From 76efc0484011cdff3b63b46425602cc2a4679b3f Mon Sep 17 00:00:00 2001 From: jfefe Date: Wed, 13 Mar 2013 22:01:34 +0100 Subject: [PATCH 001/194] Show number with dot to avoid error when update extrafield --- 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 de828e8a237..4e18cd6c983 100755 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -646,7 +646,7 @@ class ExtraFields } elseif ($type == 'price') { - $out=' '.$langs->getCurrencySymbol($conf->currency); + $out=' '.$langs->getCurrencySymbol($conf->currency); } elseif ($type == 'select') { From ae180f06a03572412189f94445a5bead7d1135cf Mon Sep 17 00:00:00 2001 From: jfefe Date: Sat, 16 Mar 2013 00:53:46 +0100 Subject: [PATCH 002/194] Fix : document module option was not saved --- htdocs/admin/propal.php | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php index 6c18da0e240..755ca681c73 100644 --- a/htdocs/admin/propal.php +++ b/htdocs/admin/propal.php @@ -162,10 +162,34 @@ if ($action == 'setdefaultduration') } } -/*if ($action == 'setusecustomercontactasrecipient') +// Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...) +if ($action == 'setModuleOptions') { - dolibarr_set_const($db, "PROPALE_USE_CUSTOMER_CONTACT_AS_RECIPIENT",$_POST["value"],'chaine',0,'',$conf->entity); -}*/ + $post_size=count($_POST); + + $db->begin(); + + for($i=0;$i < $post_size;$i++) + { + if (array_key_exists('param'.$i,$_POST)) + { + $param=GETPOST("param".$i,'alpha'); + $value=GETPOST("value".$i,'alpha'); + if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity); + if (! $res > 0) $error++; + } + } + if (! $error) + { + $db->commit(); + $mesg = "".$langs->trans("SetupSaved").""; + } + else + { + $db->rollback(); + $mesg = "".$langs->trans("Error").""; + } +} From 5f1141675c4347562c39db9423d88d99cd21aae8 Mon Sep 17 00:00:00 2001 From: jfefe Date: Sat, 16 Mar 2013 01:10:21 +0100 Subject: [PATCH 003/194] Add constants into config of ODT document for propal : can choose wich ODT will be used on creation and when close to bill or not. --- .../doc/doc_generic_proposal_odt.modules.php | 32 ++++++++++++++++++- htdocs/langs/fr_FR/propal.lang | 3 ++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php index 0f9e64c1fe2..54cf9efb2cc 100644 --- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php +++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php @@ -106,6 +106,9 @@ class doc_generic_proposal_odt extends ModelePDFPropales $texte.= ''; $texte.= ''; $texte.= ''; + $texte.= ''; + $texte.= ''; + $texte.= ''; $texte.= ''; // List of directories area @@ -143,8 +146,35 @@ class doc_generic_proposal_odt extends ModelePDFPropales $texte.= '
'; // Scan directories - if (count($listofdir)) $texte.=$langs->trans("NumberOfModelFilesFound").': '.count($listoffiles).''; + if (count($listofdir)) + { + $texte.=$langs->trans("NumberOfModelFilesFound").': '.count($listoffiles).''; + + // Model for creation + $liste=ModelePDFPropales::liste_modeles($this->db); + $texte.= ''; + $texte.= ''; + $texte.= ''; + $texte.= '"; + + $texte.= ''; + $texte.= ''; + $texte.= '"; + $texte.= ''; + + $texte.= ''; + $texte.= '"; + $texte.= '
'.$langs->trans("DefaultModelPropalCreate").''; + $texte.= $form->selectarray('value2',$liste,$conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT); + $texte.= "
'.$langs->trans("DefaultModelPropalToBill").''; + $texte.= $form->selectarray('value3',$liste,$conf->global->PROPALE_ADDON_PDF_ODT_TOBILL); + $texte.= "
'.$langs->trans("DefaultModelPropalCreate").''; + $texte.= $form->selectarray('value4',$liste,$conf->global->PROPALE_ADDON_PDF_ODT_CLOSED); + $texte.= "
'; + } + + $texte.= ''; diff --git a/htdocs/langs/fr_FR/propal.lang b/htdocs/langs/fr_FR/propal.lang index 5a4c05f0d6d..5d5d1b2043c 100644 --- a/htdocs/langs/fr_FR/propal.lang +++ b/htdocs/langs/fr_FR/propal.lang @@ -97,4 +97,7 @@ TypeContact_propal_external_CUSTOMER=Contact client suivi propale DocModelAzurDescription=Modèle de propositions commerciales complet (logo...) DocModelJauneDescription=Modèle de proposition Jaune Numbershort=N° +DefaultModelPropalCreate=Modèle par défaut à la création +DefaultModelPropalToBill=Modèle lors de la cloture d'une proposition commerciale (à facturer) +DefaultModelPropalClosed=Modèle lors de la cloture d'une proposition commerciale (non facturée) From 8a3fae31e1850e9c3120f0715cfc5f1c9cc5fb01 Mon Sep 17 00:00:00 2001 From: jfefe Date: Sat, 16 Mar 2013 01:13:44 +0100 Subject: [PATCH 004/194] When create a propal, select model document chosen by defaut in module config --- htdocs/comm/propal.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index e17940379bf..11a78523189 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -1331,7 +1331,7 @@ if ($action == 'create') print ''.$langs->trans("DefaultModel").''; print ''; $liste=ModelePDFPropales::liste_modeles($db); - print $form->selectarray('model',$liste,$conf->global->PROPALE_ADDON_PDF); + print $form->selectarray('model',$liste,($conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT?$conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT:$conf->global->PROPALE_ADDON_PDF)); print ""; // Project From 65a9edd5a7795642a120c8827daa53e40ba7379b Mon Sep 17 00:00:00 2001 From: jfefe Date: Sat, 16 Mar 2013 01:52:56 +0100 Subject: [PATCH 005/194] Fix : lang --- .../modules/propale/doc/doc_generic_proposal_odt.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php index 54cf9efb2cc..959d9b29cd9 100644 --- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php +++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php @@ -166,7 +166,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales $texte.= ""; $texte.= ''; - $texte.= ''.$langs->trans("DefaultModelPropalCreate").''; + $texte.= ''.$langs->trans("DefaultModelPropalClosed").''; $texte.= ''; $texte.= $form->selectarray('value4',$liste,$conf->global->PROPALE_ADDON_PDF_ODT_CLOSED); $texte.= ""; From 71bb4149cc250800623a32bd910088123796d1e2 Mon Sep 17 00:00:00 2001 From: jfefe Date: Sat, 16 Mar 2013 02:08:07 +0100 Subject: [PATCH 006/194] New : Automatic creation of the document to the closing of the propale depending on the model selected in the configuration --- htdocs/comm/propal/class/propal.class.php | 29 +++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 66f6bb3874d..a7cc2f71c2b 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1634,6 +1634,20 @@ class Propal extends CommonObject $this->db->rollback(); return -2; } + + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + // Define output language + $outputlangs = $langs; + if (! empty($conf->global->MAIN_MULTILANGS)) + { + $outputlangs = new Translate("",$conf); + $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $this->client->default_lang); + $outputlangs->setDefaultLang($newlang); + } + //$ret=$object->fetch($id); // Reload to get new records + propale_pdf_create($this->db, $this, $conf->global->PROPALE_ADDON_PDF_ODT_TOBILL?$conf->global->PROPALE_ADDON_PDF_ODT_TOBILL:$this->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); + } // Appel des triggers include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; @@ -1646,6 +1660,21 @@ class Propal extends CommonObject } else { + + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + // Define output language + $outputlangs = $langs; + if (! empty($conf->global->MAIN_MULTILANGS)) + { + $outputlangs = new Translate("",$conf); + $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $this->client->default_lang); + $outputlangs->setDefaultLang($newlang); + } + //$ret=$object->fetch($id); // Reload to get new records + propale_pdf_create($this->db, $this, $conf->global->PROPALE_ADDON_PDF_ODT_CLOSED?$conf->global->PROPALE_ADDON_PDF_ODT_CLOSED:$this->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); + } + // Appel des triggers include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; $interface=new Interfaces($this->db); From be8a95a22b6ad7bb9bd4e64f19ff14235aaa75a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20de=20Chateauvieux?= Date: Mon, 25 Mar 2013 13:03:37 +0400 Subject: [PATCH 007/194] =?UTF-8?q?Mise=20=C3=A0=20jour=20des=20tables=20f?= =?UTF-8?q?acture=5Ffourn=5Fdet=20et=20product=5Ffournisseur=5Fprice.=20Aj?= =?UTF-8?q?out=20d'un=20champ=20pour=20la=20gestion=20de=20la=20TVA=20NPR?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/install/mysql/tables/llx_facture_fourn_det.sql | 1 + htdocs/install/mysql/tables/llx_product_fournisseur_price.sql | 1 + 2 files changed, 2 insertions(+) diff --git a/htdocs/install/mysql/tables/llx_facture_fourn_det.sql b/htdocs/install/mysql/tables/llx_facture_fourn_det.sql index 325950a4e46..f0452c9b40e 100644 --- a/htdocs/install/mysql/tables/llx_facture_fourn_det.sql +++ b/htdocs/install/mysql/tables/llx_facture_fourn_det.sql @@ -43,6 +43,7 @@ create table llx_facture_fourn_det product_type integer DEFAULT 0, date_start datetime DEFAULT NULL, -- date debut si service date_end datetime DEFAULT NULL, -- date fin si service + info_bits integer DEFAULT 0, -- TVA NPR ou non fk_code_ventilation integer DEFAULT 0 NOT NULL, import_key varchar(14) )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_product_fournisseur_price.sql b/htdocs/install/mysql/tables/llx_product_fournisseur_price.sql index c368691e5ac..01789ff8edd 100644 --- a/htdocs/install/mysql/tables/llx_product_fournisseur_price.sql +++ b/htdocs/install/mysql/tables/llx_product_fournisseur_price.sql @@ -37,6 +37,7 @@ create table llx_product_fournisseur_price charges double(24,8) DEFAULT 0, unitcharges double(24,8) DEFAULT 0, tva_tx double(6,3) NOT NULL, + recuperableonly integer NOT NULL DEFAULT 0, fk_user integer, import_key varchar(14) -- Import key )ENGINE=innodb; From 6cfedfff9fb205dd5ec78f4e5a54d1532862a5b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20de=20Chateauvieux?= Date: Mon, 25 Mar 2013 17:18:10 +0400 Subject: [PATCH 008/194] TVA NPR : add info_bits property in class FactureFournisseur --- htdocs/fourn/class/fournisseur.facture.class.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 60bdf26a8ab..525e8fb832b 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -389,7 +389,7 @@ class FactureFournisseur extends CommonInvoice { $sql = 'SELECT f.rowid, f.description, f.pu_ht, f.pu_ttc, f.qty, f.remise_percent, f.tva_tx, f.tva'; $sql.= ', f.localtax1_tx, f.localtax2_tx, f.total_localtax1, f.total_localtax2 '; - $sql.= ', f.total_ht, f.tva as total_tva, f.total_ttc, f.fk_product, f.product_type'; + $sql.= ', f.total_ht, f.tva as total_tva, f.total_ttc, f.fk_product, f.product_type, f.info_bits'; $sql.= ', p.rowid as product_id, p.ref as product_ref, p.label as label, p.description as product_desc'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn_det as f'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON f.fk_product = p.rowid'; @@ -430,6 +430,7 @@ class FactureFournisseur extends CommonInvoice $this->lines[$i]->total_ttc = $obj->total_ttc; $this->lines[$i]->fk_product = $obj->fk_product; $this->lines[$i]->product_type = $obj->product_type; + $this->lines[$i]->info_bits = $obj->info_bits; $i++; } @@ -1104,6 +1105,7 @@ class FactureFournisseur extends CommonInvoice $pu_ttc = $tabprice[5]; $total_localtax1 = $tabprice[9]; $total_localtax2 = $tabprice[10]; + $info_bits = empty($info_bits) ? 0 : $info_bits; if ($idproduct) { @@ -1133,6 +1135,7 @@ class FactureFournisseur extends CommonInvoice if ($idproduct) $sql.= ", fk_product = ".$idproduct; else $sql.= ", fk_product = null"; $sql.= ", product_type = ".$product_type; + $sql.= ", infos_bits = ".$infos_bits; $sql.= " WHERE rowid = ".$id; dol_syslog(get_class($this)."::updateline sql=".$sql); From b2b0d1616defca62e833381cbcbe95ec15991f6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20de=20Chateauvieux?= Date: Mon, 25 Mar 2013 17:32:22 +0400 Subject: [PATCH 009/194] TVA NPR : add fourn_tva_npr property in class ProductFournisseur --- htdocs/fourn/class/fournisseur.product.class.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 7399c454cee..40e19664681 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -48,6 +48,7 @@ class ProductFournisseur extends Product var $product_fourn_id; // supplier id var $fk_availability; // availability delay var $fourn_unitprice; + var $fourn_tva_npr; /** @@ -147,7 +148,7 @@ class ProductFournisseur extends Product * @param float $remise Discount regarding qty (amount) * @return int <0 if KO, >=0 if OK */ - function update_buyprice($qty, $buyprice, $user, $price_base_type, $fourn, $availability, $ref_fourn, $tva_tx, $charges=0, $remise_percent=0, $remise=0) + function update_buyprice($qty, $buyprice, $user, $price_base_type, $fourn, $availability, $ref_fourn, $tva_tx, $charges=0, $remise_percent=0, $remise=0, $newnpr=0) { global $conf,$mysoc; @@ -188,6 +189,7 @@ class ProductFournisseur extends Product $sql.= " tva_tx = ".$tva_tx.","; $sql.= " fk_availability = ".$availability.","; $sql.= " entity = ".$conf->entity.","; + $sql.= " recuperableonly = ".$newnpr.","; $sql.= " charges = ".$charges; $sql.= " WHERE rowid = ".$this->product_fourn_price_id; // TODO Add price_base_type and price_ttc @@ -218,7 +220,7 @@ class ProductFournisseur extends Product { // Add price for this quantity to supplier $sql = "INSERT INTO ".MAIN_DB_PREFIX."product_fournisseur_price("; - $sql.= "datec, fk_product, fk_soc, ref_fourn, fk_user, price, quantity, remise_percent, remise, unitprice, tva_tx, charges, unitcharges, fk_availability, entity)"; + $sql.= "datec, fk_product, fk_soc, ref_fourn, fk_user, price, quantity, remise_percent, remise, unitprice, tva_tx, charges, unitcharges, fk_availability, entity, recuperableonly)"; $sql.= " values('".$this->db->idate($now)."',"; $sql.= " ".$this->id.","; $sql.= " ".$fourn->id.","; @@ -233,6 +235,7 @@ class ProductFournisseur extends Product $sql.= " ".$charges.","; $sql.= " ".$unitCharges.","; $sql.= " ".$availability.","; + $sql.= " ".$newnpr.","; $sql.= $conf->entity; $sql.=")"; @@ -316,6 +319,7 @@ class ProductFournisseur extends Product $this->product_id = $obj->fk_product; // deprecated $this->fk_product = $obj->fk_product; $this->fk_availability = $obj->fk_availability; + $this->fourn_tva_npr = $obj->recuperableonly; return 1; } else @@ -346,7 +350,7 @@ class ProductFournisseur extends Product $sql = "SELECT s.nom as supplier_name, s.rowid as fourn_id,"; $sql.= " pfp.rowid as product_fourn_pri_id, pfp.ref_fourn, pfp.fk_product as product_fourn_id,"; - $sql.= " pfp.price, pfp.quantity, pfp.unitprice, pfp.remise_percent, pfp.remise, pfp.tva_tx, pfp.fk_availability, pfp.charges, pfp.unitcharges"; + $sql.= " pfp.price, pfp.quantity, pfp.unitprice, pfp.remise_percent, pfp.remise, pfp.tva_tx, pfp.fk_availability, pfp.charges, pfp.unitcharges, pfp.recuperableonly"; $sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp"; $sql.= ", ".MAIN_DB_PREFIX."societe as s"; $sql.= " WHERE pfp.entity IN (".getEntity('product', 1).")"; @@ -381,6 +385,7 @@ class ProductFournisseur extends Product $prodfourn->fourn_name = $record["supplier_name"]; $prodfourn->fk_availability = $record["fk_availability"]; $prodfourn->id = $prodid; + $prodfourn->fourn_tva_npr = $record["recuperableonly"]; if (!isset($prodfourn->fourn_unitprice)) { @@ -501,4 +506,4 @@ class ProductFournisseur extends Product } -?> \ No newline at end of file +?> From aaaa5242d6a2b05102b8d6ca7475c487c428df7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20de=20Chateauvieux?= Date: Mon, 25 Mar 2013 17:42:48 +0400 Subject: [PATCH 010/194] TVA NP : update price calculation --- htdocs/product/class/product.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index c92b94b0b6e..a8803d6e5e8 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1002,7 +1002,7 @@ class Product extends CommonObject else { $price = price2num($newprice,'MU'); - $price_ttc = price2num($newprice) * (1 + ($newvat / 100)); + $price_ttc = ( $newnpr != 1 ) ? price2num($newprice) * (1 + ($newvat / 100)) : $price; $price_ttc = price2num($price_ttc,'MU'); if ($newminprice!='' || $newminprice==0) From 6a342507122bc2bdf464867586a6d7e85ae87a84 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 25 Mar 2013 17:54:54 +0100 Subject: [PATCH 011/194] Rewrite module manager. Next step. --- htdocs/core/menus/standard/eldy.lib.php | 164 +++++++++++------------ htdocs/core/menus/standard/eldy_menu.php | 19 +-- htdocs/theme/eldy/style.css.php | 33 +++++ 3 files changed, 126 insertions(+), 90 deletions(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index f7e5143344a..61aaec75fc1 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -455,7 +455,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu // Setup $newmenu->add("/admin/index.php?mainmenu=home&leftmenu=setup", $langs->trans("Setup"), 0, 1, '', $mainmenu, 'setup'); - if ($leftmenu=="setup") + if (empty($leftmenu) || $leftmenu=="setup") { $warnpicto=''; if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) @@ -475,7 +475,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $newmenu->add("/admin/ihm.php?mainmenu=home", $langs->trans("GUISetup"),1); if (! in_array($langs->defaultlang,array('en_US','en_GB','en_NZ','en_AU','fr_FR','fr_BE','es_ES','ca_ES'))) { - if ($leftmenu=="setup") $newmenu->add("/admin/translation.php", $langs->trans("Translation"),1); + if (empty($leftmenu) || $leftmenu=="setup") $newmenu->add("/admin/translation.php", $langs->trans("Translation"),1); } $newmenu->add("/admin/boxes.php?mainmenu=home", $langs->trans("Boxes"),1); $newmenu->add("/admin/delais.php?mainmenu=home",$langs->trans("Alerts"),1); @@ -490,11 +490,11 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu // System tools $newmenu->add("/admin/tools/index.php?mainmenu=home&leftmenu=admintools", $langs->trans("SystemTools"), 0, 1, '', $mainmenu, 'admintools'); - if (preg_match('/^admintools/',$leftmenu)) + if (empty($leftmenu) || preg_match('/^admintools/',$leftmenu)) { $newmenu->add('/admin/system/dolibarr.php?mainmenu=home&leftmenu=admintools_info', $langs->trans('InfoDolibarr'), 1); - if ($leftmenu=='admintools_info') $newmenu->add('/admin/system/modules.php?mainmenu=home&leftmenu=admintools_info', $langs->trans('Modules'), 2); - if ($leftmenu=='admintools_info') $newmenu->add('/admin/triggers.php?mainmenu=home&leftmenu=admintools_info', $langs->trans('Triggers'), 2); + if (empty($leftmenu) || $leftmenu=='admintools_info') $newmenu->add('/admin/system/modules.php?mainmenu=home&leftmenu=admintools_info', $langs->trans('Modules'), 2); + if (empty($leftmenu) || $leftmenu=='admintools_info') $newmenu->add('/admin/triggers.php?mainmenu=home&leftmenu=admintools_info', $langs->trans('Triggers'), 2); $newmenu->add('/admin/system/os.php?mainmenu=home&leftmenu=admintools', $langs->trans('InfoOS'), 1); $newmenu->add('/admin/system/web.php?mainmenu=home&leftmenu=admintools', $langs->trans('InfoWebServer'), 1); $newmenu->add('/admin/system/phpinfo.php?mainmenu=home&leftmenu=admintools', $langs->trans('InfoPHP'), 1); @@ -517,7 +517,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if (empty($user->societe_id)) { $newmenu->add("/admin/tools/index.php?mainmenu=home&leftmenu=modulesadmintools", $langs->trans("ModulesSystemTools"), 0, 1, '', $mainmenu, 'modulesadmintools'); - if ($leftmenu=="modulesadmintools" && $user->admin) + if ((empty($leftmenu) || $leftmenu=="modulesadmintools") && $user->admin) { $langs->load("products"); $newmenu->add("/product/admin/product_tools.php?mainmenu=home&leftmenu=modulesadmintools", $langs->trans("ProductVatMassChange"), 1, $user->admin); @@ -527,7 +527,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu } $newmenu->add("/user/home.php?leftmenu=users", $langs->trans("MenuUsersAndGroups"), 0, 1, '', $mainmenu, 'users'); - if ($leftmenu=="users") + if (empty($leftmenu) || $leftmenu=="users") { $newmenu->add("/user/index.php", $langs->trans("Users"), 1, $user->rights->user->user->lire || $user->admin); $newmenu->add("/user/fiche.php?action=create", $langs->trans("NewUser"),2, $user->rights->user->user->creer || $user->admin); @@ -561,11 +561,11 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $langs->load("commercial"); $newmenu->add("/comm/prospect/list.php?leftmenu=prospects", $langs->trans("ListProspectsShort"), 1, $user->rights->societe->lire, '', $mainmenu, 'prospects'); - if ($leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&sortorder=desc&begin=&stcomm=-1", $langs->trans("LastProspectDoNotContact"), 2, $user->rights->societe->lire); - if ($leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&sortorder=desc&begin=&stcomm=0", $langs->trans("LastProspectNeverContacted"), 2, $user->rights->societe->lire); - if ($leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&sortorder=desc&begin=&stcomm=1", $langs->trans("LastProspectToContact"), 2, $user->rights->societe->lire); - if ($leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&sortorder=desc&begin=&stcomm=2", $langs->trans("LastProspectContactInProcess"), 2, $user->rights->societe->lire); - if ($leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&sortorder=desc&begin=&stcomm=3", $langs->trans("LastProspectContactDone"), 2, $user->rights->societe->lire); + if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&sortorder=desc&begin=&stcomm=-1", $langs->trans("LastProspectDoNotContact"), 2, $user->rights->societe->lire); + if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&sortorder=desc&begin=&stcomm=0", $langs->trans("LastProspectNeverContacted"), 2, $user->rights->societe->lire); + if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&sortorder=desc&begin=&stcomm=1", $langs->trans("LastProspectToContact"), 2, $user->rights->societe->lire); + if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&sortorder=desc&begin=&stcomm=2", $langs->trans("LastProspectContactInProcess"), 2, $user->rights->societe->lire); + if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&sortorder=desc&begin=&stcomm=3", $langs->trans("LastProspectContactDone"), 2, $user->rights->societe->lire); $newmenu->add("/societe/soc.php?leftmenu=prospects&action=create&type=p", $langs->trans("MenuNewProspect"), 2, $user->rights->societe->creer); //$newmenu->add("/contact/list.php?leftmenu=customers&type=p", $langs->trans("Contacts"), 2, $user->rights->societe->contact->lire); @@ -624,7 +624,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $newmenu->add("/categories/fiche.php?action=create&type=1", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); } } - //if ($leftmenu=="cat") $newmenu->add("/categories/liste.php", $langs->trans("List"), 1, $user->rights->categorie->lire); + //if (empty($leftmenu) || $leftmenu=="cat") $newmenu->add("/categories/liste.php", $langs->trans("List"), 1, $user->rights->categorie->lire); } } @@ -643,12 +643,12 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $newmenu->add("/comm/propal/index.php?leftmenu=propals", $langs->trans("Prop"), 0, $user->rights->propale->lire, '', $mainmenu, 'propals'); $newmenu->add("/comm/propal.php?action=create&leftmenu=propals", $langs->trans("NewPropal"), 1, $user->rights->propale->creer); $newmenu->add("/comm/propal/list.php?leftmenu=propals", $langs->trans("List"), 1, $user->rights->propale->lire); - if ($leftmenu=="propals") $newmenu->add("/comm/propal/list.php?leftmenu=propals&viewstatut=0", $langs->trans("PropalsDraft"), 2, $user->rights->propale->lire); - if ($leftmenu=="propals") $newmenu->add("/comm/propal/list.php?leftmenu=propals&viewstatut=1", $langs->trans("PropalsOpened"), 2, $user->rights->propale->lire); - if ($leftmenu=="propals") $newmenu->add("/comm/propal/list.php?leftmenu=propals&viewstatut=2", $langs->trans("PropalStatusSigned"), 2, $user->rights->propale->lire); - if ($leftmenu=="propals") $newmenu->add("/comm/propal/list.php?leftmenu=propals&viewstatut=3", $langs->trans("PropalStatusNotSigned"), 2, $user->rights->propale->lire); - if ($leftmenu=="propals") $newmenu->add("/comm/propal/list.php?leftmenu=propals&viewstatut=4", $langs->trans("PropalStatusBilled"), 2, $user->rights->propale->lire); - //if ($leftmenu=="propals") $newmenu->add("/comm/propal/list.php?leftmenu=propals&viewstatut=2,3,4", $langs->trans("PropalStatusClosedShort"), 2, $user->rights->propale->lire); + if (empty($leftmenu) || $leftmenu=="propals") $newmenu->add("/comm/propal/list.php?leftmenu=propals&viewstatut=0", $langs->trans("PropalsDraft"), 2, $user->rights->propale->lire); + if (empty($leftmenu) || $leftmenu=="propals") $newmenu->add("/comm/propal/list.php?leftmenu=propals&viewstatut=1", $langs->trans("PropalsOpened"), 2, $user->rights->propale->lire); + if (empty($leftmenu) || $leftmenu=="propals") $newmenu->add("/comm/propal/list.php?leftmenu=propals&viewstatut=2", $langs->trans("PropalStatusSigned"), 2, $user->rights->propale->lire); + if (empty($leftmenu) || $leftmenu=="propals") $newmenu->add("/comm/propal/list.php?leftmenu=propals&viewstatut=3", $langs->trans("PropalStatusNotSigned"), 2, $user->rights->propale->lire); + if (empty($leftmenu) || $leftmenu=="propals") $newmenu->add("/comm/propal/list.php?leftmenu=propals&viewstatut=4", $langs->trans("PropalStatusBilled"), 2, $user->rights->propale->lire); + //if (empty($leftmenu) || $leftmenu=="propals") $newmenu->add("/comm/propal/list.php?leftmenu=propals&viewstatut=2,3,4", $langs->trans("PropalStatusClosedShort"), 2, $user->rights->propale->lire); $newmenu->add("/comm/propal/stats/index.php?leftmenu=propals", $langs->trans("Statistics"), 1, $user->rights->propale->lire); } @@ -659,12 +659,12 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $newmenu->add("/commande/index.php?leftmenu=orders", $langs->trans("CustomersOrders"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders'); $newmenu->add("/societe/societe.php?leftmenu=orders", $langs->trans("NewOrder"), 1, $user->rights->commande->creer); $newmenu->add("/commande/liste.php?leftmenu=orders", $langs->trans("List"), 1, $user->rights->commande->lire); - if ($leftmenu=="orders") $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=0", $langs->trans("StatusOrderDraftShort"), 2, $user->rights->commande->lire); - if ($leftmenu=="orders") $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=1", $langs->trans("StatusOrderValidated"), 2, $user->rights->commande->lire); - if ($leftmenu=="orders" && ! empty($conf->expedition->enabled)) $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=2", $langs->trans("StatusOrderOnProcessShort"), 2, $user->rights->commande->lire); - if ($leftmenu=="orders") $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=3", $langs->trans("StatusOrderToBill"), 2, $user->rights->commande->lire); // The translation key is StatusOrderToBill but it means StatusDelivered. TODO We should renamed this later - if ($leftmenu=="orders") $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=4", $langs->trans("StatusOrderProcessed"), 2, $user->rights->commande->lire); - if ($leftmenu=="orders") $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=-1", $langs->trans("StatusOrderCanceledShort"), 2, $user->rights->commande->lire); + if (empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=0", $langs->trans("StatusOrderDraftShort"), 2, $user->rights->commande->lire); + if (empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=1", $langs->trans("StatusOrderValidated"), 2, $user->rights->commande->lire); + if (empty($leftmenu) || $leftmenu=="orders" && ! empty($conf->expedition->enabled)) $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=2", $langs->trans("StatusOrderOnProcessShort"), 2, $user->rights->commande->lire); + if (empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=3", $langs->trans("StatusOrderToBill"), 2, $user->rights->commande->lire); // The translation key is StatusOrderToBill but it means StatusDelivered. TODO We should renamed this later + if (empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=4", $langs->trans("StatusOrderProcessed"), 2, $user->rights->commande->lire); + if (empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=-1", $langs->trans("StatusOrderCanceledShort"), 2, $user->rights->commande->lire); $newmenu->add("/commande/stats/index.php?leftmenu=orders", $langs->trans("Statistics"), 1, $user->rights->commande->lire); } @@ -686,10 +686,10 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $newmenu->add("/contrat/fiche.php?&action=create&leftmenu=contracts", $langs->trans("NewContract"), 1, $user->rights->contrat->creer); $newmenu->add("/contrat/liste.php?leftmenu=contracts", $langs->trans("List"), 1, $user->rights->contrat->lire); $newmenu->add("/contrat/services.php?leftmenu=contracts", $langs->trans("MenuServices"), 1, $user->rights->contrat->lire); - if ($leftmenu=="contracts") $newmenu->add("/contrat/services.php?leftmenu=contracts&mode=0", $langs->trans("MenuInactiveServices"), 2, $user->rights->contrat->lire); - if ($leftmenu=="contracts") $newmenu->add("/contrat/services.php?leftmenu=contracts&mode=4", $langs->trans("MenuRunningServices"), 2, $user->rights->contrat->lire); - if ($leftmenu=="contracts") $newmenu->add("/contrat/services.php?leftmenu=contracts&mode=4&filter=expired", $langs->trans("MenuExpiredServices"), 2, $user->rights->contrat->lire); - if ($leftmenu=="contracts") $newmenu->add("/contrat/services.php?leftmenu=contracts&mode=5", $langs->trans("MenuClosedServices"), 2, $user->rights->contrat->lire); + if (empty($leftmenu) || $leftmenu=="contracts") $newmenu->add("/contrat/services.php?leftmenu=contracts&mode=0", $langs->trans("MenuInactiveServices"), 2, $user->rights->contrat->lire); + if (empty($leftmenu) || $leftmenu=="contracts") $newmenu->add("/contrat/services.php?leftmenu=contracts&mode=4", $langs->trans("MenuRunningServices"), 2, $user->rights->contrat->lire); + if (empty($leftmenu) || $leftmenu=="contracts") $newmenu->add("/contrat/services.php?leftmenu=contracts&mode=4&filter=expired", $langs->trans("MenuExpiredServices"), 2, $user->rights->contrat->lire); + if (empty($leftmenu) || $leftmenu=="contracts") $newmenu->add("/contrat/services.php?leftmenu=contracts&mode=5", $langs->trans("MenuClosedServices"), 2, $user->rights->contrat->lire); } // Interventions @@ -758,7 +758,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu { $langs->load("orders"); if (! empty($conf->facture->enabled)) $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=-3", $langs->trans("MenuOrdersToBill2"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders'); - // if ($leftmenu=="orders") $newmenu->add("/commande/", $langs->trans("StatusOrderToBill"), 1, $user->rights->commande->lire); + // if (empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/", $langs->trans("StatusOrderToBill"), 1, $user->rights->commande->lire); } // Donations @@ -766,8 +766,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu { $langs->load("donations"); $newmenu->add("/compta/dons/index.php?leftmenu=donations&mainmenu=accountancy",$langs->trans("Donations"), 0, $user->rights->don->lire, '', $mainmenu, 'donations'); - if ($leftmenu=="donations") $newmenu->add("/compta/dons/fiche.php?action=create",$langs->trans("NewDonation"), 1, $user->rights->don->creer); - if ($leftmenu=="donations") $newmenu->add("/compta/dons/liste.php",$langs->trans("List"), 1, $user->rights->don->lire); + if (empty($leftmenu) || $leftmenu=="donations") $newmenu->add("/compta/dons/fiche.php?action=create",$langs->trans("NewDonation"), 1, $user->rights->don->creer); + if (empty($leftmenu) || $leftmenu=="donations") $newmenu->add("/compta/dons/liste.php",$langs->trans("List"), 1, $user->rights->don->lire); //if ($leftmenu=="donations") $newmenu->add("/compta/dons/stats.php",$langs->trans("Statistics"), 1, $user->rights->don->lire); } @@ -776,36 +776,36 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu { $langs->load("trips"); $newmenu->add("/compta/deplacement/index.php?leftmenu=tripsandexpenses&mainmenu=accountancy", $langs->trans("TripsAndExpenses"), 0, $user->rights->deplacement->lire, '', $mainmenu, 'tripsandexpenses'); - if ($leftmenu=="tripsandexpenses") $newmenu->add("/compta/deplacement/fiche.php?action=create&leftmenu=tripsandexpenses&mainmenu=accountancy", $langs->trans("New"), 1, $user->rights->deplacement->creer); - if ($leftmenu=="tripsandexpenses") $newmenu->add("/compta/deplacement/list.php?leftmenu=tripsandexpenses&mainmenu=accountancy", $langs->trans("List"), 1, $user->rights->deplacement->lire); - if ($leftmenu=="tripsandexpenses") $newmenu->add("/compta/deplacement/stats/index.php?leftmenu=tripsandexpenses&mainmenu=accountancy", $langs->trans("Statistics"), 1, $user->rights->deplacement->lire); + if (empty($leftmenu) || $leftmenu=="tripsandexpenses") $newmenu->add("/compta/deplacement/fiche.php?action=create&leftmenu=tripsandexpenses&mainmenu=accountancy", $langs->trans("New"), 1, $user->rights->deplacement->creer); + if (empty($leftmenu) || $leftmenu=="tripsandexpenses") $newmenu->add("/compta/deplacement/list.php?leftmenu=tripsandexpenses&mainmenu=accountancy", $langs->trans("List"), 1, $user->rights->deplacement->lire); + if (empty($leftmenu) || $leftmenu=="tripsandexpenses") $newmenu->add("/compta/deplacement/stats/index.php?leftmenu=tripsandexpenses&mainmenu=accountancy", $langs->trans("Statistics"), 1, $user->rights->deplacement->lire); } // Taxes and social contributions if (! empty($conf->tax->enabled)) { $newmenu->add("/compta/charges/index.php?leftmenu=tax&mainmenu=accountancy",$langs->trans("MenuTaxAndDividends"), 0, $user->rights->tax->charges->lire, '', $mainmenu, 'tax'); - if (preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/sociales/index.php?leftmenu=tax_social",$langs->trans("MenuSocialContributions"),1,$user->rights->tax->charges->lire); - if (preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/sociales/charges.php?leftmenu=tax_social&action=create",$langs->trans("MenuNewSocialContribution"), 2, $user->rights->tax->charges->creer); - if (preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/charges/index.php?leftmenu=tax_social&mainmenu=accountancy&mode=sconly",$langs->trans("Payments"), 2, $user->rights->tax->charges->lire); + if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/sociales/index.php?leftmenu=tax_social",$langs->trans("MenuSocialContributions"),1,$user->rights->tax->charges->lire); + if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/sociales/charges.php?leftmenu=tax_social&action=create",$langs->trans("MenuNewSocialContribution"), 2, $user->rights->tax->charges->creer); + if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/charges/index.php?leftmenu=tax_social&mainmenu=accountancy&mode=sconly",$langs->trans("Payments"), 2, $user->rights->tax->charges->lire); // VAT if (empty($conf->global->TAX_DISABLE_VAT_MENUS)) { - if (preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/tva/index.php?leftmenu=tax_vat&mainmenu=accountancy",$langs->trans("VAT"),1,$user->rights->tax->charges->lire, '', $mainmenu, 'tax_vat'); - if (preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/tva/fiche.php?leftmenu=tax_vat&action=create",$langs->trans("NewPayment"),2,$user->rights->tax->charges->creer); - if (preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/tva/reglement.php?leftmenu=tax_vat",$langs->trans("Payments"),2,$user->rights->tax->charges->lire); - if (preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/tva/clients.php?leftmenu=tax_vat", $langs->trans("ReportByCustomers"), 2, $user->rights->tax->charges->lire); - if (preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/tva/quadri_detail.php?leftmenu=tax_vat", $langs->trans("ReportByQuarter"), 2, $user->rights->tax->charges->lire); + if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/tva/index.php?leftmenu=tax_vat&mainmenu=accountancy",$langs->trans("VAT"),1,$user->rights->tax->charges->lire, '', $mainmenu, 'tax_vat'); + if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/tva/fiche.php?leftmenu=tax_vat&action=create",$langs->trans("NewPayment"),2,$user->rights->tax->charges->creer); + if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/tva/reglement.php?leftmenu=tax_vat",$langs->trans("Payments"),2,$user->rights->tax->charges->lire); + if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/tva/clients.php?leftmenu=tax_vat", $langs->trans("ReportByCustomers"), 2, $user->rights->tax->charges->lire); + if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/tva/quadri_detail.php?leftmenu=tax_vat", $langs->trans("ReportByQuarter"), 2, $user->rights->tax->charges->lire); global $mysoc; //Local Taxes if($mysoc->country_code=='ES' && (isset($mysoc->localtax2_assuj) && $mysoc->localtax2_assuj=="1")) { - if (preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/localtax/index.php?leftmenu=tax_vat&mainmenu=accountancy",$langs->transcountry("LT2",$mysoc->country_code),1,$user->rights->tax->charges->lire); - if (preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/localtax/fiche.php?leftmenu=tax_vat&action=create",$langs->trans("NewPayment"),2,$user->rights->tax->charges->creer); - if (preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/localtax/reglement.php?leftmenu=tax_vat",$langs->trans("Payments"),2,$user->rights->tax->charges->lire); - if (preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/localtax/clients.php?leftmenu=tax_vat", $langs->trans("ReportByCustomers"), 2, $user->rights->tax->charges->lire); - //if (preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/localtax/quadri_detail.php?leftmenu=tax_vat", $langs->trans("ReportByQuarter"), 2, $user->rights->tax->charges->lire); + if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/localtax/index.php?leftmenu=tax_vat&mainmenu=accountancy",$langs->transcountry("LT2",$mysoc->country_code),1,$user->rights->tax->charges->lire); + if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/localtax/fiche.php?leftmenu=tax_vat&action=create",$langs->trans("NewPayment"),2,$user->rights->tax->charges->creer); + if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/localtax/reglement.php?leftmenu=tax_vat",$langs->trans("Payments"),2,$user->rights->tax->charges->lire); + if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/localtax/clients.php?leftmenu=tax_vat", $langs->trans("ReportByCustomers"), 2, $user->rights->tax->charges->lire); + //if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/localtax/quadri_detail.php?leftmenu=tax_vat", $langs->trans("ReportByQuarter"), 2, $user->rights->tax->charges->lire); } } @@ -816,8 +816,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if (! empty($conf->comptabilite->enabled) && ($conf->global->MAIN_FEATURES_LEVEL >= 2)) { $newmenu->add("/compta/ventilation/index.php?leftmenu=ventil",$langs->trans("Dispatch"),0,$user->rights->compta->ventilation->lire, '', $mainmenu, 'ventil'); - if ($leftmenu=="ventil") $newmenu->add("/compta/ventilation/liste.php",$langs->trans("ToDispatch"),1,$user->rights->compta->ventilation->lire); - if ($leftmenu=="ventil") $newmenu->add("/compta/ventilation/lignes.php",$langs->trans("Dispatched"),1,$user->rights->compta->ventilation->lire); + if (empty($leftmenu) || $leftmenu=="ventil") $newmenu->add("/compta/ventilation/liste.php",$langs->trans("ToDispatch"),1,$user->rights->compta->ventilation->lire); + if (empty($leftmenu) || $leftmenu=="ventil") $newmenu->add("/compta/ventilation/lignes.php",$langs->trans("Dispatched"),1,$user->rights->compta->ventilation->lire); } // Compta expert @@ -834,29 +834,29 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu // Bilan, resultats $newmenu->add("/compta/resultat/index.php?leftmenu=ca&mainmenu=accountancy",$langs->trans("Reportings"),0,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire, '', $mainmenu, 'ca'); - if ($leftmenu=="ca") $newmenu->add("/compta/resultat/index.php?leftmenu=ca",$langs->trans("ReportInOut"),1,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire); - if ($leftmenu=="ca") $newmenu->add("/compta/resultat/clientfourn.php?leftmenu=ca",$langs->trans("ByCompanies"),2,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire); + if (empty($leftmenu) || $leftmenu=="ca") $newmenu->add("/compta/resultat/index.php?leftmenu=ca",$langs->trans("ReportInOut"),1,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire); + if (empty($leftmenu) || $leftmenu=="ca") $newmenu->add("/compta/resultat/clientfourn.php?leftmenu=ca",$langs->trans("ByCompanies"),2,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire); /* On verra ca avec module compabilite expert - if ($leftmenu=="ca") $newmenu->add("/compta/resultat/compteres.php?leftmenu=ca","Compte de resultat",2,$user->rights->compta->resultat->lire); - if ($leftmenu=="ca") $newmenu->add("/compta/resultat/bilan.php?leftmenu=ca","Bilan",2,$user->rights->compta->resultat->lire); + if (empty($leftmenu) || $leftmenu=="ca") $newmenu->add("/compta/resultat/compteres.php?leftmenu=ca","Compte de resultat",2,$user->rights->compta->resultat->lire); + if (empty($leftmenu) || $leftmenu=="ca") $newmenu->add("/compta/resultat/bilan.php?leftmenu=ca","Bilan",2,$user->rights->compta->resultat->lire); */ - if ($leftmenu=="ca") $newmenu->add("/compta/stats/index.php?leftmenu=ca",$langs->trans("ReportTurnover"),1,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire); + if (empty($leftmenu) || $leftmenu=="ca") $newmenu->add("/compta/stats/index.php?leftmenu=ca",$langs->trans("ReportTurnover"),1,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire); /* - if ($leftmenu=="ca") $newmenu->add("/compta/stats/cumul.php?leftmenu=ca","Cumule",2,$user->rights->compta->resultat->lire); + if (empty($leftmenu) || $leftmenu=="ca") $newmenu->add("/compta/stats/cumul.php?leftmenu=ca","Cumule",2,$user->rights->compta->resultat->lire); if (! empty($conf->propal->enabled)) { - if ($leftmenu=="ca") $newmenu->add("/compta/stats/prev.php?leftmenu=ca","Previsionnel",2,$user->rights->compta->resultat->lire); - if ($leftmenu=="ca") $newmenu->add("/compta/stats/comp.php?leftmenu=ca","Transforme",2,$user->rights->compta->resultat->lire); + if (empty($leftmenu) || $leftmenu=="ca") $newmenu->add("/compta/stats/prev.php?leftmenu=ca","Previsionnel",2,$user->rights->compta->resultat->lire); + if (empty($leftmenu) || $leftmenu=="ca") $newmenu->add("/compta/stats/comp.php?leftmenu=ca","Transforme",2,$user->rights->compta->resultat->lire); } */ - if ($leftmenu=="ca") $newmenu->add("/compta/stats/casoc.php?leftmenu=ca",$langs->trans("ByCompanies"),2,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire); - if ($leftmenu=="ca") $newmenu->add("/compta/stats/cabyuser.php?leftmenu=ca",$langs->trans("ByUsers"),2,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire); + if (empty($leftmenu) || $leftmenu=="ca") $newmenu->add("/compta/stats/casoc.php?leftmenu=ca",$langs->trans("ByCompanies"),2,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire); + if (empty($leftmenu) || $leftmenu=="ca") $newmenu->add("/compta/stats/cabyuser.php?leftmenu=ca",$langs->trans("ByUsers"),2,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire); // Journaux //if ($leftmenu=="ca") $newmenu->add("/compta/journaux/index.php?leftmenu=ca",$langs->trans("Journaux"),1,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire); //journaux - if ($leftmenu=="ca") $newmenu->add("/compta/journal/sellsjournal.php?leftmenu=ca",$langs->trans("SellsJournal"),1,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire); - if ($leftmenu=="ca") $newmenu->add("/compta/journal/purchasesjournal.php?leftmenu=ca",$langs->trans("PurchasesJournal"),1,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire); + if (empty($leftmenu) || $leftmenu=="ca") $newmenu->add("/compta/journal/sellsjournal.php?leftmenu=ca",$langs->trans("SellsJournal"),1,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire); + if (empty($leftmenu) || $leftmenu=="ca") $newmenu->add("/compta/journal/purchasesjournal.php?leftmenu=ca",$langs->trans("PurchasesJournal"),1,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire); } } @@ -889,17 +889,17 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu { $newmenu->add("/compta/prelevement/index.php?leftmenu=withdraw&mainmenu=bank",$langs->trans("StandingOrders"),0,$user->rights->prelevement->bons->lire, '', $mainmenu, 'withdraw'); - //if ($leftmenu=="withdraw") $newmenu->add("/compta/prelevement/demandes.php?status=0&mainmenu=bank",$langs->trans("StandingOrderToProcess"),1,$user->rights->prelevement->bons->lire); + //if (empty($leftmenu) || $leftmenu=="withdraw") $newmenu->add("/compta/prelevement/demandes.php?status=0&mainmenu=bank",$langs->trans("StandingOrderToProcess"),1,$user->rights->prelevement->bons->lire); - if ($leftmenu=="withdraw") $newmenu->add("/compta/prelevement/create.php?mainmenu=bank",$langs->trans("NewStandingOrder"),1,$user->rights->prelevement->bons->creer); + if (empty($leftmenu) || $leftmenu=="withdraw") $newmenu->add("/compta/prelevement/create.php?mainmenu=bank",$langs->trans("NewStandingOrder"),1,$user->rights->prelevement->bons->creer); - if ($leftmenu=="withdraw") $newmenu->add("/compta/prelevement/bons.php?mainmenu=bank",$langs->trans("WithdrawalsReceipts"),1,$user->rights->prelevement->bons->lire); - if ($leftmenu=="withdraw") $newmenu->add("/compta/prelevement/liste.php?mainmenu=bank",$langs->trans("WithdrawalsLines"),1,$user->rights->prelevement->bons->lire); - if ($leftmenu=="withdraw") $newmenu->add("/compta/prelevement/rejets.php?mainmenu=bank",$langs->trans("Rejects"),1,$user->rights->prelevement->bons->lire); - if ($leftmenu=="withdraw") $newmenu->add("/compta/prelevement/stats.php?mainmenu=bank",$langs->trans("Statistics"),1,$user->rights->prelevement->bons->lire); + if (empty($leftmenu) || $leftmenu=="withdraw") $newmenu->add("/compta/prelevement/bons.php?mainmenu=bank",$langs->trans("WithdrawalsReceipts"),1,$user->rights->prelevement->bons->lire); + if (empty($leftmenu) || $leftmenu=="withdraw") $newmenu->add("/compta/prelevement/liste.php?mainmenu=bank",$langs->trans("WithdrawalsLines"),1,$user->rights->prelevement->bons->lire); + if (empty($leftmenu) || $leftmenu=="withdraw") $newmenu->add("/compta/prelevement/rejets.php?mainmenu=bank",$langs->trans("Rejects"),1,$user->rights->prelevement->bons->lire); + if (empty($leftmenu) || $leftmenu=="withdraw") $newmenu->add("/compta/prelevement/stats.php?mainmenu=bank",$langs->trans("Statistics"),1,$user->rights->prelevement->bons->lire); - //if ($leftmenu=="withdraw") $newmenu->add("/compta/prelevement/config.php",$langs->trans("Setup"),1,$user->rights->prelevement->bons->configurer); + //if (empty($leftmenu) || $leftmenu=="withdraw") $newmenu->add("/compta/prelevement/config.php",$langs->trans("Setup"),1,$user->rights->prelevement->bons->configurer); } // Gestion cheques @@ -960,7 +960,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu { $newmenu->add("/categories/fiche.php?action=create&type=0", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); } - //if ($leftmenu=="cat") $newmenu->add("/categories/liste.php", $langs->trans("List"), 1, $user->rights->categorie->lire); + //if (empty($leftmenu) || $leftmenu=="cat") $newmenu->add("/categories/liste.php", $langs->trans("List"), 1, $user->rights->categorie->lire); } // Stocks @@ -968,10 +968,10 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu { $langs->load("stocks"); $newmenu->add("/product/stock/index.php?leftmenu=stock", $langs->trans("Stocks"), 0, $user->rights->stock->lire, '', $mainmenu, 'stock'); - if ($leftmenu=="stock") $newmenu->add("/product/stock/fiche.php?action=create", $langs->trans("MenuNewWarehouse"), 1, $user->rights->stock->creer); - if ($leftmenu=="stock") $newmenu->add("/product/stock/liste.php", $langs->trans("List"), 1, $user->rights->stock->lire); - if ($leftmenu=="stock") $newmenu->add("/product/stock/valo.php", $langs->trans("EnhancedValue"), 1, $user->rights->stock->lire); - if ($leftmenu=="stock") $newmenu->add("/product/stock/mouvement.php", $langs->trans("Movements"), 1, $user->rights->stock->mouvement->lire); + if (empty($leftmenu) || $leftmenu=="stock") $newmenu->add("/product/stock/fiche.php?action=create", $langs->trans("MenuNewWarehouse"), 1, $user->rights->stock->creer); + if (empty($leftmenu) || $leftmenu=="stock") $newmenu->add("/product/stock/liste.php", $langs->trans("List"), 1, $user->rights->stock->lire); + if (empty($leftmenu) || $leftmenu=="stock") $newmenu->add("/product/stock/valo.php", $langs->trans("EnhancedValue"), 1, $user->rights->stock->lire); + if (empty($leftmenu) || $leftmenu=="stock") $newmenu->add("/product/stock/mouvement.php", $langs->trans("Movements"), 1, $user->rights->stock->mouvement->lire); } // Expeditions @@ -979,9 +979,9 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu { $langs->load("sendings"); $newmenu->add("/expedition/index.php?leftmenu=sendings", $langs->trans("Shipments"), 0, $user->rights->expedition->lire, '', $mainmenu, 'sendings'); - if ($leftmenu=="sendings") $newmenu->add("/expedition/fiche.php?action=create2&leftmenu=sendings", $langs->trans("NewSending"), 1, $user->rights->expedition->creer); - if ($leftmenu=="sendings") $newmenu->add("/expedition/liste.php?leftmenu=sendings", $langs->trans("List"), 1, $user->rights->expedition->lire); - if ($leftmenu=="sendings") $newmenu->add("/expedition/stats/index.php?leftmenu=sendings", $langs->trans("Statistics"), 1, $user->rights->expedition->lire); + if (empty($leftmenu) || $leftmenu=="sendings") $newmenu->add("/expedition/fiche.php?action=create2&leftmenu=sendings", $langs->trans("NewSending"), 1, $user->rights->expedition->creer); + if (empty($leftmenu) || $leftmenu=="sendings") $newmenu->add("/expedition/liste.php?leftmenu=sendings", $langs->trans("List"), 1, $user->rights->expedition->lire); + if (empty($leftmenu) || $leftmenu=="sendings") $newmenu->add("/expedition/stats/index.php?leftmenu=sendings", $langs->trans("Statistics"), 1, $user->rights->expedition->lire); } } @@ -1037,7 +1037,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu { $newmenu->add("/categories/fiche.php?action=create&type=1", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); } - //if ($leftmenu=="cat") $newmenu->add("/categories/liste.php", $langs->trans("List"), 1, $user->rights->categorie->lire); + //if (empty($leftmenu) || $leftmenu=="cat") $newmenu->add("/categories/liste.php", $langs->trans("List"), 1, $user->rights->categorie->lire); } } @@ -1141,13 +1141,13 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu { $newmenu->add("/categories/fiche.php?action=create&type=3", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); } - //if ($leftmenu=="cat") $newmenu->add("/categories/liste.php", $langs->trans("List"), 1, $user->rights->categorie->lire); + //if (empty($leftmenu) || $leftmenu=="cat") $newmenu->add("/categories/liste.php", $langs->trans("List"), 1, $user->rights->categorie->lire); } $newmenu->add("/adherents/index.php?leftmenu=export&mainmenu=members",$langs->trans("Exports"),0,$user->rights->adherent->export, '', $mainmenu, 'export'); - if (! empty($conf->export->enabled) && $leftmenu=="export") $newmenu->add("/exports/index.php?leftmenu=export",$langs->trans("Datas"),1,$user->rights->adherent->export); - if ($leftmenu=="export") $newmenu->add("/adherents/htpasswd.php?leftmenu=export",$langs->trans("Filehtpasswd"),1,$user->rights->adherent->export); - if ($leftmenu=="export") $newmenu->add("/adherents/cartes/carte.php?leftmenu=export",$langs->trans("MembersCards"),1,$user->rights->adherent->export); + if (! empty($conf->export->enabled) && (empty($leftmenu) || $leftmenu=="export")) $newmenu->add("/exports/index.php?leftmenu=export",$langs->trans("Datas"),1,$user->rights->adherent->export); + if (empty($leftmenu) || $leftmenu=="export") $newmenu->add("/adherents/htpasswd.php?leftmenu=export",$langs->trans("Filehtpasswd"),1,$user->rights->adherent->export); + if (empty($leftmenu) || $leftmenu=="export") $newmenu->add("/adherents/cartes/carte.php?leftmenu=export",$langs->trans("MembersCards"),1,$user->rights->adherent->export); // Type $newmenu->add("/adherents/type.php?leftmenu=setup&mainmenu=members",$langs->trans("MembersTypes"),0,$user->rights->adherent->configurer, '', $mainmenu, 'setup'); diff --git a/htdocs/core/menus/standard/eldy_menu.php b/htdocs/core/menus/standard/eldy_menu.php index f920a905983..eb050232366 100644 --- a/htdocs/core/menus/standard/eldy_menu.php +++ b/htdocs/core/menus/standard/eldy_menu.php @@ -136,32 +136,36 @@ class MenuManager foreach($this->menu->liste as $key => $val) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu' { print '
    '; - print '
  • '; + print '
  • '; if ($val['enabled'] == 1) { $relurl=dol_buildpath($val['url'],1); print ''.$val['titre'].''."\n"; - + // Search submenu fot this entry + $tmpmainmenu=$val['mainmenu']; + $tmpleftmenu='all'; $submenu=new Menu(); - $res=print_left_eldy_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$submenu,1,$val['mainmenu'],$val['leftmenu']); + $res=print_left_eldy_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$submenu,1,$tmpmainmenu,$tmpleftmenu); $nexturl=dol_buildpath($submenu->liste[0]['url'],1); $canonrelurl=preg_replace('/\?.*$/','',$relurl); $canonnexturl=preg_replace('/\?.*$/','',$nexturl); //var_dump($canonrelurl); //var_dump($canonnexturl); + print ''; } if ($val['enabled'] == 2) { @@ -169,7 +173,6 @@ class MenuManager } print '
  • '; print '
'."\n"; - print 'wwwwwww'; } } diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index c3e3d58d5e6..665f58b0b89 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -2519,6 +2519,39 @@ div.dolEventError h1, div.dolEventError h2 { } + + +/* ============================================================================== */ +/* JMobile */ +/* ============================================================================== */ + +.ui-body-c .ui-link { + color: #111 !important; +} +.ui-li-divider { + background: #eee !important; +} +.ui-bar-b { + border: 1px solid #ccc !important; + background: #aaa !important; + font-weight: bold !important; + color: #444 !important; + text-shadow: 0 1px 1px #fff !important; + background-image: -webkit-gradient(linear,left top,left bottom,from(#fdfdfd),to(#aaa)) !important; + background-image: -webkit-linear-gradient(top,#fdfdfd,#aaa) !important; + background-image: -moz-linear-gradient(top,#fdfdfd,#aaa) !important; + background-image: -ms-linear-gradient(top,#fdfdfd,#aaa) !important; + background-image: -o-linear-gradient(top,#fdfdfd,#aaa) !important; + background-image: linear-gradient(top,#fdfdfd,#aaa) !important; +} +.ui-bar-b .ui-link { + border: none; + font-weight: bold !important; + color: #444 !important; + text-shadow: 0 1px 1px #fff !important; +} + + close(); ?> From bbbc4ad8c44af76b01a622e0a8a032b7cb557e27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20de=20Chateauvieux?= Date: Tue, 26 Mar 2013 07:57:19 +0400 Subject: [PATCH 012/194] TVA NPR: add parameter in function call. Accept * tva --- htdocs/fourn/facture/fiche.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index b726d39231a..62cb5334b93 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -502,13 +502,14 @@ elseif ($action == 'addline') $label.= $_POST['np_desc']; $tvatx=get_default_tva($object->thirdparty, $mysoc, $product->id, $_POST['idprodfournprice']); + $npr = get_default_npr($object->thirdparty, $mysoc, $product->id, $_POST['idprodfournprice']); $localtax1tx= get_localtax($tvatx, 1, $mysoc,$object->thirdparty); $localtax2tx= get_localtax($tvatx, 2, $mysoc,$object->thirdparty); $remise_percent=GETPOST('remise_percent'); $type = $product->type; - $result=$object->addline($label, $product->fourn_pu, $tvatx, $localtax1tx, $localtax2tx, $_POST['qty'], $idprod, $remise_percent); + $result=$object->addline($label, $product->fourn_pu, $tvatx, $localtax1tx, $localtax2tx, $_POST['qty'], $idprod, $remise_percent, '', '', 0, $npr); } if ($idprod == -1) @@ -520,7 +521,9 @@ elseif ($action == 'addline') } else { - $tauxtva = price2num($_POST['tauxtva']); + $npr = preg_match('/\*/', $_POST['tauxtva']) ? 1 : 0 ; + $tauxtva = str_replace('*','',$_POST["tauxtva"]); + $tauxtva = price2num($tauxtva); $localtax1tx= get_localtax($tauxtva, 1, $mysoc,$object->thirdparty); $localtax2tx= get_localtax($tauxtva, 2, $mysoc,$object->thirdparty); $remise_percent=GETPOST('remise_percent'); @@ -538,14 +541,14 @@ elseif ($action == 'addline') $price_base_type = 'HT'; //$desc, $pu, $txtva, $qty, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $price_base_type='HT', $type=0) - $result=$object->addline($_POST['dp_desc'], $ht, $tauxtva, $localtax1tx, $localtax2tx, $_POST['qty'], 0, $remise_percent, $datestart, $dateend, 0, 0, $price_base_type, $type); + $result=$object->addline($_POST['dp_desc'], $ht, $tauxtva, $localtax1tx, $localtax2tx, $_POST['qty'], 0, $remise_percent, $datestart, $dateend, 0, $npr, $price_base_type, $type); } else { $ttc = price2num($_POST['amountttc']); $ht = $ttc / (1 + ($tauxtva / 100)); $price_base_type = 'HT'; - $result=$object->addline($_POST['dp_desc'], $ht, $tauxtva,$localtax1tx, $localtax2tx, $_POST['qty'], 0, $remise_percent, $datestart, $dateend, 0, 0, $price_base_type, $type); + $result=$object->addline($_POST['dp_desc'], $ht, $tauxtva,$localtax1tx, $localtax2tx, $_POST['qty'], 0, $remise_percent, $datestart, $dateend, 0, $npr, $price_base_type, $type); } } } @@ -1739,7 +1742,7 @@ else print ''; // VAT - print ''.vatrate($object->lines[$i]->tva_tx).'%'; + print ''.vatrate($object->lines[$i]->tva_tx, true, $object->lines[$i]->info_bits).'%'; // Unit price print ''.price($object->lines[$i]->pu_ht,'MU').''; From 148ad65150ca44f2a4a9c8d930a1ad0ed42665da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20de=20Chateauvieux?= Date: Tue, 26 Mar 2013 08:11:06 +0400 Subject: [PATCH 013/194] TVA NPR : deduplicate line. Remove tva npr from journal lines --- htdocs/compta/journal/purchasesjournal.php | 9 +++++---- htdocs/compta/journal/sellsjournal.php | 7 ++++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/htdocs/compta/journal/purchasesjournal.php b/htdocs/compta/journal/purchasesjournal.php index f1977f9f01a..96d5fd8bf86 100755 --- a/htdocs/compta/journal/purchasesjournal.php +++ b/htdocs/compta/journal/purchasesjournal.php @@ -97,9 +97,9 @@ $sql = "SELECT f.rowid, f.facnumber, f.type, f.datef, f.libelle,"; $sql.= " fd.total_ttc, fd.tva_tx, fd.total_ht, fd.tva as total_tva, fd.product_type,"; $sql.= " s.rowid as socid, s.nom as name, s.code_compta_fournisseur,"; $sql.= " p.rowid as pid, p.ref as ref, p.accountancy_code_buy,"; -$sql.= " ct.accountancy_code_buy as account_tva"; +$sql.= " ct.accountancy_code_buy as account_tva, ct.recuperableonly"; $sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn_det fd"; -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_tva ct ON fd.tva_tx = ct.taux AND ct.fk_pays = '".$idpays."'"; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_tva ct ON fd.tva_tx = ct.taux AND fd.info_bits = ct.recuperableonly AND ct.fk_pays = '".$idpays."'"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product p ON p.rowid = fd.fk_product"; $sql.= " JOIN ".MAIN_DB_PREFIX."facture_fourn f ON f.rowid = fd.fk_facture_fourn"; $sql.= " JOIN ".MAIN_DB_PREFIX."societe s ON s.rowid = f.fk_soc" ; @@ -142,7 +142,8 @@ if ($result) $tabfac[$obj->rowid]["lib"] = $obj->libelle; $tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc; $tabht[$obj->rowid][$compta_prod] += $obj->total_ht; - $tabtva[$obj->rowid][$compta_tva] += $obj->total_tva; + if($obj->recuperableonly != 1) + $tabtva[$obj->rowid][$compta_tva] += $obj->total_tva; $tabcompany[$obj->rowid]=array('id'=>$obj->socid,'name'=>$obj->name); $i++; @@ -238,4 +239,4 @@ print ""; llxFooter(); $db->close(); -?> \ No newline at end of file +?> diff --git a/htdocs/compta/journal/sellsjournal.php b/htdocs/compta/journal/sellsjournal.php index c3cb58526ad..1e35607b1bb 100755 --- a/htdocs/compta/journal/sellsjournal.php +++ b/htdocs/compta/journal/sellsjournal.php @@ -99,12 +99,12 @@ $sql = "SELECT f.rowid, f.facnumber, f.type, f.datef, f.ref_client,"; $sql.= " fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.total_ttc,"; $sql.= " s.rowid as socid, s.nom as name, s.code_compta, s.client,"; $sql.= " p.rowid as pid, p.ref as pref, p.accountancy_code_sell,"; -$sql.= " ct.accountancy_code_sell as account_tva"; +$sql.= " ct.accountancy_code_sell as account_tva, ct.recuperableonly"; $sql.= " FROM ".MAIN_DB_PREFIX."facturedet fd"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product p ON p.rowid = fd.fk_product"; $sql.= " JOIN ".MAIN_DB_PREFIX."facture f ON f.rowid = fd.fk_facture"; $sql.= " JOIN ".MAIN_DB_PREFIX."societe s ON s.rowid = f.fk_soc"; -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_tva ct ON fd.tva_tx = ct.taux AND ct.fk_pays = '".$idpays."'"; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_tva ct ON fd.tva_tx = ct.taux AND fd.info_bits = ct.recuperableonly AND ct.fk_pays = '".$idpays."'"; $sql.= " WHERE f.entity = ".$conf->entity; $sql.= " AND f.fk_statut > 0"; if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $sql.= " AND f.type IN (0,1,2)"; @@ -149,7 +149,8 @@ if ($result) if (! isset($tabtva[$obj->rowid][$compta_tva])) $tabtva[$obj->rowid][$compta_tva]=0; $tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc; $tabht[$obj->rowid][$compta_prod] += $obj->total_ht; - $tabtva[$obj->rowid][$compta_tva] += $obj->total_tva; + if($obj->recuperableonly != 1) + $tabtva[$obj->rowid][$compta_tva] += $obj->total_tva; $tabcompany[$obj->rowid]=array('id'=>$obj->socid, 'name'=>$obj->name, 'client'=>$obj->client); $i++; } From 28999af70b4986854a4fb524a556db981078f60e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20de=20Chateauvieux?= Date: Tue, 26 Mar 2013 08:47:17 +0400 Subject: [PATCH 014/194] TVA NPR : set function get_default_npr --- htdocs/core/lib/functions.lib.php | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 835e5a36ee1..6bb524d28e1 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3047,8 +3047,32 @@ function get_default_tva($thirdparty_seller, $thirdparty_buyer, $idprod=0, $idpr * @param int $idprod Id product * @return float 0 or 1 */ -function get_default_npr($thirdparty_seller, $thirdparty_buyer, $idprod) +function get_default_npr($thirdparty_seller, $thirdparty_buyer, $idprod+0, $idprodfournprice=0) { + global $db; + if($idprodfournprice>0) + { + $sql = "SELECT pfp.recuperableonly"; + $sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp"; + $sql.= " WHERE rowid = ".$idprodfournprice; + dol_syslog(get_class($this)."::get_default_npr sql=".$sql, LOG_DEBUG); + + $resql = $this->db->query($sql); + if ($resql) + { + $record = $this->db->fetch_array($resql); + if(isset($record['recuperableonly'])) + return $record['recuperableonly']; + } + + } + elseif( $idprod > 0 ) + { + $prod = new Product($db); + $prod->fetch($idprod); + return $prod->tva_npr; + } + return 0; } From 26d2e3d928b46998599e0ee2f90d8d9dcbdd9d80 Mon Sep 17 00:00:00 2001 From: simnandez Date: Tue, 26 Mar 2013 15:48:12 +0100 Subject: [PATCH 015/194] Fix: [ bug #777 ] Withdrawal receipt set Credited --- htdocs/compta/paiement/class/paiement.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index abf8e76f988..00741aad4d4 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -442,7 +442,7 @@ class Paiement extends CommonObject } // Add link 'company' in bank_url between invoice and bank transaction (for each invoice concerned by payment) - if (! $error) + if (! $error && $label != '(WithdrawalPayment)') { $linkaddedforthirdparty=array(); foreach ($this->amounts as $key => $value) // We should have always same third party but we loop in case of. From 2c56a1c8dc4e63e2cb6ca08971c16791badd561e Mon Sep 17 00:00:00 2001 From: BENKE Charles Date: Tue, 26 Mar 2013 16:49:02 +0100 Subject: [PATCH 016/194] Update mysql.class.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Create Table 'type' not supported on recent mysql databases, need to use 'engine' instead  --- htdocs/core/db/mysql.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/db/mysql.class.php b/htdocs/core/db/mysql.class.php index 386624132f7..1143372bb98 100644 --- a/htdocs/core/db/mysql.class.php +++ b/htdocs/core/db/mysql.class.php @@ -931,7 +931,7 @@ class DoliDBMysql $sql .= ",".implode(',',$sqluq); if($keys != "") $sql .= ",".implode(',',$sqlk); - $sql .=") type=".$type; + $sql .=") engine=".$type; dol_syslog($sql,LOG_DEBUG); if(! $this -> query($sql)) From 33a82c396eca23d4ebc236fd914188b32f0b212a Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 26 Mar 2013 17:12:00 +0100 Subject: [PATCH 017/194] Fix: broken feature for use hooks with dol_move_uploaded_file method --- htdocs/core/class/fileupload.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/fileupload.class.php b/htdocs/core/class/fileupload.class.php index 8afb5f39f42..c5e83017940 100644 --- a/htdocs/core/class/fileupload.class.php +++ b/htdocs/core/class/fileupload.class.php @@ -436,7 +436,7 @@ class FileUpload { file_put_contents($file_path, fopen($uploaded_file, 'r'), FILE_APPEND); } else { - dol_move_uploaded_file($uploaded_file, $file_path, 1); + dol_move_uploaded_file($uploaded_file, $file_path, 1, 0, 0, 0, 'userfile'); } } else From dff74667c275e24669f031e3d4a986a5e5dbd848 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 26 Mar 2013 17:29:40 +0100 Subject: [PATCH 018/194] Fix: broken features due to the removal of the trigger FILE_UPLOAD ! --- htdocs/core/lib/files.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index c257b00e56d..d95bd707868 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -663,7 +663,7 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable } $hookmanager->initHooks(array('fileslib')); - $parameters=array('filename' => $file_name, 'varfiles' => $varfiles, 'allowoverwrite' => $allowoverwrite); + $parameters=array('src_file' => $src_file, 'file_name' => $file_name, 'varfiles' => $varfiles, 'allowoverwrite' => $allowoverwrite); $reshook=$hookmanager->executeHooks('moveUploadedFile', $parameters, $object); } From 4fe94b800bea6baa9dfe57e0cb635030e3275705 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 26 Mar 2013 17:43:48 +0100 Subject: [PATCH 019/194] Fix: missing parameter --- htdocs/core/lib/files.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index d95bd707868..7557fa8322d 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -663,7 +663,7 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable } $hookmanager->initHooks(array('fileslib')); - $parameters=array('src_file' => $src_file, 'file_name' => $file_name, 'varfiles' => $varfiles, 'allowoverwrite' => $allowoverwrite); + $parameters=array('dest_files' => $dest_files, 'src_file' => $src_file, 'file_name' => $file_name, 'varfiles' => $varfiles, 'allowoverwrite' => $allowoverwrite); $reshook=$hookmanager->executeHooks('moveUploadedFile', $parameters, $object); } From b694451ab28e287fd7b46bf0856233407301f252 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 26 Mar 2013 17:45:07 +0100 Subject: [PATCH 020/194] Use engine instead of type --- htdocs/core/db/mysqli.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 7d9d67f839c..2180546dc39 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -925,7 +925,7 @@ class DoliDBMysqli $sql .= ",".implode(',',$sqluq); if($keys != "") $sql .= ",".implode(',',$sqlk); - $sql .=") type=".$type; + $sql .=") engine=".$type; dol_syslog($sql,LOG_DEBUG); if(! $this -> query($sql)) From a701cbd77c97745ad540fcb2f724fca1f90d1503 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 26 Mar 2013 17:47:37 +0100 Subject: [PATCH 021/194] Fix: wrong var name --- htdocs/core/lib/files.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 7557fa8322d..d083751d819 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -663,7 +663,7 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable } $hookmanager->initHooks(array('fileslib')); - $parameters=array('dest_files' => $dest_files, 'src_file' => $src_file, 'file_name' => $file_name, 'varfiles' => $varfiles, 'allowoverwrite' => $allowoverwrite); + $parameters=array('dest_file' => $dest_file, 'src_file' => $src_file, 'file_name' => $file_name, 'varfiles' => $varfiles, 'allowoverwrite' => $allowoverwrite); $reshook=$hookmanager->executeHooks('moveUploadedFile', $parameters, $object); } From 61826b04d80b531b80d0901a66649d8057937486 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 26 Mar 2013 17:12:00 +0100 Subject: [PATCH 022/194] Fix: broken feature for use hooks with dol_move_uploaded_file method --- htdocs/core/class/fileupload.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/fileupload.class.php b/htdocs/core/class/fileupload.class.php index 8afb5f39f42..c5e83017940 100644 --- a/htdocs/core/class/fileupload.class.php +++ b/htdocs/core/class/fileupload.class.php @@ -436,7 +436,7 @@ class FileUpload { file_put_contents($file_path, fopen($uploaded_file, 'r'), FILE_APPEND); } else { - dol_move_uploaded_file($uploaded_file, $file_path, 1); + dol_move_uploaded_file($uploaded_file, $file_path, 1, 0, 0, 0, 'userfile'); } } else From e9a8457d7ed2b75f7801cb4b9699dd2e5a506d13 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 26 Mar 2013 17:29:40 +0100 Subject: [PATCH 023/194] Fix: broken features due to the removal of the trigger FILE_UPLOAD ! --- htdocs/core/lib/files.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 351b3fed386..cc756621172 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -649,7 +649,7 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable $hookmanager->initHooks(array('fileslib')); - $parameters=array('filename' => $file_name, 'varfiles' => $varfiles, 'allowoverwrite' => $allowoverwrite); + $parameters=array('src_file' => $src_file, 'file_name' => $file_name, 'varfiles' => $varfiles, 'allowoverwrite' => $allowoverwrite); $reshook=$hookmanager->executeHooks('moveUploadedFile', $parameters, $object); } From b5d13dc6e6938554c43265de5899cc97fd5aca00 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 26 Mar 2013 17:43:48 +0100 Subject: [PATCH 024/194] Fix: missing parameter --- htdocs/core/lib/files.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index cc756621172..34fb66fb5ea 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -649,7 +649,7 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable $hookmanager->initHooks(array('fileslib')); - $parameters=array('src_file' => $src_file, 'file_name' => $file_name, 'varfiles' => $varfiles, 'allowoverwrite' => $allowoverwrite); + $parameters=array('dest_files' => $dest_files, 'src_file' => $src_file, 'file_name' => $file_name, 'varfiles' => $varfiles, 'allowoverwrite' => $allowoverwrite); $reshook=$hookmanager->executeHooks('moveUploadedFile', $parameters, $object); } From e75c609a0a80451530ba217c933baa8214c548d1 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 26 Mar 2013 17:47:37 +0100 Subject: [PATCH 025/194] Fix: wrong var name --- htdocs/core/lib/files.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 34fb66fb5ea..23bf990ae69 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -649,7 +649,7 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable $hookmanager->initHooks(array('fileslib')); - $parameters=array('dest_files' => $dest_files, 'src_file' => $src_file, 'file_name' => $file_name, 'varfiles' => $varfiles, 'allowoverwrite' => $allowoverwrite); + $parameters=array('dest_file' => $dest_file, 'src_file' => $src_file, 'file_name' => $file_name, 'varfiles' => $varfiles, 'allowoverwrite' => $allowoverwrite); $reshook=$hookmanager->executeHooks('moveUploadedFile', $parameters, $object); } From 19ae4a75d62767c3566853eee88ee76a1afb5e70 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 26 Mar 2013 20:57:24 +0100 Subject: [PATCH 026/194] Qual: More robust function to run jobs --- htdocs/cron/card.php | 6 +- htdocs/cron/class/cronjob.class.php | 169 +++++++++++++++++++--------- 2 files changed, 117 insertions(+), 58 deletions(-) diff --git a/htdocs/cron/card.php b/htdocs/cron/card.php index fb936b58f3f..13ccb27cb0b 100644 --- a/htdocs/cron/card.php +++ b/htdocs/cron/card.php @@ -123,9 +123,9 @@ if ($action=='add') { // Save parameters if ($action=='update') { $object->id=$id; - $object->jobtype=GETPOST('jobtype','alpha'); - $object->label=GETPOST('label','alpha'); - $object->command=GETPOST('command','alpha'); + $object->jobtype=GETPOST('jobtype'); + $object->label=GETPOST('label'); + $object->command=GETPOST('command'); $object->classesname=GETPOST('classesname','alpha'); $object->priority=GETPOST('priority','int'); $object->objectname=GETPOST('objectname','alpha'); diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index 078ee98ad8e..b43f4ed9bd4 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -834,9 +834,12 @@ class Cronjob extends CommonObject { global $langs, $conf; + $error=0; + $now=dol_now(); + $langs->load('cron'); - if (empty($userlogin)) { + if (empty($userlogin)) { $this->error="User login is mandatory"; dol_syslog(get_class($this)."::run_jobs ".$this->error, LOG_ERR); return -1; @@ -845,27 +848,59 @@ class Cronjob extends CommonObject require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; $user=new User($this->db); $result=$user->fetch('',$userlogin); - if ($result<0) { + if ($result<0) + { $this->error="User Error:".$user->error; dol_syslog(get_class($this)."::run_jobs ".$this->error, LOG_ERR); return -1; - }else { - if (empty($user->id)) { + } + else + { + if (empty($user->id)) + { $this->error=" User user login:".$userlogin." do not exists"; dol_syslog(get_class($this)."::run_jobs ".$this->error, LOG_ERR); return -1; } } - dol_syslog(get_class($this)."::run_jobs userlogin:$userlogin", LOG_DEBUG); + dol_syslog(get_class($this)."::run_jobs jobtype=".$this->jobtype." userlogin=".$userlogin, LOG_DEBUG); - $error=0; - $now=dol_now(); - if ($this->jobtype=='method') { + // Increase limit of time. Works only if we are not in safe mode + $ExecTimeLimit=600; + if (!empty($ExecTimeLimit)) + { + $err=error_reporting(); + error_reporting(0); // Disable all errors + //error_reporting(E_ALL); + @set_time_limit($ExecTimeLimit); // Need more than 240 on Windows 7/64 + error_reporting($err); + } + if (!empty($MemoryLimit)) + { + @ini_set('memory_limit', $MemoryLimit); + } + + + // Update last run date (to track launch) + $this->datelastrun=$now; + $this->lastoutput=''; + $this->lastresult=''; + $this->nbrun=$this->nbrun+1; + $result = $this->update($user); + if ($result<0) { + dol_syslog(get_class($this)."::run_jobs ".$this->error, LOG_ERR); + return -1; + } + + // Run a method + if ($this->jobtype=='method') + { // load classes $ret=dol_include_once("/".$this->module_name."/class/".$this->classesname,$this->objectname); - if ($ret===false) { + if ($ret===false) + { $this->error=$langs->trans('CronCannotLoadClass',$file,$this->objectname); dol_syslog(get_class($this)."::run_jobs ".$this->error, LOG_ERR); return -1; @@ -873,7 +908,8 @@ class Cronjob extends CommonObject // Load langs $result=$langs->load($this->module_name.'@'.$this->module_name); - if ($result<0) { + if ($result<0) + { dol_syslog(get_class($this)."::run_jobs Cannot load module langs".$langs->error, LOG_ERR); return -1; } @@ -883,66 +919,89 @@ class Cronjob extends CommonObject // Create Object for the call module $object = new $this->objectname($this->db); - - //Update launch start date - $this->datelastrun=$now; - $this->nbrun=$this->nbrun+1; - $result = $this->update($user); - if ($result<0) { - dol_syslog(get_class($this)."::run_jobs ".$this->error, LOG_ERR); - return -1; - } - - $params_arr = array(); - $params_arr=explode(", ",$this->params); - if (!is_array($params_arr)) { + $params_arr = explode(", ",$this->params); + if (!is_array($params_arr)) + { $result = call_user_func(array($object, $this->methodename), $this->params); - }else { + } + else + { $result = call_user_func_array(array($object, $this->methodename), $params_arr); } - if ($result===false) { + if ($result===false) + { dol_syslog(get_class($this)."::run_jobs ".$object->error, LOG_ERR); return -1; - }else { + } + else + { $this->lastoutput=var_export($result,true); $this->lastresult=var_export($result,true); } - } elseif ($this->jobtype=='command') { - dol_syslog(get_class($this)."::run_jobs system:".$this->command, LOG_DEBUG); - $output_arr=array(); - - //Update launch start date - $this->datelastrun=$now; - $this->nbrun=$this->nbrun+1; - $result = $this->update($user); - if ($result<0) { - dol_syslog(get_class($this)."::run_jobs ".$this->error, LOG_ERR); - return -1; - } - - exec($this->command, $output_arr,$retval); - - dol_syslog(get_class($this)."::run_jobs output_arr:".var_export($output_arr,true), LOG_DEBUG); - - $this->lastoutput=''; - if (is_array($output_arr) && count($output_arr)>0) { - foreach($output_arr as $val) { - $this->lastoutput.=$val."\n"; - } - } - $this->lastresult=$retval; } - - //Update result date - $this->datelastresult=$now; + + // Run a command line + if ($this->jobtype=='command') + { + $command=escapeshellcmd($this->command); + $command.=" 2>&1"; + dol_mkdir($conf->cronjob->dir_temp); + $outputfile=$conf->cronjob->dir_temp.'/cronjob.'.$userlogin.'.out'; + + dol_syslog(get_class($this)."::run_jobs system:".$command, LOG_DEBUG); + $output_arr=array(); + + $execmethod=(empty($conf->global->MAIN_EXEC_USE_POPEN)?1:2); // 1 or 2 + if ($execmethod == 1) + { + exec($command, $output_arr, $retval); + } + if ($execmethod == 2) + { + $ok=0; + $handle = fopen($outputfile, 'w'); + if ($handle) + { + dol_syslog("Run command ".$command); + $handlein = popen($command, 'r'); + while (!feof($handlein)) + { + $read = fgets($handlein); + fwrite($handle,$read); + $output_arr[]=$read; + } + pclose($handlein); + fclose($handle); + } + if (! empty($conf->global->MAIN_UMASK)) @chmod($outputfile, octdec($conf->global->MAIN_UMASK)); + } + } + + dol_syslog(get_class($this)."::run_jobs output_arr:".var_export($output_arr,true), LOG_DEBUG); + + + // Update with result + $this->lastoutput=''; + if (is_array($output_arr) && count($output_arr)>0) + { + foreach($output_arr as $val) + { + $this->lastoutput.=$val."\n"; + } + } + $this->lastresult=$retval; + $this->datelastresult=dol_now(); $result = $this->update($user); - if ($result<0) { + if ($result < 0) + { dol_syslog(get_class($this)."::run_jobs ".$this->error, LOG_ERR); return -1; - }else { + } + else + { return 1; } From 8c053b2f8d254ac13fccb79b5a3c701517134511 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 26 Mar 2013 21:18:01 +0100 Subject: [PATCH 027/194] Debug module cron --- htdocs/cron/list.php | 62 +++++++++++++------------- htdocs/langs/en_US/cron.lang | 25 +++++++++++ htdocs/theme/amarok/img/play.png | Bin 0 -> 836 bytes htdocs/theme/auguria/img/play.png | Bin 0 -> 836 bytes htdocs/theme/bureau2crea/img/play.png | Bin 0 -> 836 bytes htdocs/theme/cameleo/img/play.png | Bin 0 -> 836 bytes htdocs/theme/eldy/img/play.png | Bin 0 -> 836 bytes 7 files changed, 56 insertions(+), 31 deletions(-) create mode 100644 htdocs/theme/amarok/img/play.png create mode 100644 htdocs/theme/auguria/img/play.png create mode 100644 htdocs/theme/bureau2crea/img/play.png create mode 100644 htdocs/theme/cameleo/img/play.png create mode 100644 htdocs/theme/eldy/img/play.png diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index 5e972f0e55b..db36cc5d59b 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -146,9 +146,9 @@ print $langs->trans('CronWaitingJobs'); print "

"; if (count($object->lines)>0) { - + print ''; - print ''; + print ''; $arg_url='&page='.$page.'&status='.$status.'&search_label='.$search_label; print_liste_field_titre($langs->trans("CronLabel"),$_SERVEUR['PHP_SELF'],"t.label","",$arg_url,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("CronTask"),'','',"",$arg_url,'',$sortfield,$sortorder); @@ -161,15 +161,15 @@ if (count($object->lines)>0) { print_liste_field_titre($langs->trans("CronLastResult"),$_SERVEUR['PHP_SELF'],"t.lastresult","",$arg_url,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("CronLastOutput"),$_SERVEUR['PHP_SELF'],"t.lastoutput","",$arg_url,'',$sortfield,$sortorder); print ''; - + print ''; - + print ''."\n"; print ''; print ''; - - - + + + print ''; @@ -186,30 +186,30 @@ if (count($object->lines)>0) { print '  '; print ''; print ''; - + print ''; print ''; - - - + + + // Boucler sur chaque job $style='impair'; foreach($object->lines as $line){ // title profil if ($style=='pair') {$style='impair';} else {$style='pair';} - + print ''; - + print ''; - + print ''; - + print ''; - + print ''; - + print ''; - + print ''; - + print ''; - + print ''; - + print ''; - + print ''; - - print ''; - + print ''; } print '
'; print ''; print '
'; if(!empty($line->label)) { print ''.$line->label.''; - } + } else { print $langs->trans('CronNone'); } print ''; if ($line->jobtype=='method') { print $langs->trans('CronModule').':'.$line->module_name.'
'; @@ -219,7 +219,7 @@ if (count($object->lines)>0) { if(!empty($line->params)) { print '
'.$langs->trans('CronArgs').':'. $line->params; } - + }elseif ($line->jobtype=='command') { print $langs->trans('CronCommand').':'. dol_trunc($line->command); if(!empty($line->params)) { @@ -227,55 +227,55 @@ if (count($object->lines)>0) { } } print '
'; if(!empty($line->datestart)) {print dol_print_date($line->datestart,'dayhourtext');} else {print $langs->trans('CronNone');} print ''; if(!empty($line->dateend)) {print dol_print_date($line->dateend,'dayhourtext');} else {print $langs->trans('CronNone');} print ''; if(!empty($line->datelastrun)) {print dol_print_date($line->datelastrun,'dayhourtext');} else {print $langs->trans('CronNone');} print ''; if(!empty($line->datenextrun)) {print dol_print_date($line->datenextrun,'dayhourtext');} else {print $langs->trans('CronNone');} print ''; if($line->unitfrequency == "60") print $langs->trans('CronEach')." ".($line->frequency/$line->unitfrequency)." ".$langs->trans('Minutes'); if($line->unitfrequency == "3600") print $langs->trans('CronEach')." ".($line->frequency/$line->unitfrequency)." ".$langs->trans('Hours'); if($line->unitfrequency == "86400") print $langs->trans('CronEach')." ".($line->frequency/$line->unitfrequency)." ".$langs->trans('Days'); if($line->unitfrequency == "604800") print $langs->trans('CronEach')." ".($line->frequency/$line->unitfrequency)." ".$langs->trans('Weeks'); print ''; if(!empty($line->nbrun)) {print $line->nbrun;} else {print '0';} print ''; if(!empty($line->lastresult)) {print dol_trunc($line->lastresult);} else {print $langs->trans('CronNone');} print ''; if(!empty($line->lastoutput)) {print dol_trunc(nl2br($line->lastoutput),100);} else {print $langs->trans('CronNone');} print ''; + + print ''; if ($user->rights->cron->delete) { - print "id."&status=".$status."&action=delete\" title=\"".$langs->trans('CronDelete')."\">\"".$langs-trans('CronDelete')."\" />"; + print "id."&status=".$status."&action=delete\" title=\"".$langs->trans('CronDelete')."\">".img_delete()."  "; } else { - print "trans('NotEnoughPermissions')."\">\"".$langs-trans('NotEnoughPermissions')."\" />"; + print "trans('NotEnoughPermissions')."\">".img_delete()."   "; } if ($user->rights->cron->execute) { - print "id."&status=".$status."&action=execute\" title=\"".$langs->trans('CronExecute')."\">\"".$langs-trans('CronExecute')."\" />"; + print "id."&status=".$status."&action=execute\" title=\"".$langs->trans('CronExecute')."\">".img_picto('',"play").""; } else { - print "trans('NotEnoughPermissions')."\">\"".$langs-trans('NotEnoughPermissions')."\" />"; + print "trans('NotEnoughPermissions')."\">".img_picto('',"execute").""; } print '
'; diff --git a/htdocs/langs/en_US/cron.lang b/htdocs/langs/en_US/cron.lang index c64c74f1f58..e6930cd0b08 100644 --- a/htdocs/langs/en_US/cron.lang +++ b/htdocs/langs/en_US/cron.lang @@ -1,5 +1,22 @@ # Dolibarr language file - en_US - cron CHARSET=UTF-8 +Module2310Name=Cron +Module2310Desc=Scheduled task management + +# +# About page +# +About = About +CronAbout = About Cron +CronAboutPage = Cron about page + +# +# Right +# +Permission23101 = Read Scheduled task +Permission23102 = Create/update Scheduled task +Permission23103 = Delete Scheduled task +Permission23104 = Execute Scheduled task # # Admin @@ -12,6 +29,14 @@ FileToLaunchCronJobs=Command to launch cron jobs CronExplainHowToRunUnix=On Unix environement you should use crontab to run Command line each minutes CronExplainHowToRunWin=On Microsoft(tm) Windows environement you can use Scheduled task tools to run Command line each minutes + +# +# Menu +# +CronListActive= List of active jobs +CronListInactive= List of disabled jobs + + # # Page list # diff --git a/htdocs/theme/amarok/img/play.png b/htdocs/theme/amarok/img/play.png new file mode 100644 index 0000000000000000000000000000000000000000..6de3e256ba63c72c88e3ad9929da735574d84ee1 GIT binary patch literal 836 zcmV-K1H1f*P)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2i*f2 z6b~AErG{ew00P8GL_t(I%XO2@Yg}a%#((F%cVgQ(x9QBiGt(wQTM7-h@MF`BAP9vD z(pBh6unIzDW)iGeuvW#D3!!nGdqXx-yJ#yyyDt3$+J#>r3I=TvEH(3yq%(J7bCbF6 zaWRuRK|Ra&oaZ^`Jm-CcVZ>39Y`H<_^PDk`b3|095uQO&HJRI}{Ucj${0gwTc!b=U z-vAIsVr}uT>-IZ8rD`;_67{y+2d+`|#`?!p^c}(6&X$`mj$(+T0DxW;JR8^Z8=cU9 zmH&xOJ-8Ux{q=5CnCcC2gG5-^)eZgDYAqNal71UU#lrycLXlRj^tiSg2B&(Ve-~i6 zHih|66-V?NYpLeuTI&F)<{`ZsN5K~sHy6w;v-JUVqXJ%~^|cDWuhk3hmgeqb&Mh98 ze$*F#Vz&L&$h1Zf1bxG?$x3&jc>1pcQ?6HTZl^C8^nLcdB!+bJ*k)hm0WMXJZWB0z zNkmmdjkTAIO@8P`rQ-nEa`TQ6^_n03e9)*ne$aa&eE{%!xHLG83<(4g5Cl-3HuP`B zVesXkho~#oF_J#o*s^BdPQAqi-T5MjD%VBz0)Rr_Dr&5_cZ_fXpcm%1>ocQZRsGRg z`*OC@p0UXNZrvXj)Jd#~O=7%X9I?lH_57hHD=S05US*1JJG&+2i)dHd6Ch#^^~*=HoPx#24YJ`L;(K){{a7>y{D4^000SaNL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Aqi-T5MjD%VBz0)Rr_Dr&5_cZ_fXpcm%1>ocQZRsGRg z`*OC@p0UXNZrvXj)Jd#~O=7%X9I?lH_57hHD=S05US*1JJG&+2i)dHd6Ch#^^~*=HoPx#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2i*f2 z6b~AErG{ew00P8GL_t(I%XO2@Yg}a%#((F%cVgQ(x9QBiGt(wQTM7-h@MF`BAP9vD z(pBh6unIzDW)iGeuvW#D3!!nGdqXx-yJ#yyyDt3$+J#>r3I=TvEH(3yq%(J7bCbF6 zaWRuRK|Ra&oaZ^`Jm-CcVZ>39Y`H<_^PDk`b3|095uQO&HJRI}{Ucj${0gwTc!b=U z-vAIsVr}uT>-IZ8rD`;_67{y+2d+`|#`?!p^c}(6&X$`mj$(+T0DxW;JR8^Z8=cU9 zmH&xOJ-8Ux{q=5CnCcC2gG5-^)eZgDYAqNal71UU#lrycLXlRj^tiSg2B&(Ve-~i6 zHih|66-V?NYpLeuTI&F)<{`ZsN5K~sHy6w;v-JUVqXJ%~^|cDWuhk3hmgeqb&Mh98 ze$*F#Vz&L&$h1Zf1bxG?$x3&jc>1pcQ?6HTZl^C8^nLcdB!+bJ*k)hm0WMXJZWB0z zNkmmdjkTAIO@8P`rQ-nEa`TQ6^_n03e9)*ne$aa&eE{%!xHLG83<(4g5Cl-3HuP`B zVesXkho~#oF_J#o*s^BdPQAqi-T5MjD%VBz0)Rr_Dr&5_cZ_fXpcm%1>ocQZRsGRg z`*OC@p0UXNZrvXj)Jd#~O=7%X9I?lH_57hHD=S05US*1JJG&+2i)dHd6Ch#^^~*=Ho Date: Tue, 26 Mar 2013 23:32:22 +0100 Subject: [PATCH 028/194] Add inforamtion on Project into ODT project --- .../pdf/doc_generic_project_odt.modules.php | 707 +++++++++++++----- .../doctemplates/project/template_project.odt | Bin 25790 -> 28586 bytes 2 files changed, 508 insertions(+), 199 deletions(-) diff --git a/htdocs/core/modules/project/pdf/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/pdf/doc_generic_project_odt.modules.php index 7ba6defaa3b..a1aa87366d9 100644 --- a/htdocs/core/modules/project/pdf/doc_generic_project_odt.modules.php +++ b/htdocs/core/modules/project/pdf/doc_generic_project_odt.modules.php @@ -1,36 +1,49 @@ * Copyright (C) 2012 Juanjo Menent - * Copyright (C) 2013 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 . - * or see http://www.gnu.org/ - */ +* Copyright (C) 2013 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 . +* or see http://www.gnu.org/ +*/ /** * \file htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php - * \ingroup commande + * \ingroup project * \brief File of class to build ODT documents for third parties - */ +*/ require_once DOL_DOCUMENT_ROOT.'/core/modules/project/modules_project.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; +require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; +require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; +require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php'; +if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; +if (! empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; +if (! empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php'; +if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; +if (! empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; +if (! empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; +if (! empty($conf->contrat->enabled)) require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; +if (! empty($conf->ficheinter->enabled)) require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; +if (! empty($conf->deplacement->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php'; +if (! empty($conf->agenda->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; /** @@ -88,64 +101,129 @@ class doc_generic_project_odt extends ModelePDFProjects } - /** - * Define array with couple substitution key => substitution value - * - * @param Object $object Main object to use as data source - * @param Translate $outputlangs Lang object to use for output - * @return array Array of substitution - */ - function get_substitutionarray_object($object,$outputlangs) - { - global $conf; - dol_syslog(get_class($this)."::get_substitutionarray_object object=".var_export($object,true), LOG_DEBUG); - return array( - 'object_id'=>$object->id, - 'object_ref'=>$object->ref, - 'object_title'=>$object->title, - 'object_description'=>$object->description, - 'object_date_creation'=>dol_print_date($object->date_c,'day'), - 'object_date_modification'=>dol_print_date($object->date_m,'day'), - 'object_date_start'=>dol_print_date($object->date_start,'day'), - 'object_date_end'=>dol_print_date($object->date_end,'day'), - 'object_note_private'=>$object->note_private, - 'object_note_public'=>$object->note_public, - 'object_public'=>$object->public, - 'object_statut'=>$object->getLibStatut() - ); - } + /** + * Define array with couple substitution key => substitution value + * + * @param Object $object Main object to use as data source + * @param Translate $outputlangs Lang object to use for output + * @return array Array of substitution + */ + function get_substitutionarray_object($object,$outputlangs) + { + global $conf; - /** - * Define array with couple substitution key => substitution value - * - * @param array $line Array of lines - * @param Translate $outputlangs Lang object to use for output - * @return array Return a substitution array - */ - function get_substitutionarray_lines($line,$outputlangs) - { - global $conf; + return array( + 'object_id'=>$object->id, + 'object_ref'=>$object->ref, + 'object_title'=>$object->title, + 'object_description'=>$object->description, + 'object_date_creation'=>dol_print_date($object->date_c,'day'), + 'object_date_modification'=>dol_print_date($object->date_m,'day'), + 'object_date_start'=>dol_print_date($object->date_start,'day'), + 'object_date_end'=>dol_print_date($object->date_end,'day'), + 'object_note_private'=>$object->note_private, + 'object_note_public'=>$object->note_public, + 'object_public'=>$object->public, + 'object_statut'=>html_entity_decode($object->getLibStatut()) + ); + } + + /** + * Define array with couple substitution key => substitution value + * + * @param array $task Task Object + * @param Translate $outputlangs Lang object to use for output + * @return array Return a substitution array + */ + function get_substitutionarray_tasks($task,$outputlangs) + { + global $conf; + + return array( + 'task_ref'=>$task->ref, + 'task_fk_project'=>$task->fk_project, + 'task_projectref'=>$task->projectref, + 'task_projectlabel'=>$task->projectlabel, + 'task_label'=>$task->label, + 'task_description'=>$task->description, + 'task_fk_parent'=>$task->fk_parent, + 'task_duration'=>$task->duration, + 'task_progress'=>$task->progress, + 'task_public'=>$task->public, + 'task_date_start'=>dol_print_date($task->date_start,'day'), + 'task_date_end'=>dol_print_date($task->date_end,'day') + ); + } + + /** + * Define array with couple substitution key => substitution value + * + * @param array $contact Contact array + * @param Translate $outputlangs Lang object to use for output + * @return array Return a substitution array + */ + function get_substitutionarray_project_contacts($contact,$outputlangs) + { + global $conf; + + return array( + 'projcontacts_id'=>$contact['id'], + 'projcontacts_rowid'=>$contact['rowid'], + 'projcontacts_role'=>$contact['libelle'], + 'projcontacts_lastname'=>$contact['lastname'], + 'projcontacts_firstname'=>$contact['firstname'], + 'projcontacts_fullcivname'=>$contact['fullname'], + 'projcontacts_socname'=>$contact['socname'], + 'projcontacts_email'=>$contact['email'] + ); + } + + /** + * Define array with couple substitution key => substitution value + * + * @param array $file file array + * @param Translate $outputlangs Lang object to use for output + * @return array Return a substitution array + */ + function get_substitutionarray_project_file($file,$outputlangs) + { + global $conf; + + return array( + 'projfile_name'=>$file['name'], + 'projfile_date'=>dol_print_date($file['date'],'day'), + 'projfile_size'=>$file['size'] + ); + } + + /** + * Define array with couple substitution key => substitution value + * + * @param array $refdetail Reference array + * @param Translate $outputlangs Lang object to use for output + * @return array Return a substitution array + */ + function get_substitutionarray_project_reference($refdetail,$outputlangs) + { + global $conf; + + return array( + 'projref_type'=>$refdetail['type'], + 'projref_ref'=>$refdetail['ref'], + 'projref_date'=>dol_print_date($refdetail['date'],'day'), + 'projref_socname'=>$refdetail['socname'], + 'projref_amountht'=>price($refdetail['amountht'],0,$outputlangs), + 'projref_amountttc'=>price($refdetail['amountttc'],0,$outputlangs), + 'projref_status'=>$refdetail['status'] + ); + } + - return array( - 'line_ref'=>$line->ref, - 'line_fk_project'=>$line->fk_project, - 'line_projectref'=>$line->projectref, - 'line_projectlabel'=>$line->projectlabel, - 'line_label'=>$line->label, - 'line_description'=>$line->description, - 'line_fk_parent'=>$line->fk_parent, - 'line_duration'=>$line->duration, - 'line_progress'=>$line->progress, - 'line_public'=>$line->public, - 'line_date_start'=>dol_print_date($line->date_start,'day'), - 'line_date_end'=>dol_print_date($line->date_end,'day') - ); - } /** * Return description of a module * - * @param Translate $langs Lang object to use for output + * @param Translate $langs Lang object to use for output * @return string Description */ function info($langs) @@ -173,7 +251,9 @@ class doc_generic_project_odt extends ModelePDFProjects { $tmpdir=trim($tmpdir); $tmpdir=preg_replace('/DOL_DATA_ROOT/',DOL_DATA_ROOT,$tmpdir); - if (! $tmpdir) { unset($listofdir[$key]); continue; } + if (! $tmpdir) { + unset($listofdir[$key]); continue; + } if (! is_dir($tmpdir)) $texttitle.=img_warning($langs->trans("ErrorDirNotFound",$tmpdir),0); else { @@ -184,19 +264,19 @@ class doc_generic_project_odt extends ModelePDFProjects $texthelp=$langs->trans("ListOfDirectoriesForModelGenODT"); // Add list of substitution keys $texthelp.='
'.$langs->trans("FollowingSubstitutionKeysCanBeUsed").'
'; - $texthelp.=$langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it + $texthelp.=$langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it $texte.= $form->textwithpicto($texttitle,$texthelp,1,'help','',1); $texte.= ''; + $texte.= ''; $texte.= ''; + $texte.= ''; + $texte.= ''; $texte.= ''; - $texte.= '
'; $texte.= ''; - $texte.= '  '; - $texte.= ''; - $texte.= '
'; + $texte.= ''; // Scan directories if (count($listofdir)) $texte.=$langs->trans("NumberOfModelFilesFound").': '.count($listoffiles).''; @@ -210,7 +290,7 @@ class doc_generic_project_odt extends ModelePDFProjects $texte.= ''; /*$texte.= ''; - $texte.= ''; + $texte.= ''; $texte.= ''; $texte.= ''; $texte.= '';*/ @@ -232,7 +312,7 @@ class doc_generic_project_odt extends ModelePDFProjects function write_file($object,$outputlangs,$srctemplatepath) { global $user,$langs,$conf,$mysoc; - + if (empty($srctemplatepath)) { dol_syslog("doc_generic_odt::write_file parameter srctemplatepath empty", LOG_WARNING); @@ -247,7 +327,7 @@ class doc_generic_project_odt extends ModelePDFProjects $outputlangs->load("dict"); $outputlangs->load("companies"); $outputlangs->load("projects"); - + if ($conf->projet->dir_output) { // If $object is id instead of object @@ -284,7 +364,7 @@ class doc_generic_project_odt extends ModelePDFProjects $newfiletmp=preg_replace('/\.odt/i','',$newfile); $newfiletmp=preg_replace('/template_/i','',$newfiletmp); $newfiletmp=preg_replace('/modele_/i','',$newfiletmp); - $newfiletmp=$objectref.'_'.$newfiletmp; + $newfiletmp=$objectref.'_'.$newfiletmp; //$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt'; $file=$dir.'/'.$newfiletmp.'.odt'; //print "newdir=".$dir; @@ -293,66 +373,59 @@ class doc_generic_project_odt extends ModelePDFProjects //print "conf->societe->dir_temp=".$conf->societe->dir_temp; dol_mkdir($conf->projet->dir_temp); - - - // List of all contact - $usecontact=false; - $arrayidcontact=$object->liste_contact(-1,'internal'); - if (count($arrayidcontact) > 0) - { - $usecontact=true; - $result=$object->fetch_contact($arrayidcontact[0]['id']); - } - - $socobject=$object->thirdparty; - - // Make substitution - $substitutionarray=array( - '__FROM_NAME__' => $this->emetteur->nom, - '__FROM_EMAIL__' => $this->emetteur->email, - ); - complete_substitutions_array($substitutionarray, $langs, $object); - - // Open and load template + + $socobject=$object->thirdparty; + + // Make substitution + $substitutionarray=array( + '__FROM_NAME__' => $this->emetteur->nom, + '__FROM_EMAIL__' => $this->emetteur->email, + ); + complete_substitutions_array($substitutionarray, $langs, $object); + + // Open and load template require_once ODTPHP_PATH.'odf.php'; $odfHandler = new odf( - $srctemplatepath, - array( - 'PATH_TO_TMP' => $conf->projet->dir_temp, - 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. - 'DELIMITER_LEFT' => '{', - 'DELIMITER_RIGHT' => '}' + $srctemplatepath, + array( + 'PATH_TO_TMP' => $conf->projet->dir_temp, + 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'DELIMITER_LEFT' => '{', + 'DELIMITER_RIGHT' => '}' ) ); // After construction $odfHandler->contentXml contains content and // [!-- BEGIN row.lines --]*[!-- END row.lines --] has been replaced by // [!-- BEGIN lines --]*[!-- END lines --] - //print html_entity_decode($odfHandler->__toString()); - //print exit; + //print html_entity_decode($odfHandler->__toString()); + //print exit; - // Make substitutions into odt of user info + + + + // Make substitutions into odt of user info $tmparray=$this->get_substitutionarray_user($user,$outputlangs); - //var_dump($tmparray); exit; - foreach($tmparray as $key=>$value) - { - try { - if (preg_match('/logo$/',$key)) // Image - { - //var_dump($value);exit; - if (file_exists($value)) $odfHandler->setImage($key, $value); - else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); - } - else // Text - { - $odfHandler->setVars($key, $value, true, 'UTF-8'); - } - } - catch(OdfException $e) - { - } - } - // Make substitutions into odt of mysoc - $tmparray=$this->get_substitutionarray_mysoc($mysoc,$outputlangs); + //var_dump($tmparray); exit; + foreach($tmparray as $key=>$value) + { + try { + if (preg_match('/logo$/',$key)) // Image + { + //var_dump($value);exit; + if (file_exists($value)) $odfHandler->setImage($key, $value); + else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); + } + else // Text + { + $odfHandler->setVars($key, $value, true, 'UTF-8'); + } + } + catch(OdfException $e) + { + } + } + // Make substitutions into odt of mysoc + $tmparray=$this->get_substitutionarray_mysoc($mysoc,$outputlangs); //var_dump($tmparray); exit; foreach($tmparray as $key=>$value) { @@ -372,8 +445,8 @@ class doc_generic_project_odt extends ModelePDFProjects { } } - - // Make substitutions into odt of thirdparty + + // Make substitutions into odt of thirdparty $tmparray=$this->get_substitutionarray_thirdparty($socobject,$outputlangs); foreach($tmparray as $key=>$value) { @@ -392,75 +465,312 @@ class doc_generic_project_odt extends ModelePDFProjects { } } - - // Replace tags of object + external modules - $tmparray=$this->get_substitutionarray_object($object,$outputlangs); - complete_substitutions_array($tmparray, $outputlangs, $object); - foreach($tmparray as $key=>$value) - { - try { - if (preg_match('/logo$/',$key)) // Image - { - if (file_exists($value)) $odfHandler->setImage($key, $value); - else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); - } - else // Text - { - $odfHandler->setVars($key, $value, true, 'UTF-8'); - } - } - catch(OdfException $e) - { - } - } - - // Replace tags of lines - try - { - $listlines = $odfHandler->setSegment('lines'); - - $taskstatic = new Task($this->db); - - // Security check - $socid=0; - if (!empty($object->fk_soc)) $socid = $object->fk_soc; - - $tasksarray=$taskstatic->getTasksArray(0, 0, $object->id, $socid, 0); - - foreach ($tasksarray as $task) - { - $tmparray=$this->get_substitutionarray_lines($task,$outputlangs); - complete_substitutions_array($tmparray, $outputlangs, $object, $task, "completesubstitutionarray_lines"); - foreach($tmparray as $key => $val) - { - try - { - $listlines->setVars($key, $val, true, 'UTF-8'); - } - catch(OdfException $e) - { - } - catch(SegmentException $e) - { - } - } - $listlines->merge(); - } - $odfHandler->mergeSegment($listlines); - } - catch(OdfException $e) - { - $this->error=$e->getMessage(); - dol_syslog($this->error, LOG_WARNING); - return -1; - } - // Write new file + // Replace tags of object + external modules + $tmparray=$this->get_substitutionarray_object($object,$outputlangs); + complete_substitutions_array($tmparray, $outputlangs, $object); + foreach($tmparray as $key=>$value) + { + try { + if (preg_match('/logo$/',$key)) // Image + { + if (file_exists($value)) $odfHandler->setImage($key, $value); + else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); + } + else // Text + { + $odfHandler->setVars($key, $value, true, 'UTF-8'); + } + } + catch(OdfException $e) + { + } + } + + // Replace tags of lines for tasks + try + { + $listlines = $odfHandler->setSegment('tasks'); + + $taskstatic = new Task($this->db); + + // Security check + $socid=0; + if (!empty($object->fk_soc)) $socid = $object->fk_soc; + + $tasksarray=$taskstatic->getTasksArray(0, 0, $object->id, $socid, 0); + + + + foreach ($tasksarray as $task) + { + $tmparray=$this->get_substitutionarray_tasks($task,$outputlangs); + //complete_substitutions_array($tmparray, $outputlangs, $object, $task, "completesubstitutionarray_lines"); + foreach($tmparray as $key => $val) + { + try + { + $listlines->setVars($key, $val, true, 'UTF-8'); + } + catch(OdfException $e) + { + } + catch(SegmentException $e) + { + } + } + $listlines->merge(); + } + $odfHandler->mergeSegment($listlines); + } + catch(OdfException $e) + { + $this->error=$e->getMessage(); + dol_syslog($this->error, LOG_WARNING); + return -1; + } + + // Replace tags of project files + try + { + $listlines = $odfHandler->setSegment('projectfiles'); + + $upload_dir = $conf->projet->dir_output.'/'.dol_sanitizeFileName($object->ref); + $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$','name',SORT_ASC,1); + + + foreach ($filearray as $filedetail) + { + //dol_syslog(get_class($this).'::ee $filedetail'.var_export($filedetail,true)); + $tmparray=$this->get_substitutionarray_project_file($filedetail,$outputlangs); + + foreach($tmparray as $key => $val) + { + try + { + $listlines->setVars($key, $val, true, 'UTF-8'); + } + catch(OdfException $e) + { + } + catch(SegmentException $e) + { + } + } + $listlines->merge(); + } + $odfHandler->mergeSegment($listlines); + } + catch(OdfException $e) + { + $this->error=$e->getMessage(); + dol_syslog($this->error, LOG_WARNING); + return -1; + } + + // Replace tags of lines for contacts + $sourcearray=array('internal','external'); + $contact_arrray=array(); + foreach ($sourcearray as $source) { + $contact_temp=$object->liste_contact(-1,$source); + if ((is_array($contact_temp) && count($contact_temp) > 0)) + { + $contact_arrray=array_merge($contact_arrray,$contact_temp); + } + } + if ((is_array($contact_arrray) && count($contact_arrray) > 0)) + { + try + { + $listlines = $odfHandler->setSegment('projectcontacts'); + + foreach ($contact_arrray as $contact) + { + if ($contact['source']=='internal') { + $objectdetail=new User($this->db); + $objectdetail->fetch($contact['id']); + $contact['socname']=$mysoc->name; + } elseif ($contact['source']=='external') { + $objectdetail=new Contact($this->db); + $objectdetail->fetch($contact['id']); + + $soc=new Societe($this->db); + $soc->fetch($contact['socid']); + $contact['socname']=$soc->name; + } + $contact['fullname']=$objectdetail->getFullName($outputlangs,1); + + $tmparray=$this->get_substitutionarray_project_contacts($contact,$outputlangs); + complete_substitutions_array($tmparray, $outputlangs, $contact, $contact, "completesubstitutionarray_lines"); + foreach($tmparray as $key => $val) + { + try + { + $listlines->setVars($key, $val, true, 'UTF-8'); + } + catch(OdfException $e) + { + } + catch(SegmentException $e) + { + } + } + $listlines->merge(); + } + $odfHandler->mergeSegment($listlines); + } + catch(OdfException $e) + { + $this->error=$e->getMessage(); + dol_syslog($this->error, LOG_WARNING); + return -1; + } + } + + //List of referent + + $listofreferent=array( + 'propal'=>array( + 'title'=>"ListProposalsAssociatedProject", + 'class'=>'Propal', + 'test'=>$conf->propal->enabled), + 'order'=>array( + 'title'=>"ListOrdersAssociatedProject", + 'class'=>'Commande', + 'test'=>$conf->commande->enabled), + 'invoice'=>array( + 'title'=>"ListInvoicesAssociatedProject", + 'class'=>'Facture', + 'test'=>$conf->facture->enabled), + 'invoice_predefined'=>array( + 'title'=>"ListPredefinedInvoicesAssociatedProject", + 'class'=>'FactureRec', + 'test'=>$conf->facture->enabled), + 'order_supplier'=>array( + 'title'=>"ListSupplierOrdersAssociatedProject", + 'class'=>'CommandeFournisseur', + 'test'=>$conf->fournisseur->enabled), + 'invoice_supplier'=>array( + 'title'=>"ListSupplierInvoicesAssociatedProject", + 'class'=>'FactureFournisseur', + 'test'=>$conf->fournisseur->enabled), + 'contract'=>array( + 'title'=>"ListContractAssociatedProject", + 'class'=>'Contrat', + 'test'=>$conf->contrat->enabled), + 'intervention'=>array( + 'title'=>"ListFichinterAssociatedProject", + 'class'=>'Fichinter', + 'disableamount'=>1, + 'test'=>$conf->ficheinter->enabled), + 'trip'=>array( + 'title'=>"ListTripAssociatedProject", + 'class'=>'Deplacement', + 'disableamount'=>1, + 'test'=>$conf->deplacement->enabled), + 'agenda'=>array( + 'title'=>"ListActionsAssociatedProject", + 'class'=>'ActionComm', + 'disableamount'=>1, + 'test'=>$conf->agenda->enabled) + ); + + //Inser refenrence + try + { + $listlines = $odfHandler->setSegment('projectrefs'); + + foreach ($listofreferent as $keyref => $valueref) + { + $title=$valueref['title']; + $classname=$valueref['class']; + $qualified=$valueref['test']; + if ($qualified) + { + $elementarray = $object->get_element_list($keyref); + if (count($elementarray)>0 && is_array($elementarray)) + { + $var=true; + $total_ht = 0; + $total_ttc = 0; + $num=count($elementarray); + for ($i = 0; $i < $num; $i++) + { + $ref_array=array(); + $ref_array['type']=$langs->trans($classname); + + $element = new $classname($this->db); + $element->fetch($elementarray[$i]); + $element->fetch_thirdparty(); + + //Ref object + $ref_array['ref']=$element->ref; + + //Date object + $dateref=$element->date; + if (empty($dateref)) $dateref=$element->datep; + if (empty($dateref)) $dateref=$element->date_contrat; + $ref_array['date']=$dateref; + + //Soc object + if (is_object($element->thirdparty)) { + $ref_array['socname']=$element->thirdparty->name; + } else { + $ref_array['socname']=''; + } + + //Amount object + if (empty($valueref['disableamount'])) { + if (!empty($element->total_ht)) { + $ref_array['amountht']=$element->total_ht; + $ref_array['amountttc']=$element->total_ttc; + }else { + $ref_array['amountht']=0; + $ref_array['amountttc']=0; + } + }else { + $ref_array['amountht']=''; + $ref_array['amountttc']=''; + } + + $ref_array['status']=html_entity_decode($element->getLibStatut(0)); + + $tmparray=$this->get_substitutionarray_project_reference($ref_array,$outputlangs); + + foreach($tmparray as $key => $val) + { + try + { + $listlines->setVars($key, $val, true, 'UTF-8'); + } + catch(OdfException $e) + { + } + catch(SegmentException $e) + { + } + } + $listlines->merge(); + } + + } + } + $odfHandler->mergeSegment($listlines); + } + } + catch(OdfException $e) + { + $this->error=$e->getMessage(); + dol_syslog($this->error, LOG_WARNING); + return -1; + } + + // Write new file //$result=$odfHandler->exportAsAttachedFile('toto'); $odfHandler->saveToDisk($file); if (! empty($conf->global->MAIN_UMASK)) - @chmod($file, octdec($conf->global->MAIN_UMASK)); + @chmod($file, octdec($conf->global->MAIN_UMASK)); $odfHandler=null; // Destroy object @@ -477,5 +787,4 @@ class doc_generic_project_odt extends ModelePDFProjects } } - -?> +?> \ No newline at end of file diff --git a/htdocs/install/doctemplates/project/template_project.odt b/htdocs/install/doctemplates/project/template_project.odt index fcf5f52d80126f4af6bd2ecb629f5721a5b606f1..ff34277a48c52325be4902df3ed9b9a9bf6056ad 100755 GIT binary patch delta 25734 zcma(218`;0*X|3)PKO=4gN}`kJGO1x_UhQS?WAMdwr#s(fBC=fy$4_2I(2r{ti5Zk zu~*GC=d4kqe$RM1M?lNAKoR96!6DE=Kwv;X@Lf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O`{#bF>MBv{pZ zvzmJt0ymr#K}lpfI!CHkFTfr|X5G}e57C_RG80RsV8KlpFC*qY#X zzTNuqZ+c;^^P4`k`8{4$m<{Yd6P(-fVgD=kE<)H&nD!UvZ`0%*HvcQ_BVz3+f4BJ? zxMTj+0trbNap&=*_iLQL56oW({(nhA>2Ex*sd5jQ2#E;kkG)jpZ>9Zv{%K8wxIKmN zufhMTzdIe?9m;>DeBC>(-s$MqQ^Efm8UeSbL>4wcl-g7L{wV!-MGr%SACw0BKO+3u z9f)5Q<%S4u7~Ai5FJP3&TZV}5P)0;54C6Oz|Bl6Mgy6KMLM;EqGB845II#S;MXV7* z^H0&!ffBjb2r*(!_vqit{Uti`ANg7TS_cx+J!8bO!+*BHFM;%o5vDf(NcxX)+0>B| R8E%a5b!5GNWAdx_{{g*SHGBX7 From 6494764e764f1d589e2146ed10bae5e3c3d02c48 Mon Sep 17 00:00:00 2001 From: fhenry Date: Wed, 27 Mar 2013 11:24:57 +0100 Subject: [PATCH 029/194] Add copy files ODT project on install --- htdocs/install/etape1.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/etape1.php b/htdocs/install/etape1.php index 009d953e73d..1f48bf8efc0 100644 --- a/htdocs/install/etape1.php +++ b/htdocs/install/etape1.php @@ -400,7 +400,7 @@ if (! $error && $db->connected && $action == "set") require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $srcroot=$main_dir.'/install/doctemplates'; $destroot=$main_data_dir.'/doctemplates'; - $docs=array('thirdparties' => 'thirdparty', 'proposals' => 'proposal', 'orders' => 'order', 'invoices' => 'invoice'); + $docs=array('thirdparties' => 'thirdparty', 'proposals' => 'proposal', 'orders' => 'order', 'invoices' => 'invoice', 'projects' => 'project'); foreach($docs as $cursordir => $cursorfile) { $src=$srcroot.'/'.$cursordir.'/template_'.$cursorfile.'.odt'; From c36f52c47a08a6ed5019fa4f53ec0371f554e8df Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 27 Mar 2013 11:54:10 +0100 Subject: [PATCH 030/194] Fix: avoid errors due to BROKEN FEATURES !!! --- htdocs/main.inc.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index cd5e3e32770..39acc88fd5c 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1020,6 +1020,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs print ''."\n"; } // jQuery File Upload + /* if (! empty($conf->global->MAIN_USE_JQUERY_FILEUPLOAD) || (defined('REQUIRE_JQUERY_FILEUPLOAD') && constant('REQUIRE_JQUERY_FILEUPLOAD'))) { print ''."\n"; @@ -1031,6 +1032,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs print ''."\n"; print ''."\n"; } + */ // jQuery DataTables if (! empty($conf->global->MAIN_USE_JQUERY_DATATABLES) || (defined('REQUIRE_JQUERY_DATATABLES') && constant('REQUIRE_JQUERY_DATATABLES'))) { From ce8631619a2114238bba3d9b3c202584d146feee Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 27 Mar 2013 11:54:10 +0100 Subject: [PATCH 031/194] Fix: avoid errors due to BROKEN FEATURES !!! --- htdocs/main.inc.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index dd6ac430fee..88efcfd76b5 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1075,6 +1075,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs print ''."\n"; } // jQuery File Upload + /* if (! empty($conf->global->MAIN_USE_JQUERY_FILEUPLOAD) || (defined('REQUIRE_JQUERY_FILEUPLOAD') && constant('REQUIRE_JQUERY_FILEUPLOAD'))) { print ''."\n"; @@ -1086,6 +1087,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs print ''."\n"; print ''."\n"; } + */ // jQuery DataTables if (! empty($conf->global->MAIN_USE_JQUERY_DATATABLES) || (defined('REQUIRE_JQUERY_DATATABLES') && constant('REQUIRE_JQUERY_DATATABLES'))) { From da8932f9877fbc1755704ec71415fed19a2807e5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 27 Mar 2013 13:24:26 +0100 Subject: [PATCH 032/194] Some fix for cron module --- htdocs/cron/card.php | 27 +++++++++++++++++++++------ htdocs/cron/list.php | 31 ++++++++++++++++++++----------- 2 files changed, 41 insertions(+), 17 deletions(-) diff --git a/htdocs/cron/card.php b/htdocs/cron/card.php index 13ccb27cb0b..6148ed5d5f7 100644 --- a/htdocs/cron/card.php +++ b/htdocs/cron/card.php @@ -82,6 +82,8 @@ if ($action == 'confirm_execute' && $confirm == "yes" && $user->rights->cron->ex setEventMessage($object->error,'errors'); $action=''; }else { + if ($object->lastresult > 0) setEventMessage($langs->trans("JobFinished"),'warnings'); + else setEventMessage($langs->trans("JobFinished"),'mesgs'); $action=''; } @@ -194,10 +196,13 @@ if ($action=='inactive') { llxHeader('',$langs->trans("CronAdd")); -if ($action=='edit' || empty($action) || $action=='delete' || $action=='execute') { +if ($action=='edit' || empty($action) || $action=='delete' || $action=='execute') +{ $head=cron_prepare_head($object); dol_fiche_head($head, 'card', $langs->trans("CronTask"), 0, 'bill'); -} elseif ($action=='create') { +} +elseif ($action=='create') +{ print_fiche_titre($langs->trans("CronTask"),'','setup'); } @@ -251,8 +256,8 @@ if (empty($object->status) && $action != 'create') dol_htmloutput_mesg($langs->trans("CronTaskInactive"),'','warning',1); } -if (($action=="create") || ($action=="edit")) { - +if (($action=="create") || ($action=="edit")) +{ print ''; print ''."\n"; if (!empty($object->id)) { @@ -565,6 +570,10 @@ if (($action=="create") || ($action=="edit")) { print ''; + + dol_fiche_end(); + + print "\n\n

\n"; if (! $user->rights->cron->create) { print ''.$langs->trans("Edit").''; @@ -585,9 +594,15 @@ if (($action=="create") || ($action=="edit")) { print ''.$langs->trans("CronStatusInactiveBtn").''; } } - if ((! $user->rights->cron->execute) || (empty($object->status))) { + if ((empty($user->rights->cron->execute))) + { print ''.$langs->trans("CronExecute").''; - } else { + } + else if (empty($object->status)) + { + print ''.$langs->trans("CronExecute").''; + } + else { print ''.$langs->trans("CronExecute").''; } print '

'; diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index db36cc5d59b..efed9579d1f 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -203,7 +203,7 @@ if (count($object->lines)>0) { print ''; if(!empty($line->label)) { - print ''.$line->label.''; + print ''.$line->label.''; } else { print $langs->trans('CronNone'); @@ -229,19 +229,19 @@ if (count($object->lines)>0) { print ''; print ''; - if(!empty($line->datestart)) {print dol_print_date($line->datestart,'dayhourtext');} else {print $langs->trans('CronNone');} + if(!empty($line->datestart)) {print dol_print_date($line->datestart,'dayhour');} else {print $langs->trans('CronNone');} print ''; print ''; - if(!empty($line->dateend)) {print dol_print_date($line->dateend,'dayhourtext');} else {print $langs->trans('CronNone');} + if(!empty($line->dateend)) {print dol_print_date($line->dateend,'dayhour');} else {print $langs->trans('CronNone');} print ''; print ''; - if(!empty($line->datelastrun)) {print dol_print_date($line->datelastrun,'dayhourtext');} else {print $langs->trans('CronNone');} + if(!empty($line->datelastrun)) {print dol_print_date($line->datelastrun,'dayhour');} else {print $langs->trans('CronNone');} print ''; print ''; - if(!empty($line->datenextrun)) {print dol_print_date($line->datenextrun,'dayhourtext');} else {print $langs->trans('CronNone');} + if(!empty($line->datenextrun)) {print dol_print_date($line->datenextrun,'dayhour');} else {print $langs->trans('CronNone');} print ''; print ''; @@ -283,13 +283,22 @@ if (count($object->lines)>0) { print $langs->trans('CronNoJobs'); } -print "\n\n
\n"; -if (! $user->rights->cron->create) { +print "\n
\n"; + +if (! $user->rights->cron->create) +{ print ''.$langs->trans("New").''; -} else { - print ''.$langs->trans("New").''; } -print '

'; +else +{ + print ''.$langs->trans("New").''; +} + +print '
'; + +print '
'; llxFooter(); -$db->close(); \ No newline at end of file + +$db->close(); +?> \ No newline at end of file From 982b3e9d66fdde2594e4aa245aaf103881824cdf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 27 Mar 2013 13:59:45 +0100 Subject: [PATCH 033/194] Add trigger into delete line for supplier invoice --- .../fourn/class/fournisseur.facture.class.php | 70 +++++++++++++++---- 1 file changed, 56 insertions(+), 14 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 60bdf26a8ab..840c4cecb94 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1166,24 +1166,66 @@ class FactureFournisseur extends CommonInvoice } /** - * Delete a detail line from database + * Delete a detail line from database * - * @param int $rowid Id of line to delete - * @return void + * @param int $rowid Id of line to delete + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers + * @return void */ - function deleteline($rowid) + function deleteline($rowid, $notrigger=0) { - // Supprime ligne - $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facture_fourn_det '; - $sql .= ' WHERE rowid = '.$rowid.';'; - $resql = $this->db->query($sql); - if (! $resql) + global $user, $langs, $conf; + + if (! $rowid) $rowid=$this->id; + + dol_syslog(get_class($this)."::delete rowid=".$rowid, LOG_DEBUG); + + $error=0; + $this->db->begin(); + + if (! $error && ! $notrigger) { - dol_print_error($this->db); + // Appel des triggers + include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); + $interface=new Interfaces($this->db); + $result=$interface->run_triggers('LINEBILL_SUPPLIER_DELETE',$this,$user,$langs,$conf); + if ($result < 0) { + $error++; $this->errors=$interface->errors; + } + // Fin appel triggers } - // Mise a jour prix facture - $this->update_price(); - return 1; + + if (! $error) + { + // Supprime ligne + $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facture_fourn_det '; + $sql.= ' WHERE rowid = '.$rowid; + dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG); + $resql = $this->db->query($sql); + if (! $resql) + { + $error++; + $this->error=$this->db->lasterror(); + dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR); + } + } + + if (! $error) + { + // Mise a jour prix facture + $this->update_price(); + } + + if (! $error) + { + $this->db->commit(); + return 1; + } + else + { + $this->db->rollback(); + return -1; + } } @@ -1305,7 +1347,7 @@ class FactureFournisseur extends CommonInvoice $result.=$lien.($max?dol_trunc($this->ref,$max):$this->ref).$lienfin; return $result; } - + /** * Renvoie la reference de facture suivante non utilisee en fonction du modele * de numerotation actif defini dans INVOICE_SUPPLIER_ADDON_NUMBER From 393cecb1c23c67d7e32410e77ca03730a60fe374 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 27 Mar 2013 14:08:15 +0100 Subject: [PATCH 034/194] New: Add hook --- htdocs/fourn/facture/paiement.php | 177 ++++++++++++++++-------------- 1 file changed, 92 insertions(+), 85 deletions(-) diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index e9358624fe2..51b9972260e 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -185,8 +185,8 @@ $form=new Form($db); if ($action == 'create' || $action == 'add_paiement') { - $facture = new FactureFournisseur($db); - $facture->fetch($facid); + $object = new FactureFournisseur($db); + $object->fetch($facid); $datefacture=dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); $dateinvoice=($datefacture==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0):$datefacture); @@ -248,91 +248,98 @@ if ($action == 'create' || $action == 'add_paiement') } print ''; - /* - * Autres factures impayees - */ - $sql = 'SELECT f.rowid as facid, f.rowid as ref, f.facnumber, f.total_ht, f.total_ttc, f.datef as df'; - $sql.= ', SUM(pf.amount) as am'; - $sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as f'; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf ON pf.fk_facturefourn = f.rowid'; - $sql.= " WHERE f.entity = ".$conf->entity; - $sql.= ' AND f.fk_soc = '.$facture->socid; - $sql.= ' AND f.paye = 0'; - $sql.= ' AND f.fk_statut = 1'; // Statut=0 => non validee, Statut=2 => annulee - $sql.= ' GROUP BY f.rowid, f.facnumber, f.total_ht, f.total_ttc, f.datef'; - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - if ($num > 0) - { - $i = 0; - print '
'; - print $langs->trans('Invoices').'
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + $parameters=array('facid'=>$facid, 'ref'=>$ref, 'objcanvas'=>$objcanvas); + $reshook=$hookmanager->executeHooks('paymentsupplierinvoices',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks + $error=$hookmanager->error; $errors=$hookmanager->errors; + if (empty($reshook)) + { + /* + * Autres factures impayees + */ + $sql = 'SELECT f.rowid as facid, f.rowid as ref, f.facnumber, f.total_ht, f.total_ttc, f.datef as df'; + $sql.= ', SUM(pf.amount) as am'; + $sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as f'; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf ON pf.fk_facturefourn = f.rowid'; + $sql.= " WHERE f.entity = ".$conf->entity; + $sql.= ' AND f.fk_soc = '.$object->socid; + $sql.= ' AND f.paye = 0'; + $sql.= ' AND f.fk_statut = 1'; // Statut=0 => non validee, Statut=2 => annulee + $sql.= ' GROUP BY f.rowid, f.facnumber, f.total_ht, f.total_ttc, f.datef'; + $resql = $db->query($sql); + if ($resql) + { + $num = $db->num_rows($resql); + if ($num > 0) + { + $i = 0; + print '
'; - $var=True; - $total=0; - $total_ttc=0; - $totalrecu=0; - while ($i < $num) - { - $objp = $db->fetch_object($resql); - $var=!$var; - print ''; - print ''; - print ''; - if ($objp->df > 0 ) - { - print ''; - } - else - { - print ''; - } - print ''; - print ''; - print ''; - print '\n"; - $total+=$objp->total_ht; - $total_ttc+=$objp->total_ttc; - $totalrecu+=$objp->am; - $i++; - } - if ($i > 1) - { - // Print total - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print "\n"; - } - print "
'.$langs->trans('Ref').''.$langs->trans('RefSupplier').''.$langs->trans('Date').''.$langs->trans('AmountTTC').''.$langs->trans('AlreadyPaid').''.$langs->trans('RemainderToPay').''.$langs->trans('Amount').'
'.img_object($langs->trans('ShowBill'),'bill').' '.$objp->ref; - print ''.$objp->facnumber.''; - print dol_print_date($db->jdate($objp->df)).'!!!'.price($objp->total_ttc).''.price($objp->am).''.price($objp->total_ttc - $objp->am).''; - $namef = 'amount_'.$objp->facid; - print ''; - print "
'.$langs->trans('TotalTTC').':'.price($total_ttc).''.price($totalrecu).''.price($total_ttc - $totalrecu).' 
\n"; - } - $db->free($resql); - } - else - { - dol_print_error($db); - } + print $langs->trans('Invoices').'
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + $var=True; + $total=0; + $total_ttc=0; + $totalrecu=0; + while ($i < $num) + { + $objp = $db->fetch_object($resql); + $var=!$var; + print ''; + print ''; + print ''; + if ($objp->df > 0 ) + { + print ''; + } + else + { + print ''; + } + print ''; + print ''; + print ''; + print '\n"; + $total+=$objp->total_ht; + $total_ttc+=$objp->total_ttc; + $totalrecu+=$objp->am; + $i++; + } + if ($i > 1) + { + // Print total + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print "\n"; + } + print "
'.$langs->trans('Ref').''.$langs->trans('RefSupplier').''.$langs->trans('Date').''.$langs->trans('AmountTTC').''.$langs->trans('AlreadyPaid').''.$langs->trans('RemainderToPay').''.$langs->trans('Amount').'
'.img_object($langs->trans('ShowBill'),'bill').' '.$objp->ref; + print ''.$objp->facnumber.''; + print dol_print_date($db->jdate($objp->df)).'!!!'.price($objp->total_ttc).''.price($objp->am).''.price($objp->total_ttc - $objp->am).''; + $namef = 'amount_'.$objp->facid; + print ''; + print "
'.$langs->trans('TotalTTC').':'.price($total_ttc).''.price($totalrecu).''.price($total_ttc - $totalrecu).' 
\n"; + } + $db->free($resql); + } + else + { + dol_print_error($db); + } + } // print ''; print '

'.$langs->trans("ClosePaidInvoicesAutomatically"); From a22d39adfb789fd54b6cfcca3779ff85705cc10d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 27 Mar 2013 14:11:15 +0100 Subject: [PATCH 035/194] Fix: Hook is a replaceadd hook. --- htdocs/core/class/hookmanager.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index 9154aaa2fdd..72b49af418e 100755 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -131,7 +131,7 @@ class HookManager // Define type of hook ('output', 'returnvalue' or 'addreplace') $hooktype='output'; if (preg_match('/^pdf_/',$method)) $hooktype='returnvalue'; // pdf_xxx except pdf_writelinedesc are returnvalue hooks. When there is 2 hooks of this type, only last one win. - if ($method == 'doActions' || $method == 'formObjectOptions' || $method == 'pdf_writelinedesc') $hooktype='addreplace'; + if (in_array($method,array('doActions','formObjectOptions','pdf_writelinedesc','paymentsupplierinvoices'))) $hooktype='addreplace'; // Loop on each hook to qualify modules that declared context $modulealreadyexecuted=array(); @@ -150,7 +150,7 @@ class HookManager // test to avoid to run twice a hook, when a module implements several active contexts if (in_array($module,$modulealreadyexecuted)) continue; $modulealreadyexecuted[$module]=$module; - // Hooks that return int + // Hooks that return int (doActions, formObjectOptions, pdf_writelinedesc, paymentsupplierinvoices) if ($hooktype == 'addreplace') { $resaction += $actionclassinstance->$method($parameters, $object, $action, $this); // $object and $action can be changed by method ($object->id during creation for example or $action to go back to other action for example) @@ -159,7 +159,7 @@ class HookManager $error++; $this->error=$actionclassinstance->error; $this->errors=array_merge($this->errors, (array) $actionclassinstance->errors); - // TODO remove this. Change must be inside the method if required + // TODO remove this. Change must be inside the method of hook if required if ($method == 'doActions') { if ($action=='add') $action='create'; @@ -170,7 +170,7 @@ class HookManager // Generic hooks that return a string (printSearchForm, printLeftBlock, printTopRightMenu, formAddObjectLine, formBuilddocOptions, ...) else { - // TODO. this should be done into the method by returning nothing + // TODO. this should be done into the method of hook by returning nothing if (is_array($parameters) && ! empty($parameters['special_code']) && $parameters['special_code'] > 3 && $parameters['special_code'] != $actionclassinstance->module_number) continue; $result = $actionclassinstance->$method($parameters, $object, $action, $this); // $object and $action can be changed by method ($object->id during creation for example or $action to go back to other action for example) From 6c1bbd3aebed5e0121c4b484dfadefb593956de0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 27 Mar 2013 14:24:33 +0100 Subject: [PATCH 036/194] New: Uniformize hooks. --- htdocs/fourn/facture/fiche.php | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index b726d39231a..b8b4c209cb3 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -749,7 +749,7 @@ if ($action == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_P { $mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)); // Must not contain " setEventMessage($mesg); - + $error=0; // Initialisation donnees @@ -1177,7 +1177,8 @@ if ($action == 'create') if (1==2 && ! empty($conf->global->PRODUCT_SHOW_WHEN_CREATE)) { print ''; - print ' '.$langs->trans('Label').''; + print ' '; + print ''.$langs->trans('Label').''; print ''.$langs->trans('PriceUHT').''; print ''.$langs->trans('VAT').''; print ''.$langs->trans('Qty').''; @@ -1201,7 +1202,7 @@ if ($action == 'create') } // Other options - $parameters=array(); + $parameters=array('colspan' => ' colspan="6"'); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook // Bouton "Create Draft" @@ -1571,7 +1572,7 @@ else } // Other options - $parameters=array('colspan' => ' colspan="3"'); + $parameters=array('colspan' => ' colspan="4"'); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook print ''; @@ -1736,6 +1737,12 @@ else // Show range print_date_range($date_start,$date_end); } + + if (is_object($hookmanager)) + { + $parameters=array('fk_parent_line'=>$line->fk_parent_line, 'line'=>$object->lines[$i],'var'=>$var,'num'=>$num,'i'=>$i); + $reshook=$hookmanager->executeHooks('formViewProductSupplierOptions',$parameters,$object,$action); + } print ''; // VAT @@ -1808,7 +1815,7 @@ else if (is_object($hookmanager)) { $parameters=array(); - $reshook=$hookmanager->executeHooks('formCreateProductOptions',$parameters,$object,$action); + $reshook=$hookmanager->executeHooks('formCreateSupplierProductOptions',$parameters,$object,$action); } // Editor wysiwyg @@ -2036,7 +2043,7 @@ else * Show mail form */ if ($action == 'presend') - { + { $ref = dol_sanitizeFileName($object->ref); include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $fileparams = dol_most_recent_file($conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2).$ref, preg_quote($object->ref,'/')); @@ -2092,12 +2099,12 @@ else $formmail->substit['__SIGNATURE__']=$user->signature; $formmail->substit['__PERSONALIZED__']=''; $formmail->substit['__CONTACTCIVNAME__']=''; - + //Find the good contact adress $custcontact=''; $contactarr=array(); $contactarr=$object->liste_contact(-1,'external'); - + if (is_array($contactarr) && count($contactarr)>0) { foreach($contactarr as $contact) { if ($contact['libelle']==$langs->trans('TypeContact_invoice_supplier_external_BILLING')) { @@ -2107,12 +2114,12 @@ else $custcontact=$contactstatic->getFullName($langs,1); } } - + if (!empty($custcontact)) { $formmail->substit['__CONTACTCIVNAME__']=$custcontact; } } - + // Tableau des parametres complementaires $formmail->param['action']='send'; $formmail->param['models']='invoice_supplier_send'; From 47b6829e177e6228924d858159f87bbc0569b347 Mon Sep 17 00:00:00 2001 From: jfefe Date: Wed, 27 Mar 2013 14:39:41 +0100 Subject: [PATCH 037/194] Remove DOS EOF (dos2unix utility used) --- htdocs/comm/propal.php | 4540 ++++++++++++++++++++-------------------- 1 file changed, 2270 insertions(+), 2270 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index de1a87ffe7e..c3a908fcea4 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -1,2250 +1,2250 @@ - - * Copyright (C) 2004-2013 Laurent Destailleur - * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2005 Marc Barilley / Ocebo - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2006 Andre Cianfarani - * Copyright (C) 2010-2013 Juanjo Menent - * Copyright (C) 2010-2011 Philippe Grand - * Copyright (C) 2012 Christophe Battarel -* - * 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/comm/propal.php - * \ingroup propale - * \brief Page of commercial proposals card and list - */ - -require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formpropal.class.php'; -require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; -require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/modules/propale/modules_propale.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; -if (! empty($conf->projet->enabled)) -{ - require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; - require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; -} - -$langs->load('companies'); -$langs->load('propal'); -$langs->load('compta'); -$langs->load('bills'); -$langs->load('orders'); -$langs->load('products'); -$langs->load("deliveries"); -if (! empty($conf->margin->enabled)) - $langs->load('margins'); - -$error=0; - -$id=GETPOST('id','int'); -$ref=GETPOST('ref','alpha'); -$socid=GETPOST('socid','int'); -$action=GETPOST('action','alpha'); -$origin=GETPOST('origin','alpha'); -$originid=GETPOST('originid','int'); -$confirm=GETPOST('confirm','alpha'); -$lineid=GETPOST('lineid','int'); - -//PDF -$hidedetails = (GETPOST('hidedetails','int') ? GETPOST('hidedetails','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0)); -$hidedesc = (GETPOST('hidedesc','int') ? GETPOST('hidedesc','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0)); -$hideref = (GETPOST('hideref','int') ? GETPOST('hideref','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0)); - -// Nombre de ligne pour choix de produit/service predefinis -$NBLINES=4; - -// Security check -if (! empty($user->societe_id)) $socid=$user->societe_id; -$result = restrictedArea($user, 'propal', $id); - -$object = new Propal($db); -$extrafields = new ExtraFields($db); - -// Load object -if ($id > 0 || ! empty($ref)) -{ - $ret=$object->fetch($id, $ref); - if ($ret > 0) $ret=$object->fetch_thirdparty(); - if ($ret < 0) dol_print_error('',$object->error); -} - -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array -$hookmanager->initHooks(array('propalcard')); - - - -/* - * Actions - */ - -$parameters=array('socid'=>$socid); -$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks - -// Action clone object -if ($action == 'confirm_clone' && $confirm == 'yes') -{ - if (1==0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers')) - { - setEventMessage($langs->trans("NoCloneOptionsSpecified"), 'errors'); - } - else - { - if ($object->id > 0) - { - $result=$object->createFromClone($socid); - if ($result > 0) - { - header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result); - exit; - } - else - { - setEventMessage($object->error, 'errors'); - $action=''; - } - } - } -} - -// Suppression de la propale -else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->propal->supprimer) -{ - $result=$object->delete($user); - if ($result > 0) - { - header('Location: '.DOL_URL_ROOT.'/comm/propal/list.php'); - exit; - } - else - { - $langs->load("errors"); - setEventMessage($langs->trans($object->error), 'errors'); - } -} - -// Remove line -else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->propal->creer) -{ - $result = $object->deleteline($lineid); - // reorder lines - if ($result) $object->line_order(true); - - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) - { - // Define output language - $outputlangs = $langs; - if (! empty($conf->global->MAIN_MULTILANGS)) - { - $outputlangs = new Translate("",$conf); - $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); - $outputlangs->setDefaultLang($newlang); - } - $ret=$object->fetch($id); // Reload to get new records - propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); - } - - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); - exit; -} - -// Validation -else if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->propal->valider) -{ - $result=$object->valid($user); - if ($result >= 0) - { - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) - { - // Define output language - $outputlangs = $langs; - if (! empty($conf->global->MAIN_MULTILANGS)) - { - $outputlangs = new Translate("",$conf); - $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); - $outputlangs->setDefaultLang($newlang); - } - $ret=$object->fetch($id); // Reload to get new records - propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); - } - } - else - { - $langs->load("errors"); - setEventMessage($langs->trans($object->error), 'errors'); - } -} - -else if ($action == 'setdate' && $user->rights->propal->creer) -{ - $datep=dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); - - if (empty($datep)) - { - $error++; - setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")), 'errors'); - } - - if (! $error) - { - $result=$object->set_date($user,$datep); - if ($result < 0) dol_print_error($db,$object->error); - } -} -else if ($action == 'setecheance' && $user->rights->propal->creer) -{ - $result=$object->set_echeance($user,dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear'])); - if ($result < 0) dol_print_error($db,$object->error); -} -else if ($action == 'setdate_livraison' && $user->rights->propal->creer) -{ - $result=$object->set_date_livraison($user,dol_mktime(12, 0, 0, $_POST['liv_month'], $_POST['liv_day'], $_POST['liv_year'])); - if ($result < 0) dol_print_error($db,$object->error); -} - -// Positionne ref client -else if ($action == 'set_ref_client' && $user->rights->propal->creer) -{ - $object->set_ref_client($user, $_POST['ref_client']); -} - -else if ($action == 'setnote_public' && $user->rights->propal->creer) -{ - $result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES)); - if ($result < 0) dol_print_error($db,$object->error); -} - -else if ($action == 'setnote' && $user->rights->propal->creer) -{ - $result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES)); - if ($result < 0) dol_print_error($db,$object->error); -} - -// Create proposal -else if ($action == 'add' && $user->rights->propal->creer) -{ - $object->socid=$socid; - $object->fetch_thirdparty(); - - $datep=dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); - $date_delivery=dol_mktime(12, 0, 0, GETPOST('liv_month'), GETPOST('liv_day'), GETPOST('liv_year')); - $duration=GETPOST('duree_validite'); - - if (empty($datep)) - { - setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")), 'errors'); - $action='create'; - $error++; - } - if (empty($duration)) - { - setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("ValidityDuration")), 'errors'); - $action='create'; - $error++; - } - - if ($socid<1) - { - setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Customer")),'errors'); - $action='create'; - $error++; - } - - if (! $error) - { - $db->begin(); - - // Si on a selectionne une propal a copier, on realise la copie - if (GETPOST('createmode')=='copy' && GETPOST('copie_propal')) - { - if ($object->fetch(GETPOST('copie_propal')) > 0) - { - $object->ref = GETPOST('ref'); - $object->datep = $datep; - $object->date_livraison = $date_delivery; - $object->availability_id = GETPOST('availability_id'); - $object->demand_reason_id = GETPOST('demand_reason_id'); - $object->fk_delivery_address = GETPOST('fk_address'); - $object->duree_validite = $duration; - $object->cond_reglement_id = GETPOST('cond_reglement_id'); - $object->mode_reglement_id = GETPOST('mode_reglement_id'); - $object->remise_percent = GETPOST('remise_percent'); - $object->remise_absolue = GETPOST('remise_absolue'); - $object->socid = GETPOST('socid'); - $object->contactid = GETPOST('contactidp'); - $object->fk_project = GETPOST('projectid'); - $object->modelpdf = GETPOST('model'); - $object->author = $user->id; // deprecated - $object->note = GETPOST('note'); - $object->statut = 0; - - $id = $object->create_from($user); - } - else - { - setEventMessage($langs->trans("ErrorFailedToCopyProposal",GETPOST('copie_propal')), 'errors'); - } - } - else - { - $object->ref = GETPOST('ref'); - $object->ref_client = GETPOST('ref_client'); - $object->datep = $datep; - $object->date_livraison = $date_delivery; - $object->availability_id = GETPOST('availability_id'); - $object->demand_reason_id = GETPOST('demand_reason_id'); - $object->fk_delivery_address = GETPOST('fk_address'); - $object->duree_validite = GETPOST('duree_validite'); - $object->cond_reglement_id = GETPOST('cond_reglement_id'); - $object->mode_reglement_id = GETPOST('mode_reglement_id'); - - $object->contactid = GETPOST('contactidp'); - $object->fk_project = GETPOST('projectid'); - $object->modelpdf = GETPOST('model'); - $object->author = $user->id; // deprecated - $object->note = GETPOST('note'); - - $object->origin = GETPOST('origin'); - $object->origin_id = GETPOST('originid'); - - for ($i = 1 ; $i <= $conf->global->PRODUCT_SHOW_WHEN_CREATE; $i++) - { - if ($_POST['idprod'.$i]) - { - $xid = 'idprod'.$i; - $xqty = 'qty'.$i; - $xremise = 'remise'.$i; - $object->add_product($_POST[$xid],$_POST[$xqty],$_POST[$xremise]); - } - } - - // Get extra fields - foreach($_POST as $key => $value) - { - if (preg_match("/^options_/",$key)) - { - $object->array_options[$key]=GETPOST($key); - } - } - - $id = $object->create($user); - } - - if ($id > 0) - { - // Insertion contact par defaut si defini - if (GETPOST('contactidp')) - { - $result=$object->add_contact(GETPOST('contactidp'),'CUSTOMER','external'); - if ($result < 0) - { - $error++; - setEventMessage($langs->trans("ErrorFailedToAddContact"), 'errors'); - } - } - - if (! $error) - { - $db->commit(); - - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) - { - // Define output language - $outputlangs = $langs; - if (! empty($conf->global->MAIN_MULTILANGS)) - { - $outputlangs = new Translate("",$conf); - $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); - $outputlangs->setDefaultLang($newlang); - } - $ret=$object->fetch($id); // Reload to get new records - propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); - } - - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); - exit; - } - else - { - $db->rollback(); - } - } - else - { - dol_print_error($db,$object->error); - $db->rollback(); - exit; - } - } -} - -// Classify billed -else if ($action == 'classifybilled' && $user->rights->propal->cloturer) -{ - $object->cloture($user, 4, ''); -} - -// Reopen proposal -else if ($action == 'confirm_reopen' && $user->rights->propal->cloturer && ! GETPOST('cancel')) -{ - // prevent browser refresh from reopening proposal several times - if ($object->statut==2 || $object->statut==3) - { - $object->setStatut(1); - } -} - -// Close proposal -else if ($action == 'setstatut' && $user->rights->propal->cloturer && ! GETPOST('cancel')) -{ - if (! GETPOST('statut')) - { - setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("CloseAs")), 'errors'); - $action='statut'; - } - else - { - // prevent browser refresh from closing proposal several times - if ($object->statut==1) - { - $object->cloture($user, GETPOST('statut'), GETPOST('note')); - } - } -} - -/* - * Add file in email form - */ -if (GETPOST('addfile')) -{ - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - - // Set tmp user directory TODO Use a dedicated directory for temp mails files - $vardir=$conf->user->dir_output."/".$user->id; - $upload_dir_tmp = $vardir.'/temp'; - - dol_add_file_process($upload_dir_tmp,0,0); - $action='presend'; -} - -/* - * Remove file in email form - */ -if (GETPOST('removedfile')) -{ - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - - // Set tmp user directory - $vardir=$conf->user->dir_output."/".$user->id; - $upload_dir_tmp = $vardir.'/temp'; - - // TODO Delete only files that was uploaded from email form - dol_remove_file_process($_POST['removedfile'],0); - $action='presend'; -} - -/* - * Send mail - */ -if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! GETPOST('cancel')) -{ - $langs->load('mails'); - - if ($object->id > 0) - { - if ($_POST['sendto']) - { - // Le destinataire a ete fourni via le champ libre - $sendto = $_POST['sendto']; - $sendtoid = 0; - } - elseif ($_POST['receiver'] != '-1') - { - // Recipient was provided from combo list - if ($_POST['receiver'] == 'thirdparty') // Id of third party - { - $sendto = $object->client->email; - $sendtoid = 0; - } - else // Id du contact - { - $sendto = $object->client->contact_get_property($_POST['receiver'],'email'); - $sendtoid = $_POST['receiver']; - } - } - - if (dol_strlen($sendto)) - { - $langs->load("commercial"); - - $from = $_POST['fromname'] . ' <' . $_POST['frommail'] .'>'; - $replyto = $_POST['replytoname']. ' <' . $_POST['replytomail'].'>'; - $message = $_POST['message']; - $sendtocc = $_POST['sendtocc']; - $deliveryreceipt = $_POST['deliveryreceipt']; - - if (dol_strlen($_POST['subject'])) $subject = $_POST['subject']; - else $subject = $langs->transnoentities('Propal').' '.$object->ref; - $actiontypecode='AC_PROP'; - $actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n"; - if ($message) - { - $actionmsg.=$langs->transnoentities('MailTopic').": ".$subject."\n"; - $actionmsg.=$langs->transnoentities('TextUsedInTheMessageBody').":\n"; - $actionmsg.=$message; - } - $actionmsg2=$langs->transnoentities('Action'.$actiontypecode); - - // Create form object - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; - $formmail = new FormMail($db); - - $attachedfiles=$formmail->get_attached_files(); - $filepath = $attachedfiles['paths']; - $filename = $attachedfiles['names']; - $mimetype = $attachedfiles['mimes']; - - // Envoi de la propal - require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,'',$deliveryreceipt,-1); - if ($mailfile->error) - { - setEventMessage($mailfile->error, 'errors'); - } - else - { - $result=$mailfile->sendfile(); - if ($result) - { - // Initialisation donnees - $object->sendtoid = $sendtoid; - $object->actiontypecode = $actiontypecode; - $object->actionmsg = $actionmsg; - $object->actionmsg2 = $actionmsg2; - $object->fk_element = $object->id; - $object->elementtype = $object->element; - - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($db); - $result=$interface->run_triggers('PROPAL_SENTBYMAIL',$object,$user,$langs,$conf); - if ($result < 0) { - $error++; $this->errors=$interface->errors; - } - // Fin appel triggers - - if (! $error) - { - // Redirect here - // This avoid sending mail twice if going out and then back to page - $mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)); - setEventMessage($mesg); - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); - exit; - } - else - { - dol_print_error($db); - } - } - else - { - $langs->load("other"); - if ($mailfile->error) - { - $mesg.=$langs->trans('ErrorFailedToSendMail',$from,$sendto); - $mesg.='
'.$mailfile->error; - } - else - { - $mesg.='No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS'; - } - setEventMessage($mesg, 'errors'); - } - } - } - else - { - $langs->load("other"); - setEventMessage($langs->trans('ErrorMailRecipientIsEmpty').'!', 'errors'); - dol_syslog($langs->trans('ErrorMailRecipientIsEmpty')); - } - } - else - { - $langs->load("other"); - setEventMessage($langs->trans('ErrorFailedToReadEntity',$langs->trans("Proposal")), 'errors'); - dol_syslog($langs->trans('ErrorFailedToReadEntity',$langs->trans("Proposal"))); - } -} - -// Go back to draft -if ($action == 'modif' && $user->rights->propal->creer) -{ - $object->set_draft($user); - - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) - { - // Define output language - $outputlangs = $langs; - if (! empty($conf->global->MAIN_MULTILANGS)) - { - $outputlangs = new Translate("",$conf); - $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); - $outputlangs->setDefaultLang($newlang); - } - $ret=$object->fetch($id); // Reload to get new records - propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); - } -} - -else if ($action == "setabsolutediscount" && $user->rights->propal->creer) -{ - if ($_POST["remise_id"]) - { - if ($object->id > 0) - { - $result=$object->insert_discount($_POST["remise_id"]); - if ($result < 0) - { - setEventMessage($object->error, 'errors'); - } - } - } -} - -//Ajout d'une ligne produit dans la propale -else if ($action == "addline" && $user->rights->propal->creer) -{ - $idprod=GETPOST('idprod', 'int'); - $product_desc = (GETPOST('product_desc')?GETPOST('product_desc'):(GETPOST('np_desc')?GETPOST('np_desc'):(GETPOST('dp_desc')?GETPOST('dp_desc'):''))); - $price_ht = GETPOST('price_ht'); - $tva_tx = (GETPOST('tva_tx')?GETPOST('tva_tx'):0); - - if (empty($idprod) && GETPOST('type') < 0) - { - setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")), 'errors'); - $error++; - } - if ((empty($idprod) || GETPOST('usenewaddlineform')) && (!($price_ht != 0) || $price_ht == '')) // Unit price can be 0 but not ''. Also price can be negative for proposal. - { - setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("UnitPriceHT")), 'errors'); - $error++; - } - if (empty($idprod) && empty($product_desc)) - { - setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Description")), 'errors'); - $error++; - } - - if (! $error && (GETPOST('qty') >= 0) && (! empty($product_desc) || ! empty($idprod))) - { - $pu_ht=0; - $pu_ttc=0; - $price_min=0; - $price_base_type = (GETPOST('price_base_type', 'alpha')?GETPOST('price_base_type', 'alpha'):'HT'); - - // Ecrase $pu par celui du produit - // Ecrase $desc par celui du produit - // Ecrase $txtva par celui du produit - if (! empty($idprod)) - { - $prod = new Product($db); - $prod->fetch($idprod); - - $label = ((GETPOST('product_label') && GETPOST('product_label')!=$prod->label)?GETPOST('product_label'):''); - - // If prices fields are update - if (GETPOST('usenewaddlineform')) - { - $pu_ht=price2num($price_ht, 'MU'); - $pu_ttc=price2num(GETPOST('price_ttc'), 'MU'); - $tva_npr=(preg_match('/\*/', $tva_tx)?1:0); - $tva_tx=str_replace('*','', $tva_tx); - $desc = $product_desc; - } - else - { - $tva_tx = get_default_tva($mysoc,$object->client,$prod->id); - $tva_npr = get_default_npr($mysoc,$object->client,$prod->id); - - // On defini prix unitaire - if (! empty($conf->global->PRODUIT_MULTIPRICES) && $object->client->price_level) - { - $pu_ht = $prod->multiprices[$object->client->price_level]; - $pu_ttc = $prod->multiprices_ttc[$object->client->price_level]; - $price_min = $prod->multiprices_min[$object->client->price_level]; - $price_base_type = $prod->multiprices_base_type[$object->client->price_level]; - } - else - { - $pu_ht = $prod->price; - $pu_ttc = $prod->price_ttc; - $price_min = $prod->price_min; - $price_base_type = $prod->price_base_type; - } - - // On reevalue prix selon taux tva car taux tva transaction peut etre different - // de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur). - if ($tva_tx != $prod->tva_tx) - { - if ($price_base_type != 'HT') - { - $pu_ht = price2num($pu_ttc / (1 + ($tva_tx/100)), 'MU'); - } - else - { - $pu_ttc = price2num($pu_ht * (1 + ($tva_tx/100)), 'MU'); - } - } - - $desc=''; - - // Define output language - if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) - { - $outputlangs = $langs; - $newlang=''; - if (empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id'); - if (empty($newlang)) $newlang=$object->client->default_lang; - if (! empty($newlang)) - { - $outputlangs = new Translate("",$conf); - $outputlangs->setDefaultLang($newlang); - } - - $desc = (! empty($prod->multilangs[$outputlangs->defaultlang]["description"])) ? $prod->multilangs[$outputlangs->defaultlang]["description"] : $prod->description; - } - else - { - $desc = $prod->description; - } - - $desc=dol_concatdesc($desc,$product_desc); - - // Add custom code and origin country into description - if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code))) - { - $tmptxt='('; - if (! empty($prod->customcode)) $tmptxt.=$langs->transnoentitiesnoconv("CustomCode").': '.$prod->customcode; - if (! empty($prod->customcode) && ! empty($prod->country_code)) $tmptxt.=' - '; - if (! empty($prod->country_code)) $tmptxt.=$langs->transnoentitiesnoconv("CountryOrigin").': '.getCountry($prod->country_code,0,$db,$langs,0); - $tmptxt.=')'; - $desc= dol_concatdesc($desc, $tmptxt); - } - } - - $type = $prod->type; - } - else - { - $pu_ht = price2num($price_ht, 'MU'); - $pu_ttc = price2num(GETPOST('price_ttc'), 'MU'); - $tva_npr = (preg_match('/\*/', $tva_tx)?1:0); - $tva_tx = str_replace('*', '', $tva_tx); - $label = (GETPOST('product_label')?GETPOST('product_label'):''); - $desc = $product_desc; - $type = GETPOST('type'); - } - - // Margin - $fournprice=(GETPOST('fournprice')?GETPOST('fournprice'):''); - $buyingprice=(GETPOST('buying_price')?GETPOST('buying_price'):''); - - // Local Taxes - $localtax1_tx= get_localtax($tva_tx, 1, $object->client); - $localtax2_tx= get_localtax($tva_tx, 2, $object->client); - - $info_bits=0; - if ($tva_npr) $info_bits |= 0x01; - - if (! empty($price_min) && (price2num($pu_ht)*(1-price2num(GETPOST('remise_percent'))/100) < price2num($price_min))) - { - $mesg = $langs->trans("CantBeLessThanMinPrice",price2num($price_min,'MU').$langs->getCurrencySymbol($conf->currency)); - setEventMessage($mesg, 'errors'); - } - else - { - // Insert line - $result=$object->addline( - $id, - $desc, - $pu_ht, - GETPOST('qty'), - $tva_tx, - $localtax1_tx, - $localtax2_tx, - $idprod, - GETPOST('remise_percent'), - $price_base_type, - $pu_ttc, - $info_bits, - $type, - -1, - 0, - GETPOST('fk_parent_line'), - $fournprice, - $buyingprice, - $label - ); - - if ($result > 0) - { - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) - { - // Define output language - $outputlangs = $langs; - if (! empty($conf->global->MAIN_MULTILANGS)) - { - $outputlangs = new Translate("",$conf); - $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); - $outputlangs->setDefaultLang($newlang); - } - $ret=$object->fetch($id); // Reload to get new records - propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); - } - - unset($_POST['qty']); - unset($_POST['type']); - unset($_POST['idprod']); - unset($_POST['remise_percent']); - unset($_POST['price_ht']); - unset($_POST['price_ttc']); - unset($_POST['tva_tx']); - unset($_POST['product_ref']); - unset($_POST['product_label']); - unset($_POST['product_desc']); - unset($_POST['fournprice']); - unset($_POST['buying_price']); - - // old method - unset($_POST['np_desc']); - unset($_POST['dp_desc']); - } - else - { - setEventMessage($object->error, 'errors'); - } - } - } -} - -// Mise a jour d'une ligne dans la propale -else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('save') == $langs->trans("Save")) -{ - // Define info_bits - $info_bits=0; - if (preg_match('/\*/', GETPOST('tva_tx'))) $info_bits |= 0x01; - - // Clean parameters - $description=dol_htmlcleanlastbr(GETPOST('product_desc')); - - // Define vat_rate - $vat_rate=(GETPOST('tva_tx')?GETPOST('tva_tx'):0); - $vat_rate=str_replace('*','',$vat_rate); - $localtax1_rate=get_localtax($vat_rate,1,$object->client); - $localtax2_rate=get_localtax($vat_rate,2,$object->client); - $pu_ht=GETPOST('price_ht'); - - // Add buying price - $fournprice=(GETPOST('fournprice')?GETPOST('fournprice'):''); - $buyingprice=(GETPOST('buying_price')?GETPOST('buying_price'):''); - - // Define special_code for special lines - $special_code=0; - if (! GETPOST('qty')) $special_code=3; - - // Check minimum price - $productid = GETPOST('productid', 'int'); - if (! empty($productid)) - { - $product = new Product($db); - $res=$product->fetch($productid); - - $type=$product->type; - - $price_min = $product->price_min; - if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($object->client->price_level)) - $price_min = $product->multiprices_min[$object->client->price_level]; - - $label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label'):''); - - if ($price_min && (price2num($pu_ht)*(1-price2num(GETPOST('remise_percent'))/100) < price2num($price_min))) - { - setEventMessage($langs->trans("CantBeLessThanMinPrice", price2num($price_min,'MU')).$langs->getCurrencySymbol($conf->currency), 'errors'); - $error++; - } - } - else - { - $type = GETPOST('type'); - $label = (GETPOST('product_label') ? GETPOST('product_label'):''); - - // Check parameters - if (GETPOST('type') < 0) { - setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")), 'errors'); - $error++; - } - } - - if (! $error) - { - $result = $object->updateline( - GETPOST('lineid'), - $pu_ht, - GETPOST('qty'), - GETPOST('remise_percent'), - $vat_rate, - $localtax1_rate, - $localtax2_rate, - $description, - 'HT', - $info_bits, - $special_code, - GETPOST('fk_parent_line'), - 0, - $fournprice, - $buyingprice, - $label, - $type - ); - - if ($result >= 0) - { - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) - { - // Define output language - $outputlangs = $langs; - if (! empty($conf->global->MAIN_MULTILANGS)) - { - $outputlangs = new Translate("",$conf); - $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); - $outputlangs->setDefaultLang($newlang); - } - $ret=$object->fetch($id); // Reload to get new records - propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); - } - - unset($_POST['qty']); - unset($_POST['type']); - unset($_POST['productid']); - unset($_POST['remise_percent']); - unset($_POST['price_ht']); - unset($_POST['price_ttc']); - unset($_POST['tva_tx']); - unset($_POST['product_ref']); - unset($_POST['product_label']); - unset($_POST['product_desc']); - unset($_POST['fournprice']); - unset($_POST['buying_price']); - } - else - { - setEventMessage($object->error, 'errors'); - } - } -} - -else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('cancel') == $langs->trans('Cancel')) -{ - header('Location: '.$_SERVER['PHP_SELF'].'?id='.$object->id); // Pour reaffichage de la fiche en cours d'edition - exit; -} - -// Generation doc (depuis lien ou depuis cartouche doc) -else if ($action == 'builddoc' && $user->rights->propal->creer) -{ - if (GETPOST('model')) - { - $object->setDocModel($user, GETPOST('model')); - } - - // Define output language - $outputlangs = $langs; - if (! empty($conf->global->MAIN_MULTILANGS)) - { - $outputlangs = new Translate("",$conf); - $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); - $outputlangs->setDefaultLang($newlang); - } - $ret=$object->fetch($id); // Reload to get new records - $result=propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); - - if ($result <= 0) - { - dol_print_error($db,$result); - exit; - } - else - { - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.(empty($conf->global->MAIN_JUMP_TAG)?'':'#builddoc')); - exit; - } -} - -// Remove file in doc form -else if ($action == 'remove_file' && $user->rights->propal->creer) -{ - if ($object->id > 0) - { - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - - $langs->load("other"); - $upload_dir = $conf->propal->dir_output; - $file = $upload_dir . '/' . GETPOST('file'); - $ret=dol_delete_file($file,0,0,0,$object); - if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('file'))); - else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), 'errors'); - } -} - -// Set project -else if ($action == 'classin' && $user->rights->propal->creer) -{ - $object->setProject($_POST['projectid']); -} - -// Delai de livraison -else if ($action == 'setavailability' && $user->rights->propal->creer) -{ - $result = $object->availability($_POST['availability_id']); -} - -// Origine de la propale -else if ($action == 'setdemandreason' && $user->rights->propal->creer) -{ - $result = $object->demand_reason($_POST['demand_reason_id']); -} - -// Conditions de reglement -else if ($action == 'setconditions' && $user->rights->propal->creer) -{ - $result = $object->setPaymentTerms(GETPOST('cond_reglement_id','int')); -} - -else if ($action == 'setremisepercent' && $user->rights->propal->creer) -{ - $result = $object->set_remise_percent($user, $_POST['remise_percent']); -} - -else if ($action == 'setremiseabsolue' && $user->rights->propal->creer) -{ - $result = $object->set_remise_absolue($user, $_POST['remise_absolue']); -} - -// Mode de reglement -else if ($action == 'setmode' && $user->rights->propal->creer) -{ - $result = $object->setPaymentMethods(GETPOST('mode_reglement_id','int')); -} - -/* - * Ordonnancement des lignes - */ - -else if ($action == 'up' && $user->rights->propal->creer) -{ - $object->line_up(GETPOST('rowid')); - - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) - { - // Define output language - $outputlangs = $langs; - if (! empty($conf->global->MAIN_MULTILANGS)) - { - $outputlangs = new Translate("",$conf); - $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); - $outputlangs->setDefaultLang($newlang); - } - $ret=$object->fetch($id); // Reload to get new records - propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); - } - - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id.'#'.GETPOST('rowid')); - exit; -} - -else if ($action == 'down' && $user->rights->propal->creer) -{ - $object->line_down(GETPOST('rowid')); - - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) - { - // Define output language - $outputlangs = $langs; - if (! empty($conf->global->MAIN_MULTILANGS)) - { - $outputlangs = new Translate("",$conf); - $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); - $outputlangs->setDefaultLang($newlang); - } - $ret=$object->fetch($id); // Reload to get new records - propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); - } - - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id.'#'.GETPOST('rowid')); - exit; -} -else if ($action == 'update_extras') -{ - // Get extra fields - foreach($_POST as $key => $value) - { - if (preg_match("/^options_/",$key)) - { - $object->array_options[$key]=$_POST[$key]; - } - } - // Actions on extra fields (by external module or standard code) - // FIXME le hook fait double emploi avec le trigger !! - $hookmanager->initHooks(array('propaldao')); - $parameters=array('id'=>$object->id); - $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$object,$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=$object->insertExtraFields(); - if ($result < 0) - { - $error++; - } - } - } - else if ($reshook < 0) $error++; - -} - -if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->propal->creer) -{ - if ($action == 'addcontact') - { - if ($object->id > 0) - { - $contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid')); - $result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]); - } - - if ($result >= 0) - { - header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); - exit; - } - else - { - if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') - { - $langs->load("errors"); - setEventMessage($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), 'errors'); - } - else - { - setEventMessage($object->error, 'errors'); - } - } - } - - // Bascule du statut d'un contact - else if ($action == 'swapstatut') - { - if ($object->fetch($id) > 0) - { - $result=$object->swapContactStatus(GETPOST('ligne')); - } - else - { - dol_print_error($db); - } - } - - // Efface un contact - else if ($action == 'deletecontact') - { - $object->fetch($id); - $result = $object->delete_contact($lineid); - - if ($result >= 0) - { - header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); - exit; - } - else - { - dol_print_error($db); - } - } -} - - -/* - * View - */ - -llxHeader('',$langs->trans('Proposal'),'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos'); - -$form = new Form($db); -$formother = new FormOther($db); -$formfile = new FormFile($db); -$formpropal = new FormPropal($db); -$companystatic=new Societe($db); - -// fetch optionals attributes and labels -$extralabels=$extrafields->fetch_name_optionals_label('propal'); - -$now=dol_now(); - -// Add new proposal -if ($action == 'create') -{ - print_fiche_titre($langs->trans("NewProp")); - - $soc = new Societe($db); - if ($socid>0) $res=$soc->fetch($socid); - - $object = new Propal($db); - - print ''; - print ''; - print ''; - - if ($origin != 'project' && $originid) - { - print ''; - print ''; - } - - print ''; - - // Reference - print ''; - - // Ref customer - print ''; - print ''; - - // Third party - print ''; - print ''; - if($socid>0) - { - print ''; - } - else - { - print ''; - } - print ''."\n"; - - // Contacts - if($socid>0) - { - print "'; - - // Ligne info remises tiers - print ''; - } - - // Date - print ''; - - // Validaty duration - print ''; - - // Terms of payment - print ''; - - // Mode of payment - print ''; - - // What trigger creation - print ''; - - // Delivery delay - print ''; - - // Delivery date (or manufacturing) - print ''; - print ''; - - // Model - print ''; - print ''; - print '"; - - // Project - if (! empty($conf->projet->enabled) && $socid>0) - { - $projectid = 0; - if ($origin == 'project') $projectid = ($originid?$originid:0); - - print ''; - print ''; - print ''; - } - - // Other attributes - $parameters=array('colspan' => ' colspan="3"'); - $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook - if (empty($reshook) && ! empty($extrafields->attribute_label)) - { - foreach($extrafields->attribute_label as $key=>$label) - { - $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); - - // Show separator only - if ($extrafields->attribute_type[$key] == 'separate') - { - print $extrafields->showSeparator($key); - } - else - { - print 'attribute_required[$key])) print ' class="fieldrequired"'; - print '>'.$label.''."\n"; - } - } - } - - print "
'.$langs->trans('Ref').''.$langs->trans("Draft").'
'.$langs->trans('RefCustomer').''; - print '
'.$langs->trans('Customer').''; - print $soc->getNomUrl(1); - print ''; - print ''; - print $form->select_company('','socid','s.client = 1 OR s.client = 2 OR s.client = 3',1); - print '
".$langs->trans("DefaultContact").''; - $form->select_contacts($soc->id,$setcontact,'contactidp',1,$srccontactslist); - print '
'.$langs->trans('Discounts').''; - if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client); - else print $langs->trans("CompanyHasNoRelativeDiscount"); - $absolute_discount=$soc->getAvailableDiscounts(); - print '. '; - if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->trans("Currency".$conf->currency)); - else print $langs->trans("CompanyHasNoAbsoluteDiscount"); - print '.'; - print '
'.$langs->trans('Date').''; - $form->select_date('','','','','',"addprop"); - print '
'.$langs->trans("ValidityDuration").' '.$langs->trans("days").'
'.$langs->trans('PaymentConditionsShort').''; - $form->select_conditions_paiements($soc->cond_reglement,'cond_reglement_id'); - print '
'.$langs->trans('PaymentMode').''; - $form->select_types_paiements($soc->mode_reglement,'mode_reglement_id'); - print '
'.$langs->trans('Source').''; - $form->select_demand_reason('','demand_reason_id',"SRC_PROP",1); - print '
'.$langs->trans('AvailabilityPeriod').''; - $form->select_availability('','availability_id','',1); - print '
'.$langs->trans("DeliveryDate").''; - if ($conf->global->DATE_LIVRAISON_WEEK_DELAY != "") - { - $tmpdte = time() + ((7 * $conf->global->DATE_LIVRAISON_WEEK_DELAY) * 24 * 60 * 60); - $syear = date("Y", $tmpdte); - $smonth = date("m", $tmpdte); - $sday = date("d", $tmpdte); - $form->select_date($syear."-".$smonth."-".$sday,'liv_','','','',"addprop"); - } - else - { - $datepropal=empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0; - $form->select_date($datepropal,'liv_','','','',"addprop"); - } - print '
'.$langs->trans("DefaultModel").''; - $liste=ModelePDFPropales::liste_modeles($db); - print $form->selectarray('model',$liste,$conf->global->PROPALE_ADDON_PDF); - print "
'.$langs->trans("Project").''; - - $numprojet=select_projects($soc->id,$projectid); - if ($numprojet==0) - { - print '   '.$langs->trans("AddProject").''; - } - print '
'; - print $extrafields->showInputField($key,$value); - print '
"; - print '
'; - - /* - * Combobox pour la fonction de copie - */ - - if (empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE)) - { - print ''; - } - - print ''; - if (! empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE)) - { - // For backward compatibility - print ''; - print ''; - print ''; - print ''; - - if (! empty($conf->global->PRODUCT_SHOW_WHEN_CREATE)) print ''; - - print ''; - print ''; - } - - if (! empty($conf->global->PRODUCT_SHOW_WHEN_CREATE)) - { - print ''; - } - print '
'.$langs->trans("CopyPropalFrom").' '; - $liste_propal = array(); - $liste_propal[0] = ''; - - $sql ="SELECT p.rowid as id, p.ref, s.nom"; - $sql.=" FROM ".MAIN_DB_PREFIX."propal p"; - $sql.= ", ".MAIN_DB_PREFIX."societe s"; - $sql.= " WHERE s.rowid = p.fk_soc"; - $sql.= " AND p.entity = ".$conf->entity; - $sql.= " AND p.fk_statut <> 0"; - $sql.= " ORDER BY Id"; - - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; - while ($i < $num) - { - $row = $db->fetch_row($resql); - $propalRefAndSocName = $row[1]." - ".$row[2]; - $liste_propal[$row[0]]=$propalRefAndSocName; - $i++; - } - print $form->selectarray("copie_propal",$liste_propal, 0); - } - else - { - dol_print_error($db); - } - print '
 
'.$langs->trans("CreateEmptyPropal").'
'; - if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) - { - $lib=$langs->trans("ProductsAndServices"); - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - for ($i = 1 ; $i <= $conf->global->PRODUCT_SHOW_WHEN_CREATE; $i++) - { - print ''; - print ''; - print ''; - print ''; - } - - print "
'.$lib.''.$langs->trans("Qty").''.$langs->trans("ReductionShort").'
'; - // multiprix - if($conf->global->PRODUIT_MULTIPRICES && $soc->price_level) - $form->select_produits('',"idprod".$i,'',$conf->product->limit_size,$soc->price_level); - else - $form->select_produits('',"idprod".$i,'',$conf->product->limit_size); - print '%
"; - - } - print '
'; - print '
'; - - $langs->load("bills"); - print '
'; - print ''; - print ' '; - print '
'; - - print ""; -} -else -{ - /* - * Show object in view mode - */ - - $soc = new Societe($db); - $soc->fetch($object->socid); - - $head = propal_prepare_head($object); - dol_fiche_head($head, 'comm', $langs->trans('Proposal'), 0, 'propal'); - - $formconfirm=''; - - // Clone confirmation - if ($action == 'clone') - { - // Create an array for form - $formquestion=array( - //'text' => $langs->trans("ConfirmClone"), - //array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), - //array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), - array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid','int'),'socid','(s.client=1 OR s.client=2 OR s.client=3)')) - ); - // Paiement incomplet. On demande si motif = escompte ou autre - $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans('ClonePropal'),$langs->trans('ConfirmClonePropal',$object->ref),'confirm_clone',$formquestion,'yes',1); - } - - // Confirm delete - else if ($action == 'delete') - { - $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteProp'), $langs->trans('ConfirmDeleteProp',$object->ref), 'confirm_delete','',0,1); - } - - // Confirm reopen - else if ($action == 'reopen') - { - $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ReOpen'), $langs->trans('ConfirmReOpenProp',$object->ref), 'confirm_reopen','',0,1); - } - - // Confirmation delete product/service line - else if ($action == 'ask_deleteline') - { - $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline','',0,1); - } - - // Confirm validate proposal - else if ($action == 'validate') - { - $error=0; - - // on verifie si l'objet est en numerotation provisoire - $ref = substr($object->ref, 1, 4); - if ($ref == 'PROV') - { - $numref = $object->getNextNumRef($soc); - if (empty($numref)) - { - $error++; - dol_htmloutput_errors($object->error); - } - } - else - { - $numref = $object->ref; - } - - $text=$langs->trans('ConfirmValidateProp',$numref); - if (! empty($conf->notification->enabled)) - { - require_once DOL_DOCUMENT_ROOT .'/core/class/notify.class.php'; - $notify=new Notify($db); - $text.='
'; - $text.=$notify->confirmMessage('NOTIFY_VAL_PROPAL',$object->socid); - } - - if (! $error) $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateProp'), $text, 'confirm_validate','',0,1); - } - - if (! $formconfirm) - { - $parameters=array('lineid'=>$lineid); - $formconfirm=$hookmanager->executeHooks('formConfirm',$parameters,$object,$action); // Note that $action and $object may have been modified by hook - } - - // Print form confirm - print $formconfirm; - - - print ''; - - $linkback = ''.$langs->trans("BackToList").''; - - // Ref - print ''; - - // Ref client - print ''; - print ''; - - // Company - print ''; - print ''; - - // Ligne info remises tiers - print ''; - - // Date of proposal - print ''; - print ''; - - // Date end proposal - print ''; - print ''; - print ''; - - // Payment term - print ''; - print ''; - - // Delivery date - $langs->load('deliveries'); - print ''; - print ''; - - // Delivery delay - print ''; - print ''; - - // Origin of demand - print ''; - print ''; - - // Payment mode - print ''; - print ''; - - // Project - if (! empty($conf->projet->enabled)) - { - $langs->load("projects"); - print ''; - } - else - { - print '
'.$langs->trans('Ref').''; - print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', ''); - print '
'; - print ''; - if ($action != 'refclient' && ! empty($object->brouillon)) print ''; - print '
'; - print $langs->trans('RefCustomer').''; - print ''.img_edit($langs->trans('Modify')).'
'; - print '
'; - if ($user->rights->propal->creer && $action == 'refclient') - { - print '
'; - print ''; - print ''; - print ''; - print ' '; - print '
'; - } - else - { - print $object->ref_client; - } - print '
'.$langs->trans('Company').''.$soc->getNomUrl(1).'
'.$langs->trans('Discounts').''; - if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client); - else print $langs->trans("CompanyHasNoRelativeDiscount"); - print '. '; - $absolute_discount=$soc->getAvailableDiscounts('','fk_facture_source IS NULL'); - $absolute_creditnote=$soc->getAvailableDiscounts('','fk_facture_source IS NOT NULL'); - $absolute_discount=price2num($absolute_discount,'MT'); - $absolute_creditnote=price2num($absolute_creditnote,'MT'); - if ($absolute_discount) - { - if ($object->statut > 0) - { - print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->currency)); - } - else - { - // Remise dispo de type non avoir - $filter='fk_facture_source IS NULL'; - print '
'; - $form->form_remise_dispo($_SERVER["PHP_SELF"].'?id='.$object->id,0,'remise_id',$soc->id,$absolute_discount,$filter); - } - } - if ($absolute_creditnote) - { - print $langs->trans("CompanyHasCreditNote",price($absolute_creditnote),$langs->transnoentities("Currency".$conf->currency)).'. '; - } - if (! $absolute_discount && ! $absolute_creditnote) print $langs->trans("CompanyHasNoAbsoluteDiscount").'.'; - print '
'; - print ''; - if ($action != 'editdate' && ! empty($object->brouillon)) print ''; - print '
'; - print $langs->trans('Date'); - print 'id.'">'.img_edit($langs->trans('SetDate'),1).'
'; - print '
'; - if (! empty($object->brouillon) && $action == 'editdate') - { - print '
'; - print ''; - print ''; - $form->select_date($object->date,'re','','',0,"editdate"); - print ''; - print '
'; - } - else - { - if ($object->date) - { - print dol_print_date($object->date,'daytext'); - } - else - { - print ' '; - } - } - print '
'; - print ''; - if ($action != 'editecheance' && ! empty($object->brouillon)) print ''; - print '
'; - print $langs->trans('DateEndPropal'); - print 'id.'">'.img_edit($langs->trans('SetConditions'),1).'
'; - print '
'; - if (! empty($object->brouillon) && $action == 'editecheance') - { - print '
'; - print ''; - print ''; - $form->select_date($object->fin_validite,'ech','','','',"editecheance"); - print ''; - print '
'; - } - else - { - if (! empty($object->fin_validite)) - { - print dol_print_date($object->fin_validite,'daytext'); - if ($object->statut == 1 && $object->fin_validite < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late")); - } - else - { - print ' '; - } - } - print '
'; - print ''; - if ($action != 'editconditions' && ! empty($object->brouillon)) print ''; - print '
'; - print $langs->trans('PaymentConditionsShort'); - print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetConditions'),1).'
'; - print '
'; - if ($action == 'editconditions') - { - $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->cond_reglement_id,'cond_reglement_id'); - } - else - { - $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->cond_reglement_id,'none'); - } - print '
'; - print ''; - if ($action != 'editdate_livraison' && ! empty($object->brouillon)) print ''; - print '
'; - print $langs->trans('DeliveryDate'); - print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetDeliveryDate'),1).'
'; - print '
'; - if ($action == 'editdate_livraison') - { - print '
'; - print ''; - print ''; - $form->select_date($object->date_livraison,'liv_','','','',"editdate_livraison"); - print ''; - print '
'; - } - else - { - print dol_print_date($object->date_livraison,'daytext'); - } - print '
'; - print ''; - if ($action != 'editavailability' && ! empty($object->brouillon)) print ''; - print '
'; - print $langs->trans('AvailabilityPeriod'); - if (! empty($conf->commande->enabled)) print ' ('.$langs->trans('AfterOrder').')'; - print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetAvailability'),1).'
'; - print '
'; - if ($action == 'editavailability') - { - $form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id,$object->availability_id,'availability_id',1); - } - else - { - $form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id,$object->availability_id,'none',1); - } - - print '
'; - print ''; - if ($action != 'editdemandreason' && ! empty($object->brouillon)) print ''; - print '
'; - print $langs->trans('Source'); - print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetDemandReason'),1).'
'; - print '
'; - //print $object->demand_reason_id; - if ($action == 'editdemandreason') - { - $form->form_demand_reason($_SERVER['PHP_SELF'].'?id='.$object->id,$object->demand_reason_id,'demand_reason_id',1); - } - else - { - $form->form_demand_reason($_SERVER['PHP_SELF'].'?id='.$object->id,$object->demand_reason_id,'none'); - } - - print '
'; - print ''; - if ($action != 'editmode' && ! empty($object->brouillon)) print ''; - print '
'; - print $langs->trans('PaymentMode'); - print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMode'),1).'
'; - print '
'; - if ($action == 'editmode') - { - $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->mode_reglement_id,'mode_reglement_id'); - } - else - { - $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->mode_reglement_id,'none'); - } - print '
'; - print ''; - if ($user->rights->propal->creer) - { - if ($action != 'classify') print ''; - print '
'; - print $langs->trans('Project').''.img_edit($langs->transnoentitiesnoconv('SetProject')).'
'; - print '
'; - if ($action == 'classify') - { - $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'projectid'); - } - else - { - $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none'); - } - print '
'; - if (! empty($object->fk_project)) - { - print ''; - $proj = new Project($db); - $proj->fetch($object->fk_project); - print ''; - print $proj->ref; - print ''; - print ''; - } - else { - print ' '; - } - } - print ''; - } - - // Other attributes - $res=$object->fetch_optionals($object->id,$extralabels); - $parameters=array('colspan' => ' colspan="3"'); - $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook - if (empty($reshook) && ! empty($extrafields->attribute_label)) - { - - if ($action == 'edit_extras') - { - print '
'; - print ''; - print ''; - print ''; - } - - - foreach($extrafields->attribute_label as $key=>$label) - { - $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); - if ($extrafields->attribute_type[$key] == 'separate') - { - print $extrafields->showSeparator($key); - } - else - { - print 'attribute_required[$key])) print ' class="fieldrequired"'; - print '>'.$label.''; - if ($action == 'edit_extras' && $user->rights->propal->creer) - { - print $extrafields->showInputField($key,$value); - } - else - { - print $extrafields->showOutputField($key,$value); - } - print ''."\n"; - } - } - - if(count($extrafields->attribute_label) > 0) { - - if ($action == 'edit_extras' && $user->rights->propal->creer) - { - print ''; - print ''; - print ''; - print ''; - - } - else { - if ($object->statut == 0 && $user->rights->propal->creer) - { - print ''.img_picto('','edit').' '.$langs->trans('Modify').''; - } - } - } - } - - // Amount HT - print ''.$langs->trans('AmountHT').''; - print ''.price($object->total_ht).''; - print ''.$langs->trans("Currency".$conf->currency).''; - - // Margin Infos - if (! empty($conf->margin->enabled)) { - print ''; - $object->displayMarginInfos(); - print ''; - } - print ''; - - // Amount VAT - print ''.$langs->trans('AmountVAT').''; - print ''.price($object->total_tva).''; - print ''.$langs->trans("Currency".$conf->currency).''; - - // Amount Local Taxes - if ($mysoc->localtax1_assuj=="1") //Localtax1 - { - print ''.$langs->transcountry("AmountLT1",$mysoc->country_code).''; - print ''.price($object->total_localtax1).''; - print ''.$langs->trans("Currency".$conf->currency).''; - } - if ($mysoc->localtax2_assuj=="1") //Localtax2 - { - print ''.$langs->transcountry("AmountLT2",$mysoc->country_code).''; - print ''.price($object->total_localtax2).''; - print ''.$langs->trans("Currency".$conf->currency).''; - } - - - // Amount TTC - print ''.$langs->trans('AmountTTC').''; - print ''.price($object->total_ttc).''; - print ''.$langs->trans("Currency".$conf->currency).''; - - // Statut - print ''.$langs->trans('Status').''.$object->getLibStatut(4).''; - - print '
'; - - if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) - { - $blocname = 'contacts'; - $title = $langs->trans('ContactsAddresses'); - include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php'; - } - - if (! empty($conf->global->MAIN_DISABLE_NOTES_TAB)) - { - $blocname = 'notes'; - $title = $langs->trans('Notes'); - include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php'; - } - - /* - * Lines - */ - - if (! empty($conf->use_javascript_ajax) && $object->statut == 0) - { - include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; - } - - print ''; - - // Show object lines - $result = $object->getLinesArray(); - if (! empty($object->lines)) - $ret=$object->printObjectLines($action,$mysoc,$soc,$lineid); - - // Form to add new line - if ($object->statut == 0 && $user->rights->propal->creer) - { - if ($action != 'editline') - { - $var=true; - - if ($conf->global->MAIN_FEATURES_LEVEL > 1) - { - // Add free or predefined products/services - $object->formAddObjectLine(0,$mysoc,$soc); - } - else - { - // Add free products/services - $object->formAddFreeProduct(0,$mysoc,$soc); - - // Add predefined products/services - if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) - { - $var=!$var; - $object->formAddPredefinedProduct(0,$mysoc,$soc); - } - } - - $parameters=array(); - $reshook=$hookmanager->executeHooks('formAddObjectLine',$parameters,$object,$action); // Note that $action and $object may have been modified by hook - } - } - - print '
'; - - print ''; - print "\n"; - - if ($action == 'statut') - { - /* - * Formulaire cloture (signe ou non) - */ - $form_close = '
'; - $form_close.= ''; - $form_close.= ''; - $form_close.= ''; - $form_close.= ''; - $form_close.= ''; - $form_close.= '
'.$langs->trans("CloseAs").''; - $form_close.= ''; - $form_close.= ''; - $form_close.= '
'.$langs->trans('Note').'
'; - $form_close.= ''; - $form_close.= '   '; - $form_close.= ' '; - $form_close.= '
'; - - print $form_close; - } - - - /* - * Boutons Actions - */ - if ($action != 'presend') - { - print '
'; - - if ($action != 'statut' && $action <> 'editline') - { - // Validate - if ($object->statut == 0 && $object->total_ttc >= 0 && count($object->lines) > 0 && $user->rights->propal->valider) - { - if (count($object->lines) > 0) print ''.$langs->trans('Validate').''; - //else print ''.$langs->trans('Validate').''; - } - - // Edit - if ($object->statut == 1 && $user->rights->propal->creer) - { - print ''.$langs->trans('Modify').''; - } - - // ReOpen - if (($object->statut == 2 || $object->statut == 3) && $user->rights->propal->cloturer) - { - print 'global->MAIN_JUMP_TAG)?'':'#reopen').'"'; - print '>'.$langs->trans('ReOpen').''; - } - - // Send - if ($object->statut == 1 || $object->statut == 2) - { - if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->propal->propal_advance->send) - { - print ''.$langs->trans('SendByMail').''; - } - else print ''.$langs->trans('SendByMail').''; - } - - // Create an order - if (! empty($conf->commande->enabled) && $object->statut == 2 && $user->societe_id == 0) - { - if ($user->rights->commande->creer) - { - print ''.$langs->trans("AddOrder").''; - } - } - - // Create contract - if ($conf->contrat->enabled && $object->statut == 2 && $user->societe_id == 0) - { - $langs->load("contracts"); - - if ($user->rights->contrat->creer) - { - print ''.$langs->trans('AddContract').''; - } - } - - // Create an invoice and classify billed - if ($object->statut == 2 && $user->societe_id == 0) - { - if (! empty($conf->facture->enabled) && $user->rights->facture->creer) - { - print ''.$langs->trans("AddBill").''; - } - - $arraypropal=$object->getInvoiceArrayList(); - if (is_array($arraypropal) && count($arraypropal) > 0) - { - print 'socid.'">'.$langs->trans("ClassifyBilled").''; - } - } - - // Close - if ($object->statut == 1 && $user->rights->propal->cloturer) - { - print 'global->MAIN_JUMP_TAG)?'':'#close').'"'; - print '>'.$langs->trans('Close').''; - } - - // Clone - if ($user->rights->propal->creer) - { - print ''.$langs->trans("ToClone").''; - } - - // Delete - if ($user->rights->propal->supprimer) - { - print ''.$langs->trans('Delete').''; - } - - } - - print '
'; - print "
\n"; - } - - if ($action != 'presend') - { - print '
'; - print ''; // ancre - - - /* - * Documents generes - */ - $filename=dol_sanitizeFileName($object->ref); - $filedir=$conf->propal->dir_output . "/" . dol_sanitizeFileName($object->ref); - $urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id; - $genallowed=$user->rights->propal->creer; - $delallowed=$user->rights->propal->supprimer; - - $var=true; - - $somethingshown=$formfile->show_documents('propal',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'',0,'',$soc->default_lang); - - - /* - * Linked object block - */ - $somethingshown=$object->showLinkedObjectBlock(); - - print ''; - - // List of actions on element - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; - $formactions=new FormActions($db); - $somethingshown=$formactions->showactions($object,'propal',$socid); - - print '
'; - } - - - /* - * Action presend - * - */ - if ($action == 'presend') - { - $ref = dol_sanitizeFileName($object->ref); - include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($object->ref,'/')); - $file=$fileparams['fullname']; - - // Build document if it not exists - if (! $file || ! is_readable($file)) - { - // Define output language - $outputlangs = $langs; - $newlang=''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; - if (! empty($newlang)) - { - $outputlangs = new Translate("",$conf); - $outputlangs->setDefaultLang($newlang); - } - - $result=propale_pdf_create($db, $object, GETPOST('model')?GETPOST('model'):$object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); - if ($result <= 0) - { - dol_print_error($db,$result); - exit; - } - $fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($object->ref,'/')); - $file=$fileparams['fullname']; - } - - print '
'; - print_titre($langs->trans('SendPropalByMail')); - - // Create form object - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; - $formmail = new FormMail($db); - $formmail->fromtype = 'user'; - $formmail->fromid = $user->id; - $formmail->fromname = $user->getFullName($langs); - $formmail->frommail = $user->email; - $formmail->withfrom=1; - $liste=array(); - foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key=>$value) $liste[$key]=$value; - $formmail->withto=GETPOST("sendto")?GETPOST("sendto"):$liste; - $formmail->withtocc=$liste; - $formmail->withtoccc=(! empty($conf->global->MAIN_EMAIL_USECCC)?$conf->global->MAIN_EMAIL_USECCC:false); - $formmail->withtopic=$langs->trans('SendPropalRef','__PROPREF__'); - $formmail->withfile=2; - $formmail->withbody=1; - $formmail->withdeliveryreceipt=1; - $formmail->withcancel=1; - - // Tableau des substitutions - $formmail->substit['__PROPREF__']=$object->ref; - $formmail->substit['__SIGNATURE__']=$user->signature; - $formmail->substit['__PERSONALIZED__']=''; - $formmail->substit['__CONTACTCIVNAME__']=''; - + + * Copyright (C) 2004-2013 Laurent Destailleur + * Copyright (C) 2004 Eric Seigne + * Copyright (C) 2005 Marc Barilley / Ocebo + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2006 Andre Cianfarani + * Copyright (C) 2010-2013 Juanjo Menent + * Copyright (C) 2010-2011 Philippe Grand + * Copyright (C) 2012 Christophe Battarel +* + * 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/comm/propal.php + * \ingroup propale + * \brief Page of commercial proposals card and list + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formpropal.class.php'; +require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; +require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/modules/propale/modules_propale.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; +if (! empty($conf->projet->enabled)) +{ + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; + require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; +} + +$langs->load('companies'); +$langs->load('propal'); +$langs->load('compta'); +$langs->load('bills'); +$langs->load('orders'); +$langs->load('products'); +$langs->load("deliveries"); +if (! empty($conf->margin->enabled)) + $langs->load('margins'); + +$error=0; + +$id=GETPOST('id','int'); +$ref=GETPOST('ref','alpha'); +$socid=GETPOST('socid','int'); +$action=GETPOST('action','alpha'); +$origin=GETPOST('origin','alpha'); +$originid=GETPOST('originid','int'); +$confirm=GETPOST('confirm','alpha'); +$lineid=GETPOST('lineid','int'); + +//PDF +$hidedetails = (GETPOST('hidedetails','int') ? GETPOST('hidedetails','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0)); +$hidedesc = (GETPOST('hidedesc','int') ? GETPOST('hidedesc','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0)); +$hideref = (GETPOST('hideref','int') ? GETPOST('hideref','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0)); + +// Nombre de ligne pour choix de produit/service predefinis +$NBLINES=4; + +// Security check +if (! empty($user->societe_id)) $socid=$user->societe_id; +$result = restrictedArea($user, 'propal', $id); + +$object = new Propal($db); +$extrafields = new ExtraFields($db); + +// Load object +if ($id > 0 || ! empty($ref)) +{ + $ret=$object->fetch($id, $ref); + if ($ret > 0) $ret=$object->fetch_thirdparty(); + if ($ret < 0) dol_print_error('',$object->error); +} + +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array('propalcard')); + + + +/* + * Actions + */ + +$parameters=array('socid'=>$socid); +$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks + +// Action clone object +if ($action == 'confirm_clone' && $confirm == 'yes') +{ + if (1==0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers')) + { + setEventMessage($langs->trans("NoCloneOptionsSpecified"), 'errors'); + } + else + { + if ($object->id > 0) + { + $result=$object->createFromClone($socid); + if ($result > 0) + { + header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result); + exit; + } + else + { + setEventMessage($object->error, 'errors'); + $action=''; + } + } + } +} + +// Suppression de la propale +else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->propal->supprimer) +{ + $result=$object->delete($user); + if ($result > 0) + { + header('Location: '.DOL_URL_ROOT.'/comm/propal/list.php'); + exit; + } + else + { + $langs->load("errors"); + setEventMessage($langs->trans($object->error), 'errors'); + } +} + +// Remove line +else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->propal->creer) +{ + $result = $object->deleteline($lineid); + // reorder lines + if ($result) $object->line_order(true); + + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + // Define output language + $outputlangs = $langs; + if (! empty($conf->global->MAIN_MULTILANGS)) + { + $outputlangs = new Translate("",$conf); + $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); + $outputlangs->setDefaultLang($newlang); + } + $ret=$object->fetch($id); // Reload to get new records + propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); + } + + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); + exit; +} + +// Validation +else if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->propal->valider) +{ + $result=$object->valid($user); + if ($result >= 0) + { + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + // Define output language + $outputlangs = $langs; + if (! empty($conf->global->MAIN_MULTILANGS)) + { + $outputlangs = new Translate("",$conf); + $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); + $outputlangs->setDefaultLang($newlang); + } + $ret=$object->fetch($id); // Reload to get new records + propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); + } + } + else + { + $langs->load("errors"); + setEventMessage($langs->trans($object->error), 'errors'); + } +} + +else if ($action == 'setdate' && $user->rights->propal->creer) +{ + $datep=dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); + + if (empty($datep)) + { + $error++; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")), 'errors'); + } + + if (! $error) + { + $result=$object->set_date($user,$datep); + if ($result < 0) dol_print_error($db,$object->error); + } +} +else if ($action == 'setecheance' && $user->rights->propal->creer) +{ + $result=$object->set_echeance($user,dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear'])); + if ($result < 0) dol_print_error($db,$object->error); +} +else if ($action == 'setdate_livraison' && $user->rights->propal->creer) +{ + $result=$object->set_date_livraison($user,dol_mktime(12, 0, 0, $_POST['liv_month'], $_POST['liv_day'], $_POST['liv_year'])); + if ($result < 0) dol_print_error($db,$object->error); +} + +// Positionne ref client +else if ($action == 'set_ref_client' && $user->rights->propal->creer) +{ + $object->set_ref_client($user, $_POST['ref_client']); +} + +else if ($action == 'setnote_public' && $user->rights->propal->creer) +{ + $result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES)); + if ($result < 0) dol_print_error($db,$object->error); +} + +else if ($action == 'setnote' && $user->rights->propal->creer) +{ + $result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES)); + if ($result < 0) dol_print_error($db,$object->error); +} + +// Create proposal +else if ($action == 'add' && $user->rights->propal->creer) +{ + $object->socid=$socid; + $object->fetch_thirdparty(); + + $datep=dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); + $date_delivery=dol_mktime(12, 0, 0, GETPOST('liv_month'), GETPOST('liv_day'), GETPOST('liv_year')); + $duration=GETPOST('duree_validite'); + + if (empty($datep)) + { + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")), 'errors'); + $action='create'; + $error++; + } + if (empty($duration)) + { + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("ValidityDuration")), 'errors'); + $action='create'; + $error++; + } + + if ($socid<1) + { + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Customer")),'errors'); + $action='create'; + $error++; + } + + if (! $error) + { + $db->begin(); + + // Si on a selectionne une propal a copier, on realise la copie + if (GETPOST('createmode')=='copy' && GETPOST('copie_propal')) + { + if ($object->fetch(GETPOST('copie_propal')) > 0) + { + $object->ref = GETPOST('ref'); + $object->datep = $datep; + $object->date_livraison = $date_delivery; + $object->availability_id = GETPOST('availability_id'); + $object->demand_reason_id = GETPOST('demand_reason_id'); + $object->fk_delivery_address = GETPOST('fk_address'); + $object->duree_validite = $duration; + $object->cond_reglement_id = GETPOST('cond_reglement_id'); + $object->mode_reglement_id = GETPOST('mode_reglement_id'); + $object->remise_percent = GETPOST('remise_percent'); + $object->remise_absolue = GETPOST('remise_absolue'); + $object->socid = GETPOST('socid'); + $object->contactid = GETPOST('contactidp'); + $object->fk_project = GETPOST('projectid'); + $object->modelpdf = GETPOST('model'); + $object->author = $user->id; // deprecated + $object->note = GETPOST('note'); + $object->statut = 0; + + $id = $object->create_from($user); + } + else + { + setEventMessage($langs->trans("ErrorFailedToCopyProposal",GETPOST('copie_propal')), 'errors'); + } + } + else + { + $object->ref = GETPOST('ref'); + $object->ref_client = GETPOST('ref_client'); + $object->datep = $datep; + $object->date_livraison = $date_delivery; + $object->availability_id = GETPOST('availability_id'); + $object->demand_reason_id = GETPOST('demand_reason_id'); + $object->fk_delivery_address = GETPOST('fk_address'); + $object->duree_validite = GETPOST('duree_validite'); + $object->cond_reglement_id = GETPOST('cond_reglement_id'); + $object->mode_reglement_id = GETPOST('mode_reglement_id'); + + $object->contactid = GETPOST('contactidp'); + $object->fk_project = GETPOST('projectid'); + $object->modelpdf = GETPOST('model'); + $object->author = $user->id; // deprecated + $object->note = GETPOST('note'); + + $object->origin = GETPOST('origin'); + $object->origin_id = GETPOST('originid'); + + for ($i = 1 ; $i <= $conf->global->PRODUCT_SHOW_WHEN_CREATE; $i++) + { + if ($_POST['idprod'.$i]) + { + $xid = 'idprod'.$i; + $xqty = 'qty'.$i; + $xremise = 'remise'.$i; + $object->add_product($_POST[$xid],$_POST[$xqty],$_POST[$xremise]); + } + } + + // Get extra fields + foreach($_POST as $key => $value) + { + if (preg_match("/^options_/",$key)) + { + $object->array_options[$key]=GETPOST($key); + } + } + + $id = $object->create($user); + } + + if ($id > 0) + { + // Insertion contact par defaut si defini + if (GETPOST('contactidp')) + { + $result=$object->add_contact(GETPOST('contactidp'),'CUSTOMER','external'); + if ($result < 0) + { + $error++; + setEventMessage($langs->trans("ErrorFailedToAddContact"), 'errors'); + } + } + + if (! $error) + { + $db->commit(); + + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + // Define output language + $outputlangs = $langs; + if (! empty($conf->global->MAIN_MULTILANGS)) + { + $outputlangs = new Translate("",$conf); + $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); + $outputlangs->setDefaultLang($newlang); + } + $ret=$object->fetch($id); // Reload to get new records + propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); + } + + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); + exit; + } + else + { + $db->rollback(); + } + } + else + { + dol_print_error($db,$object->error); + $db->rollback(); + exit; + } + } +} + +// Classify billed +else if ($action == 'classifybilled' && $user->rights->propal->cloturer) +{ + $object->cloture($user, 4, ''); +} + +// Reopen proposal +else if ($action == 'confirm_reopen' && $user->rights->propal->cloturer && ! GETPOST('cancel')) +{ + // prevent browser refresh from reopening proposal several times + if ($object->statut==2 || $object->statut==3) + { + $object->setStatut(1); + } +} + +// Close proposal +else if ($action == 'setstatut' && $user->rights->propal->cloturer && ! GETPOST('cancel')) +{ + if (! GETPOST('statut')) + { + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("CloseAs")), 'errors'); + $action='statut'; + } + else + { + // prevent browser refresh from closing proposal several times + if ($object->statut==1) + { + $object->cloture($user, GETPOST('statut'), GETPOST('note')); + } + } +} + +/* + * Add file in email form + */ +if (GETPOST('addfile')) +{ + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + + // Set tmp user directory TODO Use a dedicated directory for temp mails files + $vardir=$conf->user->dir_output."/".$user->id; + $upload_dir_tmp = $vardir.'/temp'; + + dol_add_file_process($upload_dir_tmp,0,0); + $action='presend'; +} + +/* + * Remove file in email form + */ +if (GETPOST('removedfile')) +{ + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + + // Set tmp user directory + $vardir=$conf->user->dir_output."/".$user->id; + $upload_dir_tmp = $vardir.'/temp'; + + // TODO Delete only files that was uploaded from email form + dol_remove_file_process($_POST['removedfile'],0); + $action='presend'; +} + +/* + * Send mail + */ +if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! GETPOST('cancel')) +{ + $langs->load('mails'); + + if ($object->id > 0) + { + if ($_POST['sendto']) + { + // Le destinataire a ete fourni via le champ libre + $sendto = $_POST['sendto']; + $sendtoid = 0; + } + elseif ($_POST['receiver'] != '-1') + { + // Recipient was provided from combo list + if ($_POST['receiver'] == 'thirdparty') // Id of third party + { + $sendto = $object->client->email; + $sendtoid = 0; + } + else // Id du contact + { + $sendto = $object->client->contact_get_property($_POST['receiver'],'email'); + $sendtoid = $_POST['receiver']; + } + } + + if (dol_strlen($sendto)) + { + $langs->load("commercial"); + + $from = $_POST['fromname'] . ' <' . $_POST['frommail'] .'>'; + $replyto = $_POST['replytoname']. ' <' . $_POST['replytomail'].'>'; + $message = $_POST['message']; + $sendtocc = $_POST['sendtocc']; + $deliveryreceipt = $_POST['deliveryreceipt']; + + if (dol_strlen($_POST['subject'])) $subject = $_POST['subject']; + else $subject = $langs->transnoentities('Propal').' '.$object->ref; + $actiontypecode='AC_PROP'; + $actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n"; + if ($message) + { + $actionmsg.=$langs->transnoentities('MailTopic').": ".$subject."\n"; + $actionmsg.=$langs->transnoentities('TextUsedInTheMessageBody').":\n"; + $actionmsg.=$message; + } + $actionmsg2=$langs->transnoentities('Action'.$actiontypecode); + + // Create form object + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; + $formmail = new FormMail($db); + + $attachedfiles=$formmail->get_attached_files(); + $filepath = $attachedfiles['paths']; + $filename = $attachedfiles['names']; + $mimetype = $attachedfiles['mimes']; + + // Envoi de la propal + require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; + $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,'',$deliveryreceipt,-1); + if ($mailfile->error) + { + setEventMessage($mailfile->error, 'errors'); + } + else + { + $result=$mailfile->sendfile(); + if ($result) + { + // Initialisation donnees + $object->sendtoid = $sendtoid; + $object->actiontypecode = $actiontypecode; + $object->actionmsg = $actionmsg; + $object->actionmsg2 = $actionmsg2; + $object->fk_element = $object->id; + $object->elementtype = $object->element; + + // Appel des triggers + include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; + $interface=new Interfaces($db); + $result=$interface->run_triggers('PROPAL_SENTBYMAIL',$object,$user,$langs,$conf); + if ($result < 0) { + $error++; $this->errors=$interface->errors; + } + // Fin appel triggers + + if (! $error) + { + // Redirect here + // This avoid sending mail twice if going out and then back to page + $mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)); + setEventMessage($mesg); + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); + exit; + } + else + { + dol_print_error($db); + } + } + else + { + $langs->load("other"); + if ($mailfile->error) + { + $mesg.=$langs->trans('ErrorFailedToSendMail',$from,$sendto); + $mesg.='
'.$mailfile->error; + } + else + { + $mesg.='No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS'; + } + setEventMessage($mesg, 'errors'); + } + } + } + else + { + $langs->load("other"); + setEventMessage($langs->trans('ErrorMailRecipientIsEmpty').'!', 'errors'); + dol_syslog($langs->trans('ErrorMailRecipientIsEmpty')); + } + } + else + { + $langs->load("other"); + setEventMessage($langs->trans('ErrorFailedToReadEntity',$langs->trans("Proposal")), 'errors'); + dol_syslog($langs->trans('ErrorFailedToReadEntity',$langs->trans("Proposal"))); + } +} + +// Go back to draft +if ($action == 'modif' && $user->rights->propal->creer) +{ + $object->set_draft($user); + + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + // Define output language + $outputlangs = $langs; + if (! empty($conf->global->MAIN_MULTILANGS)) + { + $outputlangs = new Translate("",$conf); + $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); + $outputlangs->setDefaultLang($newlang); + } + $ret=$object->fetch($id); // Reload to get new records + propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); + } +} + +else if ($action == "setabsolutediscount" && $user->rights->propal->creer) +{ + if ($_POST["remise_id"]) + { + if ($object->id > 0) + { + $result=$object->insert_discount($_POST["remise_id"]); + if ($result < 0) + { + setEventMessage($object->error, 'errors'); + } + } + } +} + +//Ajout d'une ligne produit dans la propale +else if ($action == "addline" && $user->rights->propal->creer) +{ + $idprod=GETPOST('idprod', 'int'); + $product_desc = (GETPOST('product_desc')?GETPOST('product_desc'):(GETPOST('np_desc')?GETPOST('np_desc'):(GETPOST('dp_desc')?GETPOST('dp_desc'):''))); + $price_ht = GETPOST('price_ht'); + $tva_tx = (GETPOST('tva_tx')?GETPOST('tva_tx'):0); + + if (empty($idprod) && GETPOST('type') < 0) + { + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")), 'errors'); + $error++; + } + if ((empty($idprod) || GETPOST('usenewaddlineform')) && (!($price_ht != 0) || $price_ht == '')) // Unit price can be 0 but not ''. Also price can be negative for proposal. + { + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("UnitPriceHT")), 'errors'); + $error++; + } + if (empty($idprod) && empty($product_desc)) + { + setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Description")), 'errors'); + $error++; + } + + if (! $error && (GETPOST('qty') >= 0) && (! empty($product_desc) || ! empty($idprod))) + { + $pu_ht=0; + $pu_ttc=0; + $price_min=0; + $price_base_type = (GETPOST('price_base_type', 'alpha')?GETPOST('price_base_type', 'alpha'):'HT'); + + // Ecrase $pu par celui du produit + // Ecrase $desc par celui du produit + // Ecrase $txtva par celui du produit + if (! empty($idprod)) + { + $prod = new Product($db); + $prod->fetch($idprod); + + $label = ((GETPOST('product_label') && GETPOST('product_label')!=$prod->label)?GETPOST('product_label'):''); + + // If prices fields are update + if (GETPOST('usenewaddlineform')) + { + $pu_ht=price2num($price_ht, 'MU'); + $pu_ttc=price2num(GETPOST('price_ttc'), 'MU'); + $tva_npr=(preg_match('/\*/', $tva_tx)?1:0); + $tva_tx=str_replace('*','', $tva_tx); + $desc = $product_desc; + } + else + { + $tva_tx = get_default_tva($mysoc,$object->client,$prod->id); + $tva_npr = get_default_npr($mysoc,$object->client,$prod->id); + + // On defini prix unitaire + if (! empty($conf->global->PRODUIT_MULTIPRICES) && $object->client->price_level) + { + $pu_ht = $prod->multiprices[$object->client->price_level]; + $pu_ttc = $prod->multiprices_ttc[$object->client->price_level]; + $price_min = $prod->multiprices_min[$object->client->price_level]; + $price_base_type = $prod->multiprices_base_type[$object->client->price_level]; + } + else + { + $pu_ht = $prod->price; + $pu_ttc = $prod->price_ttc; + $price_min = $prod->price_min; + $price_base_type = $prod->price_base_type; + } + + // On reevalue prix selon taux tva car taux tva transaction peut etre different + // de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur). + if ($tva_tx != $prod->tva_tx) + { + if ($price_base_type != 'HT') + { + $pu_ht = price2num($pu_ttc / (1 + ($tva_tx/100)), 'MU'); + } + else + { + $pu_ttc = price2num($pu_ht * (1 + ($tva_tx/100)), 'MU'); + } + } + + $desc=''; + + // Define output language + if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) + { + $outputlangs = $langs; + $newlang=''; + if (empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id'); + if (empty($newlang)) $newlang=$object->client->default_lang; + if (! empty($newlang)) + { + $outputlangs = new Translate("",$conf); + $outputlangs->setDefaultLang($newlang); + } + + $desc = (! empty($prod->multilangs[$outputlangs->defaultlang]["description"])) ? $prod->multilangs[$outputlangs->defaultlang]["description"] : $prod->description; + } + else + { + $desc = $prod->description; + } + + $desc=dol_concatdesc($desc,$product_desc); + + // Add custom code and origin country into description + if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code))) + { + $tmptxt='('; + if (! empty($prod->customcode)) $tmptxt.=$langs->transnoentitiesnoconv("CustomCode").': '.$prod->customcode; + if (! empty($prod->customcode) && ! empty($prod->country_code)) $tmptxt.=' - '; + if (! empty($prod->country_code)) $tmptxt.=$langs->transnoentitiesnoconv("CountryOrigin").': '.getCountry($prod->country_code,0,$db,$langs,0); + $tmptxt.=')'; + $desc= dol_concatdesc($desc, $tmptxt); + } + } + + $type = $prod->type; + } + else + { + $pu_ht = price2num($price_ht, 'MU'); + $pu_ttc = price2num(GETPOST('price_ttc'), 'MU'); + $tva_npr = (preg_match('/\*/', $tva_tx)?1:0); + $tva_tx = str_replace('*', '', $tva_tx); + $label = (GETPOST('product_label')?GETPOST('product_label'):''); + $desc = $product_desc; + $type = GETPOST('type'); + } + + // Margin + $fournprice=(GETPOST('fournprice')?GETPOST('fournprice'):''); + $buyingprice=(GETPOST('buying_price')?GETPOST('buying_price'):''); + + // Local Taxes + $localtax1_tx= get_localtax($tva_tx, 1, $object->client); + $localtax2_tx= get_localtax($tva_tx, 2, $object->client); + + $info_bits=0; + if ($tva_npr) $info_bits |= 0x01; + + if (! empty($price_min) && (price2num($pu_ht)*(1-price2num(GETPOST('remise_percent'))/100) < price2num($price_min))) + { + $mesg = $langs->trans("CantBeLessThanMinPrice",price2num($price_min,'MU').$langs->getCurrencySymbol($conf->currency)); + setEventMessage($mesg, 'errors'); + } + else + { + // Insert line + $result=$object->addline( + $id, + $desc, + $pu_ht, + GETPOST('qty'), + $tva_tx, + $localtax1_tx, + $localtax2_tx, + $idprod, + GETPOST('remise_percent'), + $price_base_type, + $pu_ttc, + $info_bits, + $type, + -1, + 0, + GETPOST('fk_parent_line'), + $fournprice, + $buyingprice, + $label + ); + + if ($result > 0) + { + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + // Define output language + $outputlangs = $langs; + if (! empty($conf->global->MAIN_MULTILANGS)) + { + $outputlangs = new Translate("",$conf); + $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); + $outputlangs->setDefaultLang($newlang); + } + $ret=$object->fetch($id); // Reload to get new records + propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); + } + + unset($_POST['qty']); + unset($_POST['type']); + unset($_POST['idprod']); + unset($_POST['remise_percent']); + unset($_POST['price_ht']); + unset($_POST['price_ttc']); + unset($_POST['tva_tx']); + unset($_POST['product_ref']); + unset($_POST['product_label']); + unset($_POST['product_desc']); + unset($_POST['fournprice']); + unset($_POST['buying_price']); + + // old method + unset($_POST['np_desc']); + unset($_POST['dp_desc']); + } + else + { + setEventMessage($object->error, 'errors'); + } + } + } +} + +// Mise a jour d'une ligne dans la propale +else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('save') == $langs->trans("Save")) +{ + // Define info_bits + $info_bits=0; + if (preg_match('/\*/', GETPOST('tva_tx'))) $info_bits |= 0x01; + + // Clean parameters + $description=dol_htmlcleanlastbr(GETPOST('product_desc')); + + // Define vat_rate + $vat_rate=(GETPOST('tva_tx')?GETPOST('tva_tx'):0); + $vat_rate=str_replace('*','',$vat_rate); + $localtax1_rate=get_localtax($vat_rate,1,$object->client); + $localtax2_rate=get_localtax($vat_rate,2,$object->client); + $pu_ht=GETPOST('price_ht'); + + // Add buying price + $fournprice=(GETPOST('fournprice')?GETPOST('fournprice'):''); + $buyingprice=(GETPOST('buying_price')?GETPOST('buying_price'):''); + + // Define special_code for special lines + $special_code=0; + if (! GETPOST('qty')) $special_code=3; + + // Check minimum price + $productid = GETPOST('productid', 'int'); + if (! empty($productid)) + { + $product = new Product($db); + $res=$product->fetch($productid); + + $type=$product->type; + + $price_min = $product->price_min; + if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($object->client->price_level)) + $price_min = $product->multiprices_min[$object->client->price_level]; + + $label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label'):''); + + if ($price_min && (price2num($pu_ht)*(1-price2num(GETPOST('remise_percent'))/100) < price2num($price_min))) + { + setEventMessage($langs->trans("CantBeLessThanMinPrice", price2num($price_min,'MU')).$langs->getCurrencySymbol($conf->currency), 'errors'); + $error++; + } + } + else + { + $type = GETPOST('type'); + $label = (GETPOST('product_label') ? GETPOST('product_label'):''); + + // Check parameters + if (GETPOST('type') < 0) { + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")), 'errors'); + $error++; + } + } + + if (! $error) + { + $result = $object->updateline( + GETPOST('lineid'), + $pu_ht, + GETPOST('qty'), + GETPOST('remise_percent'), + $vat_rate, + $localtax1_rate, + $localtax2_rate, + $description, + 'HT', + $info_bits, + $special_code, + GETPOST('fk_parent_line'), + 0, + $fournprice, + $buyingprice, + $label, + $type + ); + + if ($result >= 0) + { + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + // Define output language + $outputlangs = $langs; + if (! empty($conf->global->MAIN_MULTILANGS)) + { + $outputlangs = new Translate("",$conf); + $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); + $outputlangs->setDefaultLang($newlang); + } + $ret=$object->fetch($id); // Reload to get new records + propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); + } + + unset($_POST['qty']); + unset($_POST['type']); + unset($_POST['productid']); + unset($_POST['remise_percent']); + unset($_POST['price_ht']); + unset($_POST['price_ttc']); + unset($_POST['tva_tx']); + unset($_POST['product_ref']); + unset($_POST['product_label']); + unset($_POST['product_desc']); + unset($_POST['fournprice']); + unset($_POST['buying_price']); + } + else + { + setEventMessage($object->error, 'errors'); + } + } +} + +else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('cancel') == $langs->trans('Cancel')) +{ + header('Location: '.$_SERVER['PHP_SELF'].'?id='.$object->id); // Pour reaffichage de la fiche en cours d'edition + exit; +} + +// Generation doc (depuis lien ou depuis cartouche doc) +else if ($action == 'builddoc' && $user->rights->propal->creer) +{ + if (GETPOST('model')) + { + $object->setDocModel($user, GETPOST('model')); + } + + // Define output language + $outputlangs = $langs; + if (! empty($conf->global->MAIN_MULTILANGS)) + { + $outputlangs = new Translate("",$conf); + $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); + $outputlangs->setDefaultLang($newlang); + } + $ret=$object->fetch($id); // Reload to get new records + $result=propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); + + if ($result <= 0) + { + dol_print_error($db,$result); + exit; + } + else + { + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.(empty($conf->global->MAIN_JUMP_TAG)?'':'#builddoc')); + exit; + } +} + +// Remove file in doc form +else if ($action == 'remove_file' && $user->rights->propal->creer) +{ + if ($object->id > 0) + { + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + + $langs->load("other"); + $upload_dir = $conf->propal->dir_output; + $file = $upload_dir . '/' . GETPOST('file'); + $ret=dol_delete_file($file,0,0,0,$object); + if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('file'))); + else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), 'errors'); + } +} + +// Set project +else if ($action == 'classin' && $user->rights->propal->creer) +{ + $object->setProject($_POST['projectid']); +} + +// Delai de livraison +else if ($action == 'setavailability' && $user->rights->propal->creer) +{ + $result = $object->availability($_POST['availability_id']); +} + +// Origine de la propale +else if ($action == 'setdemandreason' && $user->rights->propal->creer) +{ + $result = $object->demand_reason($_POST['demand_reason_id']); +} + +// Conditions de reglement +else if ($action == 'setconditions' && $user->rights->propal->creer) +{ + $result = $object->setPaymentTerms(GETPOST('cond_reglement_id','int')); +} + +else if ($action == 'setremisepercent' && $user->rights->propal->creer) +{ + $result = $object->set_remise_percent($user, $_POST['remise_percent']); +} + +else if ($action == 'setremiseabsolue' && $user->rights->propal->creer) +{ + $result = $object->set_remise_absolue($user, $_POST['remise_absolue']); +} + +// Mode de reglement +else if ($action == 'setmode' && $user->rights->propal->creer) +{ + $result = $object->setPaymentMethods(GETPOST('mode_reglement_id','int')); +} + +/* + * Ordonnancement des lignes + */ + +else if ($action == 'up' && $user->rights->propal->creer) +{ + $object->line_up(GETPOST('rowid')); + + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + // Define output language + $outputlangs = $langs; + if (! empty($conf->global->MAIN_MULTILANGS)) + { + $outputlangs = new Translate("",$conf); + $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); + $outputlangs->setDefaultLang($newlang); + } + $ret=$object->fetch($id); // Reload to get new records + propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); + } + + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id.'#'.GETPOST('rowid')); + exit; +} + +else if ($action == 'down' && $user->rights->propal->creer) +{ + $object->line_down(GETPOST('rowid')); + + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + // Define output language + $outputlangs = $langs; + if (! empty($conf->global->MAIN_MULTILANGS)) + { + $outputlangs = new Translate("",$conf); + $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); + $outputlangs->setDefaultLang($newlang); + } + $ret=$object->fetch($id); // Reload to get new records + propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); + } + + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id.'#'.GETPOST('rowid')); + exit; +} +else if ($action == 'update_extras') +{ + // Get extra fields + foreach($_POST as $key => $value) + { + if (preg_match("/^options_/",$key)) + { + $object->array_options[$key]=$_POST[$key]; + } + } + // Actions on extra fields (by external module or standard code) + // FIXME le hook fait double emploi avec le trigger !! + $hookmanager->initHooks(array('propaldao')); + $parameters=array('id'=>$object->id); + $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$object,$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=$object->insertExtraFields(); + if ($result < 0) + { + $error++; + } + } + } + else if ($reshook < 0) $error++; + +} + +if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->propal->creer) +{ + if ($action == 'addcontact') + { + if ($object->id > 0) + { + $contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid')); + $result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]); + } + + if ($result >= 0) + { + header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); + exit; + } + else + { + if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') + { + $langs->load("errors"); + setEventMessage($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), 'errors'); + } + else + { + setEventMessage($object->error, 'errors'); + } + } + } + + // Bascule du statut d'un contact + else if ($action == 'swapstatut') + { + if ($object->fetch($id) > 0) + { + $result=$object->swapContactStatus(GETPOST('ligne')); + } + else + { + dol_print_error($db); + } + } + + // Efface un contact + else if ($action == 'deletecontact') + { + $object->fetch($id); + $result = $object->delete_contact($lineid); + + if ($result >= 0) + { + header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); + exit; + } + else + { + dol_print_error($db); + } + } +} + + +/* + * View + */ + +llxHeader('',$langs->trans('Proposal'),'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos'); + +$form = new Form($db); +$formother = new FormOther($db); +$formfile = new FormFile($db); +$formpropal = new FormPropal($db); +$companystatic=new Societe($db); + +// fetch optionals attributes and labels +$extralabels=$extrafields->fetch_name_optionals_label('propal'); + +$now=dol_now(); + +// Add new proposal +if ($action == 'create') +{ + print_fiche_titre($langs->trans("NewProp")); + + $soc = new Societe($db); + if ($socid>0) $res=$soc->fetch($socid); + + $object = new Propal($db); + + print '
'; + print ''; + print ''; + + if ($origin != 'project' && $originid) + { + print ''; + print ''; + } + + print ''; + + // Reference + print ''; + + // Ref customer + print ''; + print ''; + + // Third party + print ''; + print ''; + if($socid>0) + { + print ''; + } + else + { + print ''; + } + print ''."\n"; + + // Contacts + if($socid>0) + { + print "'; + + // Ligne info remises tiers + print ''; + } + + // Date + print ''; + + // Validaty duration + print ''; + + // Terms of payment + print ''; + + // Mode of payment + print ''; + + // What trigger creation + print ''; + + // Delivery delay + print ''; + + // Delivery date (or manufacturing) + print ''; + print ''; + + // Model + print ''; + print ''; + print '"; + + // Project + if (! empty($conf->projet->enabled) && $socid>0) + { + $projectid = 0; + if ($origin == 'project') $projectid = ($originid?$originid:0); + + print ''; + print ''; + print ''; + } + + // Other attributes + $parameters=array('colspan' => ' colspan="3"'); + $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + if (empty($reshook) && ! empty($extrafields->attribute_label)) + { + foreach($extrafields->attribute_label as $key=>$label) + { + $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); + + // Show separator only + if ($extrafields->attribute_type[$key] == 'separate') + { + print $extrafields->showSeparator($key); + } + else + { + print 'attribute_required[$key])) print ' class="fieldrequired"'; + print '>'.$label.''."\n"; + } + } + } + + print "
'.$langs->trans('Ref').''.$langs->trans("Draft").'
'.$langs->trans('RefCustomer').''; + print '
'.$langs->trans('Customer').''; + print $soc->getNomUrl(1); + print ''; + print ''; + print $form->select_company('','socid','s.client = 1 OR s.client = 2 OR s.client = 3',1); + print '
".$langs->trans("DefaultContact").''; + $form->select_contacts($soc->id,$setcontact,'contactidp',1,$srccontactslist); + print '
'.$langs->trans('Discounts').''; + if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client); + else print $langs->trans("CompanyHasNoRelativeDiscount"); + $absolute_discount=$soc->getAvailableDiscounts(); + print '. '; + if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->trans("Currency".$conf->currency)); + else print $langs->trans("CompanyHasNoAbsoluteDiscount"); + print '.'; + print '
'.$langs->trans('Date').''; + $form->select_date('','','','','',"addprop"); + print '
'.$langs->trans("ValidityDuration").' '.$langs->trans("days").'
'.$langs->trans('PaymentConditionsShort').''; + $form->select_conditions_paiements($soc->cond_reglement,'cond_reglement_id'); + print '
'.$langs->trans('PaymentMode').''; + $form->select_types_paiements($soc->mode_reglement,'mode_reglement_id'); + print '
'.$langs->trans('Source').''; + $form->select_demand_reason('','demand_reason_id',"SRC_PROP",1); + print '
'.$langs->trans('AvailabilityPeriod').''; + $form->select_availability('','availability_id','',1); + print '
'.$langs->trans("DeliveryDate").''; + if ($conf->global->DATE_LIVRAISON_WEEK_DELAY != "") + { + $tmpdte = time() + ((7 * $conf->global->DATE_LIVRAISON_WEEK_DELAY) * 24 * 60 * 60); + $syear = date("Y", $tmpdte); + $smonth = date("m", $tmpdte); + $sday = date("d", $tmpdte); + $form->select_date($syear."-".$smonth."-".$sday,'liv_','','','',"addprop"); + } + else + { + $datepropal=empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0; + $form->select_date($datepropal,'liv_','','','',"addprop"); + } + print '
'.$langs->trans("DefaultModel").''; + $liste=ModelePDFPropales::liste_modeles($db); + print $form->selectarray('model',$liste,$conf->global->PROPALE_ADDON_PDF); + print "
'.$langs->trans("Project").''; + + $numprojet=select_projects($soc->id,$projectid); + if ($numprojet==0) + { + print '   '.$langs->trans("AddProject").''; + } + print '
'; + print $extrafields->showInputField($key,$value); + print '
"; + print '
'; + + /* + * Combobox pour la fonction de copie + */ + + if (empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE)) + { + print ''; + } + + print ''; + if (! empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE)) + { + // For backward compatibility + print ''; + print ''; + print ''; + print ''; + + if (! empty($conf->global->PRODUCT_SHOW_WHEN_CREATE)) print ''; + + print ''; + print ''; + } + + if (! empty($conf->global->PRODUCT_SHOW_WHEN_CREATE)) + { + print ''; + } + print '
'.$langs->trans("CopyPropalFrom").' '; + $liste_propal = array(); + $liste_propal[0] = ''; + + $sql ="SELECT p.rowid as id, p.ref, s.nom"; + $sql.=" FROM ".MAIN_DB_PREFIX."propal p"; + $sql.= ", ".MAIN_DB_PREFIX."societe s"; + $sql.= " WHERE s.rowid = p.fk_soc"; + $sql.= " AND p.entity = ".$conf->entity; + $sql.= " AND p.fk_statut <> 0"; + $sql.= " ORDER BY Id"; + + $resql = $db->query($sql); + if ($resql) + { + $num = $db->num_rows($resql); + $i = 0; + while ($i < $num) + { + $row = $db->fetch_row($resql); + $propalRefAndSocName = $row[1]." - ".$row[2]; + $liste_propal[$row[0]]=$propalRefAndSocName; + $i++; + } + print $form->selectarray("copie_propal",$liste_propal, 0); + } + else + { + dol_print_error($db); + } + print '
 
'.$langs->trans("CreateEmptyPropal").'
'; + if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) + { + $lib=$langs->trans("ProductsAndServices"); + + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + for ($i = 1 ; $i <= $conf->global->PRODUCT_SHOW_WHEN_CREATE; $i++) + { + print ''; + print ''; + print ''; + print ''; + } + + print "
'.$lib.''.$langs->trans("Qty").''.$langs->trans("ReductionShort").'
'; + // multiprix + if($conf->global->PRODUIT_MULTIPRICES && $soc->price_level) + $form->select_produits('',"idprod".$i,'',$conf->product->limit_size,$soc->price_level); + else + $form->select_produits('',"idprod".$i,'',$conf->product->limit_size); + print '%
"; + + } + print '
'; + print '
'; + + $langs->load("bills"); + print '
'; + print ''; + print ' '; + print '
'; + + print "
"; +} +else +{ + /* + * Show object in view mode + */ + + $soc = new Societe($db); + $soc->fetch($object->socid); + + $head = propal_prepare_head($object); + dol_fiche_head($head, 'comm', $langs->trans('Proposal'), 0, 'propal'); + + $formconfirm=''; + + // Clone confirmation + if ($action == 'clone') + { + // Create an array for form + $formquestion=array( + //'text' => $langs->trans("ConfirmClone"), + //array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), + //array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), + array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid','int'),'socid','(s.client=1 OR s.client=2 OR s.client=3)')) + ); + // Paiement incomplet. On demande si motif = escompte ou autre + $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans('ClonePropal'),$langs->trans('ConfirmClonePropal',$object->ref),'confirm_clone',$formquestion,'yes',1); + } + + // Confirm delete + else if ($action == 'delete') + { + $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteProp'), $langs->trans('ConfirmDeleteProp',$object->ref), 'confirm_delete','',0,1); + } + + // Confirm reopen + else if ($action == 'reopen') + { + $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ReOpen'), $langs->trans('ConfirmReOpenProp',$object->ref), 'confirm_reopen','',0,1); + } + + // Confirmation delete product/service line + else if ($action == 'ask_deleteline') + { + $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline','',0,1); + } + + // Confirm validate proposal + else if ($action == 'validate') + { + $error=0; + + // on verifie si l'objet est en numerotation provisoire + $ref = substr($object->ref, 1, 4); + if ($ref == 'PROV') + { + $numref = $object->getNextNumRef($soc); + if (empty($numref)) + { + $error++; + dol_htmloutput_errors($object->error); + } + } + else + { + $numref = $object->ref; + } + + $text=$langs->trans('ConfirmValidateProp',$numref); + if (! empty($conf->notification->enabled)) + { + require_once DOL_DOCUMENT_ROOT .'/core/class/notify.class.php'; + $notify=new Notify($db); + $text.='
'; + $text.=$notify->confirmMessage('NOTIFY_VAL_PROPAL',$object->socid); + } + + if (! $error) $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateProp'), $text, 'confirm_validate','',0,1); + } + + if (! $formconfirm) + { + $parameters=array('lineid'=>$lineid); + $formconfirm=$hookmanager->executeHooks('formConfirm',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + } + + // Print form confirm + print $formconfirm; + + + print ''; + + $linkback = ''.$langs->trans("BackToList").''; + + // Ref + print ''; + + // Ref client + print ''; + print ''; + + // Company + print ''; + print ''; + + // Ligne info remises tiers + print ''; + + // Date of proposal + print ''; + print ''; + + // Date end proposal + print ''; + print ''; + print ''; + + // Payment term + print ''; + print ''; + + // Delivery date + $langs->load('deliveries'); + print ''; + print ''; + + // Delivery delay + print ''; + print ''; + + // Origin of demand + print ''; + print ''; + + // Payment mode + print ''; + print ''; + + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + print ''; + } + else + { + print '
'.$langs->trans('Ref').''; + print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', ''); + print '
'; + print ''; + if ($action != 'refclient' && ! empty($object->brouillon)) print ''; + print '
'; + print $langs->trans('RefCustomer').''; + print ''.img_edit($langs->trans('Modify')).'
'; + print '
'; + if ($user->rights->propal->creer && $action == 'refclient') + { + print '
'; + print ''; + print ''; + print ''; + print ' '; + print '
'; + } + else + { + print $object->ref_client; + } + print '
'.$langs->trans('Company').''.$soc->getNomUrl(1).'
'.$langs->trans('Discounts').''; + if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client); + else print $langs->trans("CompanyHasNoRelativeDiscount"); + print '. '; + $absolute_discount=$soc->getAvailableDiscounts('','fk_facture_source IS NULL'); + $absolute_creditnote=$soc->getAvailableDiscounts('','fk_facture_source IS NOT NULL'); + $absolute_discount=price2num($absolute_discount,'MT'); + $absolute_creditnote=price2num($absolute_creditnote,'MT'); + if ($absolute_discount) + { + if ($object->statut > 0) + { + print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->currency)); + } + else + { + // Remise dispo de type non avoir + $filter='fk_facture_source IS NULL'; + print '
'; + $form->form_remise_dispo($_SERVER["PHP_SELF"].'?id='.$object->id,0,'remise_id',$soc->id,$absolute_discount,$filter); + } + } + if ($absolute_creditnote) + { + print $langs->trans("CompanyHasCreditNote",price($absolute_creditnote),$langs->transnoentities("Currency".$conf->currency)).'. '; + } + if (! $absolute_discount && ! $absolute_creditnote) print $langs->trans("CompanyHasNoAbsoluteDiscount").'.'; + print '
'; + print ''; + if ($action != 'editdate' && ! empty($object->brouillon)) print ''; + print '
'; + print $langs->trans('Date'); + print 'id.'">'.img_edit($langs->trans('SetDate'),1).'
'; + print '
'; + if (! empty($object->brouillon) && $action == 'editdate') + { + print '
'; + print ''; + print ''; + $form->select_date($object->date,'re','','',0,"editdate"); + print ''; + print '
'; + } + else + { + if ($object->date) + { + print dol_print_date($object->date,'daytext'); + } + else + { + print ' '; + } + } + print '
'; + print ''; + if ($action != 'editecheance' && ! empty($object->brouillon)) print ''; + print '
'; + print $langs->trans('DateEndPropal'); + print 'id.'">'.img_edit($langs->trans('SetConditions'),1).'
'; + print '
'; + if (! empty($object->brouillon) && $action == 'editecheance') + { + print '
'; + print ''; + print ''; + $form->select_date($object->fin_validite,'ech','','','',"editecheance"); + print ''; + print '
'; + } + else + { + if (! empty($object->fin_validite)) + { + print dol_print_date($object->fin_validite,'daytext'); + if ($object->statut == 1 && $object->fin_validite < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late")); + } + else + { + print ' '; + } + } + print '
'; + print ''; + if ($action != 'editconditions' && ! empty($object->brouillon)) print ''; + print '
'; + print $langs->trans('PaymentConditionsShort'); + print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetConditions'),1).'
'; + print '
'; + if ($action == 'editconditions') + { + $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->cond_reglement_id,'cond_reglement_id'); + } + else + { + $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->cond_reglement_id,'none'); + } + print '
'; + print ''; + if ($action != 'editdate_livraison' && ! empty($object->brouillon)) print ''; + print '
'; + print $langs->trans('DeliveryDate'); + print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetDeliveryDate'),1).'
'; + print '
'; + if ($action == 'editdate_livraison') + { + print '
'; + print ''; + print ''; + $form->select_date($object->date_livraison,'liv_','','','',"editdate_livraison"); + print ''; + print '
'; + } + else + { + print dol_print_date($object->date_livraison,'daytext'); + } + print '
'; + print ''; + if ($action != 'editavailability' && ! empty($object->brouillon)) print ''; + print '
'; + print $langs->trans('AvailabilityPeriod'); + if (! empty($conf->commande->enabled)) print ' ('.$langs->trans('AfterOrder').')'; + print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetAvailability'),1).'
'; + print '
'; + if ($action == 'editavailability') + { + $form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id,$object->availability_id,'availability_id',1); + } + else + { + $form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id,$object->availability_id,'none',1); + } + + print '
'; + print ''; + if ($action != 'editdemandreason' && ! empty($object->brouillon)) print ''; + print '
'; + print $langs->trans('Source'); + print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetDemandReason'),1).'
'; + print '
'; + //print $object->demand_reason_id; + if ($action == 'editdemandreason') + { + $form->form_demand_reason($_SERVER['PHP_SELF'].'?id='.$object->id,$object->demand_reason_id,'demand_reason_id',1); + } + else + { + $form->form_demand_reason($_SERVER['PHP_SELF'].'?id='.$object->id,$object->demand_reason_id,'none'); + } + + print '
'; + print ''; + if ($action != 'editmode' && ! empty($object->brouillon)) print ''; + print '
'; + print $langs->trans('PaymentMode'); + print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMode'),1).'
'; + print '
'; + if ($action == 'editmode') + { + $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->mode_reglement_id,'mode_reglement_id'); + } + else + { + $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->mode_reglement_id,'none'); + } + print '
'; + print ''; + if ($user->rights->propal->creer) + { + if ($action != 'classify') print ''; + print '
'; + print $langs->trans('Project').''.img_edit($langs->transnoentitiesnoconv('SetProject')).'
'; + print '
'; + if ($action == 'classify') + { + $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'projectid'); + } + else + { + $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none'); + } + print '
'; + if (! empty($object->fk_project)) + { + print ''; + $proj = new Project($db); + $proj->fetch($object->fk_project); + print ''; + print $proj->ref; + print ''; + print ''; + } + else { + print ' '; + } + } + print ''; + } + + // Other attributes + $res=$object->fetch_optionals($object->id,$extralabels); + $parameters=array('colspan' => ' colspan="3"'); + $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + if (empty($reshook) && ! empty($extrafields->attribute_label)) + { + + if ($action == 'edit_extras') + { + print '
'; + print ''; + print ''; + print ''; + } + + + foreach($extrafields->attribute_label as $key=>$label) + { + $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); + if ($extrafields->attribute_type[$key] == 'separate') + { + print $extrafields->showSeparator($key); + } + else + { + print 'attribute_required[$key])) print ' class="fieldrequired"'; + print '>'.$label.''; + if ($action == 'edit_extras' && $user->rights->propal->creer) + { + print $extrafields->showInputField($key,$value); + } + else + { + print $extrafields->showOutputField($key,$value); + } + print ''."\n"; + } + } + + if(count($extrafields->attribute_label) > 0) { + + if ($action == 'edit_extras' && $user->rights->propal->creer) + { + print ''; + print ''; + print ''; + print ''; + + } + else { + if ($object->statut == 0 && $user->rights->propal->creer) + { + print ''.img_picto('','edit').' '.$langs->trans('Modify').''; + } + } + } + } + + // Amount HT + print ''.$langs->trans('AmountHT').''; + print ''.price($object->total_ht).''; + print ''.$langs->trans("Currency".$conf->currency).''; + + // Margin Infos + if (! empty($conf->margin->enabled)) { + print ''; + $object->displayMarginInfos(); + print ''; + } + print ''; + + // Amount VAT + print ''.$langs->trans('AmountVAT').''; + print ''.price($object->total_tva).''; + print ''.$langs->trans("Currency".$conf->currency).''; + + // Amount Local Taxes + if ($mysoc->localtax1_assuj=="1") //Localtax1 + { + print ''.$langs->transcountry("AmountLT1",$mysoc->country_code).''; + print ''.price($object->total_localtax1).''; + print ''.$langs->trans("Currency".$conf->currency).''; + } + if ($mysoc->localtax2_assuj=="1") //Localtax2 + { + print ''.$langs->transcountry("AmountLT2",$mysoc->country_code).''; + print ''.price($object->total_localtax2).''; + print ''.$langs->trans("Currency".$conf->currency).''; + } + + + // Amount TTC + print ''.$langs->trans('AmountTTC').''; + print ''.price($object->total_ttc).''; + print ''.$langs->trans("Currency".$conf->currency).''; + + // Statut + print ''.$langs->trans('Status').''.$object->getLibStatut(4).''; + + print '
'; + + if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) + { + $blocname = 'contacts'; + $title = $langs->trans('ContactsAddresses'); + include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php'; + } + + if (! empty($conf->global->MAIN_DISABLE_NOTES_TAB)) + { + $blocname = 'notes'; + $title = $langs->trans('Notes'); + include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php'; + } + + /* + * Lines + */ + + if (! empty($conf->use_javascript_ajax) && $object->statut == 0) + { + include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; + } + + print ''; + + // Show object lines + $result = $object->getLinesArray(); + if (! empty($object->lines)) + $ret=$object->printObjectLines($action,$mysoc,$soc,$lineid); + + // Form to add new line + if ($object->statut == 0 && $user->rights->propal->creer) + { + if ($action != 'editline') + { + $var=true; + + if ($conf->global->MAIN_FEATURES_LEVEL > 1) + { + // Add free or predefined products/services + $object->formAddObjectLine(0,$mysoc,$soc); + } + else + { + // Add free products/services + $object->formAddFreeProduct(0,$mysoc,$soc); + + // Add predefined products/services + if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) + { + $var=!$var; + $object->formAddPredefinedProduct(0,$mysoc,$soc); + } + } + + $parameters=array(); + $reshook=$hookmanager->executeHooks('formAddObjectLine',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + } + } + + print '
'; + + print ''; + print "\n"; + + if ($action == 'statut') + { + /* + * Formulaire cloture (signe ou non) + */ + $form_close = '
'; + $form_close.= ''; + $form_close.= ''; + $form_close.= ''; + $form_close.= ''; + $form_close.= ''; + $form_close.= '
'.$langs->trans("CloseAs").''; + $form_close.= ''; + $form_close.= ''; + $form_close.= '
'.$langs->trans('Note').'
'; + $form_close.= ''; + $form_close.= '   '; + $form_close.= ' '; + $form_close.= '
'; + + print $form_close; + } + + + /* + * Boutons Actions + */ + if ($action != 'presend') + { + print '
'; + + if ($action != 'statut' && $action <> 'editline') + { + // Validate + if ($object->statut == 0 && $object->total_ttc >= 0 && count($object->lines) > 0 && $user->rights->propal->valider) + { + if (count($object->lines) > 0) print ''.$langs->trans('Validate').''; + //else print ''.$langs->trans('Validate').''; + } + + // Edit + if ($object->statut == 1 && $user->rights->propal->creer) + { + print ''.$langs->trans('Modify').''; + } + + // ReOpen + if (($object->statut == 2 || $object->statut == 3) && $user->rights->propal->cloturer) + { + print 'global->MAIN_JUMP_TAG)?'':'#reopen').'"'; + print '>'.$langs->trans('ReOpen').''; + } + + // Send + if ($object->statut == 1 || $object->statut == 2) + { + if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->propal->propal_advance->send) + { + print ''.$langs->trans('SendByMail').''; + } + else print ''.$langs->trans('SendByMail').''; + } + + // Create an order + if (! empty($conf->commande->enabled) && $object->statut == 2 && $user->societe_id == 0) + { + if ($user->rights->commande->creer) + { + print ''.$langs->trans("AddOrder").''; + } + } + + // Create contract + if ($conf->contrat->enabled && $object->statut == 2 && $user->societe_id == 0) + { + $langs->load("contracts"); + + if ($user->rights->contrat->creer) + { + print ''.$langs->trans('AddContract').''; + } + } + + // Create an invoice and classify billed + if ($object->statut == 2 && $user->societe_id == 0) + { + if (! empty($conf->facture->enabled) && $user->rights->facture->creer) + { + print ''.$langs->trans("AddBill").''; + } + + $arraypropal=$object->getInvoiceArrayList(); + if (is_array($arraypropal) && count($arraypropal) > 0) + { + print 'socid.'">'.$langs->trans("ClassifyBilled").''; + } + } + + // Close + if ($object->statut == 1 && $user->rights->propal->cloturer) + { + print 'global->MAIN_JUMP_TAG)?'':'#close').'"'; + print '>'.$langs->trans('Close').''; + } + + // Clone + if ($user->rights->propal->creer) + { + print ''.$langs->trans("ToClone").''; + } + + // Delete + if ($user->rights->propal->supprimer) + { + print ''.$langs->trans('Delete').''; + } + + } + + print '
'; + print "
\n"; + } + + if ($action != 'presend') + { + print '
'; + print ''; // ancre + + + /* + * Documents generes + */ + $filename=dol_sanitizeFileName($object->ref); + $filedir=$conf->propal->dir_output . "/" . dol_sanitizeFileName($object->ref); + $urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id; + $genallowed=$user->rights->propal->creer; + $delallowed=$user->rights->propal->supprimer; + + $var=true; + + $somethingshown=$formfile->show_documents('propal',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'',0,'',$soc->default_lang); + + + /* + * Linked object block + */ + $somethingshown=$object->showLinkedObjectBlock(); + + print ''; + + // List of actions on element + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; + $formactions=new FormActions($db); + $somethingshown=$formactions->showactions($object,'propal',$socid); + + print '
'; + } + + + /* + * Action presend + * + */ + if ($action == 'presend') + { + $ref = dol_sanitizeFileName($object->ref); + include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + $fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($object->ref,'/')); + $file=$fileparams['fullname']; + + // Build document if it not exists + if (! $file || ! is_readable($file)) + { + // Define output language + $outputlangs = $langs; + $newlang=''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; + if (! empty($newlang)) + { + $outputlangs = new Translate("",$conf); + $outputlangs->setDefaultLang($newlang); + } + + $result=propale_pdf_create($db, $object, GETPOST('model')?GETPOST('model'):$object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); + if ($result <= 0) + { + dol_print_error($db,$result); + exit; + } + $fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($object->ref,'/')); + $file=$fileparams['fullname']; + } + + print '
'; + print_titre($langs->trans('SendPropalByMail')); + + // Create form object + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; + $formmail = new FormMail($db); + $formmail->fromtype = 'user'; + $formmail->fromid = $user->id; + $formmail->fromname = $user->getFullName($langs); + $formmail->frommail = $user->email; + $formmail->withfrom=1; + $liste=array(); + foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key=>$value) $liste[$key]=$value; + $formmail->withto=GETPOST("sendto")?GETPOST("sendto"):$liste; + $formmail->withtocc=$liste; + $formmail->withtoccc=(! empty($conf->global->MAIN_EMAIL_USECCC)?$conf->global->MAIN_EMAIL_USECCC:false); + $formmail->withtopic=$langs->trans('SendPropalRef','__PROPREF__'); + $formmail->withfile=2; + $formmail->withbody=1; + $formmail->withdeliveryreceipt=1; + $formmail->withcancel=1; + + // Tableau des substitutions + $formmail->substit['__PROPREF__']=$object->ref; + $formmail->substit['__SIGNATURE__']=$user->signature; + $formmail->substit['__PERSONALIZED__']=''; + $formmail->substit['__CONTACTCIVNAME__']=''; + //Find the good contact adress $custcontact=''; $contactarr=array(); - $contactarr=$object->liste_contact(-1,'external'); - + $contactarr=$object->liste_contact(-1,'external'); + if (is_array($contactarr) && count($contactarr)>0) { foreach($contactarr as $contact) { if ($contact['libelle']==$langs->trans('TypeContact_propal_external_CUSTOMER')) { @@ -2257,29 +2257,29 @@ else if (!empty($custcontact)) { $formmail->substit['__CONTACTCIVNAME__']=$custcontact; } - } - - // Tableau des parametres complementaires - $formmail->param['action']='send'; - $formmail->param['models']='propal_send'; - $formmail->param['id']=$object->id; - $formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id; - - - // Init list of files - if (GETPOST("mode")=='init') - { - $formmail->clear_attached_files(); - $formmail->add_attached_files($file,basename($file),dol_mimetype($file)); - } - - $formmail->show_form(); - - print '
'; - } -} - -// End of page -llxFooter(); -$db->close(); -?> + } + + // Tableau des parametres complementaires + $formmail->param['action']='send'; + $formmail->param['models']='propal_send'; + $formmail->param['id']=$object->id; + $formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id; + + + // Init list of files + if (GETPOST("mode")=='init') + { + $formmail->clear_attached_files(); + $formmail->add_attached_files($file,basename($file),dol_mimetype($file)); + } + + $formmail->show_form(); + + print '
'; + } +} + +// End of page +llxFooter(); +$db->close(); +?> From 1f537300ea11e8c85a2c3d89015cd75834d53179 Mon Sep 17 00:00:00 2001 From: jfefe Date: Wed, 27 Mar 2013 19:11:42 +0100 Subject: [PATCH 038/194] Add hidden option MAIN_PROPAL_CHOOSE_ODT_DOCUMENT to enable choice of ODT document to use according to his status --- .../doc/doc_generic_proposal_odt.modules.php | 54 ++++++++++--------- 1 file changed, 30 insertions(+), 24 deletions(-) diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php index 959d9b29cd9..0878e4da181 100644 --- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php +++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php @@ -106,9 +106,12 @@ class doc_generic_proposal_odt extends ModelePDFPropales $texte.= ''; $texte.= ''; $texte.= ''; - $texte.= ''; - $texte.= ''; - $texte.= ''; + if ($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT > 0) + { + $texte.= ''; + $texte.= ''; + $texte.= ''; + } $texte.= ''; // List of directories area @@ -150,27 +153,30 @@ class doc_generic_proposal_odt extends ModelePDFPropales { $texte.=$langs->trans("NumberOfModelFilesFound").': '.count($listoffiles).''; - // Model for creation - $liste=ModelePDFPropales::liste_modeles($this->db); - $texte.= '
'; - $texte.= ''; - $texte.= ''; - $texte.= '"; - - $texte.= ''; - $texte.= ''; - $texte.= '"; - $texte.= ''; - - $texte.= ''; - $texte.= '"; - $texte.= '
'.$langs->trans("DefaultModelPropalCreate").''; - $texte.= $form->selectarray('value2',$liste,$conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT); - $texte.= "
'.$langs->trans("DefaultModelPropalToBill").''; - $texte.= $form->selectarray('value3',$liste,$conf->global->PROPALE_ADDON_PDF_ODT_TOBILL); - $texte.= "
'.$langs->trans("DefaultModelPropalClosed").''; - $texte.= $form->selectarray('value4',$liste,$conf->global->PROPALE_ADDON_PDF_ODT_CLOSED); - $texte.= "
'; + if ($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT > 0) + { + // Model for creation + $liste=ModelePDFPropales::liste_modeles($this->db); + $texte.= ''; + $texte.= ''; + $texte.= ''; + $texte.= '"; + + $texte.= ''; + $texte.= ''; + $texte.= '"; + $texte.= ''; + + $texte.= ''; + $texte.= '"; + $texte.= '
'.$langs->trans("DefaultModelPropalCreate").''; + $texte.= $form->selectarray('value2',$liste,$conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT); + $texte.= "
'.$langs->trans("DefaultModelPropalToBill").''; + $texte.= $form->selectarray('value3',$liste,$conf->global->PROPALE_ADDON_PDF_ODT_TOBILL); + $texte.= "
'.$langs->trans("DefaultModelPropalClosed").''; + $texte.= $form->selectarray('value4',$liste,$conf->global->PROPALE_ADDON_PDF_ODT_CLOSED); + $texte.= "
'; + } } From 1f5987b379a232498f504f1fc8cd8f7c4692dc77 Mon Sep 17 00:00:00 2001 From: jfefe Date: Wed, 27 Mar 2013 19:13:50 +0100 Subject: [PATCH 039/194] Fix trad & add english --- htdocs/langs/en_US/propal.lang | 3 +++ htdocs/langs/fr_FR/propal.lang | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/propal.lang b/htdocs/langs/en_US/propal.lang index 197a9f52146..a5f01c3e884 100644 --- a/htdocs/langs/en_US/propal.lang +++ b/htdocs/langs/en_US/propal.lang @@ -96,3 +96,6 @@ TypeContact_propal_external_CUSTOMER=Customer contact following-up proposal # Document models DocModelAzurDescription=A complete proposal model (logo...) DocModelJauneDescription=Jaune proposal model +DefaultModelPropalCreate=Default model creation +DefaultModelPropalToBill=Default template when closing a business proposal (to be invoiced) +DefaultModelPropalClosed=Default template when closing a business proposal (unbilled) diff --git a/htdocs/langs/fr_FR/propal.lang b/htdocs/langs/fr_FR/propal.lang index 5d5d1b2043c..5a52f3b442b 100644 --- a/htdocs/langs/fr_FR/propal.lang +++ b/htdocs/langs/fr_FR/propal.lang @@ -98,6 +98,6 @@ DocModelAzurDescription=Modèle de propositions commerciales complet (logo...) DocModelJauneDescription=Modèle de proposition Jaune Numbershort=N° DefaultModelPropalCreate=Modèle par défaut à la création -DefaultModelPropalToBill=Modèle lors de la cloture d'une proposition commerciale (à facturer) -DefaultModelPropalClosed=Modèle lors de la cloture d'une proposition commerciale (non facturée) +DefaultModelPropalToBill=Modèle par défaut lors de la cloture d'une proposition commerciale (à facturer) +DefaultModelPropalClosed=Modèle par défaut lors de la cloture d'une proposition commerciale (non facturée) From 55757a6b82ef5578d53dbc337e47c6544d05bf62 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 27 Mar 2013 20:42:55 +0100 Subject: [PATCH 040/194] Fix: $i is global --- htdocs/core/boxes/box_activity.php | 23 +++++++---------------- htdocs/core/boxes/modules_boxes.php | 2 +- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/htdocs/core/boxes/box_activity.php b/htdocs/core/boxes/box_activity.php index 1977e41970a..87e555958e8 100644 --- a/htdocs/core/boxes/box_activity.php +++ b/htdocs/core/boxes/box_activity.php @@ -41,18 +41,9 @@ class box_activity extends ModeleBoxes var $info_box_head = array(); var $info_box_contents = array(); - /** - * Constructor - */ - function __construct($db) - { - $this->db = $db; - - $this->enabled = 1; - // FIXME: Use a cache to save data because this slow down too much main home page. This box slow down too seriously software. - // FIXME: Removed number_format (not compatible with all languages) - // FIXME: Pb into some status - } + // FIXME: Use a cache to save data because this slow down too much main home page. This box slow down too seriously software. + // FIXME: Removed number_format (not compatible with all languages) + // FIXME: Pb into some status /** * Charge les donnees en memoire pour affichage ulterieur @@ -66,6 +57,7 @@ class box_activity extends ModeleBoxes $totalMnt = 0; $totalnb = 0; + $i = 0; include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; @@ -99,7 +91,6 @@ class box_activity extends ModeleBoxes if ($result) { $num = $db->num_rows($result); - $i = 0; while ($i < $num) { $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => 'bill'); @@ -140,7 +131,7 @@ class box_activity extends ModeleBoxes $result = $db->query($sql); if ($result) { - $num = $db->num_rows($result)+$i; + $num = $db->num_rows($result) + $i; $now=dol_now(); while ($i < $num) @@ -195,7 +186,7 @@ class box_activity extends ModeleBoxes if ($result) { - $num = $db->num_rows($result)+$i; + $num = $db->num_rows($result) + $i; while ($i < $num) { $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"','logo' => 'object_order'); @@ -246,7 +237,7 @@ class box_activity extends ModeleBoxes if ($result) { - $num = $db->num_rows($result)+$i; + $num = $db->num_rows($result) + $i; while ($i < $num) { $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"','logo' => 'object_propal'); diff --git a/htdocs/core/boxes/modules_boxes.php b/htdocs/core/boxes/modules_boxes.php index ad901b42ca9..7ca1b1dd4a2 100644 --- a/htdocs/core/boxes/modules_boxes.php +++ b/htdocs/core/boxes/modules_boxes.php @@ -33,7 +33,7 @@ class ModeleBoxes // Can't be abtract as it is instanciated to build "empty" var $error=''; var $max=5; var $enabled=1; - + var $rowid; var $id; var $position; From 0a3b7e79940bbffe556946d0198aab863a8944f3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 27 Mar 2013 20:43:28 +0100 Subject: [PATCH 041/194] New: Be able to get path of image without tag img --- htdocs/core/lib/functions.lib.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 835e5a36ee1..edc39c6d164 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1640,10 +1640,11 @@ function dol_trunc($string,$size=40,$trunc='right',$stringencoding='UTF-8',$nodo * Example: /mydir/mysubdir/picto.png if picto.png is stored into htdocs/mydir/mysubdir (pictoisfullpath must be set to 1) * @param string $options Add more attribute on img tag (For example 'style="float: right"') * @param int $pictoisfullpath If 1, image path is a full path + * @param int $srconly Return only content of the src attribute of img. * @return string Return img tag * @see #img_object, #img_picto_common */ -function img_picto($alt, $picto, $options = '', $pictoisfullpath = false) +function img_picto($alt, $picto, $options = '', $pictoisfullpath = false, $srconly=0) { global $conf; @@ -1678,7 +1679,8 @@ function img_picto($alt, $picto, $options = '', $pictoisfullpath = false) $fullpathpicto = $url.'/'.$path.'/img/'.$picto; } - return ''.dol_escape_htmltag($alt).''; + if ($srconly) return $fullpathpicto; + else return ''.dol_escape_htmltag($alt).''; } /** From 0108ee2bd8e66f2d4f6af20ad45eb51837fb0554 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 27 Mar 2013 20:48:57 +0100 Subject: [PATCH 042/194] Fix: Bad name of function --- htdocs/install/etape5.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/etape5.php b/htdocs/install/etape5.php index 4f7803c9786..499cc844db9 100644 --- a/htdocs/install/etape5.php +++ b/htdocs/install/etape5.php @@ -233,7 +233,7 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i',$action)) dolibarr_install_syslog('install/etape5.php Activate module file='.$file); $res=dol_include_once("/core/modules/".$file); - $res=Activate($modtoactivatenew,1); + $res=activateModule($modtoactivatenew,1); if (! $result) print 'ERROR in activating module file='.$file; } } From 013eac1147c7acd3caa4f1850a77d5579eb29c46 Mon Sep 17 00:00:00 2001 From: jfefe Date: Wed, 27 Mar 2013 21:24:45 +0100 Subject: [PATCH 043/194] Better error management when add/update extrafield Usage of setEventMessage() function --- .../adherents/admin/adherent_extrafields.php | 2 -- .../admin/adherent_type_extrafields.php | 2 -- htdocs/admin/agenda_extrafields.php | 2 -- htdocs/comm/admin/propal_extrafields.php | 2 -- .../admin/facture_cust_extrafields.php | 2 -- htdocs/core/admin_extrafields.inc.php | 28 ++++++++++++++----- htdocs/societe/admin/contact_extrafields.php | 2 -- htdocs/societe/admin/societe_extrafields.php | 2 -- htdocs/user/admin/user_extrafields.php | 2 -- 9 files changed, 21 insertions(+), 23 deletions(-) diff --git a/htdocs/adherents/admin/adherent_extrafields.php b/htdocs/adherents/admin/adherent_extrafields.php index ef104cab883..b0996ba457d 100755 --- a/htdocs/adherents/admin/adherent_extrafields.php +++ b/htdocs/adherents/admin/adherent_extrafields.php @@ -76,8 +76,6 @@ dol_fiche_head($head, 'attributes', $langs->trans("Member"), 0, 'user'); print $langs->trans("DefineHereComplementaryAttributes",$textobject).'
'."\n"; print '
'; -dol_htmloutput_errors($mesg); - // Load attribute_label $extrafields->fetch_name_optionals_label($elementtype); diff --git a/htdocs/adherents/admin/adherent_type_extrafields.php b/htdocs/adherents/admin/adherent_type_extrafields.php index 6afc89e7498..6048bb684ef 100644 --- a/htdocs/adherents/admin/adherent_type_extrafields.php +++ b/htdocs/adherents/admin/adherent_type_extrafields.php @@ -77,8 +77,6 @@ dol_fiche_head($head, 'attributes_type', $langs->trans("Member"), 0, 'user'); print $langs->trans("DefineHereComplementaryAttributes",$textobject).'
'."\n"; print '
'; -dol_htmloutput_errors($mesg); - // Load attribute_label $extrafields->fetch_name_optionals_label($elementtype); diff --git a/htdocs/admin/agenda_extrafields.php b/htdocs/admin/agenda_extrafields.php index 26bd6c8f5ee..901ddfa2148 100644 --- a/htdocs/admin/agenda_extrafields.php +++ b/htdocs/admin/agenda_extrafields.php @@ -78,8 +78,6 @@ dol_fiche_head($head, 'attributes', $langs->trans("Agenda")); print $langs->trans("DefineHereComplementaryAttributes",$textobject).'
'."\n"; print '
'; -dol_htmloutput_errors($mesg); - // Load attribute_label $extrafields->fetch_name_optionals_label($elementtype); diff --git a/htdocs/comm/admin/propal_extrafields.php b/htdocs/comm/admin/propal_extrafields.php index 9993019775e..26667c83669 100755 --- a/htdocs/comm/admin/propal_extrafields.php +++ b/htdocs/comm/admin/propal_extrafields.php @@ -76,8 +76,6 @@ dol_fiche_head($head, 'attributes', $langs->trans("Propal"), 0, 'propal'); print $langs->trans("DefineHereComplementaryAttributes",$textobject).'
'."\n"; print '
'; -dol_htmloutput_errors($mesg); - // Load attribute_label $extrafields->fetch_name_optionals_label($elementtype); diff --git a/htdocs/compta/facture/admin/facture_cust_extrafields.php b/htdocs/compta/facture/admin/facture_cust_extrafields.php index d08d5fe0ba8..57f4be119e6 100644 --- a/htdocs/compta/facture/admin/facture_cust_extrafields.php +++ b/htdocs/compta/facture/admin/facture_cust_extrafields.php @@ -77,8 +77,6 @@ dol_fiche_head($head, 'attributes', $langs->trans("Invoices"), 0, 'invoice'); print $langs->trans("DefineHereComplementaryAttributes",$textobject).'
'."\n"; -dol_htmloutput_errors($mesg); - // Load attribute_label $extrafields->fetch_name_optionals_label($elementtype); diff --git a/htdocs/core/admin_extrafields.inc.php b/htdocs/core/admin_extrafields.inc.php index 975fa94d308..43b04a83a9a 100644 --- a/htdocs/core/admin_extrafields.inc.php +++ b/htdocs/core/admin_extrafields.inc.php @@ -41,7 +41,7 @@ if ($action == 'add') { $error++; $langs->load("errors"); - $mesg=$langs->trans("ErrorFieldRequired",$langs->trans("Type")); + $mesg[]=$langs->trans("ErrorFieldRequired",$langs->trans("Type")); $action = 'create'; } @@ -49,21 +49,21 @@ if ($action == 'add') { $error++; $langs->load("errors"); - $mesg=$langs->trans("ErrorSizeTooLongForVarcharType",$maxsizestring); + $mesg[]=$langs->trans("ErrorSizeTooLongForVarcharType",$maxsizestring); $action = 'create'; } if (GETPOST('type')=='int' && $extrasize > $maxsizeint) { $error++; $langs->load("errors"); - $mesg=$langs->trans("ErrorSizeTooLongForIntType",$maxsizeint); + $mesg[]=$langs->trans("ErrorSizeTooLongForIntType",$maxsizeint); $action = 'create'; } if (GETPOST('type')=='select' && !GETPOST('param')) { $error++; $langs->load("errors"); - $mesg=$langs->trans("ErrorNoValueForSelectType"); + $mesg[]=$langs->trans("ErrorNoValueForSelectType"); $action = 'create'; } @@ -84,6 +84,7 @@ if ($action == 'add') $result=$extrafields->addExtraField($_POST['attrname'],$_POST['label'],$_POST['type'],$_POST['pos'],$extrasize,$elementtype,(GETPOST('unique')?1:0),(GETPOST('required')?1:0),$default_value,$params); if ($result > 0) { + setEventMessage($langs->trans('SetupSaved')); header("Location: ".$_SERVER["PHP_SELF"]); exit; } @@ -91,6 +92,7 @@ if ($action == 'add') { $error++; $mesg=$extrafields->error; + setEventMessage($mesg,'error'); } } else @@ -98,9 +100,14 @@ if ($action == 'add') $error++; $langs->load("errors"); $mesg=$langs->trans("ErrorFieldCanNotContainSpecialCharacters",$langs->transnoentities("AttributeCode")); + setEventMessage($mesg,'error'); $action = 'create'; } } + else + { + setEventMessage($mesg,'errors'); + } } } @@ -114,21 +121,21 @@ if ($action == 'update') { $error++; $langs->load("errors"); - $mesg=$langs->trans("ErrorFieldRequired",$langs->trans("Type")); + $mesg[]=$langs->trans("ErrorFieldRequired",$langs->trans("Type")); $action = 'create'; } if (GETPOST('type')=='varchar' && $extrasize > $maxsizestring) { $error++; $langs->load("errors"); - $mesg=$langs->trans("ErrorSizeTooLongForVarcharType",$maxsizestring); + $mesg[]=$langs->trans("ErrorSizeTooLongForVarcharType",$maxsizestring); $action = 'edit'; } if (GETPOST('type')=='int' && $extrasize > $maxsizeint) { $error++; $langs->load("errors"); - $mesg=$langs->trans("ErrorSizeTooLongForIntType",$maxsizeint); + $mesg[]=$langs->trans("ErrorSizeTooLongForIntType",$maxsizeint); $action = 'edit'; } @@ -148,6 +155,7 @@ if ($action == 'update') $result=$extrafields->update($_POST['attrname'],$_POST['label'],$_POST['type'],$extrasize,$elementtype,(GETPOST('unique')?1:0),(GETPOST('required')?1:0),$pos,$params); if ($result > 0) { + setEventMessage($langs->trans('SetupSaved')); header("Location: ".$_SERVER["PHP_SELF"]); exit; } @@ -155,6 +163,7 @@ if ($action == 'update') { $error++; $mesg=$extrafields->error; + setEventMessage($mesg,'errors'); } } else @@ -162,8 +171,13 @@ if ($action == 'update') $error++; $langs->load("errors"); $mesg=$langs->trans("ErrorFieldCanNotContainSpecialCharacters",$langs->transnoentities("AttributeCode")); + setEventMessage($mesg,'errors'); } } + else + { + setEventMessage($mesg,'errors'); + } } } diff --git a/htdocs/societe/admin/contact_extrafields.php b/htdocs/societe/admin/contact_extrafields.php index 892e6318dca..a2460c6cda4 100755 --- a/htdocs/societe/admin/contact_extrafields.php +++ b/htdocs/societe/admin/contact_extrafields.php @@ -76,8 +76,6 @@ dol_fiche_head($head, 'attributes_contacts', $langs->trans("ThirdParties"), 0, ' print $langs->trans("DefineHereComplementaryAttributes",$textobject).'
'."\n"; print '
'; -dol_htmloutput_errors($mesg); - // Load attribute_label $extrafields->fetch_name_optionals_label($elementtype); diff --git a/htdocs/societe/admin/societe_extrafields.php b/htdocs/societe/admin/societe_extrafields.php index 4ad507dc468..11cb02e80ae 100755 --- a/htdocs/societe/admin/societe_extrafields.php +++ b/htdocs/societe/admin/societe_extrafields.php @@ -77,8 +77,6 @@ dol_fiche_head($head, 'attributes', $langs->trans("ThirdParties"), 0, 'company') print $langs->trans("DefineHereComplementaryAttributes",$textobject).'
'."\n"; print '
'; -dol_htmloutput_errors($mesg); - // Load attribute_label $extrafields->fetch_name_optionals_label($elementtype); diff --git a/htdocs/user/admin/user_extrafields.php b/htdocs/user/admin/user_extrafields.php index b9b1cd9811e..8b4bc780cbf 100644 --- a/htdocs/user/admin/user_extrafields.php +++ b/htdocs/user/admin/user_extrafields.php @@ -76,8 +76,6 @@ dol_fiche_head($head, 'attributes', $langs->trans("User"), 0, 'user'); print $langs->trans("DefineHereComplementaryAttributes",$textobject).'
'."\n"; print '
'; -dol_htmloutput_errors($mesg); - // Load attribute_label $extrafields->fetch_name_optionals_label($elementtype); From eda61879821af0f2d4bd9f00ee47e88aa099e1c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20de=20Chateauvieux?= Date: Thu, 28 Mar 2013 09:30:42 +0400 Subject: [PATCH 044/194] TVA NPR : can use * in tva when set supplier price --- htdocs/product/fournisseurs.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 43929c96b0c..97011f44c30 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -95,7 +95,9 @@ if ($action == 'updateprice' && GETPOST('cancel') <> $langs->trans("Cancel")) if (empty($ref_fourn)) $ref_fourn=GETPOST("search_ref_fourn"); $quantity=GETPOST("qty"); $remise_percent=price2num(GETPOST('remise_percent','alpha')); - $tva_tx=price2num(GETPOST('tva_tx','alpha')); + $npr = preg_match('/\*/', $_POST['tva_tx']) ? 1 : 0 ; + $tva_tx = str_replace('*','', GETPOST('tva_tx','alpha')); + $tva_tx = price2num($tva_tx); if (empty($quantity)) { @@ -156,7 +158,7 @@ if ($action == 'updateprice' && GETPOST('cancel') <> $langs->trans("Cancel")) if (isset($_POST['ref_fourn_price_id'])) $product->fetch_product_fournisseur_price($_POST['ref_fourn_price_id']); - $ret=$product->update_buyprice($quantity, $_POST["price"], $user, $_POST["price_base_type"], $supplier, $_POST["oselDispo"], $ref_fourn, $tva_tx, $_POST["charges"], $remise_percent); + $ret=$product->update_buyprice($quantity, $_POST["price"], $user, $_POST["price_base_type"], $supplier, $_POST["oselDispo"], $ref_fourn, $tva_tx, $_POST["charges"], $remise_percent, $npr); if ($ret < 0) { $error++; @@ -527,4 +529,4 @@ else // End of page llxFooter(); $db->close(); -?> \ No newline at end of file +?> From ed2b359dae523fc62c5066e06e44d0911017c0e6 Mon Sep 17 00:00:00 2001 From: jfefe Date: Thu, 28 Mar 2013 06:48:21 +0100 Subject: [PATCH 045/194] Bad parameter when calling setEventMessage function --- htdocs/core/admin_extrafields.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/admin_extrafields.inc.php b/htdocs/core/admin_extrafields.inc.php index 43b04a83a9a..ea4f26c8509 100644 --- a/htdocs/core/admin_extrafields.inc.php +++ b/htdocs/core/admin_extrafields.inc.php @@ -92,7 +92,7 @@ if ($action == 'add') { $error++; $mesg=$extrafields->error; - setEventMessage($mesg,'error'); + setEventMessage($mesg,'errors'); } } else @@ -100,7 +100,7 @@ if ($action == 'add') $error++; $langs->load("errors"); $mesg=$langs->trans("ErrorFieldCanNotContainSpecialCharacters",$langs->transnoentities("AttributeCode")); - setEventMessage($mesg,'error'); + setEventMessage($mesg,'errors'); $action = 'create'; } } From 5921033f9437e7ab7bb135c7fde734431ab9978d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20de=20Chateauvieux?= Date: Thu, 28 Mar 2013 09:51:49 +0400 Subject: [PATCH 046/194] TVA NPR : Change field name recuperableonly to info_bits --- htdocs/fourn/class/fournisseur.product.class.php | 8 ++++---- .../mysql/tables/llx_product_fournisseur_price.sql | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 40e19664681..6c0ee20b89b 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -189,7 +189,7 @@ class ProductFournisseur extends Product $sql.= " tva_tx = ".$tva_tx.","; $sql.= " fk_availability = ".$availability.","; $sql.= " entity = ".$conf->entity.","; - $sql.= " recuperableonly = ".$newnpr.","; + $sql.= " info_bits = ".$newnpr.","; $sql.= " charges = ".$charges; $sql.= " WHERE rowid = ".$this->product_fourn_price_id; // TODO Add price_base_type and price_ttc @@ -220,7 +220,7 @@ class ProductFournisseur extends Product { // Add price for this quantity to supplier $sql = "INSERT INTO ".MAIN_DB_PREFIX."product_fournisseur_price("; - $sql.= "datec, fk_product, fk_soc, ref_fourn, fk_user, price, quantity, remise_percent, remise, unitprice, tva_tx, charges, unitcharges, fk_availability, entity, recuperableonly)"; + $sql.= "datec, fk_product, fk_soc, ref_fourn, fk_user, price, quantity, remise_percent, remise, unitprice, tva_tx, charges, unitcharges, fk_availability, entity, info_bits)"; $sql.= " values('".$this->db->idate($now)."',"; $sql.= " ".$this->id.","; $sql.= " ".$fourn->id.","; @@ -350,7 +350,7 @@ class ProductFournisseur extends Product $sql = "SELECT s.nom as supplier_name, s.rowid as fourn_id,"; $sql.= " pfp.rowid as product_fourn_pri_id, pfp.ref_fourn, pfp.fk_product as product_fourn_id,"; - $sql.= " pfp.price, pfp.quantity, pfp.unitprice, pfp.remise_percent, pfp.remise, pfp.tva_tx, pfp.fk_availability, pfp.charges, pfp.unitcharges, pfp.recuperableonly"; + $sql.= " pfp.price, pfp.quantity, pfp.unitprice, pfp.remise_percent, pfp.remise, pfp.tva_tx, pfp.fk_availability, pfp.charges, pfp.unitcharges, pfp.info_bits"; $sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp"; $sql.= ", ".MAIN_DB_PREFIX."societe as s"; $sql.= " WHERE pfp.entity IN (".getEntity('product', 1).")"; @@ -385,7 +385,7 @@ class ProductFournisseur extends Product $prodfourn->fourn_name = $record["supplier_name"]; $prodfourn->fk_availability = $record["fk_availability"]; $prodfourn->id = $prodid; - $prodfourn->fourn_tva_npr = $record["recuperableonly"]; + $prodfourn->fourn_tva_npr = $record["info_bits"]; if (!isset($prodfourn->fourn_unitprice)) { diff --git a/htdocs/install/mysql/tables/llx_product_fournisseur_price.sql b/htdocs/install/mysql/tables/llx_product_fournisseur_price.sql index 01789ff8edd..2a26034c130 100644 --- a/htdocs/install/mysql/tables/llx_product_fournisseur_price.sql +++ b/htdocs/install/mysql/tables/llx_product_fournisseur_price.sql @@ -37,7 +37,7 @@ create table llx_product_fournisseur_price charges double(24,8) DEFAULT 0, unitcharges double(24,8) DEFAULT 0, tva_tx double(6,3) NOT NULL, - recuperableonly integer NOT NULL DEFAULT 0, + info_bits integer NOT NULL DEFAULT 0, fk_user integer, import_key varchar(14) -- Import key )ENGINE=innodb; From 3c3c0b456e856c9b8b60d6f9d241ef37e9af70b5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Mar 2013 09:59:59 +0100 Subject: [PATCH 047/194] Fix: _ not allowed into prestashop tags. --- htdocs/admin/sms.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/sms.php b/htdocs/admin/sms.php index 45bbcaa76e9..de795f4683b 100755 --- a/htdocs/admin/sms.php +++ b/htdocs/admin/sms.php @@ -161,7 +161,7 @@ if ($action == 'edit') { $form=new Form($db); - if (! count($listofmethods)) print '
'.$langs->trans("NoSmsEngine",'DoliStore').'
'; + if (! count($listofmethods)) print '
'.$langs->trans("NoSmsEngine",'DoliStore').'
'; print '
'; print ''; @@ -217,7 +217,7 @@ else { $var=true; - if (! count($listofmethods)) print '
'.$langs->trans("NoSmsEngine",'DoliStore').'
'; + if (! count($listofmethods)) print '
'.$langs->trans("NoSmsEngine",'DoliStore').'
'; print ''; print ''; From c2be118efdaa1ad5f1c754254ea903450a1e5378 Mon Sep 17 00:00:00 2001 From: fhenry Date: Thu, 28 Mar 2013 20:51:00 +0100 Subject: [PATCH 048/194] Add more information in ODT project template --- .../pdf/doc_generic_project_odt.modules.php | 198 +++++++++++++++++- .../doctemplates/project/template_project.odt | Bin 28586 -> 0 bytes .../project/template_task_summary.odt | Bin 15625 -> 0 bytes .../projects/template_project.odt | Bin 0 -> 29375 bytes .../projects/template_task_summary.odt | Bin 0 -> 19309 bytes htdocs/install/etape1.php | 2 +- 6 files changed, 196 insertions(+), 4 deletions(-) delete mode 100755 htdocs/install/doctemplates/project/template_project.odt delete mode 100755 htdocs/install/doctemplates/project/template_task_summary.odt create mode 100755 htdocs/install/doctemplates/projects/template_project.odt create mode 100755 htdocs/install/doctemplates/projects/template_task_summary.odt diff --git a/htdocs/core/modules/project/pdf/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/pdf/doc_generic_project_odt.modules.php index a1aa87366d9..34cd23a0a7f 100644 --- a/htdocs/core/modules/project/pdf/doc_generic_project_odt.modules.php +++ b/htdocs/core/modules/project/pdf/doc_generic_project_odt.modules.php @@ -34,6 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; if (! empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; if (! empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php'; @@ -151,7 +152,9 @@ class doc_generic_project_odt extends ModelePDFProjects 'task_progress'=>$task->progress, 'task_public'=>$task->public, 'task_date_start'=>dol_print_date($task->date_start,'day'), - 'task_date_end'=>dol_print_date($task->date_end,'day') + 'task_date_end'=>dol_print_date($task->date_end,'day'), + 'task_note_private'=>$task->note_private, + 'task_note_public'=>$task->note_public ); } @@ -218,6 +221,68 @@ class doc_generic_project_odt extends ModelePDFProjects ); } + /** + * Define array with couple substitution key => substitution value + * + * @param array $taskressource Reference array + * @param Translate $outputlangs Lang object to use for output + * @return array Return a substitution array + */ + function get_substitutionarray_tasksressource($taskressource,$outputlangs) + { + global $conf; + //dol_syslog(get_class($this).'::get_substitutionarray_tasksressource taskressource='.var_export($taskressource,true),LOG_DEBUG); + return array( + 'taskressource_rowid'=>$taskressource['rowid'], + 'taskressource_role'=>$taskressource['libelle'], + 'taskressource_lastname'=>$taskressource['lastname'], + 'taskressource_firstname'=>$taskressource['firstname'], + 'taskressource_fullcivname'=>$taskressource['fullname'], + 'taskressource_socname'=>$taskressource['socname'], + 'taskressource_email'=>$taskressource['email'] + ); + } + + /** + * Define array with couple substitution key => substitution value + * + * @param object $tasktime times object + * @param Translate $outputlangs Lang object to use for output + * @return array Return a substitution array + */ + function get_substitutionarray_taskstime($tasktime,$outputlangs) + { + global $conf; + + return array( + 'tasktime_rowid'=>$tasktime['rowid'], + 'tasktime_task_date'=>dol_print_date($tasktime['task_date'],'day'), + 'tasktime_task_duration'=>convertSecondToTime($tasktime['task_duration'],'all'), + 'tasktime_note'=>$tasktime['note'], + 'tasktime_fk_user'=>$tasktime['fk_user'], + 'tasktime_user_name'=>$tasktime['name'], + 'tasktime_user_first'=>$tasktime['firstname'], + 'tasktime_fullcivname'=>$tasktime['fullcivname'] + ); + } + + /** + * Define array with couple substitution key => substitution value + * + * @param array $file file array + * @param Translate $outputlangs Lang object to use for output + * @return array Return a substitution array + */ + function get_substitutionarray_task_file($file,$outputlangs) + { + global $conf; + + return array( + 'tasksfile_name'=>$file['name'], + 'tasksfile_date'=>dol_print_date($file['date'],'day'), + 'tasksfile_size'=>$file['size'] + ); + } /** @@ -519,6 +584,134 @@ class doc_generic_project_odt extends ModelePDFProjects { } } + + $taskobj=new Task($this->db); + $taskobj->fetch($task->id); + + // Replace tags of lines for contacts task + $sourcearray=array('internal','external'); + $contact_arrray=array(); + foreach ($sourcearray as $source) { + $contact_temp=$taskobj->liste_contact(-1,$source); + if ((is_array($contact_temp) && count($contact_temp) > 0)) + { + $contact_arrray=array_merge($contact_arrray,$contact_temp); + } + } + if ((is_array($contact_arrray) && count($contact_arrray) > 0)) + { + $listlinestaskres = $listlines->__get('tasksressources'); + + foreach ($contact_arrray as $contact) + { + if ($contact['source']=='internal') { + $objectdetail=new User($this->db); + $objectdetail->fetch($contact['id']); + $contact['socname']=$mysoc->name; + } elseif ($contact['source']=='external') { + $objectdetail=new Contact($this->db); + $objectdetail->fetch($contact['id']); + + $soc=new Societe($this->db); + $soc->fetch($contact['socid']); + $contact['socname']=$soc->name; + } + $contact['fullname']=$objectdetail->getFullName($outputlangs,1); + + $tmparray=$this->get_substitutionarray_tasksressource($contact,$outputlangs); + + foreach($tmparray as $key => $val) + { + try + { + $listlinestaskres->setVars($key, $val, true, 'UTF-8'); + } + catch(OdfException $e) + { + } + catch(SegmentException $e) + { + } + } + $listlinestaskres->merge(); + } + } + + //Time ressources + $sql = "SELECT t.rowid, t.task_date, t.task_duration, t.fk_user, t.note"; + $sql.= ", u.name, u.firstname"; + $sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t"; + $sql .= " , ".MAIN_DB_PREFIX."user as u"; + $sql .= " WHERE t.fk_task =".$task->id; + $sql .= " AND t.fk_user = u.rowid"; + $sql .= " ORDER BY t.task_date DESC"; + + $resql = $this->db->query($sql); + if ($resql) + { + $num = $this->db->num_rows($resql); + $i = 0; + $tasks = array(); + $listlinestasktime = $listlines->__get('taskstimes'); + while ($i < $num) + { + $row = $this->db->fetch_array($resql); + if (!empty($row['fk_user'])) { + $objectdetail=new User($this->db); + $objectdetail->fetch($row['fk_user']); + $row['fullcivname']=$objectdetail->getFullName($outputlangs,1); + } else { + $row['fullcivname']=''; + } + + $tmparray=$this->get_substitutionarray_taskstime($row,$outputlangs); + + foreach($tmparray as $key => $val) + { + try + { + $listlinestasktime->setVars($key, $val, true, 'UTF-8'); + } + catch(OdfException $e) + { + } + catch(SegmentException $e) + { + } + } + $listlinestasktime->merge(); + $i++; + } + $this->db->free($resql); + } + + + // Replace tags of project files + $listtasksfiles = $listlines->__get('tasksfiles'); + + $upload_dir = $conf->projet->dir_output.'/'.dol_sanitizeFileName($object->ref).'/'.dol_sanitizeFileName($task->ref); + $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$','name',SORT_ASC,1); + + + foreach ($filearray as $filedetail) + { + $tmparray=$this->get_substitutionarray_task_file($filedetail,$outputlangs); + //dol_syslog(get_class($this).'::main $tmparray'.var_export($tmparray,true)); + foreach($tmparray as $key => $val) + { + try + { + $listtasksfiles->setVars($key, $val, true, 'UTF-8'); + } + catch(OdfException $e) + { + } + catch(SegmentException $e) + { + } + } + $listtasksfiles->merge(); + } $listlines->merge(); } $odfHandler->mergeSegment($listlines); @@ -541,7 +734,7 @@ class doc_generic_project_odt extends ModelePDFProjects foreach ($filearray as $filedetail) { - //dol_syslog(get_class($this).'::ee $filedetail'.var_export($filedetail,true)); + //dol_syslog(get_class($this).'::main $filedetail'.var_export($filedetail,true)); $tmparray=$this->get_substitutionarray_project_file($filedetail,$outputlangs); foreach($tmparray as $key => $val) @@ -766,7 +959,6 @@ class doc_generic_project_odt extends ModelePDFProjects } // Write new file - //$result=$odfHandler->exportAsAttachedFile('toto'); $odfHandler->saveToDisk($file); if (! empty($conf->global->MAIN_UMASK)) diff --git a/htdocs/install/doctemplates/project/template_project.odt b/htdocs/install/doctemplates/project/template_project.odt deleted file mode 100755 index ff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;m3Lm#(6eQkMj2GYyOE20%Xa^Fr=a?+hkdowfw^KUQ z#b} z%t{{6oa9`c4;D53==SKaRJrt!QJ4XlJ}F2;!{9>wdjL2{lmC|P!@>Ps>+g}?eyPYp z{`|MNZ}%wohj)HIdUHpizfud&Uyt(qUGw+#io2sZzY_7YzZ}&0yW;Q94DOaQekBUE z-xoLjuJ`-g^slZ?>HhWk!oBAGDEj-{^_Rt5BgkC?a=*Eo$=++-H_h+F`B!^9W`Dic z+-u(3`-Kk$bvN*SB{%c`v_Gibq_ux+No-6N&_E#$V2b_PQ-T&s?9nJnqNEZL; z+%MAoYoGn4^)t@kuWSB)K>0<&|0{~)KcM^~<$p)HqvcXha`fc;MDKXLAR)9(~?N9(`RTL{iSlDvX6Ji?tA PHsq%O!d$mjcUS)hQNnij literal 0 HcmV?d00001 diff --git a/htdocs/install/doctemplates/projects/template_task_summary.odt b/htdocs/install/doctemplates/projects/template_task_summary.odt new file mode 100755 index 0000000000000000000000000000000000000000..84fbe00ccc9703adef642faa7412ea3648999d6c GIT binary patch literal 19309 zcmd43byOY6x(7-i1Pj4J2<|Q$cXxM!ySr;}cXxM};10pv-QC?C9?VS6%$zglu6y76 z=ha%ZcX!oiRo(Tg>aRpn1myi^ARurcAmLtlZlPe`i5C=fCEvmEaanSLp}&Vq7_+?O z2pu@cr`#=C_hcMit;6n>zLxuOSfxv>%+OG47)5Jn74>L+A~s%JYbrQSeRAiDH8A9o z`h6mG`O#|Faaa>Ig#SH|na0fx1P}BXZlJQ&zAGcQ5OjN*rza&n5l?n_Dd!B&2Eh#pXd(Y8a=FA#sVN%C z8O=^R$^1F$%i|gT#M9wkEIF06CVzj|M zi5xT@i@PC^&xRiI2razoc(+5vSqH*#c9(DP;eLjmc7tJecfddu6or`ofgQgf1+rPu)2t>V0{-(E89dHq^IncFk*^m$hx@l9&KnnRX%fj}9h+xn5;PA=uP34d zlU!^QJe{m&KvwHyrY8U8R8)Q;Lf3Loq=SJ439}o57!3c38E<1NKLnah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ape1.php +++ b/htdocs/install/etape1.php @@ -400,7 +400,7 @@ if (! $error && $db->connected && $action == "set") require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $srcroot=$main_dir.'/install/doctemplates'; $destroot=$main_data_dir.'/doctemplates'; - $docs=array('thirdparties' => 'thirdparty', 'proposals' => 'proposal', 'orders' => 'order', 'invoices' => 'invoice', 'projects' => 'project'); + $docs=array('thirdparties' => 'thirdparty', 'proposals' => 'proposal', 'orders' => 'order', 'invoices' => 'invoice', 'projects' => 'project', 'projects' => 'task_summary'); foreach($docs as $cursordir => $cursorfile) { $src=$srcroot.'/'.$cursordir.'/template_'.$cursorfile.'.odt'; From e745cbb5cf9f5c50b22c8846be4092430b002c20 Mon Sep 17 00:00:00 2001 From: fhenry Date: Thu, 28 Mar 2013 22:13:04 +0100 Subject: [PATCH 049/194] Add missing column into llx_extrafield creation --- htdocs/install/mysql/tables/llx_extrafields.sql | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_extrafields.sql b/htdocs/install/mysql/tables/llx_extrafields.sql index 04ed6eba157..ba4c7df964f 100755 --- a/htdocs/install/mysql/tables/llx_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_extrafields.sql @@ -22,12 +22,13 @@ create table llx_extrafields rowid integer AUTO_INCREMENT PRIMARY KEY, name varchar(64) NOT NULL, -- nom de l'attribut entity integer DEFAULT 1 NOT NULL, -- multi company id - elementtype varchar(64) NOT NULL DEFAULT 'member', + elementtype varchar(64) NOT NULL DEFAULT 'member', tms timestamp, label varchar(255) NOT NULL, -- label correspondant a l'attribut type varchar(8), size varchar(8) DEFAULT NULL, fieldunique integer DEFAULT 0, fieldrequired integer DEFAULT 0, - pos integer DEFAULT 0 + pos integer DEFAULT 0, + param text )ENGINE=innodb; From d5a1f64e760c5232b93a1f232bcc37d1f95feb19 Mon Sep 17 00:00:00 2001 From: BENKE Charles Date: Fri, 29 Mar 2013 02:09:19 +0100 Subject: [PATCH 050/194] Update mysql.class.php some other problems about DDLCreateTable, other field setting not actived --- htdocs/core/db/mysql.class.php | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/htdocs/core/db/mysql.class.php b/htdocs/core/db/mysql.class.php index 1143372bb98..4868fb81642 100644 --- a/htdocs/core/db/mysql.class.php +++ b/htdocs/core/db/mysql.class.php @@ -886,21 +886,23 @@ class DoliDBMysql $sqlfields[$i] = $field_name." "; $sqlfields[$i] .= $field_desc['type']; if( preg_match("/^[^\s]/i",$field_desc['value'])) - $sqlfields[$i] .= "(".$field_desc['value'].")"; - else if( preg_match("/^[^\s]/i",$field_desc['attribute'])) - $sqlfields[$i] .= " ".$field_desc['attribute']; - else if( preg_match("/^[^\s]/i",$field_desc['default'])) + $sqlfields[$i] .= "(".$field_desc['value'].")"; + if( preg_match("/^[^\s]/i",$field_desc['attribute'])) + $sqlfields[$i] .= " ".$field_desc['attribute']; + if( preg_match("/^[^\s]/i",$field_desc['default'])) { if(preg_match("/null/i",$field_desc['default'])) - $sqlfields[$i] .= " default ".$field_desc['default']; + $sqlfields[$i] .= " default ".$field_desc['default']; + elseif ($field_desc['default'] == 'CURRENT_TIMESTAMP') + $sqlfields[$i] .= " default ".$field_desc['default']; else - $sqlfields[$i] .= " default '".$field_desc['default']."'"; + $sqlfields[$i] .= " default '".$field_desc['default']."'"; } - else if( preg_match("/^[^\s]/i",$field_desc['null'])) - $sqlfields[$i] .= " ".$field_desc['null']; + if( preg_match("/^[^\s]/i",$field_desc['null'])) + $sqlfields[$i] .= " ".$field_desc['null']; - else if( preg_match("/^[^\s]/i",$field_desc['extra'])) - $sqlfields[$i] .= " ".$field_desc['extra']; + if( preg_match("/^[^\s]/i",$field_desc['extra'])) + $sqlfields[$i] .= " ".$field_desc['extra']; $i++; } if($primary_key != "") From 888da9f3e9f1fa073c4b6cd4e4f1d54b1ccebf9c Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 29 Mar 2013 11:52:18 +0100 Subject: [PATCH 051/194] Fix: file with a specific mask not found --- htdocs/comm/propal.php | 3794 ++++++++++++++++++++-------------------- 1 file changed, 1897 insertions(+), 1897 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 1201fbf8835..b6ef6d3f5b8 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -1,742 +1,742 @@ - - * Copyright (C) 2004-2013 Laurent Destailleur - * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2005 Marc Barilley / Ocebo - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2006 Andre Cianfarani - * Copyright (C) 2010-2012 Juanjo Menent - * Copyright (C) 2010-2011 Philippe Grand - * Copyright (C) 2012 Christophe Battarel -* - * 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/comm/propal.php - * \ingroup propale - * \brief Page of commercial proposals card and list - */ - -require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formpropal.class.php'; -require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; -require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/modules/propale/modules_propale.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; - -$langs->load('companies'); -$langs->load('propal'); -$langs->load('compta'); -$langs->load('bills'); -$langs->load('orders'); -$langs->load('products'); -if (! empty($conf->margin->enabled)) - $langs->load('margins'); - -$error=0; - -$id=GETPOST('id','int'); -$ref=GETPOST('ref','alpha'); -$socid=GETPOST('socid','int'); -$action=GETPOST('action','alpha'); -$confirm=GETPOST('confirm','alpha'); -$lineid=GETPOST('lineid','int'); - -//PDF -$hidedetails = (GETPOST('hidedetails','int') ? GETPOST('hidedetails','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0)); -$hidedesc = (GETPOST('hidedesc','int') ? GETPOST('hidedesc','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0)); -$hideref = (GETPOST('hideref','int') ? GETPOST('hideref','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0)); - -// Nombre de ligne pour choix de produit/service predefinis -$NBLINES=4; - -// Security check -if (! empty($user->societe_id)) $socid=$user->societe_id; -$result = restrictedArea($user, 'propal', $id); - -$object = new Propal($db); - -// Load object -if ($id > 0 || ! empty($ref)) -{ - if ($action != 'add') - { - $ret=$object->fetch($id, $ref); - if ($ret == 0) - { - $langs->load("errors"); - setEventMessage($langs->trans('ErrorRecordNotFound'), 'errors'); - $error++; - } - else if ($ret < 0) - { - setEventMessage($object->error, 'errors'); - $error++; - } - else $object->fetch_thirdparty(); - } -} -else -{ - header('Location: '.DOL_URL_ROOT.'/comm/propal/list.php'); - exit; -} - -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array -include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; -$hookmanager=new HookManager($db); -$hookmanager->initHooks(array('propalcard')); - - - -/* - * Actions - */ - -$parameters=array('socid'=>$socid); -$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks - -// Action clone object -if ($action == 'confirm_clone' && $confirm == 'yes') -{ - if (1==0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers')) - { - setEventMessage($langs->trans("NoCloneOptionsSpecified"), 'errors'); - } - else - { - if ($object->id > 0) - { - $result=$object->createFromClone($socid, $hookmanager); - if ($result > 0) - { - header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result); - exit; - } - else - { - setEventMessage($object->error, 'errors'); - $action=''; - } - } - } -} - -// Suppression de la propale -else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->propal->supprimer) -{ - $result=$object->delete($user); - if ($result > 0) - { - header('Location: '.DOL_URL_ROOT.'/comm/propal/list.php'); - exit; - } - else - { - $langs->load("errors"); - setEventMessage($langs->trans($object->error), 'errors'); - } -} - -// Remove line -else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->propal->creer) -{ - $result = $object->deleteline($lineid); - // reorder lines - if ($result) $object->line_order(true); - - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) - { - // Define output language - $outputlangs = $langs; - if (! empty($conf->global->MAIN_MULTILANGS)) - { - $outputlangs = new Translate("",$conf); - $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); - $outputlangs->setDefaultLang($newlang); - } - $ret=$object->fetch($id); // Reload to get new records - propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); - } - - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); - exit; -} - -// Validation -else if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->propal->valider) -{ - $result=$object->valid($user); - if ($result >= 0) - { - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) - { - // Define output language - $outputlangs = $langs; - if (! empty($conf->global->MAIN_MULTILANGS)) - { - $outputlangs = new Translate("",$conf); - $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); - $outputlangs->setDefaultLang($newlang); - } - $ret=$object->fetch($id); // Reload to get new records - propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); - } - } - else - { - $langs->load("errors"); - setEventMessage($langs->trans($object->error), 'errors'); - } -} - -else if ($action == 'setdate' && $user->rights->propal->creer) -{ - $datep=dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); - - if (empty($datep)) - { - $error++; - setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")), 'errors'); - } - - if (! $error) - { - $result=$object->set_date($user,$datep); - if ($result < 0) dol_print_error($db,$object->error); - } -} -else if ($action == 'setecheance' && $user->rights->propal->creer) -{ - $result=$object->set_echeance($user,dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear'])); - if ($result < 0) dol_print_error($db,$object->error); -} -else if ($action == 'setdate_livraison' && $user->rights->propal->creer) -{ - $result=$object->set_date_livraison($user,dol_mktime(12, 0, 0, $_POST['liv_month'], $_POST['liv_day'], $_POST['liv_year'])); - if ($result < 0) dol_print_error($db,$object->error); -} - -// Positionne ref client -else if ($action == 'set_ref_client' && $user->rights->propal->creer) -{ - $object->set_ref_client($user, $_POST['ref_client']); -} - -else if ($action == 'setnote_public' && $user->rights->propal->creer) -{ - $result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES)); - if ($result < 0) dol_print_error($db,$object->error); -} - -else if ($action == 'setnote' && $user->rights->propal->creer) -{ - $result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES)); - if ($result < 0) dol_print_error($db,$object->error); -} - -// Create proposal -else if ($action == 'add' && $user->rights->propal->creer) -{ - $object->socid=$socid; - $object->fetch_thirdparty(); - - $datep=dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); - $date_delivery=dol_mktime(12, 0, 0, GETPOST('liv_month'), GETPOST('liv_day'), GETPOST('liv_year')); - $duration=GETPOST('duree_validite'); - - if (empty($datep)) - { - setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")), 'errors'); - header("Location: ".DOL_URL_ROOT.'/comm/addpropal.php?socid='.$socid.'&action=create'); - exit; - } - if (empty($duration)) - { - setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("ValidityDuration")), 'errors'); - header("Location: ".DOL_URL_ROOT.'/comm/addpropal.php?socid='.$socid.'&action=create'); - exit; - } - - if (! $error) - { - $db->begin(); - - // Si on a selectionne une propal a copier, on realise la copie - if (GETPOST('createmode')=='copy' && GETPOST('copie_propal')) - { - if ($object->fetch(GETPOST('copie_propal')) > 0) - { - $object->ref = GETPOST('ref'); - $object->datep = $datep; - $object->date_livraison = $date_delivery; - $object->availability_id = GETPOST('availability_id'); - $object->demand_reason_id = GETPOST('demand_reason_id'); - $object->fk_delivery_address = GETPOST('fk_address'); - $object->duree_validite = $duration; - $object->cond_reglement_id = GETPOST('cond_reglement_id'); - $object->mode_reglement_id = GETPOST('mode_reglement_id'); - $object->remise_percent = GETPOST('remise_percent'); - $object->remise_absolue = GETPOST('remise_absolue'); - $object->socid = GETPOST('socid'); - $object->contactid = GETPOST('contactidp'); - $object->fk_project = GETPOST('projectid'); - $object->modelpdf = GETPOST('model'); - $object->author = $user->id; // deprecated - $object->note = GETPOST('note'); - $object->statut = 0; - - $id = $object->create_from($user); - } - else - { - setEventMessage($langs->trans("ErrorFailedToCopyProposal",GETPOST('copie_propal')), 'errors'); - } - } - else - { - $object->ref = GETPOST('ref'); - $object->ref_client = GETPOST('ref_client'); - $object->datep = $datep; - $object->date_livraison = $date_delivery; - $object->availability_id = GETPOST('availability_id'); - $object->demand_reason_id = GETPOST('demand_reason_id'); - $object->fk_delivery_address = GETPOST('fk_address'); - $object->duree_validite = GETPOST('duree_validite'); - $object->cond_reglement_id = GETPOST('cond_reglement_id'); - $object->mode_reglement_id = GETPOST('mode_reglement_id'); - - $object->contactid = GETPOST('contactidp'); - $object->fk_project = GETPOST('projectid'); - $object->modelpdf = GETPOST('model'); - $object->author = $user->id; // deprecated - $object->note = GETPOST('note'); - - $object->origin = GETPOST('origin'); - $object->origin_id = GETPOST('originid'); - - for ($i = 1 ; $i <= $conf->global->PRODUCT_SHOW_WHEN_CREATE; $i++) - { - if ($_POST['idprod'.$i]) - { - $xid = 'idprod'.$i; - $xqty = 'qty'.$i; - $xremise = 'remise'.$i; - $object->add_product($_POST[$xid],$_POST[$xqty],$_POST[$xremise]); - } - } - - $id = $object->create($user); - } - - if ($id > 0) - { - // Insertion contact par defaut si defini - if (GETPOST('contactidp')) - { - $result=$object->add_contact(GETPOST('contactidp'),'CUSTOMER','external'); - if ($result < 0) - { - $error++; - setEventMessage($langs->trans("ErrorFailedToAddContact"), 'errors'); - } - } - - if (! $error) - { - $db->commit(); - - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) - { - // Define output language - $outputlangs = $langs; - if (! empty($conf->global->MAIN_MULTILANGS)) - { - $outputlangs = new Translate("",$conf); - $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); - $outputlangs->setDefaultLang($newlang); - } - $ret=$object->fetch($id); // Reload to get new records - propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); - } - - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); - exit; - } - else - { - $db->rollback(); - } - } - else - { - dol_print_error($db,$object->error); - $db->rollback(); - exit; - } - } -} - -// Classify billed -else if ($action == 'classifybilled' && $user->rights->propal->cloturer) -{ - $object->cloture($user, 4, ''); -} - -// Reopen proposal -else if ($action == 'confirm_reopen' && $user->rights->propal->cloturer && ! GETPOST('cancel')) -{ - // prevent browser refresh from reopening proposal several times - if ($object->statut==2 || $object->statut==3) - { - $object->setStatut(1); - } -} - -// Close proposal -else if ($action == 'setstatut' && $user->rights->propal->cloturer && ! GETPOST('cancel')) -{ - if (! GETPOST('statut')) - { - setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("CloseAs")), 'errors'); - $action='statut'; - } - else - { - // prevent browser refresh from closing proposal several times - if ($object->statut==1) - { - $object->cloture($user, GETPOST('statut'), GETPOST('note')); - } - } -} - -/* - * Add file in email form - */ -if (GETPOST('addfile')) -{ - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - - // Set tmp user directory TODO Use a dedicated directory for temp mails files - $vardir=$conf->user->dir_output."/".$user->id; - $upload_dir_tmp = $vardir.'/temp'; - - dol_add_file_process($upload_dir_tmp,0,0); - $action='presend'; -} - -/* - * Remove file in email form - */ -if (GETPOST('removedfile')) -{ - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - - // Set tmp user directory - $vardir=$conf->user->dir_output."/".$user->id; - $upload_dir_tmp = $vardir.'/temp'; - - // TODO Delete only files that was uploaded from email form - dol_remove_file_process($_POST['removedfile'],0); - $action='presend'; -} - -/* - * Send mail - */ -if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! GETPOST('cancel')) -{ - $langs->load('mails'); - - if ($object->id > 0) - { - if ($_POST['sendto']) - { - // Le destinataire a ete fourni via le champ libre - $sendto = $_POST['sendto']; - $sendtoid = 0; - } - elseif ($_POST['receiver'] != '-1') - { - // Recipient was provided from combo list - if ($_POST['receiver'] == 'thirdparty') // Id of third party - { - $sendto = $object->client->email; - $sendtoid = 0; - } - else // Id du contact - { - $sendto = $object->client->contact_get_property($_POST['receiver'],'email'); - $sendtoid = $_POST['receiver']; - } - } - - if (dol_strlen($sendto)) - { - $langs->load("commercial"); - - $from = $_POST['fromname'] . ' <' . $_POST['frommail'] .'>'; - $replyto = $_POST['replytoname']. ' <' . $_POST['replytomail'].'>'; - $message = $_POST['message']; - $sendtocc = $_POST['sendtocc']; - $deliveryreceipt = $_POST['deliveryreceipt']; - - if (dol_strlen($_POST['subject'])) $subject = $_POST['subject']; - else $subject = $langs->transnoentities('Propal').' '.$object->ref; - $actiontypecode='AC_PROP'; - $actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n"; - if ($message) - { - $actionmsg.=$langs->transnoentities('MailTopic').": ".$subject."\n"; - $actionmsg.=$langs->transnoentities('TextUsedInTheMessageBody').":\n"; - $actionmsg.=$message; - } - $actionmsg2=$langs->transnoentities('Action'.$actiontypecode); - - // Create form object - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; - $formmail = new FormMail($db); - - $attachedfiles=$formmail->get_attached_files(); - $filepath = $attachedfiles['paths']; - $filename = $attachedfiles['names']; - $mimetype = $attachedfiles['mimes']; - - // Envoi de la propal - require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,'',$deliveryreceipt); - if ($mailfile->error) - { - setEventMessage($mailfile->error, 'errors'); - } - else - { - $result=$mailfile->sendfile(); - if ($result) - { - // Initialisation donnees - $object->sendtoid = $sendtoid; - $object->actiontypecode = $actiontypecode; - $object->actionmsg = $actionmsg; - $object->actionmsg2 = $actionmsg2; - $object->fk_element = $object->id; - $object->elementtype = $object->element; - - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($db); - $result=$interface->run_triggers('PROPAL_SENTBYMAIL',$object,$user,$langs,$conf); - if ($result < 0) { - $error++; $this->errors=$interface->errors; - } - // Fin appel triggers - - if (! $error) - { - // Redirect here - // This avoid sending mail twice if going out and then back to page - $mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)); - setEventMessage($mesg); - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); - exit; - } - else - { - dol_print_error($db); - } - } - else - { - $langs->load("other"); - if ($mailfile->error) - { - $mesg.=$langs->trans('ErrorFailedToSendMail',$from,$sendto); - $mesg.='
'.$mailfile->error; - } - else - { - $mesg.='No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS'; - } - setEventMessage($mesg, 'errors'); - } - } - } - else - { - $langs->load("other"); - setEventMessage($langs->trans('ErrorMailRecipientIsEmpty').'!', 'errors'); - dol_syslog($langs->trans('ErrorMailRecipientIsEmpty')); - } - } - else - { - $langs->load("other"); - setEventMessage($langs->trans('ErrorFailedToReadEntity',$langs->trans("Proposal")), 'errors'); - dol_syslog($langs->trans('ErrorFailedToReadEntity',$langs->trans("Proposal"))); - } -} - -// Go back to draft -if ($action == 'modif' && $user->rights->propal->creer) -{ - $object->set_draft($user); - - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) - { - // Define output language - $outputlangs = $langs; - if (! empty($conf->global->MAIN_MULTILANGS)) - { - $outputlangs = new Translate("",$conf); - $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); - $outputlangs->setDefaultLang($newlang); - } - $ret=$object->fetch($id); // Reload to get new records - propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); - } -} - -else if ($action == "setabsolutediscount" && $user->rights->propal->creer) -{ - if ($_POST["remise_id"]) - { - if ($object->id > 0) - { - $result=$object->insert_discount($_POST["remise_id"]); - if ($result < 0) - { - setEventMessage($object->error, 'errors'); - } - } - } -} - -//Ajout d'une ligne produit dans la propale -else if ($action == "addline" && $user->rights->propal->creer) -{ - $idprod=GETPOST('idprod', 'int'); - $product_desc = (GETPOST('product_desc')?GETPOST('product_desc'):(GETPOST('np_desc')?GETPOST('np_desc'):(GETPOST('dp_desc')?GETPOST('dp_desc'):''))); - $price_ht = GETPOST('price_ht'); - $tva_tx = (GETPOST('tva_tx')?GETPOST('tva_tx'):0); - - if (empty($idprod) && GETPOST('type') < 0) - { - setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")), 'errors'); - $error++; - } - if ((empty($idprod) || GETPOST('usenewaddlineform')) && (!($price_ht != 0) || $price_ht == '')) // Unit price can be 0 but not ''. Also price can be negative for proposal. - { - setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("UnitPriceHT")), 'errors'); - $error++; - } - if (empty($idprod) && empty($product_desc)) - { - setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Description")), 'errors'); - $error++; - } - - if (! $error && (GETPOST('qty') >= 0) && (! empty($product_desc) || ! empty($idprod))) - { - $pu_ht=0; - $pu_ttc=0; - $price_min=0; - $price_base_type = (GETPOST('price_base_type', 'alpha')?GETPOST('price_base_type', 'alpha'):'HT'); - - // Ecrase $pu par celui du produit - // Ecrase $desc par celui du produit - // Ecrase $txtva par celui du produit - if (! empty($idprod)) - { - $prod = new Product($db); - $prod->fetch($idprod); - - $label = ((GETPOST('product_label') && GETPOST('product_label')!=$prod->label)?GETPOST('product_label'):''); - - // If prices fields are update - if (GETPOST('usenewaddlineform')) - { - $pu_ht=price2num($price_ht, 'MU'); - $pu_ttc=price2num(GETPOST('price_ttc'), 'MU'); - $tva_npr=(preg_match('/\*/', $tva_tx)?1:0); - $tva_tx=str_replace('*','', $tva_tx); - $desc = $product_desc; - } - else - { - $tva_tx = get_default_tva($mysoc,$object->client,$prod->id); - $tva_npr = get_default_npr($mysoc,$object->client,$prod->id); - - // On defini prix unitaire - if (! empty($conf->global->PRODUIT_MULTIPRICES) && $object->client->price_level) - { - $pu_ht = $prod->multiprices[$object->client->price_level]; - $pu_ttc = $prod->multiprices_ttc[$object->client->price_level]; - $price_min = $prod->multiprices_min[$object->client->price_level]; - $price_base_type = $prod->multiprices_base_type[$object->client->price_level]; - } - else - { - $pu_ht = $prod->price; - $pu_ttc = $prod->price_ttc; - $price_min = $prod->price_min; - $price_base_type = $prod->price_base_type; - } - - // On reevalue prix selon taux tva car taux tva transaction peut etre different - // de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur). - if ($tva_tx != $prod->tva_tx) - { - if ($price_base_type != 'HT') - { - $pu_ht = price2num($pu_ttc / (1 + ($tva_tx/100)), 'MU'); - } - else - { - $pu_ttc = price2num($pu_ht * (1 + ($tva_tx/100)), 'MU'); - } - } - - $desc=''; - - // Define output language - if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) - { - $outputlangs = $langs; - $newlang=''; - if (empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id'); - if (empty($newlang)) $newlang=$object->client->default_lang; - if (! empty($newlang)) - { - $outputlangs = new Translate("",$conf); - $outputlangs->setDefaultLang($newlang); - } - - $desc = (! empty($prod->multilangs[$outputlangs->defaultlang]["description"])) ? $prod->multilangs[$outputlangs->defaultlang]["description"] : $prod->description; - } - else - { - $desc = $prod->description; - } - - $desc=dol_concatdesc($desc,$product_desc); - + + * Copyright (C) 2004-2013 Laurent Destailleur + * Copyright (C) 2004 Eric Seigne + * Copyright (C) 2005 Marc Barilley / Ocebo + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2006 Andre Cianfarani + * Copyright (C) 2010-2012 Juanjo Menent + * Copyright (C) 2010-2011 Philippe Grand + * Copyright (C) 2012 Christophe Battarel +* + * 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/comm/propal.php + * \ingroup propale + * \brief Page of commercial proposals card and list + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formpropal.class.php'; +require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; +require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/modules/propale/modules_propale.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; + +$langs->load('companies'); +$langs->load('propal'); +$langs->load('compta'); +$langs->load('bills'); +$langs->load('orders'); +$langs->load('products'); +if (! empty($conf->margin->enabled)) + $langs->load('margins'); + +$error=0; + +$id=GETPOST('id','int'); +$ref=GETPOST('ref','alpha'); +$socid=GETPOST('socid','int'); +$action=GETPOST('action','alpha'); +$confirm=GETPOST('confirm','alpha'); +$lineid=GETPOST('lineid','int'); + +//PDF +$hidedetails = (GETPOST('hidedetails','int') ? GETPOST('hidedetails','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0)); +$hidedesc = (GETPOST('hidedesc','int') ? GETPOST('hidedesc','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0)); +$hideref = (GETPOST('hideref','int') ? GETPOST('hideref','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0)); + +// Nombre de ligne pour choix de produit/service predefinis +$NBLINES=4; + +// Security check +if (! empty($user->societe_id)) $socid=$user->societe_id; +$result = restrictedArea($user, 'propal', $id); + +$object = new Propal($db); + +// Load object +if ($id > 0 || ! empty($ref)) +{ + if ($action != 'add') + { + $ret=$object->fetch($id, $ref); + if ($ret == 0) + { + $langs->load("errors"); + setEventMessage($langs->trans('ErrorRecordNotFound'), 'errors'); + $error++; + } + else if ($ret < 0) + { + setEventMessage($object->error, 'errors'); + $error++; + } + else $object->fetch_thirdparty(); + } +} +else +{ + header('Location: '.DOL_URL_ROOT.'/comm/propal/list.php'); + exit; +} + +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; +$hookmanager=new HookManager($db); +$hookmanager->initHooks(array('propalcard')); + + + +/* + * Actions + */ + +$parameters=array('socid'=>$socid); +$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks + +// Action clone object +if ($action == 'confirm_clone' && $confirm == 'yes') +{ + if (1==0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers')) + { + setEventMessage($langs->trans("NoCloneOptionsSpecified"), 'errors'); + } + else + { + if ($object->id > 0) + { + $result=$object->createFromClone($socid, $hookmanager); + if ($result > 0) + { + header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result); + exit; + } + else + { + setEventMessage($object->error, 'errors'); + $action=''; + } + } + } +} + +// Suppression de la propale +else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->propal->supprimer) +{ + $result=$object->delete($user); + if ($result > 0) + { + header('Location: '.DOL_URL_ROOT.'/comm/propal/list.php'); + exit; + } + else + { + $langs->load("errors"); + setEventMessage($langs->trans($object->error), 'errors'); + } +} + +// Remove line +else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->propal->creer) +{ + $result = $object->deleteline($lineid); + // reorder lines + if ($result) $object->line_order(true); + + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + // Define output language + $outputlangs = $langs; + if (! empty($conf->global->MAIN_MULTILANGS)) + { + $outputlangs = new Translate("",$conf); + $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); + $outputlangs->setDefaultLang($newlang); + } + $ret=$object->fetch($id); // Reload to get new records + propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); + } + + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); + exit; +} + +// Validation +else if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->propal->valider) +{ + $result=$object->valid($user); + if ($result >= 0) + { + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + // Define output language + $outputlangs = $langs; + if (! empty($conf->global->MAIN_MULTILANGS)) + { + $outputlangs = new Translate("",$conf); + $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); + $outputlangs->setDefaultLang($newlang); + } + $ret=$object->fetch($id); // Reload to get new records + propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); + } + } + else + { + $langs->load("errors"); + setEventMessage($langs->trans($object->error), 'errors'); + } +} + +else if ($action == 'setdate' && $user->rights->propal->creer) +{ + $datep=dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); + + if (empty($datep)) + { + $error++; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")), 'errors'); + } + + if (! $error) + { + $result=$object->set_date($user,$datep); + if ($result < 0) dol_print_error($db,$object->error); + } +} +else if ($action == 'setecheance' && $user->rights->propal->creer) +{ + $result=$object->set_echeance($user,dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear'])); + if ($result < 0) dol_print_error($db,$object->error); +} +else if ($action == 'setdate_livraison' && $user->rights->propal->creer) +{ + $result=$object->set_date_livraison($user,dol_mktime(12, 0, 0, $_POST['liv_month'], $_POST['liv_day'], $_POST['liv_year'])); + if ($result < 0) dol_print_error($db,$object->error); +} + +// Positionne ref client +else if ($action == 'set_ref_client' && $user->rights->propal->creer) +{ + $object->set_ref_client($user, $_POST['ref_client']); +} + +else if ($action == 'setnote_public' && $user->rights->propal->creer) +{ + $result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES)); + if ($result < 0) dol_print_error($db,$object->error); +} + +else if ($action == 'setnote' && $user->rights->propal->creer) +{ + $result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES)); + if ($result < 0) dol_print_error($db,$object->error); +} + +// Create proposal +else if ($action == 'add' && $user->rights->propal->creer) +{ + $object->socid=$socid; + $object->fetch_thirdparty(); + + $datep=dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); + $date_delivery=dol_mktime(12, 0, 0, GETPOST('liv_month'), GETPOST('liv_day'), GETPOST('liv_year')); + $duration=GETPOST('duree_validite'); + + if (empty($datep)) + { + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")), 'errors'); + header("Location: ".DOL_URL_ROOT.'/comm/addpropal.php?socid='.$socid.'&action=create'); + exit; + } + if (empty($duration)) + { + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("ValidityDuration")), 'errors'); + header("Location: ".DOL_URL_ROOT.'/comm/addpropal.php?socid='.$socid.'&action=create'); + exit; + } + + if (! $error) + { + $db->begin(); + + // Si on a selectionne une propal a copier, on realise la copie + if (GETPOST('createmode')=='copy' && GETPOST('copie_propal')) + { + if ($object->fetch(GETPOST('copie_propal')) > 0) + { + $object->ref = GETPOST('ref'); + $object->datep = $datep; + $object->date_livraison = $date_delivery; + $object->availability_id = GETPOST('availability_id'); + $object->demand_reason_id = GETPOST('demand_reason_id'); + $object->fk_delivery_address = GETPOST('fk_address'); + $object->duree_validite = $duration; + $object->cond_reglement_id = GETPOST('cond_reglement_id'); + $object->mode_reglement_id = GETPOST('mode_reglement_id'); + $object->remise_percent = GETPOST('remise_percent'); + $object->remise_absolue = GETPOST('remise_absolue'); + $object->socid = GETPOST('socid'); + $object->contactid = GETPOST('contactidp'); + $object->fk_project = GETPOST('projectid'); + $object->modelpdf = GETPOST('model'); + $object->author = $user->id; // deprecated + $object->note = GETPOST('note'); + $object->statut = 0; + + $id = $object->create_from($user); + } + else + { + setEventMessage($langs->trans("ErrorFailedToCopyProposal",GETPOST('copie_propal')), 'errors'); + } + } + else + { + $object->ref = GETPOST('ref'); + $object->ref_client = GETPOST('ref_client'); + $object->datep = $datep; + $object->date_livraison = $date_delivery; + $object->availability_id = GETPOST('availability_id'); + $object->demand_reason_id = GETPOST('demand_reason_id'); + $object->fk_delivery_address = GETPOST('fk_address'); + $object->duree_validite = GETPOST('duree_validite'); + $object->cond_reglement_id = GETPOST('cond_reglement_id'); + $object->mode_reglement_id = GETPOST('mode_reglement_id'); + + $object->contactid = GETPOST('contactidp'); + $object->fk_project = GETPOST('projectid'); + $object->modelpdf = GETPOST('model'); + $object->author = $user->id; // deprecated + $object->note = GETPOST('note'); + + $object->origin = GETPOST('origin'); + $object->origin_id = GETPOST('originid'); + + for ($i = 1 ; $i <= $conf->global->PRODUCT_SHOW_WHEN_CREATE; $i++) + { + if ($_POST['idprod'.$i]) + { + $xid = 'idprod'.$i; + $xqty = 'qty'.$i; + $xremise = 'remise'.$i; + $object->add_product($_POST[$xid],$_POST[$xqty],$_POST[$xremise]); + } + } + + $id = $object->create($user); + } + + if ($id > 0) + { + // Insertion contact par defaut si defini + if (GETPOST('contactidp')) + { + $result=$object->add_contact(GETPOST('contactidp'),'CUSTOMER','external'); + if ($result < 0) + { + $error++; + setEventMessage($langs->trans("ErrorFailedToAddContact"), 'errors'); + } + } + + if (! $error) + { + $db->commit(); + + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + // Define output language + $outputlangs = $langs; + if (! empty($conf->global->MAIN_MULTILANGS)) + { + $outputlangs = new Translate("",$conf); + $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); + $outputlangs->setDefaultLang($newlang); + } + $ret=$object->fetch($id); // Reload to get new records + propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); + } + + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); + exit; + } + else + { + $db->rollback(); + } + } + else + { + dol_print_error($db,$object->error); + $db->rollback(); + exit; + } + } +} + +// Classify billed +else if ($action == 'classifybilled' && $user->rights->propal->cloturer) +{ + $object->cloture($user, 4, ''); +} + +// Reopen proposal +else if ($action == 'confirm_reopen' && $user->rights->propal->cloturer && ! GETPOST('cancel')) +{ + // prevent browser refresh from reopening proposal several times + if ($object->statut==2 || $object->statut==3) + { + $object->setStatut(1); + } +} + +// Close proposal +else if ($action == 'setstatut' && $user->rights->propal->cloturer && ! GETPOST('cancel')) +{ + if (! GETPOST('statut')) + { + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("CloseAs")), 'errors'); + $action='statut'; + } + else + { + // prevent browser refresh from closing proposal several times + if ($object->statut==1) + { + $object->cloture($user, GETPOST('statut'), GETPOST('note')); + } + } +} + +/* + * Add file in email form + */ +if (GETPOST('addfile')) +{ + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + + // Set tmp user directory TODO Use a dedicated directory for temp mails files + $vardir=$conf->user->dir_output."/".$user->id; + $upload_dir_tmp = $vardir.'/temp'; + + dol_add_file_process($upload_dir_tmp,0,0); + $action='presend'; +} + +/* + * Remove file in email form + */ +if (GETPOST('removedfile')) +{ + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + + // Set tmp user directory + $vardir=$conf->user->dir_output."/".$user->id; + $upload_dir_tmp = $vardir.'/temp'; + + // TODO Delete only files that was uploaded from email form + dol_remove_file_process($_POST['removedfile'],0); + $action='presend'; +} + +/* + * Send mail + */ +if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! GETPOST('cancel')) +{ + $langs->load('mails'); + + if ($object->id > 0) + { + if ($_POST['sendto']) + { + // Le destinataire a ete fourni via le champ libre + $sendto = $_POST['sendto']; + $sendtoid = 0; + } + elseif ($_POST['receiver'] != '-1') + { + // Recipient was provided from combo list + if ($_POST['receiver'] == 'thirdparty') // Id of third party + { + $sendto = $object->client->email; + $sendtoid = 0; + } + else // Id du contact + { + $sendto = $object->client->contact_get_property($_POST['receiver'],'email'); + $sendtoid = $_POST['receiver']; + } + } + + if (dol_strlen($sendto)) + { + $langs->load("commercial"); + + $from = $_POST['fromname'] . ' <' . $_POST['frommail'] .'>'; + $replyto = $_POST['replytoname']. ' <' . $_POST['replytomail'].'>'; + $message = $_POST['message']; + $sendtocc = $_POST['sendtocc']; + $deliveryreceipt = $_POST['deliveryreceipt']; + + if (dol_strlen($_POST['subject'])) $subject = $_POST['subject']; + else $subject = $langs->transnoentities('Propal').' '.$object->ref; + $actiontypecode='AC_PROP'; + $actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n"; + if ($message) + { + $actionmsg.=$langs->transnoentities('MailTopic').": ".$subject."\n"; + $actionmsg.=$langs->transnoentities('TextUsedInTheMessageBody').":\n"; + $actionmsg.=$message; + } + $actionmsg2=$langs->transnoentities('Action'.$actiontypecode); + + // Create form object + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; + $formmail = new FormMail($db); + + $attachedfiles=$formmail->get_attached_files(); + $filepath = $attachedfiles['paths']; + $filename = $attachedfiles['names']; + $mimetype = $attachedfiles['mimes']; + + // Envoi de la propal + require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; + $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,'',$deliveryreceipt); + if ($mailfile->error) + { + setEventMessage($mailfile->error, 'errors'); + } + else + { + $result=$mailfile->sendfile(); + if ($result) + { + // Initialisation donnees + $object->sendtoid = $sendtoid; + $object->actiontypecode = $actiontypecode; + $object->actionmsg = $actionmsg; + $object->actionmsg2 = $actionmsg2; + $object->fk_element = $object->id; + $object->elementtype = $object->element; + + // Appel des triggers + include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; + $interface=new Interfaces($db); + $result=$interface->run_triggers('PROPAL_SENTBYMAIL',$object,$user,$langs,$conf); + if ($result < 0) { + $error++; $this->errors=$interface->errors; + } + // Fin appel triggers + + if (! $error) + { + // Redirect here + // This avoid sending mail twice if going out and then back to page + $mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)); + setEventMessage($mesg); + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); + exit; + } + else + { + dol_print_error($db); + } + } + else + { + $langs->load("other"); + if ($mailfile->error) + { + $mesg.=$langs->trans('ErrorFailedToSendMail',$from,$sendto); + $mesg.='
'.$mailfile->error; + } + else + { + $mesg.='No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS'; + } + setEventMessage($mesg, 'errors'); + } + } + } + else + { + $langs->load("other"); + setEventMessage($langs->trans('ErrorMailRecipientIsEmpty').'!', 'errors'); + dol_syslog($langs->trans('ErrorMailRecipientIsEmpty')); + } + } + else + { + $langs->load("other"); + setEventMessage($langs->trans('ErrorFailedToReadEntity',$langs->trans("Proposal")), 'errors'); + dol_syslog($langs->trans('ErrorFailedToReadEntity',$langs->trans("Proposal"))); + } +} + +// Go back to draft +if ($action == 'modif' && $user->rights->propal->creer) +{ + $object->set_draft($user); + + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + // Define output language + $outputlangs = $langs; + if (! empty($conf->global->MAIN_MULTILANGS)) + { + $outputlangs = new Translate("",$conf); + $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); + $outputlangs->setDefaultLang($newlang); + } + $ret=$object->fetch($id); // Reload to get new records + propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); + } +} + +else if ($action == "setabsolutediscount" && $user->rights->propal->creer) +{ + if ($_POST["remise_id"]) + { + if ($object->id > 0) + { + $result=$object->insert_discount($_POST["remise_id"]); + if ($result < 0) + { + setEventMessage($object->error, 'errors'); + } + } + } +} + +//Ajout d'une ligne produit dans la propale +else if ($action == "addline" && $user->rights->propal->creer) +{ + $idprod=GETPOST('idprod', 'int'); + $product_desc = (GETPOST('product_desc')?GETPOST('product_desc'):(GETPOST('np_desc')?GETPOST('np_desc'):(GETPOST('dp_desc')?GETPOST('dp_desc'):''))); + $price_ht = GETPOST('price_ht'); + $tva_tx = (GETPOST('tva_tx')?GETPOST('tva_tx'):0); + + if (empty($idprod) && GETPOST('type') < 0) + { + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")), 'errors'); + $error++; + } + if ((empty($idprod) || GETPOST('usenewaddlineform')) && (!($price_ht != 0) || $price_ht == '')) // Unit price can be 0 but not ''. Also price can be negative for proposal. + { + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("UnitPriceHT")), 'errors'); + $error++; + } + if (empty($idprod) && empty($product_desc)) + { + setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Description")), 'errors'); + $error++; + } + + if (! $error && (GETPOST('qty') >= 0) && (! empty($product_desc) || ! empty($idprod))) + { + $pu_ht=0; + $pu_ttc=0; + $price_min=0; + $price_base_type = (GETPOST('price_base_type', 'alpha')?GETPOST('price_base_type', 'alpha'):'HT'); + + // Ecrase $pu par celui du produit + // Ecrase $desc par celui du produit + // Ecrase $txtva par celui du produit + if (! empty($idprod)) + { + $prod = new Product($db); + $prod->fetch($idprod); + + $label = ((GETPOST('product_label') && GETPOST('product_label')!=$prod->label)?GETPOST('product_label'):''); + + // If prices fields are update + if (GETPOST('usenewaddlineform')) + { + $pu_ht=price2num($price_ht, 'MU'); + $pu_ttc=price2num(GETPOST('price_ttc'), 'MU'); + $tva_npr=(preg_match('/\*/', $tva_tx)?1:0); + $tva_tx=str_replace('*','', $tva_tx); + $desc = $product_desc; + } + else + { + $tva_tx = get_default_tva($mysoc,$object->client,$prod->id); + $tva_npr = get_default_npr($mysoc,$object->client,$prod->id); + + // On defini prix unitaire + if (! empty($conf->global->PRODUIT_MULTIPRICES) && $object->client->price_level) + { + $pu_ht = $prod->multiprices[$object->client->price_level]; + $pu_ttc = $prod->multiprices_ttc[$object->client->price_level]; + $price_min = $prod->multiprices_min[$object->client->price_level]; + $price_base_type = $prod->multiprices_base_type[$object->client->price_level]; + } + else + { + $pu_ht = $prod->price; + $pu_ttc = $prod->price_ttc; + $price_min = $prod->price_min; + $price_base_type = $prod->price_base_type; + } + + // On reevalue prix selon taux tva car taux tva transaction peut etre different + // de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur). + if ($tva_tx != $prod->tva_tx) + { + if ($price_base_type != 'HT') + { + $pu_ht = price2num($pu_ttc / (1 + ($tva_tx/100)), 'MU'); + } + else + { + $pu_ttc = price2num($pu_ht * (1 + ($tva_tx/100)), 'MU'); + } + } + + $desc=''; + + // Define output language + if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) + { + $outputlangs = $langs; + $newlang=''; + if (empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id'); + if (empty($newlang)) $newlang=$object->client->default_lang; + if (! empty($newlang)) + { + $outputlangs = new Translate("",$conf); + $outputlangs->setDefaultLang($newlang); + } + + $desc = (! empty($prod->multilangs[$outputlangs->defaultlang]["description"])) ? $prod->multilangs[$outputlangs->defaultlang]["description"] : $prod->description; + } + else + { + $desc = $prod->description; + } + + $desc=dol_concatdesc($desc,$product_desc); + // Add custom code and origin country into description if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code))) { @@ -747,1161 +747,1161 @@ else if ($action == "addline" && $user->rights->propal->creer) $tmptxt.=')'; $desc= dol_concatdesc($desc, $tmptxt); } - } - - $type = $prod->type; - } - else - { - $pu_ht = price2num($price_ht, 'MU'); - $pu_ttc = price2num(GETPOST('price_ttc'), 'MU'); - $tva_npr = (preg_match('/\*/', $tva_tx)?1:0); - $tva_tx = str_replace('*', '', $tva_tx); - $label = (GETPOST('product_label')?GETPOST('product_label'):''); - $desc = $product_desc; - $type = GETPOST('type'); - } - - // Margin - $fournprice=(GETPOST('fournprice')?GETPOST('fournprice'):''); - $buyingprice=(GETPOST('buying_price')?GETPOST('buying_price'):''); - - // Local Taxes - $localtax1_tx= get_localtax($tva_tx, 1, $object->client); - $localtax2_tx= get_localtax($tva_tx, 2, $object->client); - - $info_bits=0; - if ($tva_npr) $info_bits |= 0x01; - - if (! empty($price_min) && (price2num($pu_ht)*(1-price2num(GETPOST('remise_percent'))/100) < price2num($price_min))) - { - $mesg = $langs->trans("CantBeLessThanMinPrice",price2num($price_min,'MU').getCurrencySymbol($conf->currency)); - setEventMessage($mesg, 'errors'); - } - else - { - // Insert line - $result=$object->addline( - $id, - $desc, - $pu_ht, - GETPOST('qty'), - $tva_tx, - $localtax1_tx, - $localtax2_tx, - $idprod, - GETPOST('remise_percent'), - $price_base_type, - $pu_ttc, - $info_bits, - $type, - -1, - 0, - GETPOST('fk_parent_line'), - $fournprice, - $buyingprice, - $label - ); - - if ($result > 0) - { - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) - { - // Define output language - $outputlangs = $langs; - if (! empty($conf->global->MAIN_MULTILANGS)) - { - $outputlangs = new Translate("",$conf); - $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); - $outputlangs->setDefaultLang($newlang); - } - $ret=$object->fetch($id); // Reload to get new records - propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); - } - - unset($_POST['qty']); - unset($_POST['type']); - unset($_POST['idprod']); - unset($_POST['remise_percent']); - unset($_POST['price_ht']); - unset($_POST['price_ttc']); - unset($_POST['tva_tx']); - unset($_POST['product_ref']); - unset($_POST['product_label']); - unset($_POST['product_desc']); - unset($_POST['fournprice']); - unset($_POST['buying_price']); - - // old method - unset($_POST['np_desc']); - unset($_POST['dp_desc']); - } - else - { - setEventMessage($object->error, 'errors'); - } - } - } -} - -// Mise a jour d'une ligne dans la propale -else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('save') == $langs->trans("Save")) -{ - // Define info_bits - $info_bits=0; - if (preg_match('/\*/', GETPOST('tva_tx'))) $info_bits |= 0x01; - - // Clean parameters - $description=dol_htmlcleanlastbr(GETPOST('product_desc')); - - // Define vat_rate - $vat_rate=(GETPOST('tva_tx')?GETPOST('tva_tx'):0); - $vat_rate=str_replace('*','',$vat_rate); - $localtax1_rate=get_localtax($vat_rate,1,$object->client); - $localtax2_rate=get_localtax($vat_rate,2,$object->client); - $pu_ht=GETPOST('price_ht'); - - // Add buying price - $fournprice=(GETPOST('fournprice')?GETPOST('fournprice'):''); - $buyingprice=(GETPOST('buying_price')?GETPOST('buying_price'):''); - - // Define special_code for special lines - $special_code=0; - if (! GETPOST('qty')) $special_code=3; - - // Check minimum price - $productid = GETPOST('productid', 'int'); - if (! empty($productid)) - { - $product = new Product($db); - $res=$product->fetch($productid); - - $type=$product->type; - - $price_min = $product->price_min; - if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($object->client->price_level)) - $price_min = $product->multiprices_min[$object->client->price_level]; - - $label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label'):''); - - if ($price_min && (price2num($pu_ht)*(1-price2num(GETPOST('remise_percent'))/100) < price2num($price_min))) - { - setEventMessage($langs->trans("CantBeLessThanMinPrice", price2num($price_min,'MU')).getCurrencySymbol($conf->currency), 'errors'); - $error++; - } - } - else - { - $type = GETPOST('type'); - $label = (GETPOST('product_label') ? GETPOST('product_label'):''); - - // Check parameters - if (GETPOST('type') < 0) { - setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")), 'errors'); - $error++; - } - } - - if (! $error) - { - $result = $object->updateline( - GETPOST('lineid'), - $pu_ht, - GETPOST('qty'), - GETPOST('remise_percent'), - $vat_rate, - $localtax1_rate, - $localtax2_rate, - $description, - 'HT', - $info_bits, - $special_code, - GETPOST('fk_parent_line'), - 0, - $fournprice, - $buyingprice, - $label, - $type - ); - - if ($result >= 0) - { - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) - { - // Define output language - $outputlangs = $langs; - if (! empty($conf->global->MAIN_MULTILANGS)) - { - $outputlangs = new Translate("",$conf); - $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); - $outputlangs->setDefaultLang($newlang); - } - $ret=$object->fetch($id); // Reload to get new records - propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); - } - - unset($_POST['qty']); - unset($_POST['type']); - unset($_POST['productid']); - unset($_POST['remise_percent']); - unset($_POST['price_ht']); - unset($_POST['price_ttc']); - unset($_POST['tva_tx']); - unset($_POST['product_ref']); - unset($_POST['product_label']); - unset($_POST['product_desc']); - unset($_POST['fournprice']); - unset($_POST['buying_price']); - } - else - { - setEventMessage($object->error, 'errors'); - } - } -} - -else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('cancel') == $langs->trans('Cancel')) -{ - header('Location: '.$_SERVER['PHP_SELF'].'?id='.$object->id); // Pour reaffichage de la fiche en cours d'edition - exit; -} - -// Generation doc (depuis lien ou depuis cartouche doc) -else if ($action == 'builddoc' && $user->rights->propal->creer) -{ - if (GETPOST('model')) - { - $object->setDocModel($user, GETPOST('model')); - } - - // Define output language - $outputlangs = $langs; - if (! empty($conf->global->MAIN_MULTILANGS)) - { - $outputlangs = new Translate("",$conf); - $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); - $outputlangs->setDefaultLang($newlang); - } - $ret=$object->fetch($id); // Reload to get new records - $result=propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); - - if ($result <= 0) - { - dol_print_error($db,$result); - exit; - } - else - { - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.(empty($conf->global->MAIN_JUMP_TAG)?'':'#builddoc')); - exit; - } -} - -// Remove file in doc form -else if ($action == 'remove_file' && $user->rights->propal->creer) -{ - if ($object->id > 0) - { - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - - $langs->load("other"); - $upload_dir = $conf->propal->dir_output; - $file = $upload_dir . '/' . GETPOST('file'); - $ret=dol_delete_file($file,0,0,0,$object); - if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('file'))); - else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), 'errors'); - } -} - -// Set project -else if ($action == 'classin' && $user->rights->propal->creer) -{ - $object->setProject($_POST['projectid']); -} - -// Delai de livraison -else if ($action == 'setavailability' && $user->rights->propal->creer) -{ - $result = $object->availability($_POST['availability_id']); -} - -// Origine de la propale -else if ($action == 'setdemandreason' && $user->rights->propal->creer) -{ - $result = $object->demand_reason($_POST['demand_reason_id']); -} - -// Conditions de reglement -else if ($action == 'setconditions' && $user->rights->propal->creer) -{ - $result = $object->setPaymentTerms(GETPOST('cond_reglement_id','int')); -} - -else if ($action == 'setremisepercent' && $user->rights->propal->creer) -{ - $result = $object->set_remise_percent($user, $_POST['remise_percent']); -} - -else if ($action == 'setremiseabsolue' && $user->rights->propal->creer) -{ - $result = $object->set_remise_absolue($user, $_POST['remise_absolue']); -} - -// Mode de reglement -else if ($action == 'setmode' && $user->rights->propal->creer) -{ - $result = $object->setPaymentMethods(GETPOST('mode_reglement_id','int')); -} - -/* - * Ordonnancement des lignes - */ - -else if ($action == 'up' && $user->rights->propal->creer) -{ - $object->line_up(GETPOST('rowid')); - - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) - { - // Define output language - $outputlangs = $langs; - if (! empty($conf->global->MAIN_MULTILANGS)) - { - $outputlangs = new Translate("",$conf); - $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); - $outputlangs->setDefaultLang($newlang); - } - $ret=$object->fetch($id); // Reload to get new records - propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); - } - - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id.'#'.GETPOST('rowid')); - exit; -} - -else if ($action == 'down' && $user->rights->propal->creer) -{ - $object->line_down(GETPOST('rowid')); - - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) - { - // Define output language - $outputlangs = $langs; - if (! empty($conf->global->MAIN_MULTILANGS)) - { - $outputlangs = new Translate("",$conf); - $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); - $outputlangs->setDefaultLang($newlang); - } - $ret=$object->fetch($id); // Reload to get new records - propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); - } - - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id.'#'.GETPOST('rowid')); - exit; -} - -if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->propal->creer) -{ - if ($action == 'addcontact') - { - if ($object->id > 0) - { - $contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid')); - $result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]); - } - - if ($result >= 0) - { - header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); - exit; - } - else - { - if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') - { - $langs->load("errors"); - setEventMessage($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), 'errors'); - } - else - { - setEventMessage($object->error, 'errors'); - } - } - } - - // Bascule du statut d'un contact - else if ($action == 'swapstatut') - { - if ($object->fetch($id) > 0) - { - $result=$object->swapContactStatus(GETPOST('ligne')); - } - else - { - dol_print_error($db); - } - } - - // Efface un contact - else if ($action == 'deletecontact') - { - $object->fetch($id); - $result = $object->delete_contact($lineid); - - if ($result >= 0) - { - header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); - exit; - } - else - { - dol_print_error($db); - } - } -} - - -/* - * View - */ - -llxHeader('',$langs->trans('Proposal'),'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos'); - -$form = new Form($db); -$formother = new FormOther($db); -$formfile = new FormFile($db); -$formpropal = new FormPropal($db); -$companystatic=new Societe($db); - -$now=dol_now(); - -/* - * Show object in view mode - */ - -$soc = new Societe($db); -$soc->fetch($object->socid); - -$head = propal_prepare_head($object); -dol_fiche_head($head, 'comm', $langs->trans('Proposal'), 0, 'propal'); - -$formconfirm=''; - -// Clone confirmation -if ($action == 'clone') -{ - // Create an array for form - $formquestion=array( - //'text' => $langs->trans("ConfirmClone"), - //array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), - //array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), - array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid','int'),'socid','(s.client=1 OR s.client=2 OR s.client=3)')) - ); - // Paiement incomplet. On demande si motif = escompte ou autre - $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans('ClonePropal'),$langs->trans('ConfirmClonePropal',$object->ref),'confirm_clone',$formquestion,'yes',1); -} - -// Confirm delete -else if ($action == 'delete') -{ - $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteProp'), $langs->trans('ConfirmDeleteProp',$object->ref), 'confirm_delete','',0,1); -} - -// Confirm reopen -else if ($action == 'reopen') -{ - $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ReOpen'), $langs->trans('ConfirmReOpenProp',$object->ref), 'confirm_reopen','',0,1); -} - -// Confirmation delete product/service line -else if ($action == 'ask_deleteline') -{ - $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline','',0,1); -} - -// Confirm validate proposal -else if ($action == 'validate') -{ - $error=0; - - // on verifie si l'objet est en numerotation provisoire - $ref = substr($object->ref, 1, 4); - if ($ref == 'PROV') - { - $numref = $object->getNextNumRef($soc); - if (empty($numref)) - { - $error++; - dol_htmloutput_errors($object->error); - } - } - else - { - $numref = $object->ref; - } - - $text=$langs->trans('ConfirmValidateProp',$numref); - if (! empty($conf->notification->enabled)) - { - require_once DOL_DOCUMENT_ROOT .'/core/class/notify.class.php'; - $notify=new Notify($db); - $text.='
'; - $text.=$notify->confirmMessage('NOTIFY_VAL_PROPAL',$object->socid); - } - - if (! $error) $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateProp'), $text, 'confirm_validate','',0,1); -} - -if (! $formconfirm) -{ - $parameters=array('lineid'=>$lineid); - $formconfirm=$hookmanager->executeHooks('formConfirm',$parameters,$object,$action); // Note that $action and $object may have been modified by hook -} - -// Print form confirm -print $formconfirm; - - -print '

'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; - -$linkback = ''.$langs->trans("BackToList").''; - -// Ref -print ''; - -// Ref client -print ''; -print ''; - -// Company -print ''; -print ''; - -// Ligne info remises tiers -print ''; - -// Date of proposal -print ''; -print ''; - -// Date end proposal -print ''; -print ''; -print ''; - -// Payment term -print ''; -print ''; - -// Delivery date -$langs->load('deliveries'); -print ''; -print ''; - -// Delivery delay -print ''; -print ''; - -// Origin of demand -print ''; -print ''; - -// Payment mode -print ''; -print ''; - -// Project -if (! empty($conf->projet->enabled)) -{ - $langs->load("projects"); - print ''; - } - else - { - print '
'.$langs->trans('Ref').''; -print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', ''); -print '
'; -print ''; -if ($action != 'refclient' && ! empty($object->brouillon)) print ''; -print '
'; -print $langs->trans('RefCustomer').''; -print ''.img_edit($langs->trans('Modify')).'
'; -print '
'; -if ($user->rights->propal->creer && $action == 'refclient') -{ - print ''; - print ''; - print ''; - print ''; - print ' '; - print ''; -} -else -{ - print $object->ref_client; -} -print '
'.$langs->trans('Company').''.$soc->getNomUrl(1).'
'.$langs->trans('Discounts').''; -if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client); -else print $langs->trans("CompanyHasNoRelativeDiscount"); -print '. '; -$absolute_discount=$soc->getAvailableDiscounts('','fk_facture_source IS NULL'); -$absolute_creditnote=$soc->getAvailableDiscounts('','fk_facture_source IS NOT NULL'); -$absolute_discount=price2num($absolute_discount,'MT'); -$absolute_creditnote=price2num($absolute_creditnote,'MT'); -if ($absolute_discount) -{ - if ($object->statut > 0) - { - print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->currency)); - } - else - { - // Remise dispo de type non avoir - $filter='fk_facture_source IS NULL'; - print '
'; - $form->form_remise_dispo($_SERVER["PHP_SELF"].'?id='.$object->id,0,'remise_id',$soc->id,$absolute_discount,$filter); - } -} -if ($absolute_creditnote) -{ - print $langs->trans("CompanyHasCreditNote",price($absolute_creditnote),$langs->transnoentities("Currency".$conf->currency)).'. '; -} -if (! $absolute_discount && ! $absolute_creditnote) print $langs->trans("CompanyHasNoAbsoluteDiscount").'.'; -print '
'; -print ''; -if ($action != 'editdate' && ! empty($object->brouillon)) print ''; -print '
'; -print $langs->trans('Date'); -print 'id.'">'.img_edit($langs->trans('SetDate'),1).'
'; -print '
'; -if (! empty($object->brouillon) && $action == 'editdate') -{ - print '
'; - print ''; - print ''; - $form->select_date($object->date,'re','','',0,"editdate"); - print ''; - print '
'; -} -else -{ - if ($object->date) - { - print dol_print_date($object->date,'daytext'); - } - else - { - print ' '; - } -} -print '
'; -print ''; -if ($action != 'editecheance' && ! empty($object->brouillon)) print ''; -print '
'; -print $langs->trans('DateEndPropal'); -print 'id.'">'.img_edit($langs->trans('SetConditions'),1).'
'; -print '
'; -if (! empty($object->brouillon) && $action == 'editecheance') -{ - print '
'; - print ''; - print ''; - $form->select_date($object->fin_validite,'ech','','','',"editecheance"); - print ''; - print '
'; -} -else -{ - if (! empty($object->fin_validite)) - { - print dol_print_date($object->fin_validite,'daytext'); - if ($object->statut == 1 && $object->fin_validite < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late")); - } - else - { - print ' '; - } -} -print '
'; -print ''; -if ($action != 'editconditions' && ! empty($object->brouillon)) print ''; -print '
'; -print $langs->trans('PaymentConditionsShort'); -print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetConditions'),1).'
'; -print '
'; -if ($action == 'editconditions') -{ - $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->cond_reglement_id,'cond_reglement_id'); -} -else -{ - $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->cond_reglement_id,'none'); -} -print '
'; -print ''; -if ($action != 'editdate_livraison' && ! empty($object->brouillon)) print ''; -print '
'; -print $langs->trans('DeliveryDate'); -print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetDeliveryDate'),1).'
'; -print '
'; -if ($action == 'editdate_livraison') -{ - print '
'; - print ''; - print ''; - $form->select_date($object->date_livraison,'liv_','','','',"editdate_livraison"); - print ''; - print '
'; -} -else -{ - print dol_print_date($object->date_livraison,'daytext'); -} -print '
'; -print ''; -if ($action != 'editavailability' && ! empty($object->brouillon)) print ''; -print '
'; -print $langs->trans('AvailabilityPeriod'); -if (! empty($conf->commande->enabled)) print ' ('.$langs->trans('AfterOrder').')'; -print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetAvailability'),1).'
'; -print '
'; -if ($action == 'editavailability') -{ - $form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id,$object->availability_id,'availability_id',1); -} -else -{ - $form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id,$object->availability_id,'none',1); -} - -print '
'; -print ''; -if ($action != 'editdemandreason' && ! empty($object->brouillon)) print ''; -print '
'; -print $langs->trans('Source'); -print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetDemandReason'),1).'
'; -print '
'; -//print $object->demand_reason_id; -if ($action == 'editdemandreason') -{ - $form->form_demand_reason($_SERVER['PHP_SELF'].'?id='.$object->id,$object->demand_reason_id,'demand_reason_id',1); -} -else -{ - $form->form_demand_reason($_SERVER['PHP_SELF'].'?id='.$object->id,$object->demand_reason_id,'none'); -} - -print '
'; -print ''; -if ($action != 'editmode' && ! empty($object->brouillon)) print ''; -print '
'; -print $langs->trans('PaymentMode'); -print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMode'),1).'
'; -print '
'; -if ($action == 'editmode') -{ - $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->mode_reglement_id,'mode_reglement_id'); -} -else -{ - $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->mode_reglement_id,'none'); -} -print '
'; - print ''; - if ($user->rights->propal->creer) - { - if ($action != 'classify') print ''; - print '
'; - print $langs->trans('Project').''.img_edit($langs->transnoentitiesnoconv('SetProject')).'
'; - print '
'; - if ($action == 'classify') - { - $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'projectid'); - } - else - { - $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none'); - } - print '
'; - if (! empty($object->fk_project)) - { - print ''; - $proj = new Project($db); - $proj->fetch($object->fk_project); - print ''; - print $proj->ref; - print ''; - print ''; - } - else { - print ' '; - } - } - print ''; -} - -// Other attributes -$parameters=array('colspan' => ' colspan="3"'); -$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook -if (empty($reshook) && ! empty($extrafields->attribute_label)) -{ - foreach($extrafields->attribute_label as $key=>$label) - { - $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); - print 'attribute_required[$key])) print ' class="fieldrequired"'; - print '>'.$label.''; - print $extrafields->showInputField($key,$value); - print ''."\n"; - } -} - -// Amount HT -print ''.$langs->trans('AmountHT').''; -print ''.price($object->total_ht).''; -print ''.$langs->trans("Currency".$conf->currency).''; - -// Margin Infos -if (! empty($conf->margin->enabled)) { - print ''; - $object->displayMarginInfos(); - print ''; -} -print ''; - -// Amount VAT -print ''.$langs->trans('AmountVAT').''; -print ''.price($object->total_tva).''; -print ''.$langs->trans("Currency".$conf->currency).''; - -// Amount Local Taxes -if ($mysoc->localtax1_assuj=="1") //Localtax1 -{ - print ''.$langs->transcountry("AmountLT1",$mysoc->country_code).''; - print ''.price($object->total_localtax1).''; - print ''.$langs->trans("Currency".$conf->currency).''; -} -if ($mysoc->localtax2_assuj=="1") //Localtax2 -{ - print ''.$langs->transcountry("AmountLT2",$mysoc->country_code).''; - print ''.price($object->total_localtax2).''; - print ''.$langs->trans("Currency".$conf->currency).''; -} - - -// Amount TTC -print ''.$langs->trans('AmountTTC').''; -print ''.price($object->total_ttc).''; -print ''.$langs->trans("Currency".$conf->currency).''; - -// Statut -print ''.$langs->trans('Status').''.$object->getLibStatut(4).''; - -print '
'; - -if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) -{ - $blocname = 'contacts'; - $title = $langs->trans('ContactsAddresses'); - include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php'; -} - -if (! empty($conf->global->MAIN_DISABLE_NOTES_TAB)) -{ - $blocname = 'notes'; - $title = $langs->trans('Notes'); - include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php'; -} - -/* - * Lines - */ - -if (! empty($conf->use_javascript_ajax) && $object->statut == 0) -{ - include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; -} - -print ''; - -// Show object lines -$result = $object->getLinesArray(); -if (! empty($object->lines)) - $ret=$object->printObjectLines($action,$mysoc,$soc,$lineid,0,$hookmanager); - -// Form to add new line -if ($object->statut == 0 && $user->rights->propal->creer) -{ - if ($action != 'editline') - { - $var=true; - - if ($conf->global->MAIN_FEATURES_LEVEL > 1) - { - // Add free or predefined products/services - $object->formAddObjectLine(0,$mysoc,$soc,$hookmanager); - } - else - { - // Add free products/services - $object->formAddFreeProduct(0,$mysoc,$soc,$hookmanager); - - // Add predefined products/services - if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) - { - $var=!$var; - $object->formAddPredefinedProduct(0,$mysoc,$soc,$hookmanager); - } - } - - $parameters=array(); - $reshook=$hookmanager->executeHooks('formAddObjectLine',$parameters,$object,$action); // Note that $action and $object may have been modified by hook - } -} - -print '
'; - -print ''; -print "\n"; - -if ($action == 'statut') -{ - /* - * Formulaire cloture (signe ou non) - */ - $form_close = '
'; - $form_close.= ''; - $form_close.= ''; - $form_close.= ''; - $form_close.= ''; - $form_close.= ''; - $form_close.= '
'.$langs->trans("CloseAs").''; - $form_close.= ''; - $form_close.= ''; - $form_close.= '
'.$langs->trans('Note').'
'; - $form_close.= ''; - $form_close.= '   '; - $form_close.= ' '; - $form_close.= '
'; - - print $form_close; -} - - -/* - * Boutons Actions - */ -if ($action != 'presend') -{ - print '
'; - - if ($action != 'statut' && $action <> 'editline') - { - // Validate - if ($object->statut == 0 && $user->rights->propal->valider) - { - if (count($object->lines) > 0) print ''.$langs->trans('Validate').''; - else print ''.$langs->trans('Validate').''; - } - - // Edit - if ($object->statut == 1 && $user->rights->propal->creer) - { - print ''.$langs->trans('Modify').''; - } - - // ReOpen - if (($object->statut == 2 || $object->statut == 3) && $user->rights->propal->cloturer) - { - print 'global->MAIN_JUMP_TAG)?'':'#reopen').'"'; - print '>'.$langs->trans('ReOpen').''; - } - - // Send - if ($object->statut == 1 || $object->statut == 2) - { - if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->propal->propal_advance->send) - { - print ''.$langs->trans('SendByMail').''; - } - else print ''.$langs->trans('SendByMail').''; - } - - // Create an order - if (! empty($conf->commande->enabled) && $object->statut == 2 && $user->societe_id == 0) - { - if ($user->rights->commande->creer) - { - print ''.$langs->trans("AddOrder").''; - } - } - - // Create an invoice and classify billed - if ($object->statut == 2 && $user->societe_id == 0) - { - if (! empty($conf->facture->enabled) && $user->rights->facture->creer) - { - print ''.$langs->trans("AddBill").''; - } - - $arraypropal=$object->getInvoiceArrayList(); - if (is_array($arraypropal) && count($arraypropal) > 0) - { - print 'socid.'">'.$langs->trans("ClassifyBilled").''; - } - } - - // Close - if ($object->statut == 1 && $user->rights->propal->cloturer) - { - print 'global->MAIN_JUMP_TAG)?'':'#close').'"'; - print '>'.$langs->trans('Close').''; - } - - // Clone - if ($user->rights->propal->creer) - { - print ''.$langs->trans("ToClone").''; - } - - // Delete - if ($user->rights->propal->supprimer) - { - print ''.$langs->trans('Delete').''; - } - - } - - print '
'; - print "
\n"; -} - -if ($action != 'presend') -{ - print '
'; - print ''; // ancre - - - /* - * Documents generes - */ - $filename=dol_sanitizeFileName($object->ref); - $filedir=$conf->propal->dir_output . "/" . dol_sanitizeFileName($object->ref); - $urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id; - $genallowed=$user->rights->propal->creer; - $delallowed=$user->rights->propal->supprimer; - - $var=true; - - $somethingshown=$formfile->show_documents('propal',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'',0,'',$soc->default_lang,$hookmanager); - - - /* - * Linked object block - */ - $somethingshown=$object->showLinkedObjectBlock(); - - print ''; - - // List of actions on element - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; - $formactions=new FormActions($db); - $somethingshown=$formactions->showactions($object,'propal',$socid); - - print '
'; -} - - -/* - * Action presend - * - */ -if ($action == 'presend') -{ - $ref = dol_sanitizeFileName($object->ref); - include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($object->ref,'/')); - $file=$fileparams['fullname']; - - // Build document if it not exists - if (! $file || ! is_readable($file)) - { - // Define output language - $outputlangs = $langs; - $newlang=''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; - if (! empty($newlang)) - { - $outputlangs = new Translate("",$conf); - $outputlangs->setDefaultLang($newlang); - } - - $result=propale_pdf_create($db, $object, GETPOST('model')?GETPOST('model'):$object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); - if ($result <= 0) - { - dol_print_error($db,$result); - exit; - } - $fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($object->ref,'/')); - $file=$fileparams['fullname']; - } - - print '
'; - print_titre($langs->trans('SendPropalByMail')); - - // Create form object - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; - $formmail = new FormMail($db); - $formmail->fromtype = 'user'; - $formmail->fromid = $user->id; - $formmail->fromname = $user->getFullName($langs); - $formmail->frommail = $user->email; - $formmail->withfrom=1; - $formmail->withto=empty($_POST["sendto"])?1:$_POST["sendto"]; - $formmail->withtosocid=$soc->id; - $formmail->withtocc=1; - $formmail->withtoccsocid=0; - $formmail->withtoccc=(! empty($conf->global->MAIN_EMAIL_USECCC)?$conf->global->MAIN_EMAIL_USECCC:false); - $formmail->withtocccsocid=0; - $formmail->withtopic=$langs->trans('SendPropalRef','__PROPREF__'); - $formmail->withfile=2; - $formmail->withbody=1; - $formmail->withdeliveryreceipt=1; - $formmail->withcancel=1; - - // Tableau des substitutions - $formmail->substit['__PROPREF__']=$object->ref; - $formmail->substit['__SIGNATURE__']=$user->signature; - $formmail->substit['__PERSONALIZED__']=''; - // Tableau des parametres complementaires - $formmail->param['action']='send'; - $formmail->param['models']='propal_send'; - $formmail->param['id']=$object->id; - $formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id; - - // Init list of files - if (GETPOST("mode")=='init') - { - $formmail->clear_attached_files(); - $formmail->add_attached_files($file,basename($file),dol_mimetype($file)); - } - - $formmail->show_form(); - - print '
'; -} - - -// End of page -llxFooter(); -$db->close(); -?> + } + + $type = $prod->type; + } + else + { + $pu_ht = price2num($price_ht, 'MU'); + $pu_ttc = price2num(GETPOST('price_ttc'), 'MU'); + $tva_npr = (preg_match('/\*/', $tva_tx)?1:0); + $tva_tx = str_replace('*', '', $tva_tx); + $label = (GETPOST('product_label')?GETPOST('product_label'):''); + $desc = $product_desc; + $type = GETPOST('type'); + } + + // Margin + $fournprice=(GETPOST('fournprice')?GETPOST('fournprice'):''); + $buyingprice=(GETPOST('buying_price')?GETPOST('buying_price'):''); + + // Local Taxes + $localtax1_tx= get_localtax($tva_tx, 1, $object->client); + $localtax2_tx= get_localtax($tva_tx, 2, $object->client); + + $info_bits=0; + if ($tva_npr) $info_bits |= 0x01; + + if (! empty($price_min) && (price2num($pu_ht)*(1-price2num(GETPOST('remise_percent'))/100) < price2num($price_min))) + { + $mesg = $langs->trans("CantBeLessThanMinPrice",price2num($price_min,'MU').getCurrencySymbol($conf->currency)); + setEventMessage($mesg, 'errors'); + } + else + { + // Insert line + $result=$object->addline( + $id, + $desc, + $pu_ht, + GETPOST('qty'), + $tva_tx, + $localtax1_tx, + $localtax2_tx, + $idprod, + GETPOST('remise_percent'), + $price_base_type, + $pu_ttc, + $info_bits, + $type, + -1, + 0, + GETPOST('fk_parent_line'), + $fournprice, + $buyingprice, + $label + ); + + if ($result > 0) + { + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + // Define output language + $outputlangs = $langs; + if (! empty($conf->global->MAIN_MULTILANGS)) + { + $outputlangs = new Translate("",$conf); + $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); + $outputlangs->setDefaultLang($newlang); + } + $ret=$object->fetch($id); // Reload to get new records + propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); + } + + unset($_POST['qty']); + unset($_POST['type']); + unset($_POST['idprod']); + unset($_POST['remise_percent']); + unset($_POST['price_ht']); + unset($_POST['price_ttc']); + unset($_POST['tva_tx']); + unset($_POST['product_ref']); + unset($_POST['product_label']); + unset($_POST['product_desc']); + unset($_POST['fournprice']); + unset($_POST['buying_price']); + + // old method + unset($_POST['np_desc']); + unset($_POST['dp_desc']); + } + else + { + setEventMessage($object->error, 'errors'); + } + } + } +} + +// Mise a jour d'une ligne dans la propale +else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('save') == $langs->trans("Save")) +{ + // Define info_bits + $info_bits=0; + if (preg_match('/\*/', GETPOST('tva_tx'))) $info_bits |= 0x01; + + // Clean parameters + $description=dol_htmlcleanlastbr(GETPOST('product_desc')); + + // Define vat_rate + $vat_rate=(GETPOST('tva_tx')?GETPOST('tva_tx'):0); + $vat_rate=str_replace('*','',$vat_rate); + $localtax1_rate=get_localtax($vat_rate,1,$object->client); + $localtax2_rate=get_localtax($vat_rate,2,$object->client); + $pu_ht=GETPOST('price_ht'); + + // Add buying price + $fournprice=(GETPOST('fournprice')?GETPOST('fournprice'):''); + $buyingprice=(GETPOST('buying_price')?GETPOST('buying_price'):''); + + // Define special_code for special lines + $special_code=0; + if (! GETPOST('qty')) $special_code=3; + + // Check minimum price + $productid = GETPOST('productid', 'int'); + if (! empty($productid)) + { + $product = new Product($db); + $res=$product->fetch($productid); + + $type=$product->type; + + $price_min = $product->price_min; + if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($object->client->price_level)) + $price_min = $product->multiprices_min[$object->client->price_level]; + + $label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label'):''); + + if ($price_min && (price2num($pu_ht)*(1-price2num(GETPOST('remise_percent'))/100) < price2num($price_min))) + { + setEventMessage($langs->trans("CantBeLessThanMinPrice", price2num($price_min,'MU')).getCurrencySymbol($conf->currency), 'errors'); + $error++; + } + } + else + { + $type = GETPOST('type'); + $label = (GETPOST('product_label') ? GETPOST('product_label'):''); + + // Check parameters + if (GETPOST('type') < 0) { + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")), 'errors'); + $error++; + } + } + + if (! $error) + { + $result = $object->updateline( + GETPOST('lineid'), + $pu_ht, + GETPOST('qty'), + GETPOST('remise_percent'), + $vat_rate, + $localtax1_rate, + $localtax2_rate, + $description, + 'HT', + $info_bits, + $special_code, + GETPOST('fk_parent_line'), + 0, + $fournprice, + $buyingprice, + $label, + $type + ); + + if ($result >= 0) + { + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + // Define output language + $outputlangs = $langs; + if (! empty($conf->global->MAIN_MULTILANGS)) + { + $outputlangs = new Translate("",$conf); + $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); + $outputlangs->setDefaultLang($newlang); + } + $ret=$object->fetch($id); // Reload to get new records + propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); + } + + unset($_POST['qty']); + unset($_POST['type']); + unset($_POST['productid']); + unset($_POST['remise_percent']); + unset($_POST['price_ht']); + unset($_POST['price_ttc']); + unset($_POST['tva_tx']); + unset($_POST['product_ref']); + unset($_POST['product_label']); + unset($_POST['product_desc']); + unset($_POST['fournprice']); + unset($_POST['buying_price']); + } + else + { + setEventMessage($object->error, 'errors'); + } + } +} + +else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('cancel') == $langs->trans('Cancel')) +{ + header('Location: '.$_SERVER['PHP_SELF'].'?id='.$object->id); // Pour reaffichage de la fiche en cours d'edition + exit; +} + +// Generation doc (depuis lien ou depuis cartouche doc) +else if ($action == 'builddoc' && $user->rights->propal->creer) +{ + if (GETPOST('model')) + { + $object->setDocModel($user, GETPOST('model')); + } + + // Define output language + $outputlangs = $langs; + if (! empty($conf->global->MAIN_MULTILANGS)) + { + $outputlangs = new Translate("",$conf); + $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); + $outputlangs->setDefaultLang($newlang); + } + $ret=$object->fetch($id); // Reload to get new records + $result=propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); + + if ($result <= 0) + { + dol_print_error($db,$result); + exit; + } + else + { + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.(empty($conf->global->MAIN_JUMP_TAG)?'':'#builddoc')); + exit; + } +} + +// Remove file in doc form +else if ($action == 'remove_file' && $user->rights->propal->creer) +{ + if ($object->id > 0) + { + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + + $langs->load("other"); + $upload_dir = $conf->propal->dir_output; + $file = $upload_dir . '/' . GETPOST('file'); + $ret=dol_delete_file($file,0,0,0,$object); + if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('file'))); + else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), 'errors'); + } +} + +// Set project +else if ($action == 'classin' && $user->rights->propal->creer) +{ + $object->setProject($_POST['projectid']); +} + +// Delai de livraison +else if ($action == 'setavailability' && $user->rights->propal->creer) +{ + $result = $object->availability($_POST['availability_id']); +} + +// Origine de la propale +else if ($action == 'setdemandreason' && $user->rights->propal->creer) +{ + $result = $object->demand_reason($_POST['demand_reason_id']); +} + +// Conditions de reglement +else if ($action == 'setconditions' && $user->rights->propal->creer) +{ + $result = $object->setPaymentTerms(GETPOST('cond_reglement_id','int')); +} + +else if ($action == 'setremisepercent' && $user->rights->propal->creer) +{ + $result = $object->set_remise_percent($user, $_POST['remise_percent']); +} + +else if ($action == 'setremiseabsolue' && $user->rights->propal->creer) +{ + $result = $object->set_remise_absolue($user, $_POST['remise_absolue']); +} + +// Mode de reglement +else if ($action == 'setmode' && $user->rights->propal->creer) +{ + $result = $object->setPaymentMethods(GETPOST('mode_reglement_id','int')); +} + +/* + * Ordonnancement des lignes + */ + +else if ($action == 'up' && $user->rights->propal->creer) +{ + $object->line_up(GETPOST('rowid')); + + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + // Define output language + $outputlangs = $langs; + if (! empty($conf->global->MAIN_MULTILANGS)) + { + $outputlangs = new Translate("",$conf); + $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); + $outputlangs->setDefaultLang($newlang); + } + $ret=$object->fetch($id); // Reload to get new records + propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); + } + + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id.'#'.GETPOST('rowid')); + exit; +} + +else if ($action == 'down' && $user->rights->propal->creer) +{ + $object->line_down(GETPOST('rowid')); + + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + // Define output language + $outputlangs = $langs; + if (! empty($conf->global->MAIN_MULTILANGS)) + { + $outputlangs = new Translate("",$conf); + $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); + $outputlangs->setDefaultLang($newlang); + } + $ret=$object->fetch($id); // Reload to get new records + propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); + } + + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id.'#'.GETPOST('rowid')); + exit; +} + +if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->propal->creer) +{ + if ($action == 'addcontact') + { + if ($object->id > 0) + { + $contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid')); + $result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]); + } + + if ($result >= 0) + { + header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); + exit; + } + else + { + if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') + { + $langs->load("errors"); + setEventMessage($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), 'errors'); + } + else + { + setEventMessage($object->error, 'errors'); + } + } + } + + // Bascule du statut d'un contact + else if ($action == 'swapstatut') + { + if ($object->fetch($id) > 0) + { + $result=$object->swapContactStatus(GETPOST('ligne')); + } + else + { + dol_print_error($db); + } + } + + // Efface un contact + else if ($action == 'deletecontact') + { + $object->fetch($id); + $result = $object->delete_contact($lineid); + + if ($result >= 0) + { + header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); + exit; + } + else + { + dol_print_error($db); + } + } +} + + +/* + * View + */ + +llxHeader('',$langs->trans('Proposal'),'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos'); + +$form = new Form($db); +$formother = new FormOther($db); +$formfile = new FormFile($db); +$formpropal = new FormPropal($db); +$companystatic=new Societe($db); + +$now=dol_now(); + +/* + * Show object in view mode + */ + +$soc = new Societe($db); +$soc->fetch($object->socid); + +$head = propal_prepare_head($object); +dol_fiche_head($head, 'comm', $langs->trans('Proposal'), 0, 'propal'); + +$formconfirm=''; + +// Clone confirmation +if ($action == 'clone') +{ + // Create an array for form + $formquestion=array( + //'text' => $langs->trans("ConfirmClone"), + //array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), + //array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), + array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid','int'),'socid','(s.client=1 OR s.client=2 OR s.client=3)')) + ); + // Paiement incomplet. On demande si motif = escompte ou autre + $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans('ClonePropal'),$langs->trans('ConfirmClonePropal',$object->ref),'confirm_clone',$formquestion,'yes',1); +} + +// Confirm delete +else if ($action == 'delete') +{ + $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteProp'), $langs->trans('ConfirmDeleteProp',$object->ref), 'confirm_delete','',0,1); +} + +// Confirm reopen +else if ($action == 'reopen') +{ + $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ReOpen'), $langs->trans('ConfirmReOpenProp',$object->ref), 'confirm_reopen','',0,1); +} + +// Confirmation delete product/service line +else if ($action == 'ask_deleteline') +{ + $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline','',0,1); +} + +// Confirm validate proposal +else if ($action == 'validate') +{ + $error=0; + + // on verifie si l'objet est en numerotation provisoire + $ref = substr($object->ref, 1, 4); + if ($ref == 'PROV') + { + $numref = $object->getNextNumRef($soc); + if (empty($numref)) + { + $error++; + dol_htmloutput_errors($object->error); + } + } + else + { + $numref = $object->ref; + } + + $text=$langs->trans('ConfirmValidateProp',$numref); + if (! empty($conf->notification->enabled)) + { + require_once DOL_DOCUMENT_ROOT .'/core/class/notify.class.php'; + $notify=new Notify($db); + $text.='
'; + $text.=$notify->confirmMessage('NOTIFY_VAL_PROPAL',$object->socid); + } + + if (! $error) $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateProp'), $text, 'confirm_validate','',0,1); +} + +if (! $formconfirm) +{ + $parameters=array('lineid'=>$lineid); + $formconfirm=$hookmanager->executeHooks('formConfirm',$parameters,$object,$action); // Note that $action and $object may have been modified by hook +} + +// Print form confirm +print $formconfirm; + + +print ''; + +$linkback = ''.$langs->trans("BackToList").''; + +// Ref +print ''; + +// Ref client +print ''; +print ''; + +// Company +print ''; +print ''; + +// Ligne info remises tiers +print ''; + +// Date of proposal +print ''; +print ''; + +// Date end proposal +print ''; +print ''; +print ''; + +// Payment term +print ''; +print ''; + +// Delivery date +$langs->load('deliveries'); +print ''; +print ''; + +// Delivery delay +print ''; +print ''; + +// Origin of demand +print ''; +print ''; + +// Payment mode +print ''; +print ''; + +// Project +if (! empty($conf->projet->enabled)) +{ + $langs->load("projects"); + print ''; + } + else + { + print '
'.$langs->trans('Ref').''; +print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', ''); +print '
'; +print ''; +if ($action != 'refclient' && ! empty($object->brouillon)) print ''; +print '
'; +print $langs->trans('RefCustomer').''; +print ''.img_edit($langs->trans('Modify')).'
'; +print '
'; +if ($user->rights->propal->creer && $action == 'refclient') +{ + print '
'; + print ''; + print ''; + print ''; + print ' '; + print '
'; +} +else +{ + print $object->ref_client; +} +print '
'.$langs->trans('Company').''.$soc->getNomUrl(1).'
'.$langs->trans('Discounts').''; +if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client); +else print $langs->trans("CompanyHasNoRelativeDiscount"); +print '. '; +$absolute_discount=$soc->getAvailableDiscounts('','fk_facture_source IS NULL'); +$absolute_creditnote=$soc->getAvailableDiscounts('','fk_facture_source IS NOT NULL'); +$absolute_discount=price2num($absolute_discount,'MT'); +$absolute_creditnote=price2num($absolute_creditnote,'MT'); +if ($absolute_discount) +{ + if ($object->statut > 0) + { + print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->currency)); + } + else + { + // Remise dispo de type non avoir + $filter='fk_facture_source IS NULL'; + print '
'; + $form->form_remise_dispo($_SERVER["PHP_SELF"].'?id='.$object->id,0,'remise_id',$soc->id,$absolute_discount,$filter); + } +} +if ($absolute_creditnote) +{ + print $langs->trans("CompanyHasCreditNote",price($absolute_creditnote),$langs->transnoentities("Currency".$conf->currency)).'. '; +} +if (! $absolute_discount && ! $absolute_creditnote) print $langs->trans("CompanyHasNoAbsoluteDiscount").'.'; +print '
'; +print ''; +if ($action != 'editdate' && ! empty($object->brouillon)) print ''; +print '
'; +print $langs->trans('Date'); +print 'id.'">'.img_edit($langs->trans('SetDate'),1).'
'; +print '
'; +if (! empty($object->brouillon) && $action == 'editdate') +{ + print '
'; + print ''; + print ''; + $form->select_date($object->date,'re','','',0,"editdate"); + print ''; + print '
'; +} +else +{ + if ($object->date) + { + print dol_print_date($object->date,'daytext'); + } + else + { + print ' '; + } +} +print '
'; +print ''; +if ($action != 'editecheance' && ! empty($object->brouillon)) print ''; +print '
'; +print $langs->trans('DateEndPropal'); +print 'id.'">'.img_edit($langs->trans('SetConditions'),1).'
'; +print '
'; +if (! empty($object->brouillon) && $action == 'editecheance') +{ + print '
'; + print ''; + print ''; + $form->select_date($object->fin_validite,'ech','','','',"editecheance"); + print ''; + print '
'; +} +else +{ + if (! empty($object->fin_validite)) + { + print dol_print_date($object->fin_validite,'daytext'); + if ($object->statut == 1 && $object->fin_validite < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late")); + } + else + { + print ' '; + } +} +print '
'; +print ''; +if ($action != 'editconditions' && ! empty($object->brouillon)) print ''; +print '
'; +print $langs->trans('PaymentConditionsShort'); +print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetConditions'),1).'
'; +print '
'; +if ($action == 'editconditions') +{ + $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->cond_reglement_id,'cond_reglement_id'); +} +else +{ + $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->cond_reglement_id,'none'); +} +print '
'; +print ''; +if ($action != 'editdate_livraison' && ! empty($object->brouillon)) print ''; +print '
'; +print $langs->trans('DeliveryDate'); +print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetDeliveryDate'),1).'
'; +print '
'; +if ($action == 'editdate_livraison') +{ + print '
'; + print ''; + print ''; + $form->select_date($object->date_livraison,'liv_','','','',"editdate_livraison"); + print ''; + print '
'; +} +else +{ + print dol_print_date($object->date_livraison,'daytext'); +} +print '
'; +print ''; +if ($action != 'editavailability' && ! empty($object->brouillon)) print ''; +print '
'; +print $langs->trans('AvailabilityPeriod'); +if (! empty($conf->commande->enabled)) print ' ('.$langs->trans('AfterOrder').')'; +print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetAvailability'),1).'
'; +print '
'; +if ($action == 'editavailability') +{ + $form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id,$object->availability_id,'availability_id',1); +} +else +{ + $form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id,$object->availability_id,'none',1); +} + +print '
'; +print ''; +if ($action != 'editdemandreason' && ! empty($object->brouillon)) print ''; +print '
'; +print $langs->trans('Source'); +print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetDemandReason'),1).'
'; +print '
'; +//print $object->demand_reason_id; +if ($action == 'editdemandreason') +{ + $form->form_demand_reason($_SERVER['PHP_SELF'].'?id='.$object->id,$object->demand_reason_id,'demand_reason_id',1); +} +else +{ + $form->form_demand_reason($_SERVER['PHP_SELF'].'?id='.$object->id,$object->demand_reason_id,'none'); +} + +print '
'; +print ''; +if ($action != 'editmode' && ! empty($object->brouillon)) print ''; +print '
'; +print $langs->trans('PaymentMode'); +print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMode'),1).'
'; +print '
'; +if ($action == 'editmode') +{ + $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->mode_reglement_id,'mode_reglement_id'); +} +else +{ + $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->mode_reglement_id,'none'); +} +print '
'; + print ''; + if ($user->rights->propal->creer) + { + if ($action != 'classify') print ''; + print '
'; + print $langs->trans('Project').''.img_edit($langs->transnoentitiesnoconv('SetProject')).'
'; + print '
'; + if ($action == 'classify') + { + $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'projectid'); + } + else + { + $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none'); + } + print '
'; + if (! empty($object->fk_project)) + { + print ''; + $proj = new Project($db); + $proj->fetch($object->fk_project); + print ''; + print $proj->ref; + print ''; + print ''; + } + else { + print ' '; + } + } + print ''; +} + +// Other attributes +$parameters=array('colspan' => ' colspan="3"'); +$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook +if (empty($reshook) && ! empty($extrafields->attribute_label)) +{ + foreach($extrafields->attribute_label as $key=>$label) + { + $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); + print 'attribute_required[$key])) print ' class="fieldrequired"'; + print '>'.$label.''; + print $extrafields->showInputField($key,$value); + print ''."\n"; + } +} + +// Amount HT +print ''.$langs->trans('AmountHT').''; +print ''.price($object->total_ht).''; +print ''.$langs->trans("Currency".$conf->currency).''; + +// Margin Infos +if (! empty($conf->margin->enabled)) { + print ''; + $object->displayMarginInfos(); + print ''; +} +print ''; + +// Amount VAT +print ''.$langs->trans('AmountVAT').''; +print ''.price($object->total_tva).''; +print ''.$langs->trans("Currency".$conf->currency).''; + +// Amount Local Taxes +if ($mysoc->localtax1_assuj=="1") //Localtax1 +{ + print ''.$langs->transcountry("AmountLT1",$mysoc->country_code).''; + print ''.price($object->total_localtax1).''; + print ''.$langs->trans("Currency".$conf->currency).''; +} +if ($mysoc->localtax2_assuj=="1") //Localtax2 +{ + print ''.$langs->transcountry("AmountLT2",$mysoc->country_code).''; + print ''.price($object->total_localtax2).''; + print ''.$langs->trans("Currency".$conf->currency).''; +} + + +// Amount TTC +print ''.$langs->trans('AmountTTC').''; +print ''.price($object->total_ttc).''; +print ''.$langs->trans("Currency".$conf->currency).''; + +// Statut +print ''.$langs->trans('Status').''.$object->getLibStatut(4).''; + +print '
'; + +if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) +{ + $blocname = 'contacts'; + $title = $langs->trans('ContactsAddresses'); + include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php'; +} + +if (! empty($conf->global->MAIN_DISABLE_NOTES_TAB)) +{ + $blocname = 'notes'; + $title = $langs->trans('Notes'); + include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php'; +} + +/* + * Lines + */ + +if (! empty($conf->use_javascript_ajax) && $object->statut == 0) +{ + include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; +} + +print ''; + +// Show object lines +$result = $object->getLinesArray(); +if (! empty($object->lines)) + $ret=$object->printObjectLines($action,$mysoc,$soc,$lineid,0,$hookmanager); + +// Form to add new line +if ($object->statut == 0 && $user->rights->propal->creer) +{ + if ($action != 'editline') + { + $var=true; + + if ($conf->global->MAIN_FEATURES_LEVEL > 1) + { + // Add free or predefined products/services + $object->formAddObjectLine(0,$mysoc,$soc,$hookmanager); + } + else + { + // Add free products/services + $object->formAddFreeProduct(0,$mysoc,$soc,$hookmanager); + + // Add predefined products/services + if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) + { + $var=!$var; + $object->formAddPredefinedProduct(0,$mysoc,$soc,$hookmanager); + } + } + + $parameters=array(); + $reshook=$hookmanager->executeHooks('formAddObjectLine',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + } +} + +print '
'; + +print ''; +print "\n"; + +if ($action == 'statut') +{ + /* + * Formulaire cloture (signe ou non) + */ + $form_close = '
'; + $form_close.= ''; + $form_close.= ''; + $form_close.= ''; + $form_close.= ''; + $form_close.= ''; + $form_close.= '
'.$langs->trans("CloseAs").''; + $form_close.= ''; + $form_close.= ''; + $form_close.= '
'.$langs->trans('Note').'
'; + $form_close.= ''; + $form_close.= '   '; + $form_close.= ' '; + $form_close.= '
'; + + print $form_close; +} + + +/* + * Boutons Actions + */ +if ($action != 'presend') +{ + print '
'; + + if ($action != 'statut' && $action <> 'editline') + { + // Validate + if ($object->statut == 0 && $user->rights->propal->valider) + { + if (count($object->lines) > 0) print ''.$langs->trans('Validate').''; + else print ''.$langs->trans('Validate').''; + } + + // Edit + if ($object->statut == 1 && $user->rights->propal->creer) + { + print ''.$langs->trans('Modify').''; + } + + // ReOpen + if (($object->statut == 2 || $object->statut == 3) && $user->rights->propal->cloturer) + { + print 'global->MAIN_JUMP_TAG)?'':'#reopen').'"'; + print '>'.$langs->trans('ReOpen').''; + } + + // Send + if ($object->statut == 1 || $object->statut == 2) + { + if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->propal->propal_advance->send) + { + print ''.$langs->trans('SendByMail').''; + } + else print ''.$langs->trans('SendByMail').''; + } + + // Create an order + if (! empty($conf->commande->enabled) && $object->statut == 2 && $user->societe_id == 0) + { + if ($user->rights->commande->creer) + { + print ''.$langs->trans("AddOrder").''; + } + } + + // Create an invoice and classify billed + if ($object->statut == 2 && $user->societe_id == 0) + { + if (! empty($conf->facture->enabled) && $user->rights->facture->creer) + { + print ''.$langs->trans("AddBill").''; + } + + $arraypropal=$object->getInvoiceArrayList(); + if (is_array($arraypropal) && count($arraypropal) > 0) + { + print 'socid.'">'.$langs->trans("ClassifyBilled").''; + } + } + + // Close + if ($object->statut == 1 && $user->rights->propal->cloturer) + { + print 'global->MAIN_JUMP_TAG)?'':'#close').'"'; + print '>'.$langs->trans('Close').''; + } + + // Clone + if ($user->rights->propal->creer) + { + print ''.$langs->trans("ToClone").''; + } + + // Delete + if ($user->rights->propal->supprimer) + { + print ''.$langs->trans('Delete').''; + } + + } + + print '
'; + print "
\n"; +} + +if ($action != 'presend') +{ + print '
'; + print ''; // ancre + + + /* + * Documents generes + */ + $filename=dol_sanitizeFileName($object->ref); + $filedir=$conf->propal->dir_output . "/" . dol_sanitizeFileName($object->ref); + $urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id; + $genallowed=$user->rights->propal->creer; + $delallowed=$user->rights->propal->supprimer; + + $var=true; + + $somethingshown=$formfile->show_documents('propal',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'',0,'',$soc->default_lang,$hookmanager); + + + /* + * Linked object block + */ + $somethingshown=$object->showLinkedObjectBlock(); + + print ''; + + // List of actions on element + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; + $formactions=new FormActions($db); + $somethingshown=$formactions->showactions($object,'propal',$socid); + + print '
'; +} + + +/* + * Action presend + * + */ +if ($action == 'presend') +{ + $ref = dol_sanitizeFileName($object->ref); + include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + $fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($ref,'/')); + $file=$fileparams['fullname']; + + // Build document if it not exists + if (! $file || ! is_readable($file)) + { + // Define output language + $outputlangs = $langs; + $newlang=''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; + if (! empty($newlang)) + { + $outputlangs = new Translate("",$conf); + $outputlangs->setDefaultLang($newlang); + } + + $result=propale_pdf_create($db, $object, GETPOST('model')?GETPOST('model'):$object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); + if ($result <= 0) + { + dol_print_error($db,$result); + exit; + } + $fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($object->ref,'/')); + $file=$fileparams['fullname']; + } + + print '
'; + print_titre($langs->trans('SendPropalByMail')); + + // Create form object + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; + $formmail = new FormMail($db); + $formmail->fromtype = 'user'; + $formmail->fromid = $user->id; + $formmail->fromname = $user->getFullName($langs); + $formmail->frommail = $user->email; + $formmail->withfrom=1; + $formmail->withto=empty($_POST["sendto"])?1:$_POST["sendto"]; + $formmail->withtosocid=$soc->id; + $formmail->withtocc=1; + $formmail->withtoccsocid=0; + $formmail->withtoccc=(! empty($conf->global->MAIN_EMAIL_USECCC)?$conf->global->MAIN_EMAIL_USECCC:false); + $formmail->withtocccsocid=0; + $formmail->withtopic=$langs->trans('SendPropalRef','__PROPREF__'); + $formmail->withfile=2; + $formmail->withbody=1; + $formmail->withdeliveryreceipt=1; + $formmail->withcancel=1; + + // Tableau des substitutions + $formmail->substit['__PROPREF__']=$object->ref; + $formmail->substit['__SIGNATURE__']=$user->signature; + $formmail->substit['__PERSONALIZED__']=''; + // Tableau des parametres complementaires + $formmail->param['action']='send'; + $formmail->param['models']='propal_send'; + $formmail->param['id']=$object->id; + $formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id; + + // Init list of files + if (GETPOST("mode")=='init') + { + $formmail->clear_attached_files(); + $formmail->add_attached_files($file,basename($file),dol_mimetype($file)); + } + + $formmail->show_form(); + + print '
'; +} + + +// End of page +llxFooter(); +$db->close(); +?> From 1e3b26a104e04b62ca422fd19b295c2eb19f0653 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 29 Mar 2013 11:54:22 +0100 Subject: [PATCH 052/194] Fix: file with a specific mask not found, again --- htdocs/compta/facture.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 8c357894b4a..286204b52a2 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -3350,7 +3350,7 @@ else if ($id > 0 || ! empty($ref)) $ref = dol_sanitizeFileName($object->ref); include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($object->ref,'/')); + $fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; // Build document if it not exists From c53564c45470a09065d8d8f1e09cadbd97ca977c Mon Sep 17 00:00:00 2001 From: jfefe Date: Fri, 29 Mar 2013 14:03:39 +0100 Subject: [PATCH 053/194] For extrafield with date type show calendar instead basic input field --- htdocs/core/class/extrafields.class.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index ce94f2d33ba..b143091799d 100755 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -582,7 +582,7 @@ class ExtraFields * Return HTML string to put an input field into a page * * @param string $key Key of attribute - * @param string $value Value to show + * @param string $value Value to show (for date type it must be in timestamp format) * @param string $moreparam To add more parametes on html input tag * @return void */ @@ -619,7 +619,13 @@ class ExtraFields { $tmp=explode(',',$size); $newsize=$tmp[0]; - $out=''; + if(!class_exists('Form')) + require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; + $formstat = new Form($db); + + $showtime = in_array($type,array('datetime')) ? 1 : 0; + $out = $formstat->select_date($value, 'options_'.$key, $showtime, $showtime, $required, '', 1, 1, 0, 0, 1); + //$out=''; } elseif (in_array($type,array('int','double'))) { @@ -670,9 +676,10 @@ class ExtraFields } $out.=''; } - // Add comments + /* Add comments if ($type == 'date') $out.=' (YYYY-MM-DD)'; elseif ($type == 'datetime') $out.=' (YYYY-MM-DD HH:MM:SS)'; + */ return $out; } From 76ce938f61b85e81fed182f35b0a84f0410b5853 Mon Sep 17 00:00:00 2001 From: jfefe Date: Fri, 29 Mar 2013 14:09:47 +0100 Subject: [PATCH 054/194] When retrieve extrafields, loop on extralabels array instead of posted values Add support for calendar display on date extrafield --- htdocs/societe/soc.php | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 80de6ec7146..7761a13c469 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -55,6 +55,9 @@ if ($user->societe_id) $socid=$user->societe_id; $object = new Societe($db); $extrafields = new ExtraFields($db); +// fetch optionals attributes and labels +$extralabels=$extrafields->fetch_name_optionals_label('company'); + // Get object canvas (By default, this is not defined, so standard usage of dolibarr) $object->getCanvas($socid); $canvas = $object->canvas?$object->canvas:GETPOST("canvas"); @@ -167,14 +170,21 @@ if (empty($reshook)) $object->default_lang = GETPOST('default_lang'); // Get extra fields - foreach($_POST as $key => $value) + foreach ($extralabels as $key => $value) { - if (preg_match("/^options_/",$key)) - { - $object->array_options[$key]=GETPOST($key); - } + $key_type = $extrafields->attribute_type[$key]; + + if (in_array($key_type,array('date','datetime'))) + { + // Clean parameters + $value_key=dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]); + } + else + { + $value_key=GETPOST("options_".$key); + } + $object->array_options[$key]=$value_key; } - if (GETPOST('deletephoto')) $object->logo = ''; else if (! empty($_FILES['photo']['name'])) $object->logo = dol_sanitizeFileName($_FILES['photo']['name']); @@ -508,9 +518,6 @@ if (empty($reshook)) * View */ -// fetch optionals attributes and labels -$extralabels=$extrafields->fetch_name_optionals_label('company'); - $help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; llxHeader('',$langs->trans("ThirdParty"),$help_url); @@ -1000,6 +1007,13 @@ else if (! empty($extrafields->attribute_required[$key])) print ' class="fieldrequired"'; print '>'.$label.''; print ''; + + // Convert date into timestamp format + if (in_array($extrafields->attribute_type[$key],array('date','datetime'))) + { + $value = dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]); + } + print $extrafields->showInputField($key,$value); print ''; From c1e6de33eb2e723c35ef810a2c490282d6021b16 Mon Sep 17 00:00:00 2001 From: jfefe Date: Fri, 29 Mar 2013 14:37:29 +0100 Subject: [PATCH 055/194] Fix : bad definition of key for extrafields array --- htdocs/societe/soc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 7761a13c469..e28f1a12443 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -183,7 +183,7 @@ if (empty($reshook)) { $value_key=GETPOST("options_".$key); } - $object->array_options[$key]=$value_key; + $object->array_options["options_".$key]=$value_key; } if (GETPOST('deletephoto')) $object->logo = ''; else if (! empty($_FILES['photo']['name'])) $object->logo = dol_sanitizeFileName($_FILES['photo']['name']); From 80f080f5a954ad2e109dbf5a06e51a5323f6a014 Mon Sep 17 00:00:00 2001 From: jfefe Date: Fri, 29 Mar 2013 14:45:40 +0100 Subject: [PATCH 056/194] Format date for sql query Using dol_print_date because db->idate doesn't work --- htdocs/core/class/commonobject.class.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 79a471a0251..b128455b8ff 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2132,15 +2132,19 @@ abstract class CommonObject case 'price': $this->array_options[$key] = price2num($this->array_options[$key]); break; + case 'date': + $this->array_options[$key] = dol_print_date($this->array_options[$key],'dayrfc'); + break; + case 'datetime': + $this->array_options[$key] = dol_print_date($this->array_options[$key],'dayhourrfc'); + break; } - } - + } $this->db->begin(); $sql_del = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element."_extrafields WHERE fk_object = ".$this->id; dol_syslog(get_class($this)."::insertExtraFields delete sql=".$sql_del); $this->db->query($sql_del); - $sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element."_extrafields (fk_object"; foreach($this->array_options as $key => $value) { From 6702386b8bb76f478a284ccf24defab57a2bc449 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 29 Mar 2013 14:54:07 +0100 Subject: [PATCH 057/194] Some fix into chineese language files --- htdocs/langs/zh_CN/main.lang | 2 +- htdocs/langs/zh_TW/main.lang | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/langs/zh_CN/main.lang b/htdocs/langs/zh_CN/main.lang index 31e8e03a2c5..04235a1bd69 100644 --- a/htdocs/langs/zh_CN/main.lang +++ b/htdocs/langs/zh_CN/main.lang @@ -1,5 +1,5 @@ /* - * Language code: zh_CN + * Language code: zh_CN (simplified) * Automatic generated via autotranslator.php tool * Generation date 2010-06-09 00:39:24 */ diff --git a/htdocs/langs/zh_TW/main.lang b/htdocs/langs/zh_TW/main.lang index 5712e8e5c03..b853fbb6073 100644 --- a/htdocs/langs/zh_TW/main.lang +++ b/htdocs/langs/zh_TW/main.lang @@ -1,13 +1,14 @@ /* - * Language code: zh_TW + * Language code: zh_TW (traditionnal) * Generation date 2012-09-04 16:02:00 */ // Reference language: en_US CHARSET=UTF-8 DIRECTION=ltr -#FONTFORPDF=chinese -FONTFORPDF=stsongstdlight +# msungstdlight or cid0ct are for traditionnal chinese (traditionnal does not render with ubuntu pdf reader) +# stsongstdlight or cid0cs are for simplified chinese +FONTFORPDF=msungstdlight #FONTSIZEFORPDF=9 SeparatorDecimal=. SeparatorThousand=None From 1a1aebf793bf6363585f4b5715ee1eabac0e270d Mon Sep 17 00:00:00 2001 From: jfefe Date: Fri, 29 Mar 2013 14:56:31 +0100 Subject: [PATCH 058/194] Display date extrafield with correct format --- htdocs/core/class/extrafields.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index b143091799d..4ddc38301bd 100755 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -705,10 +705,12 @@ class ExtraFields if ($type == 'date') { $showsize=10; + $value=dol_print_date($value,'day'); } elseif ($type == 'datetime') { $showsize=19; + $value=dol_print_date($value,'dayhour'); } elseif ($type == 'int') { From f57320e697d460473027876e7972e40a08bc518c Mon Sep 17 00:00:00 2001 From: Grand Philippe Date: Fri, 29 Mar 2013 15:36:54 +0100 Subject: [PATCH 059/194] add numbering for supplier invoice --- .../fourn/class/fournisseur.facture.class.php | 38 +++++++++++-------- htdocs/fourn/facture/fiche.php | 29 +++++++++++++- htdocs/fourn/facture/index.php | 3 +- .../install/mysql/migration/3.3.0-3.4.0.sql | 6 +-- 4 files changed, 54 insertions(+), 22 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 840c4cecb94..019b36f7fdf 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -5,6 +5,7 @@ * Copyright (C) 2005 Marc Barilley * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2010-2011 Juanjo Menent + * Copyright (C) 2013 Philippe Grand * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -40,7 +41,7 @@ class FactureFournisseur extends CommonInvoice public $fk_element='fk_facture_fourn'; protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe - var $ref; // TODO deprecated + var $ref; var $product_ref; var $ref_supplier; var $socid; @@ -132,7 +133,8 @@ class FactureFournisseur extends CommonInvoice $totalht = ($amount - $remise); $sql = "INSERT INTO ".MAIN_DB_PREFIX."facture_fourn ("; - $sql.= "facnumber"; + $sql.= "ref"; + $sql.= ", facnumber"; $sql.= ", entity"; $sql.= ", libelle"; $sql.= ", fk_soc"; @@ -144,7 +146,8 @@ class FactureFournisseur extends CommonInvoice $sql.= ", date_lim_reglement"; $sql.= ")"; $sql.= " VALUES ("; - $sql.= "'".$this->db->escape($number)."'"; + $sql.= "'(PROV)'"; + $sql.= ", '".$this->db->escape($number)."'"; $sql.= ", ".$conf->entity; $sql.= ", '".$this->db->escape($this->libelle)."'"; $sql.= ", ".$this->socid; @@ -259,6 +262,7 @@ class FactureFournisseur extends CommonInvoice $sql = "SELECT"; $sql.= " t.rowid,"; + $sql.= " t.ref,"; $sql.= " t.facnumber,"; $sql.= " t.entity,"; $sql.= " t.type,"; @@ -294,7 +298,7 @@ class FactureFournisseur extends CommonInvoice $sql.= ' s.nom as socnom, s.rowid as socid'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as t,'.MAIN_DB_PREFIX.'societe as s'; if ($id) $sql.= " WHERE t.rowid=".$id; - if ($ref) $sql.= " WHERE t.rowid='".$this->db->escape($ref)."'"; // ref is id (facnumber is supplier ref) + if ($ref) $sql.= " WHERE t.ref='".$this->db->escape($ref)."'"; // ref is id (facnumber is supplier ref) $sql.= ' AND t.fk_soc = s.rowid'; dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); @@ -306,7 +310,7 @@ class FactureFournisseur extends CommonInvoice $obj = $this->db->fetch_object($resql); $this->id = $obj->rowid; - $this->ref = $obj->rowid; + $this->ref = $obj->ref; $this->ref_supplier = $obj->facnumber; $this->facnumber = $obj->facnumber; @@ -459,6 +463,7 @@ class FactureFournisseur extends CommonInvoice $error=0; // Clean parameters + if (isset($this->ref)) $this->ref=trim($this->ref); if (isset($this->ref_supplier)) $this->ref_supplier=trim($this->ref_supplier); if (isset($this->entity)) $this->entity=trim($this->entity); if (isset($this->type)) $this->type=trim($this->type); @@ -495,6 +500,7 @@ class FactureFournisseur extends CommonInvoice // Update request $sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn SET"; + $sql.= " ref=".(isset($this->ref)?"'".$this->db->escape($this->ref)."'":"null").","; $sql.= " facnumber=".(isset($this->facnumber)?"'".$this->db->escape($this->facnumber)."'":"null").","; $sql.= " entity=".(isset($this->entity)?$this->entity:"null").","; $sql.= " type=".(isset($this->type)?$this->type:"null").","; @@ -834,7 +840,7 @@ class FactureFournisseur extends CommonInvoice } $sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn"; - $sql.= " SET fk_statut = 1, fk_user_valid = ".$user->id; + $sql.= " SET ref='".$num."', fk_statut = 1, fk_user_valid = ".$user->id; $sql.= " WHERE rowid = ".$this->id; dol_syslog(get_class($this)."::validate sql=".$sql); @@ -1181,17 +1187,17 @@ class FactureFournisseur extends CommonInvoice dol_syslog(get_class($this)."::delete rowid=".$rowid, LOG_DEBUG); $error=0; - $this->db->begin(); + $this->db->begin(); if (! $error && ! $notrigger) { - // Appel des triggers - include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('LINEBILL_SUPPLIER_DELETE',$this,$user,$langs,$conf); - if ($result < 0) { - $error++; $this->errors=$interface->errors; - } + // Appel des triggers + include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); + $interface=new Interfaces($this->db); + $result=$interface->run_triggers('LINEBILL_SUPPLIER_DELETE',$this,$user,$langs,$conf); + if ($result < 0) { + $error++; $this->errors=$interface->errors; + } // Fin appel triggers } @@ -1213,7 +1219,7 @@ class FactureFournisseur extends CommonInvoice if (! $error) { // Mise a jour prix facture - $this->update_price(); + $this->update_price(); } if (! $error) @@ -1519,7 +1525,7 @@ class FactureFournisseur extends CommonInvoice $object->statut=0; // Clear fields - $object->ref_supplier=$langs->trans("CopyOf").' '.$object->ref_supplier; + $object->ref=$langs->trans("CopyOf").' '.$object->ref; $object->author = $user->id; $object->user_valid = ''; $object->fk_facture_source = 0; diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index b8b4c209cb3..8d33e97f499 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -5,6 +5,7 @@ * Copyright (C) 2005 Marc Barilley * Copyright (C) 2005-2013 Regis Houssin * Copyright (C) 2010-2012 Juanjo Menent + * Copyright (C) 2013 Philippe Grand * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -49,6 +50,7 @@ $errors=array(); $id = (GETPOST('facid','int') ? GETPOST('facid','int') : GETPOST('id','int')); $action = GETPOST("action"); $confirm = GETPOST("confirm"); +$ref = GETPOST('ref','alpha'); //PDF $hidedetails = (GETPOST('hidedetails','int') ? GETPOST('hidedetails','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0)); @@ -65,6 +67,12 @@ $hookmanager->initHooks(array('invoicesuppliercard')); $object=new FactureFournisseur($db); +// Load object +if ($id > 0 || ! empty($ref)) +{ + $ret=$object->fetch($id, $ref); +} + /* @@ -258,7 +266,8 @@ elseif ($action == 'add' && $user->rights->fournisseur->facture->creer) $db->begin(); // Creation facture - $object->ref = $_POST['facnumber']; + $object->ref = $_POST['ref']; + $object->facnumber = $_POST['facnumber']; $object->socid = $_POST['socid']; $object->libelle = $_POST['libelle']; $object->date = $datefacture; @@ -1281,6 +1290,22 @@ else // Confirmation de la validation if ($action == 'valid') { + // on verifie si l'objet est en numerotation provisoire + $objectref = substr($object->ref, 1, 4); + if ($objectref == 'PROV') + { + $savdate=$object->date; + if (! empty($conf->global->FAC_FORCE_DATE_VALIDATION)) + { + $object->date=dol_now(); + $object->date_lim_reglement=$object->calculate_date_lim_reglement(); + } + $numref = $object->getNextNumRef($soc); + } + else + { + $numref = $object->ref; + } $formquestion=array(); if (! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL) && $object->hasProductsOrServices(1)) { @@ -1322,7 +1347,7 @@ else // Ref print ''.$langs->trans("Ref").''; - print $form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'ref'); + print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref'); print ''; print "\n"; diff --git a/htdocs/fourn/facture/index.php b/htdocs/fourn/facture/index.php index 6181ec15b24..b5922f52b29 100644 --- a/htdocs/fourn/facture/index.php +++ b/htdocs/fourn/facture/index.php @@ -2,6 +2,7 @@ /* Copyright (C) 2002-2006 Rodolphe Quiedeville * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2013 Philippe Grand * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -102,7 +103,7 @@ $htmlother=new FormOther($db); llxHeader('',$langs->trans("SuppliersInvoices"),'EN:Suppliers_Invoices|FR:FactureFournisseur|ES:Facturas_de_proveedores'); $sql = "SELECT s.rowid as socid, s.nom, "; -$sql.= " fac.rowid as ref, fac.rowid as facid, fac.facnumber, fac.datef, fac.date_lim_reglement as date_echeance,"; +$sql.= " fac.rowid as facid, fac.ref, fac.facnumber, fac.datef, fac.date_lim_reglement as date_echeance,"; $sql.= " fac.total_ht, fac.total_ttc, fac.paye as paye, fac.fk_statut as fk_statut, fac.libelle"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user "; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as fac"; diff --git a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql index 571ba7373a2..db609d76ad1 100755 --- a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql +++ b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql @@ -48,6 +48,9 @@ alter table llx_contratdet add column buy_price_ht double(24,8) DEFAULT 0 after -- serialised array, to store value of select list choices for example alter table llx_extrafields add column param text after pos; +-- numbering on supplier invoice +alter table llx_facture_fourn add column ref varchar(30) NOT NULL after rowid; + alter table llx_propal CHANGE COLUMN fk_adresse_livraison fk_delivery_address integer; alter table llx_commande CHANGE COLUMN fk_adresse_livraison fk_delivery_address integer; @@ -205,6 +208,3 @@ ALTER TABLE llx_user ADD COLUMN town varchar(50); ALTER TABLE llx_user ADD COLUMN fk_state integer DEFAULT 0; ALTER TABLE llx_user ADD COLUMN fk_country integer DEFAULT 0; - - - From 006050b6cd8c32b1bfdc37f01ddecb8c7de0b405 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 29 Mar 2013 15:39:35 +0100 Subject: [PATCH 060/194] Fix: left menu not always opened --- htdocs/core/menus/standard/eldy.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 61aaec75fc1..f6b58699919 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -414,8 +414,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $newmenu = $menu; $mainmenu=($forcemainmenu?$forcemainmenu:$_SESSION["mainmenu"]); - $leftmenu=($forceleftmenu?'':$_SESSION["leftmenu"]); - + $leftmenu=($forceleftmenu?'':(empty($_SESSION["leftmenu"])?'none':$_SESSION["leftmenu"])); + // Show logo company if (empty($noout) && ! empty($conf->global->MAIN_SHOW_LOGO)) { From 8f331adff61ebb3f0841d51648242abe6d824e50 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 29 Mar 2013 16:16:26 +0100 Subject: [PATCH 061/194] New: Work on men management rewrite --- htdocs/core/menus/standard/auguria.lib.php | 106 +++++++++++--------- htdocs/core/menus/standard/auguria_menu.php | 52 +++++++++- htdocs/core/menus/standard/eldy.lib.php | 7 +- htdocs/core/menus/standard/eldy_menu.php | 2 +- 4 files changed, 110 insertions(+), 57 deletions(-) diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php index 18ffe81ecdd..6faf6e90a50 100644 --- a/htdocs/core/menus/standard/auguria.lib.php +++ b/htdocs/core/menus/standard/auguria.lib.php @@ -30,12 +30,13 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php'; * * @param DoliDB $db Database handler * @param string $atarget Target - * @param int $type_user 0=Internal,1=External,2=All + * @param int $type_user 0=Menu for backoffice, 1=Menu for front office * @param array &$tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) * @param array &$menu Object Menu to return back list of menu entries + * @param int $noout Disable output (Initialise &$menu only). * @return void */ -function print_auguria_menu($db,$atarget,$type_user,&$tabMenu,&$menu) +function print_auguria_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0) { global $user,$conf,$langs,$dolibarr_main_db_name; @@ -45,11 +46,11 @@ function print_auguria_menu($db,$atarget,$type_user,&$tabMenu,&$menu) $id='mainmenu'; $listofmodulesforexternal=explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL); - //$tabMenu=array(); + // Show personalized menus $menuArbo = new Menubase($db,'auguria'); $newTabMenu = $menuArbo->menuTopCharger('', '', $type_user, 'auguria',$tabMenu); - print_start_menu_array_auguria(); + if (empty($noout)) print_start_menu_array_auguria(); $num = count($newTabMenu); for($i = 0; $i < $num; $i++) @@ -59,24 +60,23 @@ function print_auguria_menu($db,$atarget,$type_user,&$tabMenu,&$menu) $showmode=dol_auguria_showmenu($type_user,$newTabMenu[$i],$listofmodulesforexternal); if ($showmode == 1) { - // Define url - if (preg_match("/^(http:\/\/|https:\/\/)/i",$newTabMenu[$i]['url'])) + $url = $shorturl = $newTabMenu[$i]['url']; + if (! preg_match("/^(http:\/\/|https:\/\/)/i",$newTabMenu[$i]['url'])) { - $url = $newTabMenu[$i]['url']; - } - else - { - $url=dol_buildpath($newTabMenu[$i]['url'],1); + $param=''; if (! preg_match('/mainmenu/i',$url) || ! preg_match('/leftmenu/i',$url)) { - if (! preg_match('/\?/',$url)) $url.='?'; - else $url.='&'; - $url.='mainmenu='.$newTabMenu[$i]['mainmenu'].'&leftmenu='; + if (! preg_match('/\?/',$url)) $param.='?'; + else $param.='&'; + $param.='mainmenu='.$newTabMenu[$i]['mainmenu'].'&leftmenu='; } //$url.="idmenu=".$newTabMenu[$i]['rowid']; // Already done by menuLoad + $url=dol_buildpath($url,1).$param; + $shorturl = $newTabMenu[$i]['url'].$param; } $url=preg_replace('/__LOGIN__/',$user->login,$url); - + $shorturl=preg_replace('/__LOGIN__/',$user->login,$shorturl); + // Define the class (top menu selected or not) if (! empty($_SESSION['idmenu']) && $newTabMenu[$i]['rowid'] == $_SESSION['idmenu']) $classname='class="tmenusel"'; else if (! empty($_SESSION["mainmenu"]) && $newTabMenu[$i]['mainmenu'] == $_SESSION["mainmenu"]) $classname='class="tmenusel"'; @@ -84,12 +84,13 @@ function print_auguria_menu($db,$atarget,$type_user,&$tabMenu,&$menu) } else if ($showmode == 2) $classname='class="tmenu"'; - print_start_menu_entry_auguria($idsel,$classname,$showmode); - print_text_menu_entry_auguria($newTabMenu[$i]['titre'], $showmode, $url, $id, $idsel, $classname, ($newTabMenu[$i]['target']?$newTabMenu[$i]['target']:$atarget)); - print_end_menu_entry_auguria($showmode); + if (empty($noout)) print_start_menu_entry_auguria($idsel,$classname,$showmode); + if (empty($noout)) print_text_menu_entry_auguria($newTabMenu[$i]['titre'], $showmode, $url, $id, $idsel, $classname, ($newTabMenu[$i]['target']?$newTabMenu[$i]['target']:$atarget)); + if (empty($noout)) print_end_menu_entry_auguria($showmode); + $menu->add($shorturl, $newTabMenu[$i]['titre'], 0, $showmode, ($newTabMenu[$i]['target']?$newTabMenu[$i]['target']:$atarget), ($newTabMenu[$i]['mainmenu']?$newTabMenu[$i]['mainmenu']:$newTabMenu[$i]['rowid']), ''); } - print_end_menu_array_auguria(); + if (empty($noout)) print_end_menu_array_auguria(); print "\n"; } @@ -127,7 +128,7 @@ function print_start_menu_entry_auguria($idsel,$classname,$showmode) * Output menu entry * * @param string $text Text - * @param int $showmode 1 = allowed or 2 = not allowed + * @param int $showmode 0 = hide, 1 = allowed or 2 = not allowed * @param string $url Url * @param string $id Id * @param string $idsel Id sel @@ -142,7 +143,7 @@ function print_text_menu_entry_auguria($text, $showmode, $url, $id, $idsel, $cla if ($showmode == 1) { print ''; - print '
'; + print '
'; print '
'; print ''; print ''; @@ -152,7 +153,7 @@ function print_text_menu_entry_auguria($text, $showmode, $url, $id, $idsel, $cla } if ($showmode == 2) { - print '
'; + print '
'; print '
'; print ''; print $text; @@ -172,8 +173,8 @@ function print_end_menu_entry_auguria($showmode) if ($showmode) { print ''; - print "\n"; } + print "\n"; } /** @@ -198,20 +199,22 @@ function print_end_menu_array_auguria() * @param array $menu_array_after Table of menu entries to show after entries of menu handler * @param array &$tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) * @param array &$menu Object Menu to return back list of menu entries + * @param int $noout Disable output (Initialise &$menu only). + * @param string $forcemainmenu 'x'=Force mainmenu to mainmenu='x' + * @param string $forceleftmenu 'all'=Force leftmenu to '' (= all) * @return void */ -function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabMenu,&$menu) +function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabMenu,&$menu,$noout=0,$forcemainmenu='',$forceleftmenu='') { global $user,$conf,$langs,$dolibarr_main_db_name,$mysoc; - $overwritemenufor = array(); $newmenu = $menu; - $mainmenu=$_SESSION["mainmenu"]; - $leftmenu=$_SESSION["leftmenu"]; + $mainmenu=($forcemainmenu?$forcemainmenu:$_SESSION["mainmenu"]); + $leftmenu=($forceleftmenu?'':(empty($_SESSION["leftmenu"])?'none':$_SESSION["leftmenu"])); // Show logo company - if (! empty($conf->global->MAIN_SHOW_LOGO)) + if (empty($noout) && ! empty($conf->global->MAIN_SHOW_LOGO)) { $mysoc->logo_mini=$conf->global->MAIN_INFO_SOCIETE_LOGO_MINI; if (! empty($mysoc->logo_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) @@ -245,23 +248,21 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM if (! is_array($menu_array)) return 0; // Show menu + if (empty($noout)) + { $alt=0; $num=count($menu_array); for ($i = 0; $i < $num; $i++) { + $showmenu=true; + if (! empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED) && empty($menu_array[$i]['enabled'])) $showmenu=false; + $alt++; - if (empty($menu_array[$i]['level'])) + if (empty($menu_array[$i]['level']) && $showmenu) { if (($alt%2==0)) { - if ($conf->use_javascript_ajax && ! empty($conf->global->MAIN_MENU_USE_JQUERY_ACCORDION)) - { - print '
'."\n"; - } - else - { - print '
'."\n"; - } + print '
'."\n"; } else { @@ -290,7 +291,7 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM $url.='mainmenu='.$mainmenu; } - print ''."\n"; + print ''."\n"; // Menu niveau 0 if ($menu_array[$i]['level'] == 0) @@ -299,35 +300,42 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM { print ''; } - else if (empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED)) + else if ($showmenu) { - print ''; + print ''."\n"; } - print "\n".'
'."\n"; - print ''."\n"; + if ($showmenu) + print ''."\n"; } // Menu niveau > 0 if ($menu_array[$i]['level'] > 0) { if ($menu_array[$i]['enabled']) { - print ''; + print ''."\n"; } - else if (empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED)) + else if ($showmenu) { - print ''; + print ''."\n"; } } // If next is a new block or end if (empty($menu_array[$i+1]['level'])) { - print ''."\n"; - print "
\n"; - print "
\n"; + if ($showmenu) + print ''."\n"; + print "
\n"; } } - + } + return count($menu_array); } diff --git a/htdocs/core/menus/standard/auguria_menu.php b/htdocs/core/menus/standard/auguria_menu.php index 1aeb8d8ac98..19b4b15764f 100644 --- a/htdocs/core/menus/standard/auguria_menu.php +++ b/htdocs/core/menus/standard/auguria_menu.php @@ -151,12 +151,12 @@ class MenuManager /** * Show menu * - * @param string $mode 'top' or 'left' + * @param string $mode 'top', 'left', 'jmobile' * @return int Number of menu entries shown */ function showmenu($mode) { - global $conf; + global $conf, $langs; require_once DOL_DOCUMENT_ROOT.'/core/menus/standard/auguria.lib.php'; @@ -173,7 +173,53 @@ class MenuManager if ($mode == 'top') $res=print_auguria_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu); if ($mode == 'left') $res=print_left_auguria_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$this->menu); - + if ($mode == 'jmobile') + { + $res=print_auguria_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,1); + + foreach($this->menu->liste as $key => $val) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu' + { + print '
    '; + print '
  • '; + if ($val['enabled'] == 1) + { + $relurl=dol_buildpath($val['url'],1); + + print ''.$val['titre'].''."\n"; + // Search submenu fot this entry + $tmpmainmenu=$val['mainmenu']; + $tmpleftmenu='all'; + $submenu=new Menu(); + $res=print_left_auguria_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$submenu,1,$tmpmainmenu,$tmpleftmenu); + $nexturl=dol_buildpath($submenu->liste[0]['url'],1); + $canonrelurl=preg_replace('/\?.*$/','',$relurl); + $canonnexturl=preg_replace('/\?.*$/','',$nexturl); + //var_dump($canonrelurl); + //var_dump($canonnexturl); + print '
      '; + if ($canonrelurl != $canonnexturl && $val['mainmenu'] != 'home') + { + // We add sub entry + print '
    • '.$langs->trans("MainArea").'-'.$val['titre'].'
    • '."\n"; + } + foreach($submenu->liste as $key2 => $val2) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu' + { + $relurl2=dol_buildpath($val2['url'],1); + //var_dump($val2); + print ''.$val2['titre'].''."\n"; + } + //var_dump($submenu); + print '
    '; + } + if ($val['enabled'] == 2) + { + print ''.$val['titre'].''; + } + print '
  • '; + print '
'."\n"; + } + } + unset($this->menu); return $res; diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index f6b58699919..23970e6897c 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -264,10 +264,9 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0) $showmode=dol_eldy_showmenu($type_user,$newTabMenu[$i],$listofmodulesforexternal); if ($showmode == 1) { - $url = $newTabMenu[$i]['url']; + $url = $shorturl = $newTabMenu[$i]['url']; if (! preg_match("/^(http:\/\/|https:\/\/)/i",$newTabMenu[$i]['url'])) { - $url = $newTabMenu[$i]['url']; $param=''; if (! preg_match('/mainmenu/i',$url) || ! preg_match('/leftmenu/i',$url)) { @@ -436,8 +435,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu } /** - * On definit newmenu en fonction de mainmenu et leftmenu - * ------------------------------------------------------ + * We update newmenu with entries found into database + * -------------------------------------------------- */ if ($mainmenu) { diff --git a/htdocs/core/menus/standard/eldy_menu.php b/htdocs/core/menus/standard/eldy_menu.php index eb050232366..fdf3a93e2fb 100644 --- a/htdocs/core/menus/standard/eldy_menu.php +++ b/htdocs/core/menus/standard/eldy_menu.php @@ -140,7 +140,7 @@ class MenuManager if ($val['enabled'] == 1) { $relurl=dol_buildpath($val['url'],1); - + print ''.$val['titre'].''."\n"; // Search submenu fot this entry $tmpmainmenu=$val['mainmenu']; From 4c47393b51adba844584765c0050287877b01c94 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 29 Mar 2013 16:18:55 +0100 Subject: [PATCH 062/194] Fix: Add more ODT tags --- .../core/class/commondocgenerator.class.php | 31 ++++++++++++++++++- .../doc/doc_generic_invoice_odt.modules.php | 4 ++- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 9561aa288fb..36eb166f499 100755 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -51,7 +51,14 @@ abstract class CommonDocGenerator 'myuser_firstname'=>$user->firstname, 'myuser_login'=>$user->login, 'myuser_phone'=>$user->office_phone, - 'myuser_fax'=>$user->office_fax, + 'myuser_address'=>$user->address, + 'myuser_zip'=>$user->zip, + 'myuser_town'=>$user->town, + 'myuser_country'=>$user->country, + 'myuser_country_code'=>$user->country_code, + 'myuser_state'=>$user->state, + 'myuser_state_code'=>$user->state_code, + 'myuser_fax'=>$user->office_fax, 'myuser_mobile'=>$user->user_mobile, 'myuser_email'=>$user->email, 'myuser_web'=>'' // url not exist in $user object @@ -190,6 +197,28 @@ abstract class CommonDocGenerator } + /** + * Define array with couple subtitution key => subtitution value + * + * @param Translate $outputlangs Language object for output + * @return array Array of substitution key->code + */ + function get_substitutionarray_other($outputlangs) + { + global $conf; + + $now=dol_now('gmt'); // gmt + $array_other = array( + 'current_date'=>dol_print_date($now,'day','tzuser'), + 'current_datehour'=>dol_print_date($now,'dayhour','tzuser'), + 'current_server_date'=>dol_print_date($now,'day','tzserver'), + 'current_server_datehour'=>dol_print_date($now,'dayhour','tzserver'), + ); + + return $array_other; + } + + /** * Define array with couple substitution key => substitution value * diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php index ee80dbbb141..753446b10ad 100644 --- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php +++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php @@ -117,6 +117,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures 'object_date_creation'=>dol_print_date($object->date_creation,'day'), 'object_date_modification'=>(! empty($object->date_modification)?dol_print_date($object->date_modification,'day'):''), 'object_date_validation'=>dol_print_date($object->date_validation,'dayhour'), + 'object_date_delivery_planed'=>dol_print_date($object->date_livraison,'dayhour'), 'object_payment_mode_code'=>$object->mode_reglement_code, 'object_payment_mode'=>($outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code)!='PaymentType'.$object->mode_reglement_code?$outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code):$object->mode_reglement), 'object_payment_term_code'=>$object->cond_reglement_code, @@ -415,7 +416,8 @@ class doc_generic_invoice_odt extends ModelePDFFactures $array_thirdparty=$this->get_substitutionarray_thirdparty($socobject,$outputlangs); $array_objet=$this->get_substitutionarray_object($object,$outputlangs); $array_propal=is_object($propal_object)?$this->get_substitutionarray_propal($propal_object,$outputlangs,'propal'):array(); - + $array_other=$this->get_substitutionarray_other($user,$outputlangs); + $tmparray = array_merge($array_user,$array_soc,$array_thirdparty,$array_objet,$array_propal); complete_substitutions_array($tmparray, $outputlangs, $object); From 97a90b09048f867509ba577861a69e568b76765b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 29 Mar 2013 16:45:40 +0100 Subject: [PATCH 063/194] New: Add more ODT tags --- .../modules/commande/doc/doc_generic_order_odt.modules.php | 5 +++-- .../modules/facture/doc/doc_generic_invoice_odt.modules.php | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php index 4ba2a560f5d..7ec078099db 100644 --- a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php +++ b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php @@ -105,8 +105,9 @@ class doc_generic_order_odt extends ModelePDFCommandes 'object_date'=>dol_print_date($object->date,'day'), 'object_date_delivery'=>dol_print_date($object->date_livraison,'dayhour'), 'object_date_creation'=>dol_print_date($object->date_creation,'day'), - 'object_date_modification'=>dol_print_date($object->date_modification,'day'), - 'object_date_validation'=>dol_print_date($object->date_validation,'dayhour'), + 'object_date_modification'=>(! empty($object->date_modification)?dol_print_date($object->date_modification,'day'):''), + 'object_date_validation'=>(! empty($object->date_validation)?dol_print_date($object->date_validation,'dayhour'):''), + 'object_date_delivery_planed'=>(! empty($object->date_livraison)?dol_print_date($object->date_livraison,'day'):''), 'object_date_close'=>dol_print_date($object->date_cloture,'dayhour'), 'object_payment_mode_code'=>$object->mode_reglement_code, 'object_payment_mode'=>($outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code)!='PaymentType'.$object->mode_reglement_code?$outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code):$object->mode_reglement), diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php index 753446b10ad..393804c580a 100644 --- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php +++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php @@ -116,8 +116,8 @@ class doc_generic_invoice_odt extends ModelePDFFactures 'object_date_limit'=>dol_print_date($object->date_lim_reglement,'day'), 'object_date_creation'=>dol_print_date($object->date_creation,'day'), 'object_date_modification'=>(! empty($object->date_modification)?dol_print_date($object->date_modification,'day'):''), - 'object_date_validation'=>dol_print_date($object->date_validation,'dayhour'), - 'object_date_delivery_planed'=>dol_print_date($object->date_livraison,'dayhour'), + 'object_date_validation'=>(! empty($object->date_validation)?dol_print_date($object->date_validation,'dayhour'):''), + 'object_date_delivery_planed'=>(! empty($object->date_livraison)?dol_print_date($object->date_livraison,'day'):''), 'object_payment_mode_code'=>$object->mode_reglement_code, 'object_payment_mode'=>($outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code)!='PaymentType'.$object->mode_reglement_code?$outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code):$object->mode_reglement), 'object_payment_term_code'=>$object->cond_reglement_code, From 11d2cb1e1c0d17a33d58dd85f76a08b35fa9e7d3 Mon Sep 17 00:00:00 2001 From: Grand Philippe Date: Fri, 29 Mar 2013 17:18:47 +0100 Subject: [PATCH 064/194] fix: ref_suplier instead of ref for add numbering for supplier invoice --- htdocs/fourn/class/fournisseur.facture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 019b36f7fdf..5b26339c8c8 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1525,7 +1525,7 @@ class FactureFournisseur extends CommonInvoice $object->statut=0; // Clear fields - $object->ref=$langs->trans("CopyOf").' '.$object->ref; + $object->ref_supplier=$langs->trans("CopyOf").' '.$object->ref_supplier; $object->author = $user->id; $object->user_valid = ''; $object->fk_facture_source = 0; From d8090ba994a7ffc66f977d24f1310ad4139f7117 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Fri, 29 Mar 2013 18:47:53 +0100 Subject: [PATCH 065/194] Fix : "Firstname" was used as var instead of "firstname" --- htdocs/user/fiche.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/user/fiche.php b/htdocs/user/fiche.php index 1ef52efc85b..0d2586c9639 100644 --- a/htdocs/user/fiche.php +++ b/htdocs/user/fiche.php @@ -1089,7 +1089,7 @@ else // Firstname print ''.$langs->trans("Firstname").''; - print ''.$object->Firstname.''; + print ''.$object->firstname.''; print ''."\n"; // Position/Job @@ -1588,12 +1588,12 @@ else print ''; if ($caneditfield && !$object->ldap_sid) { - print ''; + print ''; } else { - print ''; - print $object->Firstname; + print ''; + print $object->firstname; } print ''; From 2309a4b81b80a3ce21d37ff7677769b823a37b8c Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Fri, 29 Mar 2013 18:56:01 +0100 Subject: [PATCH 066/194] Fix : on holiday list on a specific user, user and validator were not displayed --- htdocs/holiday/class/holiday.class.php | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index c97d2f1384e..27e45118fa8 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -267,10 +267,17 @@ class Holiday extends CommonObject $sql.= " cp.fk_user_refuse,"; $sql.= " cp.date_cancel,"; $sql.= " cp.fk_user_cancel,"; - $sql.= " cp.detail_refuse"; + $sql.= " cp.detail_refuse,"; + + $sql.= " uu.lastname as user_lastname,"; + $sql.= " uu.firstname as user_firstname,"; - $sql.= " FROM ".MAIN_DB_PREFIX."holiday as cp"; - $sql.= " WHERE cp.fk_user = '".$user_id."'"; + $sql.= " ua.lastname as validator_lastname,"; + $sql.= " ua.firstname as validator_firstname"; + + $sql.= " FROM ".MAIN_DB_PREFIX."holiday as cp, ".MAIN_DB_PREFIX."user as uu, ".MAIN_DB_PREFIX."user as ua"; + $sql.= " WHERE cp.fk_user = uu.rowid AND cp.fk_validator = ua.rowid "; // Hack pour la recherche sur le tableau + $sql.= " AND cp.fk_user = '".$user_id."'"; // Filtre de séléction if(!empty($filter)) { @@ -320,6 +327,12 @@ class Holiday extends CommonObject $tab_result[$i]['fk_user_cancel'] = $obj->fk_user_cancel; $tab_result[$i]['detail_refuse'] = $obj->detail_refuse; + $tab_result[$i]['user_firstname'] = $obj->user_firstname; + $tab_result[$i]['user_lastname'] = $obj->user_lastname; + + $tab_result[$i]['validator_firstname'] = $obj->validator_firstname; + $tab_result[$i]['validator_lastname'] = $obj->validator_lastname; + $i++; } From 701814ad199678789bc08ec0cf8744f83e28905c Mon Sep 17 00:00:00 2001 From: BENKE Charles Date: Fri, 29 Mar 2013 21:19:22 +0100 Subject: [PATCH 067/194] Update mysqli.class.php --- htdocs/core/db/mysqli.class.php | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 2180546dc39..e2db251db1c 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -879,22 +879,27 @@ class DoliDBMysqli { $sqlfields[$i] = $field_name." "; $sqlfields[$i] .= $field_desc['type']; + if( preg_match("/^[^\s]/i",$field_desc['value'])) - $sqlfields[$i] .= "(".$field_desc['value'].")"; - else if( preg_match("/^[^\s]/i",$field_desc['attribute'])) - $sqlfields[$i] .= " ".$field_desc['attribute']; - else if( preg_match("/^[^\s]/i",$field_desc['default'])) + $sqlfields[$i] .= "(".$field_desc['value'].")"; + + if( preg_match("/^[^\s]/i",$field_desc['attribute'])) + $sqlfields[$i] .= " ".$field_desc['attribute']; + + if( preg_match("/^[^\s]/i",$field_desc['default'])) { if(preg_match("/null/i",$field_desc['default'])) - $sqlfields[$i] .= " default ".$field_desc['default']; + $sqlfields[$i] .= " default ".$field_desc['default']; + elseif ($field_desc['default'] == 'CURRENT_TIMESTAMP') + $sqlfields[$i] .= " default ".$field_desc['default']; else - $sqlfields[$i] .= " default '".$field_desc['default']."'"; + $sqlfields[$i] .= " default '".$field_desc['default']."'"; } - else if( preg_match("/^[^\s]/i",$field_desc['null'])) - $sqlfields[$i] .= " ".$field_desc['null']; + if( preg_match("/^[^\s]/i",$field_desc['null'])) + $sqlfields[$i] .= " ".$field_desc['null']; - else if( preg_match("/^[^\s]/i",$field_desc['extra'])) - $sqlfields[$i] .= " ".$field_desc['extra']; + if( preg_match("/^[^\s]/i",$field_desc['extra'])) + $sqlfields[$i] .= " ".$field_desc['extra']; $i++; } if($primary_key != "") From 6aae37493c0b4026f6c39ca8226a63d260ce4af2 Mon Sep 17 00:00:00 2001 From: jfefe Date: Fri, 29 Mar 2013 22:14:06 +0100 Subject: [PATCH 068/194] Add support of calendar on date type extrafield on propal --- htdocs/comm/propal.php | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index e35c8d2940d..08ec557e8f5 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -81,6 +81,9 @@ $result = restrictedArea($user, 'propal', $id); $object = new Propal($db); $extrafields = new ExtraFields($db); +// fetch optionals attributes and labels +$extralabels=$extrafields->fetch_name_optionals_label('propal'); + // Load object if ($id > 0 || ! empty($ref)) { @@ -339,12 +342,20 @@ else if ($action == 'add' && $user->rights->propal->creer) } // Get extra fields - foreach($_POST as $key => $value) + foreach ($extralabels as $key => $value) { - if (preg_match("/^options_/",$key)) + $key_type = $extrafields->attribute_type[$key]; + + if (in_array($key_type,array('date','datetime'))) { - $object->array_options[$key]=GETPOST($key); + // Clean parameters + $value_key=dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]); } + else + { + $value_key=GETPOST("options_".$key); + } + $object->array_options["options_".$key]=$value_key; } $id = $object->create($user); @@ -1108,13 +1119,22 @@ else if ($action == 'down' && $user->rights->propal->creer) else if ($action == 'update_extras') { // Get extra fields - foreach($_POST as $key => $value) + foreach ($extralabels as $key => $value) { - if (preg_match("/^options_/",$key)) + $key_type = $extrafields->attribute_type[$key]; + + if (in_array($key_type,array('date','datetime'))) { - $object->array_options[$key]=$_POST[$key]; + // Clean parameters + $value_key=dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]); } + else + { + $value_key=GETPOST("options_".$key); + } + $object->array_options["options_".$key]=$value_key; } + // Actions on extra fields (by external module or standard code) // FIXME le hook fait double emploi avec le trigger !! $hookmanager->initHooks(array('propaldao')); @@ -1208,9 +1228,6 @@ $formfile = new FormFile($db); $formpropal = new FormPropal($db); $companystatic=new Societe($db); -// fetch optionals attributes and labels -$extralabels=$extrafields->fetch_name_optionals_label('propal'); - $now=dol_now(); // Add new proposal From 649c1f3721e81b0aa18a49bf51c6f4a7deac9bcc Mon Sep 17 00:00:00 2001 From: jfefe Date: Fri, 29 Mar 2013 22:25:02 +0100 Subject: [PATCH 069/194] Try new function to set array_options to object (extrafields values) with date sent by forms --- htdocs/comm/propal.php | 20 ++----------- htdocs/core/class/extrafields.class.php | 37 +++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 17 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 08ec557e8f5..cf2d6054dee 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -341,23 +341,9 @@ else if ($action == 'add' && $user->rights->propal->creer) } } - // Get extra fields - foreach ($extralabels as $key => $value) - { - $key_type = $extrafields->attribute_type[$key]; - - if (in_array($key_type,array('date','datetime'))) - { - // Clean parameters - $value_key=dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]); - } - else - { - $value_key=GETPOST("options_".$key); - } - $object->array_options["options_".$key]=$value_key; - } - + // Fill array 'array_options' with data from add form + $ret = setOptionalsFromPost($extralabels,$object);* + $id = $object->create($user); } diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 5b12672f6ce..ecd2c469fb1 100755 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -752,5 +752,42 @@ class ExtraFields $out = ''.$this->attribute_label[$key].''; return $out; } + + /** + * Fill array_options array for object by extrafields value (using for data send by forms) + * + * @param array $extralabels $array of extrafields + * @param object $object object + * @return int 1 if array_options set / 0 if no value + */ + function setOptionalsFromPost($extralabels,&$object) + { + global $_POST; + + if (is_array($extralabels)) + { + // Get extra fields + foreach ($extralabels as $key => $value) + { + $key_type = $this->attribute_type[$key]; + + if (in_array($key_type,array('date','datetime'))) + { + // Clean parameters + $value_key=dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]); + } + else + { + $value_key=GETPOST("options_".$key); + } + $object->array_options["options_".$key]=$value_key; + } + + return 1; + } + else { + return 0; + } + } } ?> From 6c872395e312c76f7898fc50ac481a601f395d46 Mon Sep 17 00:00:00 2001 From: jfefe Date: Fri, 29 Mar 2013 22:26:25 +0100 Subject: [PATCH 070/194] Fix: syntax error --- htdocs/comm/propal.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index cf2d6054dee..a2a20c6c6d0 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -342,7 +342,7 @@ else if ($action == 'add' && $user->rights->propal->creer) } // Fill array 'array_options' with data from add form - $ret = setOptionalsFromPost($extralabels,$object);* + $ret = setOptionalsFromPost($extralabels,$object); $id = $object->create($user); } From f3a7d497c6b02c06a5883cac831ed2065808a98d Mon Sep 17 00:00:00 2001 From: jfefe Date: Fri, 29 Mar 2013 22:30:07 +0100 Subject: [PATCH 071/194] Fix : missing object when calling function --- htdocs/comm/propal.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index a2a20c6c6d0..1f3ea7cd46f 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -342,7 +342,7 @@ else if ($action == 'add' && $user->rights->propal->creer) } // Fill array 'array_options' with data from add form - $ret = setOptionalsFromPost($extralabels,$object); + $ret = $extrafields->setOptionalsFromPost($extralabels,$object); $id = $object->create($user); } From e99ba51f1d01d50d75d516c072b912687ee5bbfd Mon Sep 17 00:00:00 2001 From: jfefe Date: Sat, 30 Mar 2013 10:46:23 +0100 Subject: [PATCH 072/194] Use of new function to set optionals from add / update form Format date display for data from JS calendar (date type extrafield) --- htdocs/comm/propal.php | 26 ++++++++++---------------- htdocs/compta/facture.php | 19 ++++++++++--------- htdocs/societe/soc.php | 19 +++---------------- 3 files changed, 23 insertions(+), 41 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 1f3ea7cd46f..7cf90691655 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -1104,22 +1104,9 @@ else if ($action == 'down' && $user->rights->propal->creer) } else if ($action == 'update_extras') { - // Get extra fields - foreach ($extralabels as $key => $value) - { - $key_type = $extrafields->attribute_type[$key]; - - if (in_array($key_type,array('date','datetime'))) - { - // Clean parameters - $value_key=dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]); - } - else - { - $value_key=GETPOST("options_".$key); - } - $object->array_options["options_".$key]=$value_key; - } + // Fill array 'array_options' with data from update form + $extralabels=$extrafields->fetch_name_optionals_label('propal'); + $ret = $extrafields->setOptionalsFromPost($extralabels,$object); // Actions on extra fields (by external module or standard code) // FIXME le hook fait double emploi avec le trigger !! @@ -1875,6 +1862,13 @@ else print 'attribute_required[$key])) print ' class="fieldrequired"'; print '>'.$label.''; + + // Convert date into timestamp format + if (in_array($extrafields->attribute_type[$key],array('date','datetime'))) + { + $value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$object->array_options['options_'.$key]; + } + if ($action == 'edit_extras' && $user->rights->propal->creer) { print $extrafields->showInputField($key,$value); diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 233ebaa4f32..935d475bb9e 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1738,14 +1738,10 @@ if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->facture- if ($action == 'update_extras') { - // Get extra fields - foreach($_POST as $key => $value) - { - if (preg_match("/^options_/",$key)) - { - $object->array_options[$key]=$_POST[$key]; - } - } + // Fill array 'array_options' with data from add form + $extralabels=$extrafields->fetch_name_optionals_label('facture'); + $ret = $extrafields->setOptionalsFromPost($extralabels,$object); + // Actions on extra fields (by external module or standard code) // FIXME le hook fait double emploi avec le trigger !! $hookmanager->initHooks(array('invoicedao')); @@ -3125,7 +3121,6 @@ else if ($id > 0 || ! empty($ref)) print ''; } - foreach($extrafields->attribute_label as $key=>$label) { $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); @@ -3138,6 +3133,12 @@ else if ($id > 0 || ! empty($ref)) print 'attribute_required[$key])) print ' class="fieldrequired"'; print '>'.$label.''; + // Convert date into timestamp format + if (in_array($extrafields->attribute_type[$key],array('date','datetime'))) + { + $value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$object->array_options['options_'.$key]; + } + if ($action == 'edit_extras' && $user->rights->facture->creer) { print $extrafields->showInputField($key,$value); diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index e28f1a12443..0972d93f26a 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -169,22 +169,9 @@ if (empty($reshook)) $object->commercial_id = GETPOST('commercial_id'); $object->default_lang = GETPOST('default_lang'); - // Get extra fields - foreach ($extralabels as $key => $value) - { - $key_type = $extrafields->attribute_type[$key]; - - if (in_array($key_type,array('date','datetime'))) - { - // Clean parameters - $value_key=dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]); - } - else - { - $value_key=GETPOST("options_".$key); - } - $object->array_options["options_".$key]=$value_key; - } + // Fill array 'array_options' with data from add form + $ret = $extrafields->setOptionalsFromPost($extralabels,$object); + if (GETPOST('deletephoto')) $object->logo = ''; else if (! empty($_FILES['photo']['name'])) $object->logo = dol_sanitizeFileName($_FILES['photo']['name']); From 95d8ee8b4118199881125137b01464c5e93968b7 Mon Sep 17 00:00:00 2001 From: jfefe Date: Sat, 30 Mar 2013 10:49:52 +0100 Subject: [PATCH 073/194] Revert "Show number with dot to avoid error when update extrafield" This reverts commit 76efc0484011cdff3b63b46425602cc2a4679b3f. --- 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 41465636b03..f9398c21cb8 100755 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -663,7 +663,7 @@ class ExtraFields } elseif ($type == 'price') { - $out=' '.$langs->getCurrencySymbol($conf->currency); + $out=' '.$langs->getCurrencySymbol($conf->currency); } elseif ($type == 'select') { From c75ce979600cb22a958ca07d8d15988eaaa9a14b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 30 Mar 2013 13:30:44 +0100 Subject: [PATCH 074/194] Update es_MX --- htdocs/langs/es_MX/banks.lang | 3 ++ htdocs/langs/es_MX/bills.lang | 51 ++++++++++++++++-------------- htdocs/langs/es_MX/categories.lang | 3 ++ htdocs/langs/es_MX/companies.lang | 8 +++-- htdocs/langs/es_MX/main.lang | 7 ++++ 5 files changed, 46 insertions(+), 26 deletions(-) create mode 100644 htdocs/langs/es_MX/banks.lang create mode 100644 htdocs/langs/es_MX/categories.lang create mode 100644 htdocs/langs/es_MX/main.lang diff --git a/htdocs/langs/es_MX/banks.lang b/htdocs/langs/es_MX/banks.lang new file mode 100644 index 00000000000..58ef3a65d00 --- /dev/null +++ b/htdocs/langs/es_MX/banks.lang @@ -0,0 +1,3 @@ +# Dolibarr language file - es_MX - banks +CHARSET=UTF-8 +BankAccountDomiciliation=Tarjeta \ No newline at end of file diff --git a/htdocs/langs/es_MX/bills.lang b/htdocs/langs/es_MX/bills.lang index 4afc7e178f8..ef60be41921 100644 --- a/htdocs/langs/es_MX/bills.lang +++ b/htdocs/langs/es_MX/bills.lang @@ -1,23 +1,28 @@ -# Dolibarr language file - es_MX - bills -CHARSET=UTF-8 -InvoiceAvoir=Nota de crédito -InvoiceAvoirAsk=Nota de crédito para corregir la factura -InvoiceAvoirDesc=La nota de crédito es una factura negativa destinada a compensar un importe de factura que difiere del importe realmente pagado (por haber pagado de más o por devolución de productos, por ejemplo). -InvoiceHasAvoir=Corregida por una o más notas de crédito -ConfirmConvertToReduc=¿Quiere convertir esta nota de crédito en una reducción futura?
El importe de esta nota de crédito se almacenará para este cliente. Podrá utilizarse para reducir el importe de una próxima factura del cliente. -AddBill=Crear factura o nota de crédito -EnterPaymentDueToCustomer=Realizar pago de notas de crédito al cliente -ErrorInvoiceAvoirMustBeNegative=Error, una factura de tipo nota de crédito debe tener un importe negativo -ConfirmClassifyPaidPartiallyReasonAvoir=El resto a pagar (%s %s) se ha regularizado (ya que artículo se ha devuelto, olvidado entregar, descuento no definido...) mediante una nota de crédito -ConfirmClassifyPaidPartiallyReasonOtherDesc=Esta elección será posible, por ejemplo, en los casos siguiente:
-pago parcial ya que una partida de productos se ha devuleto.
- reclamado por no entregar productos de la factura
En todos los casos, la reclamación debe regularizarse mediante una nota de crédito -ShowInvoiceAvoir=Ver nota de crédito -AlreadyPaidNoCreditNotesNoDeposits=Ya pagado (excluidos las notas de crédito y anticipos) -ShowDiscount=Ver la nota de crédito -CreditNote=Nota de crédito -CreditNotes=Notas de crédito -DiscountFromCreditNote=Descuento resultante de la nota de crédito %s -AbsoluteDiscountUse=Este tipo de crédito no puede ser utilizado en una factura antes de su validación -CreditNoteDepositUse=La factura debe de estar validada para poder utilizar este tipo de créditos -CreditNoteConvertedIntoDiscount=Esta nota de crédito se convirtió en %s -TerreNumRefModelDesc1=Devuelve el número bajo el formato %syymm-nnnn para las facturas y %syymm-nnnn para las notas de crédito donde yy es el año, mm. el mes y nnnn un contador secuencial sin ruptura y sin permanencia a 0 -AddCreditNote=Crear nota de crédito \ No newline at end of file +# Dolibarr language file - es_MX - bills +CHARSET=UTF-8 +InvoiceAvoir=Nota de crédito +InvoiceAvoirAsk=Nota de crédito para corregir la factura +InvoiceAvoirDesc=La nota de crédito es una factura negativa destinada a compensar un importe de factura que difiere del importe realmente pagado (por haber pagado de más o por devolución de productos, por ejemplo). +InvoiceHasAvoir=Corregida por una o más notas de crédito +ConfirmConvertToReduc=¿Quiere convertir esta nota de crédito en una reducción futura?
El importe de esta nota de crédito se almacenará para este cliente. Podrá utilizarse para reducir el importe de una próxima factura del cliente. +AddBill=Crear factura o nota de crédito +EnterPaymentDueToCustomer=Realizar pago de notas de crédito al cliente +ErrorInvoiceAvoirMustBeNegative=Error, una factura de tipo nota de crédito debe tener un importe negativo +ConfirmClassifyPaidPartiallyReasonAvoir=El resto a pagar (%s %s) se ha regularizado (ya que artículo se ha devuelto, olvidado entregar, descuento no definido...) mediante una nota de crédito +ConfirmClassifyPaidPartiallyReasonOtherDesc=Esta elección será posible, por ejemplo, en los casos siguiente:
-pago parcial ya que una partida de productos se ha devuleto.
- reclamado por no entregar productos de la factura
En todos los casos, la reclamación debe regularizarse mediante una nota de crédito +ShowInvoiceAvoir=Ver nota de crédito +AlreadyPaidNoCreditNotesNoDeposits=Ya pagado (excluidos las notas de crédito y anticipos) +ShowDiscount=Ver la nota de crédito +CreditNote=Nota de crédito +CreditNotes=Notas de crédito +DiscountFromCreditNote=Descuento resultante de la nota de crédito %s +AbsoluteDiscountUse=Este tipo de crédito no puede ser utilizado en una factura antes de su validación +CreditNoteDepositUse=La factura debe de estar validada para poder utilizar este tipo de créditos +CreditNoteConvertedIntoDiscount=Esta nota de crédito se convirtió en %s +TerreNumRefModelDesc1=Devuelve el número bajo el formato %syymm-nnnn para las facturas y %syymm-nnnn para las notas de crédito donde yy es el año, mm. el mes y nnnn un contador secuencial sin ruptura y sin permanencia a 0 +AddCreditNote=Crear nota de crédito +BillTo=Receptor +Residence=Tarjeta +IBANNumber=CLABE Interbancaria +BICNumber=Sucursal +PaymentByTransferOnThisBankAccount=Cuenta para depositos y transferencias \ No newline at end of file diff --git a/htdocs/langs/es_MX/categories.lang b/htdocs/langs/es_MX/categories.lang new file mode 100644 index 00000000000..8904c443bcf --- /dev/null +++ b/htdocs/langs/es_MX/categories.lang @@ -0,0 +1,3 @@ +# Dolibarr language file - es_MX - categories +CHARSET=UTF-8 +NotCategorized=Sin Categoría \ No newline at end of file diff --git a/htdocs/langs/es_MX/companies.lang b/htdocs/langs/es_MX/companies.lang index bef45bb79b8..99dd8ca9896 100644 --- a/htdocs/langs/es_MX/companies.lang +++ b/htdocs/langs/es_MX/companies.lang @@ -1,3 +1,5 @@ -# Dolibarr language file - es_MX - companies -CHARSET=UTF-8 -CompanyHasCreditNote=Este cliente tiene %s %s notas de crédito/anticipos disponibles +# Dolibarr language file - es_MX - companies +CHARSET=UTF-8 +State=Estado +Town=Municipio +CompanyHasCreditNote=Este cliente tiene %s %s notas de crédito/anticipos disponibles \ No newline at end of file diff --git a/htdocs/langs/es_MX/main.lang b/htdocs/langs/es_MX/main.lang new file mode 100644 index 00000000000..323ec95b1e3 --- /dev/null +++ b/htdocs/langs/es_MX/main.lang @@ -0,0 +1,7 @@ +# Dolibarr language file - es_MX - main +CHARSET=UTF-8 +SeparatorDecimal=. +SeparatorThousand=, +AmountHT=Subtotal +TotalHT=Subtotal +TotalVAT=IVA \ No newline at end of file From a5e66ab7ba3bf5b9d8e5f643a046ebf629d186ae Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 30 Mar 2013 13:54:46 +0100 Subject: [PATCH 075/194] Generalize fix: file with a specific mask not found, again --- htdocs/comm/propal.php | 42 ++++++++++++++++----------------- htdocs/commande/fiche.php | 12 +++++----- htdocs/compta/facture.php | 22 ++++++++--------- htdocs/expedition/fiche.php | 16 ++++++------- htdocs/fichinter/fiche.php | 14 +++++------ htdocs/fourn/commande/fiche.php | 4 ++-- htdocs/fourn/facture/fiche.php | 4 ++-- 7 files changed, 57 insertions(+), 57 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 7cf90691655..cea565515b5 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -1107,7 +1107,7 @@ else if ($action == 'update_extras') // Fill array 'array_options' with data from update form $extralabels=$extrafields->fetch_name_optionals_label('propal'); $ret = $extrafields->setOptionalsFromPost($extralabels,$object); - + // Actions on extra fields (by external module or standard code) // FIXME le hook fait double emploi avec le trigger !! $hookmanager->initHooks(array('propaldao')); @@ -1125,7 +1125,7 @@ else if ($action == 'update_extras') } } else if ($reshook < 0) $error++; - + } if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->propal->creer) @@ -1350,13 +1350,13 @@ if ($action == 'create') foreach($extrafields->attribute_label as $key=>$label) { $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); - + // Show separator only if ($extrafields->attribute_type[$key] == 'separate') { print $extrafields->showSeparator($key); } - else + else { print 'attribute_required[$key])) print ' class="fieldrequired"'; @@ -1840,7 +1840,7 @@ else $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if (empty($reshook) && ! empty($extrafields->attribute_label)) { - + if ($action == 'edit_extras') { print '
'; @@ -1848,8 +1848,8 @@ else print ''; print ''; } - - + + foreach($extrafields->attribute_label as $key=>$label) { $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); @@ -1862,13 +1862,13 @@ else print 'attribute_required[$key])) print ' class="fieldrequired"'; print '>'.$label.''; - + // Convert date into timestamp format if (in_array($extrafields->attribute_type[$key],array('date','datetime'))) { $value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$object->array_options['options_'.$key]; } - + if ($action == 'edit_extras' && $user->rights->propal->creer) { print $extrafields->showInputField($key,$value); @@ -1880,19 +1880,19 @@ else print ''."\n"; } } - + if(count($extrafields->attribute_label) > 0) { - + if ($action == 'edit_extras' && $user->rights->propal->creer) { print ''; print ''; print ''; print ''; - + } else { - if ($object->statut == 0 && $user->rights->propal->creer) + if ($object->statut == 0 && $user->rights->propal->creer) { print ''.img_picto('','edit').' '.$langs->trans('Modify').''; } @@ -2182,7 +2182,7 @@ else { $ref = dol_sanitizeFileName($object->ref); include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($object->ref,'/')); + $fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; // Build document if it not exists @@ -2205,7 +2205,7 @@ else dol_print_error($db,$result); exit; } - $fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($object->ref,'/')); + $fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; } @@ -2236,12 +2236,12 @@ else $formmail->substit['__SIGNATURE__']=$user->signature; $formmail->substit['__PERSONALIZED__']=''; $formmail->substit['__CONTACTCIVNAME__']=''; - + //Find the good contact adress $custcontact=''; $contactarr=array(); $contactarr=$object->liste_contact(-1,'external'); - + if (is_array($contactarr) && count($contactarr)>0) { foreach($contactarr as $contact) { if ($contact['libelle']==$langs->trans('TypeContact_propal_external_CUSTOMER')) { @@ -2250,19 +2250,19 @@ else $custcontact=$contactstatic->getFullName($langs,1); } } - + if (!empty($custcontact)) { $formmail->substit['__CONTACTCIVNAME__']=$custcontact; } } - + // Tableau des parametres complementaires $formmail->param['action']='send'; $formmail->param['models']='propal_send'; $formmail->param['id']=$object->id; $formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id; - - + + // Init list of files if (GETPOST("mode")=='init') { diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index bdd61a6ace3..9b4a88592f3 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -2390,7 +2390,7 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G { $ref = dol_sanitizeFileName($object->ref); include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($object->ref,'/')); + $fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; // Build document if it not exists @@ -2413,7 +2413,7 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G dol_print_error($db,$result); exit; } - $fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($object->ref,'/')); + $fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; } @@ -2443,11 +2443,11 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G $formmail->substit['__SIGNATURE__']=$user->signature; $formmail->substit['__PERSONALIZED__']=''; $formmail->substit['__CONTACTCIVNAME__']=''; - + $custcontact=''; $contactarr=array(); $contactarr=$object->liste_contact(-1,'external'); - + if (is_array($contactarr) && count($contactarr)>0) { foreach($contactarr as $contact) { if ($contact['libelle']==$langs->trans('TypeContact_commande_external_CUSTOMER')) { @@ -2456,12 +2456,12 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G $custcontact=$contactstatic->getFullName($langs,1); } } - + if (!empty($custcontact)) { $formmail->substit['__CONTACTCIVNAME__']=$custcontact; } } - + // Tableau des parametres complementaires $formmail->param['action']='send'; $formmail->param['models']='order_send'; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 935d475bb9e..98f09c18351 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -3138,7 +3138,7 @@ else if ($id > 0 || ! empty($ref)) { $value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$object->array_options['options_'.$key]; } - + if ($action == 'edit_extras' && $user->rights->facture->creer) { print $extrafields->showInputField($key,$value); @@ -3511,7 +3511,7 @@ else if ($id > 0 || ! empty($ref)) $ref = dol_sanitizeFileName($object->ref); include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($object->ref,'/')); + $fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; // Build document if it not exists @@ -3534,7 +3534,7 @@ else if ($id > 0 || ! empty($ref)) dol_print_error($db,$result); exit; } - $fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($object->ref,'/')); + $fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; } @@ -3563,31 +3563,31 @@ else if ($id > 0 || ! empty($ref)) $formmail->substit['__FACREF__']=$object->ref; $formmail->substit['__SIGNATURE__']=$user->signature; $formmail->substit['__PERSONALIZED__']=''; - $formmail->substit['__CONTACTCIVNAME__']=''; - + $formmail->substit['__CONTACTCIVNAME__']=''; + //Find the good contact adress $custcontact=''; $contactarr=array(); $contactarr=$object->liste_contact(-1,'external'); - + if (is_array($contactarr) && count($contactarr)>0) { foreach($contactarr as $contact) { if ($contact['libelle']==$langs->trans('TypeContact_facture_external_BILLING')) { - + require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; - + $contactstatic=new Contact($db); $contactstatic->fetch($contact['id']); $custcontact=$contactstatic->getFullName($langs,1); } } - + if (!empty($custcontact)) { $formmail->substit['__CONTACTCIVNAME__']=$custcontact; } } - - + + // Tableau des parametres complementaires du post $formmail->param['action']=$action; $formmail->param['models']=$modelmail; diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php index d58b6d60f4f..0066b3ad485 100644 --- a/htdocs/expedition/fiche.php +++ b/htdocs/expedition/fiche.php @@ -1405,7 +1405,7 @@ else { $ref = dol_sanitizeFileName($object->ref); include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $fileparams = dol_most_recent_file($conf->expedition->dir_output . '/sending/' . $ref, preg_quote($object->ref,'/')); + $fileparams = dol_most_recent_file($conf->expedition->dir_output . '/sending/' . $ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; // Build document if it not exists @@ -1428,7 +1428,7 @@ else dol_print_error($db,$result); exit; } - $fileparams = dol_most_recent_file($conf->expedition->dir_output . '/sending/' . $ref, preg_quote($object->ref,'/')); + $fileparams = dol_most_recent_file($conf->expedition->dir_output . '/sending/' . $ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; } @@ -1458,7 +1458,7 @@ else $formmail->substit['__SIGNATURE__']=$user->signature; $formmail->substit['__PERSONALIZED__']=''; $formmail->substit['__CONTACTCIVNAME__']=''; - + //Find the good contact adress //Find the good contact adress if ($typeobject == 'commande' && $object->$typeobject->id && ! empty($conf->commande->enabled)) { @@ -1475,22 +1475,22 @@ else if (is_array($contactarr) && count($contactarr)>0) { foreach($contactarr as $contact) { - + if ($contact['libelle']==$langs->trans('TypeContact_commande_external_CUSTOMER')) { - + require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; - + $contactstatic=new Contact($db); $contactstatic->fetch($contact['id']); $custcontact=$contactstatic->getFullName($langs,1); } } - + if (!empty($custcontact)) { $formmail->substit['__CONTACTCIVNAME__']=$custcontact; } } - + // Tableau des parametres complementaires $formmail->param['action']='send'; $formmail->param['models']='shipping_send'; diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php index f7371f42066..295298614b8 100644 --- a/htdocs/fichinter/fiche.php +++ b/htdocs/fichinter/fiche.php @@ -1068,7 +1068,7 @@ else if ($id > 0 || ! empty($ref)) $numref = $object->ref; } $text=$langs->trans('ConfirmValidateIntervention',$numref); - + $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateIntervention'), $text, 'confirm_validate','',0,1); if ($ret == 'html') print '
'; } @@ -1465,7 +1465,7 @@ else if ($id > 0 || ! empty($ref)) { $ref = dol_sanitizeFileName($object->ref); include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $fileparams = dol_most_recent_file($conf->ficheinter->dir_output . '/' . $ref, preg_quote($object->ref,'/')); + $fileparams = dol_most_recent_file($conf->ficheinter->dir_output . '/' . $ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; // Build document if it not exists @@ -1488,7 +1488,7 @@ else if ($id > 0 || ! empty($ref)) dol_print_error($db,$result); exit; } - $fileparams = dol_most_recent_file($conf->ficheinter->dir_output . '/' . $ref, preg_quote($object->ref,'/')); + $fileparams = dol_most_recent_file($conf->ficheinter->dir_output . '/' . $ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; } @@ -1519,12 +1519,12 @@ else if ($id > 0 || ! empty($ref)) $formmail->substit['__SIGNATURE__']=$user->signature; $formmail->substit['__PERSONALIZED__']=''; $formmail->substit['__CONTACTCIVNAME__']=''; - + //Find the good contact adress $custcontact=''; $contactarr=array(); $contactarr=$object->liste_contact(-1,'external'); - + if (is_array($contactarr) && count($contactarr)>0) { foreach($contactarr as $contact) { if ($contact['libelle']==$langs->trans('TypeContact_fichinter_external_CUSTOMER')) { @@ -1534,12 +1534,12 @@ else if ($id > 0 || ! empty($ref)) $custcontact=$contactstatic->getFullName($langs,1); } } - + if (!empty($custcontact)) { $formmail->substit['__CONTACTCIVNAME__']=$custcontact; } } - + // Tableau des parametres complementaires $formmail->param['action']='send'; $formmail->param['models']='fichinter_send'; diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php index 856c92c88bf..6ba577c152b 100644 --- a/htdocs/fourn/commande/fiche.php +++ b/htdocs/fourn/commande/fiche.php @@ -1855,7 +1855,7 @@ elseif (! empty($object->id)) { $ref = dol_sanitizeFileName($object->ref); include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $fileparams = dol_most_recent_file($conf->fournisseur->commande->dir_output . '/' . $ref, preg_quote($object->ref,'/')); + $fileparams = dol_most_recent_file($conf->fournisseur->commande->dir_output . '/' . $ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; // Build document if it not exists @@ -1878,7 +1878,7 @@ elseif (! empty($object->id)) dol_print_error($db,$result); exit; } - $fileparams = dol_most_recent_file($conf->fournisseur->commande->dir_output . '/' . $ref, preg_quote($object->ref,'/')); + $fileparams = dol_most_recent_file($conf->fournisseur->commande->dir_output . '/' . $ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; } diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index 8d33e97f499..9f63805a288 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -2071,7 +2071,7 @@ else { $ref = dol_sanitizeFileName($object->ref); include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $fileparams = dol_most_recent_file($conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2).$ref, preg_quote($object->ref,'/')); + $fileparams = dol_most_recent_file($conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2).$ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; // Build document if it not exists @@ -2094,7 +2094,7 @@ else dol_print_error($db,$result); exit; } - $fileparams = dol_most_recent_file($conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2).$ref, preg_quote($object->ref,'/')); + $fileparams = dol_most_recent_file($conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2).$ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; } From e0baa0fe46e53851f2f74a3be1fe77021b526c52 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 30 Mar 2013 14:04:09 +0100 Subject: [PATCH 076/194] Generalize fix: file with a specific mask not found, again Conflicts: htdocs/comm/propal.php htdocs/commande/fiche.php htdocs/compta/facture.php htdocs/expedition/fiche.php htdocs/fichinter/fiche.php --- htdocs/comm/propal.php | 4 ++-- htdocs/commande/fiche.php | 4 ++-- htdocs/compta/facture.php | 2 +- htdocs/core/lib/files.lib.php | 6 +++--- htdocs/expedition/fiche.php | 6 +++--- htdocs/fichinter/fiche.php | 4 ++-- htdocs/fourn/commande/fiche.php | 4 ++-- htdocs/fourn/facture/fiche.php | 4 ++-- 8 files changed, 17 insertions(+), 17 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index b6ef6d3f5b8..19d9f89cc48 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -1851,7 +1851,7 @@ if ($action == 'presend') dol_print_error($db,$result); exit; } - $fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($object->ref,'/')); + $fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; } @@ -1904,4 +1904,4 @@ if ($action == 'presend') // End of page llxFooter(); $db->close(); -?> +?> \ No newline at end of file diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 5b80bfadf9e..a1d1d173add 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -2359,7 +2359,7 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G { $ref = dol_sanitizeFileName($object->ref); include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($object->ref,'/')); + $fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; // Build document if it not exists @@ -2382,7 +2382,7 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G dol_print_error($db,$result); exit; } - $fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($object->ref,'/')); + $fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; } diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 286204b52a2..a990149aa87 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -3373,7 +3373,7 @@ else if ($id > 0 || ! empty($ref)) dol_print_error($db,$result); exit; } - $fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($object->ref,'/')); + $fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; } diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index d083751d819..d5874b1d4d7 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -42,7 +42,7 @@ function dol_basename($pathfile) * @param string $path Starting path from which to search * @param string $types Can be "directories", "files", or "all" * @param int $recursive Determines whether subdirectories are searched - * @param string $filter Regex for include filter + * @param string $filter Regex filter to restrict list. This regex value must be escaped for '/', since this char is used for preg_match function * @param string $excludefilter Array of Regex for exclude filter (example: array('\.meta$','^\.')) * @param string $sortcriteria Sort criteria ("","fullname","name","date","size") * @param string $sortorder Sort order (SORT_ASC, SORT_DESC) @@ -1237,8 +1237,8 @@ function dol_uncompress($inputfile,$outputdir) * Return most recent file * * @param string $dir Directory to scan - * @param string $regexfilter Regexfilter - * @param string $excludefilter Array of Regex for exclude filter (example: array('\.meta$','^\.')) + * @param string $regexfilter Regex filter to restrict list. This regex value must be escaped for '/', since this char is used for preg_match function + * @param string $excludefilter Array of Regex for exclude filter (example: array('\.meta$','^\.')). This regex value must be escaped for '/', since this char is used for preg_match function * @return strnig Full path to most recent file */ function dol_most_recent_file($dir,$regexfilter='',$excludefilter=array('\.meta$','^\.')) diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php index 7e9a24be0f9..9085aaa95ea 100644 --- a/htdocs/expedition/fiche.php +++ b/htdocs/expedition/fiche.php @@ -1407,7 +1407,7 @@ else { $ref = dol_sanitizeFileName($object->ref); include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $fileparams = dol_most_recent_file($conf->expedition->dir_output . '/sending/' . $ref, preg_quote($object->ref,'/')); + $fileparams = dol_most_recent_file($conf->expedition->dir_output . '/sending/' . $ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; // Build document if it not exists @@ -1430,7 +1430,7 @@ else dol_print_error($db,$result); exit; } - $fileparams = dol_most_recent_file($conf->expedition->dir_output . '/sending/' . $ref, preg_quote($object->ref,'/')); + $fileparams = dol_most_recent_file($conf->expedition->dir_output . '/sending/' . $ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; } @@ -1491,4 +1491,4 @@ else llxFooter(); $db->close(); -?> \ No newline at end of file +?> diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php index 755b68b5af1..086b88fa032 100644 --- a/htdocs/fichinter/fiche.php +++ b/htdocs/fichinter/fiche.php @@ -1451,7 +1451,7 @@ else if ($id > 0 || ! empty($ref)) { $ref = dol_sanitizeFileName($object->ref); include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $fileparams = dol_most_recent_file($conf->ficheinter->dir_output . '/' . $ref, preg_quote($object->ref,'/')); + $fileparams = dol_most_recent_file($conf->ficheinter->dir_output . '/' . $ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; // Build document if it not exists @@ -1474,7 +1474,7 @@ else if ($id > 0 || ! empty($ref)) dol_print_error($db,$result); exit; } - $fileparams = dol_most_recent_file($conf->ficheinter->dir_output . '/' . $ref, preg_quote($object->ref,'/')); + $fileparams = dol_most_recent_file($conf->ficheinter->dir_output . '/' . $ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; } diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php index 703e52f8652..ef3117dec78 100644 --- a/htdocs/fourn/commande/fiche.php +++ b/htdocs/fourn/commande/fiche.php @@ -1785,7 +1785,7 @@ if (! empty($object->id)) { $ref = dol_sanitizeFileName($object->ref); include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $fileparams = dol_most_recent_file($conf->fournisseur->commande->dir_output . '/' . $ref, preg_quote($object->ref,'/')); + $fileparams = dol_most_recent_file($conf->fournisseur->commande->dir_output . '/' . $ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; // Build document if it not exists @@ -1808,7 +1808,7 @@ if (! empty($object->id)) dol_print_error($db,$result); exit; } - $fileparams = dol_most_recent_file($conf->fournisseur->commande->dir_output . '/' . $ref, preg_quote($object->ref,'/')); + $fileparams = dol_most_recent_file($conf->fournisseur->commande->dir_output . '/' . $ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; } diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index 4b332efcc64..468a5c91e79 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -2039,7 +2039,7 @@ else { $ref = dol_sanitizeFileName($object->ref); include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $fileparams = dol_most_recent_file($conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2).$ref, preg_quote($object->ref,'/')); + $fileparams = dol_most_recent_file($conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2).$ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; // Build document if it not exists @@ -2062,7 +2062,7 @@ else dol_print_error($db,$result); exit; } - $fileparams = dol_most_recent_file($conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2).$ref, preg_quote($object->ref,'/')); + $fileparams = dol_most_recent_file($conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2).$ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; } From 89365786a823e0bda7266f0a3540c825ed82e009 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 30 Mar 2013 14:27:13 +0100 Subject: [PATCH 077/194] New: enhance tool fixdosfiles.sh Convert DOS files to unix --- dev/finddosfiles.sh | 15 - dev/fixdosfiles.sh | 30 ++ dev/skeletons/skeleton_script.php | 4 +- htdocs/adherents/admin/adherent.php | 54 +- htdocs/adherents/card_subscriptions.php | 2 +- htdocs/adherents/index.php | 4 +- htdocs/admin/agenda.php | 4 +- htdocs/admin/agenda_extsites.php | 46 +- htdocs/admin/agenda_xcal.php | 4 +- htdocs/admin/const.php | 8 +- htdocs/admin/dict.php | 36 +- htdocs/admin/menus.php | 16 +- htdocs/admin/menus/index.php | 22 +- htdocs/admin/modules.php | 20 +- htdocs/admin/pdf.php | 26 +- htdocs/admin/tools/listevents.php | 10 +- htdocs/categories/index.php | 56 +-- htdocs/comm/action/rapport/index.php | 4 +- htdocs/comm/index.php | 6 +- htdocs/comm/mailing/fiche.php | 8 +- htdocs/comm/mailing/index.php | 8 +- htdocs/comm/propal/index.php | 6 +- htdocs/comm/prospect/index.php | 6 +- htdocs/commande/fiche.php | 18 +- htdocs/commande/index.php | 6 +- htdocs/compta/bank/rappro.php | 2 +- htdocs/compta/facture.php | 36 +- htdocs/compta/facture/impayees.php | 2 +- htdocs/compta/index.php | 6 +- htdocs/compta/paiement/cheque/index.php | 6 +- htdocs/compta/prelevement/index.php | 6 +- htdocs/compta/recap-compta.php | 4 +- htdocs/compta/ventilation/index.php | 6 +- htdocs/contrat/index.php | 10 +- .../core/class/commondocgenerator.class.php | 24 +- htdocs/core/class/commonobject.class.php | 16 +- htdocs/core/class/html.form.class.php | 22 +- htdocs/core/class/html.formfile.class.php | 6 +- htdocs/core/class/html.formother.class.php | 100 ++-- htdocs/core/getmenu_jmobile.php | 62 +-- htdocs/core/lib/company.lib.php | 10 +- htdocs/core/lib/functions.lib.php | 58 +-- htdocs/core/lib/treeview.lib.php | 4 +- htdocs/core/menus/standard/auguria.lib.php | 48 +- htdocs/core/menus/standard/auguria_menu.php | 198 ++++---- htdocs/core/menus/standard/eldy.lib.php | 26 +- htdocs/core/menus/standard/eldy_menu.php | 46 +- htdocs/core/menus/standard/empty.php | 46 +- .../doc/doc_generic_order_odt.modules.php | 18 +- .../modules/export/export_csv.modules.php | 2 +- .../modules/export/export_excel.modules.php | 24 +- .../export/export_excel2007.modules.php | 4 +- .../modules/export/export_tsv.modules.php | 2 +- .../doc/doc_generic_invoice_odt.modules.php | 2 +- .../modules/facture/doc/pdf_crabe.modules.php | 6 +- htdocs/core/modules/modCron.class.php | 24 +- htdocs/core/search_jmobile.php | 84 ++-- htdocs/cron/admin/cron.php | 18 +- htdocs/cron/card.php | 2 +- htdocs/expedition/index.php | 6 +- htdocs/exports/class/export.class.php | 2 +- htdocs/exports/export.php | 2 +- htdocs/filefunc.inc.php | 2 +- htdocs/fourn/index.php | 6 +- htdocs/holiday/class/holiday.class.php | 12 +- htdocs/holiday/define_holiday.php | 8 +- htdocs/holiday/index.php | 74 +-- htdocs/install/etape5.php | 4 +- htdocs/install/inc.php | 36 +- htdocs/install/upgrade.php | 40 +- htdocs/main.inc.php | 4 +- htdocs/master.inc.php | 4 +- htdocs/product/index.php | 6 +- htdocs/product/stock/index.php | 6 +- htdocs/public/paybox/paymentko.php | 6 +- htdocs/public/paybox/paymentok.php | 6 +- htdocs/public/paypal/paymentko.php | 6 +- htdocs/societe/class/societe.class.php | 6 +- htdocs/societe/consumption.php | 248 +++++----- htdocs/societe/index.php | 4 +- htdocs/theme/bureau2crea/style.css.php | 2 +- htdocs/theme/eldy/style.css.php | 2 +- .../theme/phones/smartphone/tpl/menu.tpl.php | 16 +- htdocs/user/class/user.class.php | 408 ++++++++-------- htdocs/user/fiche.php | 72 +-- htdocs/user/hierarchy.php | 92 ++-- htdocs/user/home.php | 6 +- htdocs/webservices/server_invoice.php | 12 +- htdocs/webservices/server_order.php | 46 +- .../webservices/server_productorservice.php | 10 +- scripts/cron/cron_run_jobs.php | 40 +- ...ail_unpaid_invoices_to_representatives.php | 18 +- test/phpunit/AllTests.php | 16 +- test/phpunit/ContactTest.php | 8 +- test/phpunit/CoreTest.php | 8 +- test/phpunit/WebservicesInvoicesTest.php | 114 ++--- test/phpunit/WebservicesOrdersTest.php | 462 +++++++++--------- test/phpunit/WebservicesOtherTest.php | 116 ++--- test/phpunit/WebservicesThirdpartyTest.php | 118 ++--- test/phpunit/WebservicesUserTest.php | 116 ++--- 100 files changed, 1767 insertions(+), 1752 deletions(-) delete mode 100755 dev/finddosfiles.sh create mode 100755 dev/fixdosfiles.sh diff --git a/dev/finddosfiles.sh b/dev/finddosfiles.sh deleted file mode 100755 index f77859ba1ea..00000000000 --- a/dev/finddosfiles.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -#------------------------------------------------------ -# Script to find files that are not Unix encoded -# -# Laurent Destailleur - eldy@users.sourceforge.net -#------------------------------------------------------ -# Usage: finddosfiles.sh -#------------------------------------------------------ - -# To detec -find . -type f -iname "*.php" -exec file "{}" + | grep CRLF - -# To convert -#find . -type f -iname "*.php" -exec dos2unix "{}" +; - diff --git a/dev/fixdosfiles.sh b/dev/fixdosfiles.sh new file mode 100755 index 00000000000..da1e1a12af5 --- /dev/null +++ b/dev/fixdosfiles.sh @@ -0,0 +1,30 @@ +#!/bin/sh +#------------------------------------------------------ +# Script to find files that are not Unix encoded +# +# Laurent Destailleur - eldy@users.sourceforge.net +#------------------------------------------------------ +# Usage: fixdosfiles.sh [list|fix] +#------------------------------------------------------ + +# Syntax +if [ "x$1" != "xlist" -a "x$1" != "xfix" ] +then + echo "Usage: fixdosfiles.sh [list|fix]" +fi + +# To detec +if [ "x$1" = "xlist" ] +then + find . -type f -iname "*.php" -exec file "{}" + | grep CRLF +fi + +# To convert +if [ "x$1" = "xfix" ] +then + for fic in `find . -type f -iname "*.php" -exec file "{}" + | grep CRLF | awk -F':' '{ print $1 }' ` + do + echo "Fix file $fic" + dos2unix $fic + done; +fi diff --git a/dev/skeletons/skeleton_script.php b/dev/skeletons/skeleton_script.php index 38a68a73ed3..083e7ef680b 100644 --- a/dev/skeletons/skeleton_script.php +++ b/dev/skeletons/skeleton_script.php @@ -40,8 +40,8 @@ $error=0; // -------------------- START OF YOUR CODE HERE -------------------- -@set_time_limit(0); // No timeout for this script -define('EVEN_IF_ONLY_LOGIN_ALLOWED',1); // Set this define to 0 if you want to lock your script when dolibarr setup is "locked to admin user only". +@set_time_limit(0); // No timeout for this script +define('EVEN_IF_ONLY_LOGIN_ALLOWED',1); // Set this define to 0 if you want to lock your script when dolibarr setup is "locked to admin user only". // Include and load Dolibarr environment variables require_once($path."../../htdocs/master.inc.php"); diff --git a/htdocs/adherents/admin/adherent.php b/htdocs/adherents/admin/adherent.php index 62f89f992dd..2bed305783a 100644 --- a/htdocs/adherents/admin/adherent.php +++ b/htdocs/adherents/admin/adherent.php @@ -169,7 +169,7 @@ print $form->selectyesno('constvalue',(! empty($conf->global->ADHERENT_DEFAULT_S print ''; print ''; print "\n"; -print ''; +print ''; // Insert subscription into bank account $var=!$var; @@ -179,41 +179,41 @@ print ''; print ''; print ''.$langs->trans("MoreActionsOnSubscription").''; $arraychoices=array('0'=>$langs->trans("None")); -if (! empty($conf->banque->enabled)) $arraychoices['bankdirect']=$langs->trans("MoreActionBankDirect"); -if (! empty($conf->banque->enabled) && ! empty($conf->societe->enabled) && ! empty($conf->facture->enabled)) $arraychoices['invoiceonly']=$langs->trans("MoreActionInvoiceOnly"); -if (! empty($conf->banque->enabled) && ! empty($conf->societe->enabled) && ! empty($conf->facture->enabled)) $arraychoices['bankviainvoice']=$langs->trans("MoreActionBankViaInvoice"); +if (! empty($conf->banque->enabled)) $arraychoices['bankdirect']=$langs->trans("MoreActionBankDirect"); +if (! empty($conf->banque->enabled) && ! empty($conf->societe->enabled) && ! empty($conf->facture->enabled)) $arraychoices['invoiceonly']=$langs->trans("MoreActionInvoiceOnly"); +if (! empty($conf->banque->enabled) && ! empty($conf->societe->enabled) && ! empty($conf->facture->enabled)) $arraychoices['bankviainvoice']=$langs->trans("MoreActionBankViaInvoice"); print ''; print $form->selectarray('constvalue',$arraychoices,$conf->global->ADHERENT_BANK_USE,0); print ''; print ''; print ''; print "\n"; -print ''; +print ''; -// Use vat for invoice creation +// Use vat for invoice creation if ($conf->facture->enabled) { - $var=!$var; - print '
'; - print ''; - print ''; - print ''; - print ''.$langs->trans("VATToUseForSubscriptions").''; - if (! empty($conf->banque->enabled)) - { - print ''; - print $form->selectarray('constvalue', array('0'=>$langs->trans("NoVatOnSubscription"),'defaultforfoundationcountry'=>$langs->trans("Default")), (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS)?'0':$conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS), 0); - print ''; - print ''; - print ''; - } - else - { - print ''; - print $langs->trans("WarningModuleNotActive",$langs->transnoentities("Module85Name")); - print ''; - } - print "\n"; + $var=!$var; + print ''; + print ''; + print ''; + print ''; + print ''.$langs->trans("VATToUseForSubscriptions").''; + if (! empty($conf->banque->enabled)) + { + print ''; + print $form->selectarray('constvalue', array('0'=>$langs->trans("NoVatOnSubscription"),'defaultforfoundationcountry'=>$langs->trans("Default")), (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS)?'0':$conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS), 0); + print ''; + print ''; + print ''; + } + else + { + print ''; + print $langs->trans("WarningModuleNotActive",$langs->transnoentities("Module85Name")); + print ''; + } + print "\n"; print '
'; } diff --git a/htdocs/adherents/card_subscriptions.php b/htdocs/adherents/card_subscriptions.php index 279669497ec..bed822274ed 100644 --- a/htdocs/adherents/card_subscriptions.php +++ b/htdocs/adherents/card_subscriptions.php @@ -362,7 +362,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $ // Add line to draft invoice $idprodsubscription=0; - $vattouse=0; + $vattouse=0; if (isset($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) && $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS == 'defaultforfoundationcountry') { $vattouse=get_default_tva($mysoc, $mysoc, $idprodsubscription); diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php index e3787b18c89..fc5994f3086 100644 --- a/htdocs/adherents/index.php +++ b/htdocs/adherents/index.php @@ -197,7 +197,7 @@ if ($conf->use_javascript_ajax) //print ''; -print '
'; +print '
'; $var=true; @@ -419,7 +419,7 @@ print "\n"; print "
\n"; //print ''; -print '
'; +print '
'; llxFooter(); diff --git a/htdocs/admin/agenda.php b/htdocs/admin/agenda.php index 29af716ceb0..7eb659bde97 100644 --- a/htdocs/admin/agenda.php +++ b/htdocs/admin/agenda.php @@ -139,9 +139,9 @@ $head=agenda_prepare_head(); dol_fiche_head($head, 'autoactions', $langs->trans("Agenda")); -print $langs->trans("AgendaAutoActionDesc")."
\n"; +print $langs->trans("AgendaAutoActionDesc")."
\n"; print $langs->trans("OnlyActiveElementsAreShown").'
'; -print "
\n"; +print "
\n"; print '
'; print ''; diff --git a/htdocs/admin/agenda_extsites.php b/htdocs/admin/agenda_extsites.php index 5d4c787bf37..d23d7c510ea 100644 --- a/htdocs/admin/agenda_extsites.php +++ b/htdocs/admin/agenda_extsites.php @@ -64,8 +64,8 @@ if ($actionsave) { $name=trim(GETPOST('agenda_ext_name'.$i),'alpha'); $src=trim(GETPOST('agenda_ext_src'.$i,'alpha')); - $color=trim(GETPOST('agenda_ext_color'.$i,'alpha')); - if ($color=='-1') $color=''; + $color=trim(GETPOST('agenda_ext_color'.$i,'alpha')); + if ($color=='-1') $color=''; if (! empty($src) && ! preg_match('/^(http\s*|ftp\s*):/', $src)) { @@ -148,32 +148,32 @@ $var=!$var; print ""; print "".$langs->trans("ExtSitesEnableThisTool").""; print ''; -if ($conf->use_javascript_ajax) -{ - print ajax_constantonoff('AGENDA_DISABLE_EXT',array('enabled'=>array(0=>'.hideifnotset')),null,1); -} -else -{ - if($conf->global->AGENDA_DISABLE_EXT == 0) - { - print ''.img_picto($langs->trans("Enabled"),'on').''; - } - else - { - print ''.img_picto($langs->trans("Disabled"),'off').''; - } -} +if ($conf->use_javascript_ajax) +{ + print ajax_constantonoff('AGENDA_DISABLE_EXT',array('enabled'=>array(0=>'.hideifnotset')),null,1); +} +else +{ + if($conf->global->AGENDA_DISABLE_EXT == 0) + { + print ''.img_picto($langs->trans("Enabled"),'on').''; + } + else + { + print ''.img_picto($langs->trans("Disabled"),'off').''; + } +} print ""; print ""; // Nb of agenda $var=!$var; -print ""; -print "".$langs->trans("ExtSitesNbOfAgenda").""; -print ''; -print ''; -print ""; -print ""; +print ""; +print "".$langs->trans("ExtSitesNbOfAgenda").""; +print ''; +print ''; +print ""; +print ""; print ""; print "
"; diff --git a/htdocs/admin/agenda_xcal.php b/htdocs/admin/agenda_xcal.php index 64e03fe7f9c..2aa5992b5af 100644 --- a/htdocs/admin/agenda_xcal.php +++ b/htdocs/admin/agenda_xcal.php @@ -80,8 +80,8 @@ $head=agenda_prepare_head(); dol_fiche_head($head, 'xcal', $langs->trans("Agenda")); -print $langs->trans("AgendaSetupOtherDesc")."
\n"; -print "
\n"; +print $langs->trans("AgendaSetupOtherDesc")."
\n"; +print "
\n"; print ''; print ''; diff --git a/htdocs/admin/const.php b/htdocs/admin/const.php index a2b07ca2d11..a2838ae7fe9 100644 --- a/htdocs/admin/const.php +++ b/htdocs/admin/const.php @@ -122,7 +122,7 @@ if (! empty($consts) && $action == 'delete') } } if ($nbdeleted > 0) setEventMessage($langs->trans("RecordDeleted")); - $action=''; + $action=''; } // Delete line from delete picto @@ -130,7 +130,7 @@ if ($action == 'delete') { if (dolibarr_del_const($db, $rowid, $entity) >= 0) { - setEventMessage($langs->trans("RecordDeleted")); + setEventMessage($langs->trans("RecordDeleted")); } else { @@ -222,8 +222,8 @@ print '
'; print "\n"; print '
entity) && $debug)?'?debug=1':'').'" method="POST">'; -print ''; -print ''; +print ''; +print ''; // Show constants $sql = "SELECT"; diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 21f6195525d..4df22736021 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -125,8 +125,8 @@ $tablib[20]= "DictionnaryOrderMethods"; $tablib[21]= "DictionnaryAvailability"; $tablib[22]= "DictionnarySource"; $tablib[23]= "DictionnaryAccountancyplan"; -$tablib[24]= "DictionnaryAccountancysystem"; -$tablib[25]= "DictionnaryRevenueStamp"; +$tablib[24]= "DictionnaryAccountancysystem"; +$tablib[25]= "DictionnaryRevenueStamp"; // Requete pour extraction des donnees des dictionnaires $tabsql=array(); @@ -153,8 +153,8 @@ $tabsql[20]= "SELECT rowid as rowid, code, libelle, active FROM ".MAIN_DB_PREF $tabsql[21]= "SELECT c.rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_availability AS c"; $tabsql[22]= "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_input_reason"; $tabsql[23]= "SELECT rowid as rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number as accountancy_code, account_parent, label, active FROM ".MAIN_DB_PREFIX."accountingaccount"; -$tabsql[24]= "SELECT s.rowid as rowid, pcg_version, s.fk_pays as country_id, p.code as country_code, p.libelle as pays, s.label, s.active FROM ".MAIN_DB_PREFIX."accounting_system as s, ".MAIN_DB_PREFIX."c_pays as p WHERE s.fk_pays=p.rowid and p.active=1"; -$tabsql[25]= "SELECT t.rowid, t.taux, p.libelle as country, p.code as country_code, t.fk_pays as country_id, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_revenuestamp as t, llx_c_pays as p WHERE t.fk_pays=p.rowid"; +$tabsql[24]= "SELECT s.rowid as rowid, pcg_version, s.fk_pays as country_id, p.code as country_code, p.libelle as pays, s.label, s.active FROM ".MAIN_DB_PREFIX."accounting_system as s, ".MAIN_DB_PREFIX."c_pays as p WHERE s.fk_pays=p.rowid and p.active=1"; +$tabsql[25]= "SELECT t.rowid, t.taux, p.libelle as country, p.code as country_code, t.fk_pays as country_id, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_revenuestamp as t, llx_c_pays as p WHERE t.fk_pays=p.rowid"; // Critere de tri du dictionnaire $tabsqlsort=array(); @@ -181,8 +181,8 @@ $tabsqlsort[20]="code ASC, libelle ASC"; $tabsqlsort[21]="code ASC, label ASC"; $tabsqlsort[22]="code ASC, label ASC"; $tabsqlsort[23]="fk_pcg_version ASC, accountancy_code ASC"; -$tabsqlsort[24]="pcg_version ASC"; -$tabsqlsort[25]="country ASC, taux ASC"; +$tabsqlsort[24]="pcg_version ASC"; +$tabsqlsort[25]="country ASC, taux ASC"; // Nom des champs en resultat de select pour affichage du dictionnaire $tabfield=array(); @@ -209,8 +209,8 @@ $tabfield[20]= "code,libelle"; $tabfield[21]= "code,label"; $tabfield[22]= "code,label"; $tabfield[23]= "fk_pcg_version,accountancy_code,account_parent,pcg_type,pcg_subtype,label"; -$tabfield[24]= "pcg_version,country_id,country,label"; -$tabfield[25]= "country_id,country,taux,accountancy_code_sell,accountancy_code_buy,note"; +$tabfield[24]= "pcg_version,country_id,country,label"; +$tabfield[25]= "country_id,country,taux,accountancy_code_sell,accountancy_code_buy,note"; // Nom des champs d'edition pour modification d'un enregistrement $tabfieldvalue=array(); @@ -237,8 +237,8 @@ $tabfieldvalue[20]= "code,libelle"; $tabfieldvalue[21]= "code,label"; $tabfieldvalue[22]= "code,label"; $tabfieldvalue[23]= "fk_pcg_version,accountancy_code,account_parent,pcg_type,pcg_subtype,label"; -$tabfieldvalue[24]= "pcg_version,country,label"; -$tabfieldvalue[25]= "country,taux,accountancy_code_sell,accountancy_code_buy,note"; +$tabfieldvalue[24]= "pcg_version,country,label"; +$tabfieldvalue[25]= "country,taux,accountancy_code_sell,accountancy_code_buy,note"; // Nom des champs dans la table pour insertion d'un enregistrement $tabfieldinsert=array(); @@ -265,8 +265,8 @@ $tabfieldinsert[20]= "code,libelle"; $tabfieldinsert[21]= "code,label"; $tabfieldinsert[22]= "code,label"; $tabfieldinsert[23]= "fk_pcg_version,account_number,account_parent,pcg_type,pcg_subtype,label"; -$tabfieldinsert[24]= "pcg_version,fk_pays,label"; -$tabfieldinsert[25]= "fk_pays,taux,accountancy_code_sell,accountancy_code_buy,note"; +$tabfieldinsert[24]= "pcg_version,fk_pays,label"; +$tabfieldinsert[25]= "fk_pays,taux,accountancy_code_sell,accountancy_code_buy,note"; // Nom du rowid si le champ n'est pas de type autoincrement // Example: "" if id field is "rowid" and has autoincrement on @@ -295,8 +295,8 @@ $tabrowid[20]= ""; $tabrowid[21]= "rowid"; $tabrowid[22]= "rowid"; $tabrowid[23]= ""; -$tabrowid[24]= ""; -$tabrowid[25]= ""; +$tabrowid[24]= ""; +$tabrowid[25]= ""; // Condition to show dictionnary in setup page $tabcond=array(); @@ -323,8 +323,8 @@ $tabcond[20]= ! empty($conf->fournisseur->enabled); $tabcond[21]= ! empty($conf->propal->enabled); $tabcond[22]= (! empty($conf->commande->enabled) || ! empty($conf->propal->enabled)); $tabcond[23]= (! empty($conf->global->ACCOUNTING_USEDICTTOEDIT) && ! empty($conf->accounting->enabled)); // The accountancy plan should be edited with specific pages. You can set ACCOUNTING_USEDICTTOEDIT to 1 if you want to use dictionnary editor. -$tabcond[24]= (! empty($conf->global->ACCOUNTING_USEDICTTOEDIT) && ! empty($conf->accounting->enabled)); // The accountancy system should be edited with specific pages. You can set ACCOUNTING_USEDICTTOEDIT to 1 if you want to use dictionnary editor. -$tabcond[25]= true; +$tabcond[24]= (! empty($conf->global->ACCOUNTING_USEDICTTOEDIT) && ! empty($conf->accounting->enabled)); // The accountancy system should be edited with specific pages. You can set ACCOUNTING_USEDICTTOEDIT to 1 if you want to use dictionnary editor. +$tabcond[25]= true; // List of help for fields $tabhelp=array(); @@ -351,8 +351,8 @@ $tabhelp[20] = array(); $tabhelp[21] = array(); $tabhelp[22] = array(); $tabhelp[23] = array(); -$tabhelp[24] = array(); -$tabhelp[25] = array(); +$tabhelp[24] = array(); +$tabhelp[25] = array(); // Complete all arrays with entries found into modules complete_dictionnary_with_modules($taborder,$tabname,$tablib,$tabsql,$tabsqlsort,$tabfield,$tabfieldvalue,$tabfieldinsert,$tabrowid,$tabcond,$tabhelp); diff --git a/htdocs/admin/menus.php b/htdocs/admin/menus.php index bd5074f01b1..5974de1decc 100644 --- a/htdocs/admin/menus.php +++ b/htdocs/admin/menus.php @@ -77,21 +77,21 @@ if ($action == 'update' && empty($_POST["cancel"])) // Define list of menu handlers to initialize $listofmenuhandler=array(); - $listofmenuhandler[preg_replace('/(_backoffice|_frontoffice|_menu)?\.php/i','',$_POST["MAIN_MENU_STANDARD"])]=1; - $listofmenuhandler[preg_replace('/(_backoffice|_frontoffice|_menu)?\.php/i','',$_POST["MAIN_MENUFRONT_STANDARD"])]=1; - if (isset($_POST["MAIN_MENU_SMARTPHONE"])) $listofmenuhandler[preg_replace('/(_backoffice|_frontoffice|_menu)?\.php/i','',$_POST["MAIN_MENU_SMARTPHONE"])]=1; - if (isset($_POST["MAIN_MENUFRONT_SMARTPHONE"])) $listofmenuhandler[preg_replace('/(_backoffice|_frontoffice|_menu)?\.php/i','',$_POST["MAIN_MENUFRONT_SMARTPHONE"])]=1; + $listofmenuhandler[preg_replace('/(_backoffice|_frontoffice|_menu)?\.php/i','',$_POST["MAIN_MENU_STANDARD"])]=1; + $listofmenuhandler[preg_replace('/(_backoffice|_frontoffice|_menu)?\.php/i','',$_POST["MAIN_MENUFRONT_STANDARD"])]=1; + if (isset($_POST["MAIN_MENU_SMARTPHONE"])) $listofmenuhandler[preg_replace('/(_backoffice|_frontoffice|_menu)?\.php/i','',$_POST["MAIN_MENU_SMARTPHONE"])]=1; + if (isset($_POST["MAIN_MENUFRONT_SMARTPHONE"])) $listofmenuhandler[preg_replace('/(_backoffice|_frontoffice|_menu)?\.php/i','',$_POST["MAIN_MENUFRONT_SMARTPHONE"])]=1; // Initialize menu handlers foreach ($listofmenuhandler as $key => $val) { // Load sql init_menu_handler.sql file - $dirmenus=array_merge(array("/core/menus/"),(array) $conf->modules_parts['menus']); - foreach($dirmenus as $dirmenu) - { + $dirmenus=array_merge(array("/core/menus/"),(array) $conf->modules_parts['menus']); + foreach($dirmenus as $dirmenu) + { $file='init_menu_'.$key.'.sql'; $fullpath=dol_buildpath($dirmenu.$file); - //print 'action='.$action.' Search menu into fullpath='.$fullpath.'
';exit; + //print 'action='.$action.' Search menu into fullpath='.$fullpath.'
';exit; if (file_exists($fullpath)) { diff --git a/htdocs/admin/menus/index.php b/htdocs/admin/menus/index.php index 092e910c5cc..fa30f472a5c 100644 --- a/htdocs/admin/menus/index.php +++ b/htdocs/admin/menus/index.php @@ -57,7 +57,7 @@ $menu_handler=$menu_handler_top; if (GETPOST("handler_origine")) $menu_handler=GETPOST("handler_origine"); if (GETPOST("menu_handler")) $menu_handler=GETPOST("menu_handler"); -$menu_handler_to_search=preg_replace('/(_backoffice|_frontoffice|_menu)?(\.php)?/i','',$menu_handler); +$menu_handler_to_search=preg_replace('/(_backoffice|_frontoffice|_menu)?(\.php)?/i','',$menu_handler); /* @@ -207,8 +207,8 @@ elseif ($action == 'confirm_delete' && $confirm == 'yes') $form=new Form($db); $formadmin=new FormAdmin($db); -$arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js'); -$arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css'); +$arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js'); +$arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css'); llxHeader('',$langs->trans("Menus"),'','',0,0,$arrayofjs,$arrayofcss); @@ -324,14 +324,14 @@ if ($conf->use_javascript_ajax) 'leftmenu'=>$menu['leftmenu'], 'fk_mainmenu'=>$menu['fk_mainmenu'], 'fk_leftmenu'=>$menu['fk_leftmenu'], - 'entry'=>'
'. - '   '.$titre.''. - ''. - ''.img_edit('default',0,'class="menuEdit" id="edit'.$menu['rowid'].'"').' '. - ''.img_edit_add('default',0,'class="menuNew" id="new'.$menu['rowid'].'"').' '. - ''.img_delete('default',0,'class="menuDel" id="del'.$menu['rowid'].'"').' '. - ''.img_picto("Monter","1uparrow").''.img_picto("Descendre","1downarrow").''. - '
' + 'entry'=>'
'. + '   '.$titre.''. + ''. + ''.img_edit('default',0,'class="menuEdit" id="edit'.$menu['rowid'].'"').' '. + ''.img_edit_add('default',0,'class="menuNew" id="new'.$menu['rowid'].'"').' '. + ''.img_delete('default',0,'class="menuDel" id="del'.$menu['rowid'].'"').' '. + ''.img_picto("Monter","1uparrow").''.img_picto("Descendre","1downarrow").''. + '
' ); $i++; } diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index cbe59807a26..4440d632b2e 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -197,14 +197,14 @@ $moreinfo=$langs->trans("TotalNumberOfActivatedModules",($nbofactivatedmodules-1 print load_fiche_titre($langs->trans("ModulesSetup"),$moreinfo,'setup'); -// Start to show page -if (empty($mode)) $mode='common'; -if ($mode==='common') print $langs->trans("ModulesDesc")."
\n"; -if ($mode==='other') print $langs->trans("ModulesSpecialDesc")."
\n"; -if ($mode==='interfaces') print $langs->trans("ModulesInterfaceDesc")."
\n"; -if ($mode==='functional') print $langs->trans("ModulesJobDesc")."
\n"; -if ($mode==='marketplace') print $langs->trans("ModulesMarketPlaceDesc")."
\n"; -if ($mode==='expdev') print $langs->trans("ModuleFamilyExperimental")."
\n"; +// Start to show page +if (empty($mode)) $mode='common'; +if ($mode==='common') print $langs->trans("ModulesDesc")."
\n"; +if ($mode==='other') print $langs->trans("ModulesSpecialDesc")."
\n"; +if ($mode==='interfaces') print $langs->trans("ModulesInterfaceDesc")."
\n"; +if ($mode==='functional') print $langs->trans("ModulesJobDesc")."
\n"; +if ($mode==='marketplace') print $langs->trans("ModulesMarketPlaceDesc")."
\n"; +if ($mode==='expdev') print $langs->trans("ModuleFamilyExperimental")."
\n"; if ($nbofactivatedmodules <= 1) print ' '.img_warning($langs->trans("YouMustEnableOneModule")); //print '
'."\n"; @@ -499,8 +499,8 @@ else dol_fiche_end(); -// Show warning about external users -if ($mode != 'marketplace') print showModulesExludedForExternal($modules).'
'."\n"; +// Show warning about external users +if ($mode != 'marketplace') print showModulesExludedForExternal($modules).'
'."\n"; llxFooter(); diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index 5617ecc1dfb..afa67c434e8 100755 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -68,19 +68,19 @@ if ($action == 'update') exit; } -if ($action == 'activate_pdfsecurity') -{ - dolibarr_set_const($db, "PDF_SECURITY_ENCRYPTION", "1",'chaine',0,'',$conf->entity); - header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); - exit; -} -else if ($action == 'disable_pdfsecurity') -{ - dolibarr_del_const($db, "PDF_SECURITY_ENCRYPTION",$conf->entity); - header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); - exit; -} - +if ($action == 'activate_pdfsecurity') +{ + dolibarr_set_const($db, "PDF_SECURITY_ENCRYPTION", "1",'chaine',0,'',$conf->entity); + header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); + exit; +} +else if ($action == 'disable_pdfsecurity') +{ + dolibarr_del_const($db, "PDF_SECURITY_ENCRYPTION",$conf->entity); + header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); + exit; +} + /* diff --git a/htdocs/admin/tools/listevents.php b/htdocs/admin/tools/listevents.php index 8056080be23..284520bce48 100644 --- a/htdocs/admin/tools/listevents.php +++ b/htdocs/admin/tools/listevents.php @@ -139,11 +139,11 @@ if ($result) $i = 0; $param=''; - if ($search_code) $param.='&search_code='.$search_code; - if ($search_ip) $param.='&search_ip='.$search_ip; - if ($search_user) $param.='&search_user='.$search_user; - if ($search_desc) $param.='&search_desc='.$search_desc; - if ($search_ua) $param.='&search_ua='.$search_ua; + if ($search_code) $param.='&search_code='.$search_code; + if ($search_ip) $param.='&search_ip='.$search_ip; + if ($search_user) $param.='&search_user='.$search_user; + if ($search_desc) $param.='&search_desc='.$search_desc; + if ($search_ua) $param.='&search_ua='.$search_ua; print_barre_liste($langs->trans("ListOfSecurityEvents"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, 0, 'setup'); diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php index 532a95f7317..aeed1760f00 100644 --- a/htdocs/categories/index.php +++ b/htdocs/categories/index.php @@ -62,7 +62,7 @@ print_fiche_titre($title); //print ''; //print '
'; -print '
'; +print '
'; /* @@ -91,7 +91,7 @@ print '
'; //print ''; -print '
'; +print '
'; /* @@ -136,25 +136,25 @@ $cate_arbo = $categstatic->get_full_arbo($type); $fulltree=$cate_arbo; // Define data (format for treeview) -$data=array(); -$data[] = array('rowid'=>0,'fk_menu'=>-1,'title'=>"racine",'mainmenu'=>'','leftmenu'=>'','fk_mainmenu'=>'','fk_leftmenu'=>''); -foreach($fulltree as $key => $val) +$data=array(); +$data[] = array('rowid'=>0,'fk_menu'=>-1,'title'=>"racine",'mainmenu'=>'','leftmenu'=>'','fk_mainmenu'=>'','fk_leftmenu'=>''); +foreach($fulltree as $key => $val) { - $categstatic->id=$val['id']; - $categstatic->ref=$val['label']; - $categstatic->type=$type; - $li=$categstatic->getNomUrl(1,'',60); + $categstatic->id=$val['id']; + $categstatic->ref=$val['label']; + $categstatic->type=$type; + $li=$categstatic->getNomUrl(1,'',60); - $data[] = array( - 'rowid'=>$val['rowid'], - 'fk_menu'=>$val['fk_parent'], - 'entry'=>''. + '
'.$li. - ''. + $data[] = array( + 'rowid'=>$val['rowid'], + 'fk_menu'=>$val['fk_parent'], + 'entry'=>''. - ''. - '
'.$li. + ''. ' '.$val['description'].''.img_view().'
' - ); -} + '
'.img_view().'
' + ); +} print ''; @@ -170,20 +170,20 @@ $nbofentries=(count($data) - 1); if ($nbofentries > 0) { print ''; } else { - print ''; - print ''; - print ''; -} + print ''; + print ''; + print ''; +} print "
'; - tree_recur($data,$data[0],0); + tree_recur($data,$data[0],0); print '
'; - print ''; - print ''; - print '
'.img_picto_common('','treemenu/branchbottom.gif').''; - print $langs->trans("NoCategoryYet"); - print ' 
'; + print ''; + print ''; + print '
'.img_picto_common('','treemenu/branchbottom.gif').''; + print $langs->trans("NoCategoryYet"); + print ' 
"; diff --git a/htdocs/comm/action/rapport/index.php b/htdocs/comm/action/rapport/index.php index 9d82fb21ab9..33a30e9c6b6 100644 --- a/htdocs/comm/action/rapport/index.php +++ b/htdocs/comm/action/rapport/index.php @@ -30,8 +30,8 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/modules/action/rapport.pdf.php'; -$langs->load("agenda"); -$langs->load("commercial"); +$langs->load("agenda"); +$langs->load("commercial"); $action=GETPOST('action','alpha'); $month=GETPOST('month'); diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index c30d75192d8..d3acdd87593 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -87,7 +87,7 @@ llxHeader(); print_fiche_titre($langs->trans("CustomerArea")); -print '
'; +print '
'; /* print ''; print ''; @@ -270,7 +270,7 @@ else { print '
'; }*/ -print '
'; +print '
'; $NBMAX=3; @@ -546,7 +546,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire) //print '
'; -print '
'; +print '
'; llxFooter(); diff --git a/htdocs/comm/mailing/fiche.php b/htdocs/comm/mailing/fiche.php index d04b9c7aefe..564daaaaa74 100644 --- a/htdocs/comm/mailing/fiche.php +++ b/htdocs/comm/mailing/fiche.php @@ -1017,9 +1017,9 @@ else print ''; if (empty($object->bgcolor) || strtolower($object->bgcolor) == 'ffffff') { - // Editeur wysiwyg - require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor('body',$object->body,'',320,'dolibarr_readonly','',false,true,empty($conf->global->FCKEDITOR_ENABLE_MAILING)?0:1,20,70); + // Editeur wysiwyg + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $doleditor=new DolEditor('body',$object->body,'',320,'dolibarr_readonly','',false,true,empty($conf->global->FCKEDITOR_ENABLE_MAILING)?0:1,20,70); $doleditor->Create(); } else print dol_htmlentitiesbr($object->body); @@ -1055,7 +1055,7 @@ else print ''; print $langs->trans("TotalNbOfDistinctRecipients"); print ''; - $nbemail = ($object->nbemail?$object->nbemail:img_warning('').' '.$langs->trans("NoTargetYet").''); + $nbemail = ($object->nbemail?$object->nbemail:img_warning('').' '.$langs->trans("NoTargetYet").''); if (!empty($conf->global->MAILING_LIMIT_SENDBYWEB) && is_numeric($nbemail) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) { $text=$langs->trans('LimitSendingEmailing',$conf->global->MAILING_LIMIT_SENDBYWEB); diff --git a/htdocs/comm/mailing/index.php b/htdocs/comm/mailing/index.php index b2ff4d92f76..fd12402f050 100644 --- a/htdocs/comm/mailing/index.php +++ b/htdocs/comm/mailing/index.php @@ -46,7 +46,7 @@ print_fiche_titre($langs->trans("MailingArea")); //print ''; //print '
'; -print '
'; +print '
'; // Recherche emails @@ -143,7 +143,7 @@ print "

"; //print ''; -print '
'; +print '
'; /* @@ -201,7 +201,7 @@ else //print ''; -print '
'; +print '
'; if ($langs->file_exists("html/spam.html",0)) { @@ -216,5 +216,5 @@ if ($langs->file_exists("html/spam.html",0)) { llxFooter(); -$db->close(); +$db->close(); ?> diff --git a/htdocs/comm/propal/index.php b/htdocs/comm/propal/index.php index 4ac166b54a2..6347f68c87a 100644 --- a/htdocs/comm/propal/index.php +++ b/htdocs/comm/propal/index.php @@ -56,7 +56,7 @@ print_fiche_titre($langs->trans("ProspectionArea")); //print ''; //print '
'; -print '
'; +print '
'; /* @@ -202,7 +202,7 @@ if (! empty($conf->propal->enabled)) //print '
'; -print '
'; +print '
'; $max=5; @@ -513,7 +513,7 @@ if (! empty($conf->propal->enabled)) */ //print '
'; -print '
'; +print '
'; llxFooter(); diff --git a/htdocs/comm/prospect/index.php b/htdocs/comm/prospect/index.php index bf53b674bc5..e08228b5c61 100644 --- a/htdocs/comm/prospect/index.php +++ b/htdocs/comm/prospect/index.php @@ -48,7 +48,7 @@ print_fiche_titre($langs->trans("ProspectionArea")); //print ''; //print '
'; -print '
'; +print '
'; if (! empty($conf->propal->enabled)) @@ -161,7 +161,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propale->lire) //print '
'; -print '
'; +print '
'; /* @@ -279,7 +279,7 @@ if ($resql) //print '
'; -print '
'; +print '
'; llxFooter(); diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 9b4a88592f3..4bf473d3413 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -657,15 +657,15 @@ else if ($action == 'addline' && $user->rights->commande->creer) $desc=dol_concatdesc($desc,$product_desc); - // Add custom code and origin country into description - if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code))) - { - $tmptxt='('; - if (! empty($prod->customcode)) $tmptxt.=$langs->transnoentitiesnoconv("CustomCode").': '.$prod->customcode; - if (! empty($prod->customcode) && ! empty($prod->country_code)) $tmptxt.=' - '; - if (! empty($prod->country_code)) $tmptxt.=$langs->transnoentitiesnoconv("CountryOrigin").': '.getCountry($prod->country_code,0,$db,$langs,0); - $tmptxt.=')'; - $desc= dol_concatdesc($desc, $tmptxt); + // Add custom code and origin country into description + if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code))) + { + $tmptxt='('; + if (! empty($prod->customcode)) $tmptxt.=$langs->transnoentitiesnoconv("CustomCode").': '.$prod->customcode; + if (! empty($prod->customcode) && ! empty($prod->country_code)) $tmptxt.=' - '; + if (! empty($prod->country_code)) $tmptxt.=$langs->transnoentitiesnoconv("CountryOrigin").': '.getCountry($prod->country_code,0,$db,$langs,0); + $tmptxt.=')'; + $desc= dol_concatdesc($desc, $tmptxt); } } diff --git a/htdocs/commande/index.php b/htdocs/commande/index.php index 3301721df7a..cb6e85ac117 100644 --- a/htdocs/commande/index.php +++ b/htdocs/commande/index.php @@ -57,7 +57,7 @@ print_fiche_titre($langs->trans("OrdersArea")); //print ''; //print '
'; -print '
'; +print '
'; /* @@ -207,7 +207,7 @@ if (! empty($conf->commande->enabled)) //print '
'; -print '
'; +print '
'; $max=5; @@ -425,7 +425,7 @@ if (! empty($conf->commande->enabled)) //print '
'; -print '
'; +print '
'; llxFooter(); diff --git a/htdocs/compta/bank/rappro.php b/htdocs/compta/bank/rappro.php index d631e8e1843..4e8b717201c 100644 --- a/htdocs/compta/bank/rappro.php +++ b/htdocs/compta/bank/rappro.php @@ -443,7 +443,7 @@ if ($resql) print "
\n"; - print '

'; + print '

'; print "\n"; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 98f09c18351..2ba0ce6e137 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -2283,7 +2283,7 @@ else if ($id > 0 || ! empty($ref)) $soc = new Societe($db); $soc->fetch($object->socid); - $selleruserevenustamp=$mysoc->useRevenueStamp(); + $selleruserevenustamp=$mysoc->useRevenueStamp(); $totalpaye = $object->getSommePaiement(); $totalcreditnotes = $object->getSumCreditNotesUsed(); @@ -2754,7 +2754,7 @@ else if ($id > 0 || ! empty($ref)) if (! empty($conf->banque->enabled)) $nbcols++; if($mysoc->localtax1_assuj=="1") $nbrows++; if($mysoc->localtax2_assuj=="1") $nbrows++; - if ($selleruserevenustamp) $nbrows++; + if ($selleruserevenustamp) $nbrows++; print ''; @@ -3043,16 +3043,16 @@ else if ($id > 0 || ! empty($ref)) // Revenue stamp if ($selleruserevenustamp) // Test company use revenue stamp - { - print ''; - print ''; - if ($action != 'editrevenuestamp' && ! empty($object->brouillon) && $user->rights->facture->creer) print ''; - print '
'; - print $langs->trans('RevenueStamp'); - print 'id.'">'.img_edit($langs->trans('SetRevenuStamp'),1).'
'; - print ''; - if ($action == 'editrevenuestamp') - { + { + print ''; + print ''; + if ($action != 'editrevenuestamp' && ! empty($object->brouillon) && $user->rights->facture->creer) print ''; + print '
'; + print $langs->trans('RevenueStamp'); + print 'id.'">'.img_edit($langs->trans('SetRevenuStamp'),1).'
'; + print ''; + if ($action == 'editrevenuestamp') + { print '
'; print ''; print ''; @@ -3060,12 +3060,12 @@ else if ($id > 0 || ! empty($ref)) //print ''; print ' '; print '
'; - } - else - { - print price($object->revenuestamp,1,'',1,-1,-1,$conf->currency); - } - print ''; + } + else + { + print price($object->revenuestamp,1,'',1,-1,-1,$conf->currency); + } + print ''; } // Total with tax diff --git a/htdocs/compta/facture/impayees.php b/htdocs/compta/facture/impayees.php index 086b9a35fc4..240ad867358 100644 --- a/htdocs/compta/facture/impayees.php +++ b/htdocs/compta/facture/impayees.php @@ -377,7 +377,7 @@ if ($resql) print ''; $cn=$facturestatic->getSumCreditNotesUsed(); if (! empty($objp->am)) print price($objp->am); - if (! empty($objp->am) && ! empty($cn)) print '+'; + if (! empty($objp->am) && ! empty($cn)) print '+'; if (! empty($cn)) print price($cn); print ''; diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index d4aad86977e..925e55f02fc 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -106,7 +106,7 @@ print_fiche_titre($langs->trans("AccountancyTreasuryArea")); //print ''; //print '
'; -print '
'; +print '
'; $max=3; @@ -324,7 +324,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture- //print '
'; -print '
'; +print '
'; // Last modified customer invoices @@ -1033,7 +1033,7 @@ if ($resql) } //print '
'; -print '
'; +print '
'; llxFooter(); diff --git a/htdocs/compta/paiement/cheque/index.php b/htdocs/compta/paiement/cheque/index.php index 45a1f665a37..ac67e103a82 100644 --- a/htdocs/compta/paiement/cheque/index.php +++ b/htdocs/compta/paiement/cheque/index.php @@ -48,7 +48,7 @@ print_fiche_titre($langs->trans("ChequesArea")); //print ''; //print '
'; -print '
'; +print '
'; $sql = "SELECT count(b.rowid)"; $sql.= " FROM ".MAIN_DB_PREFIX."bank as b"; @@ -87,7 +87,7 @@ else //print '
'; -print '
'; +print '
'; $sql = "SELECT bc.rowid, bc.date_bordereau as db, bc.amount, bc.number as ref"; @@ -146,7 +146,7 @@ else //print "
\n"; -print '
'; +print '
'; llxFooter(); diff --git a/htdocs/compta/prelevement/index.php b/htdocs/compta/prelevement/index.php index 5fdd334db55..916c3fccec5 100644 --- a/htdocs/compta/prelevement/index.php +++ b/htdocs/compta/prelevement/index.php @@ -63,7 +63,7 @@ print_fiche_titre($langs->trans("CustomersStandingOrdersArea")); //print ''; //print '
'; -print '
'; +print '
'; $thirdpartystatic=new Societe($db); @@ -88,7 +88,7 @@ print '

'; //print ''; -print '
'; +print '
'; /* @@ -221,7 +221,7 @@ else //print ''; -print '
'; +print '
'; llxFooter(); diff --git a/htdocs/compta/recap-compta.php b/htdocs/compta/recap-compta.php index bc89cf7de7e..0cc7e2008e6 100644 --- a/htdocs/compta/recap-compta.php +++ b/htdocs/compta/recap-compta.php @@ -189,8 +189,8 @@ if ($socid > 0) print ''.price($solde)."\n"; // Author - $userstatic->id=$objp->userid; - $userstatic->login=$objp->login; + $userstatic->id=$objp->userid; + $userstatic->login=$objp->login; print ''; print $userstatic->getLoginUrl(1); print ''; diff --git a/htdocs/compta/ventilation/index.php b/htdocs/compta/ventilation/index.php index d01d1735734..316f5c41e1e 100644 --- a/htdocs/compta/ventilation/index.php +++ b/htdocs/compta/ventilation/index.php @@ -34,7 +34,7 @@ print_fiche_titre("Ventilation Comptable"); //print ''; //print '
'; -print '
'; +print '
'; $sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."facturedet as fd"; $sql.= " , ".MAIN_DB_PREFIX."facture as f"; @@ -62,7 +62,7 @@ print "
\n"; //print ''; -print '
'; +print '
'; print ''; @@ -94,7 +94,7 @@ if ($resql) print "
\n"; //print ''; -print '
'; +print '
'; llxFooter(); diff --git a/htdocs/contrat/index.php b/htdocs/contrat/index.php index 88220fa7e29..bd35af4d55b 100644 --- a/htdocs/contrat/index.php +++ b/htdocs/contrat/index.php @@ -66,9 +66,9 @@ llxHeader(); print_fiche_titre($langs->trans("ContractsArea")); -//print ''; -//print '
'; -print '
'; +//print ''; +//print ''; print ''."\n"; diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 88efcfd76b5..d94fcab199d 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -139,7 +139,7 @@ function analyse_sql_and_script(&$var, $type) // Check consitency of NOREQUIREXXX DEFINES -if ((defined('NOREQUIREDB') || defined('NOREQUIRETRAN')) && ! defined('NOREQUIREMENU')) dol_print_error('','If define NOREQUIREDB or NOREQUIRETRAN are set, you must also set NOREQUIREMENU or not use them'); +if ((defined('NOREQUIREDB') || defined('NOREQUIRETRAN')) && ! defined('NOREQUIREMENU')) dol_print_error('','If define NOREQUIREDB or NOREQUIRETRAN are set, you must also set NOREQUIREMENU or not use them'); // Sanity check on URL if (! empty($_SERVER["PHP_SELF"])) @@ -761,7 +761,7 @@ else $heightforframes=52; // Switch to another entity -// TODO Multicompany Remove this +// TODO Multicompany Remove this if (! empty($conf->multicompany->enabled) && GETPOST('action') == 'switchentity') { if ($mc->switchEntity(GETPOST('entity','int')) > 0) diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index 36f85c9524e..7212ea38f5b 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -76,7 +76,7 @@ if (! empty($dolibarr_main_document_root_alt)) } // Set properties specific to multicompany -// TODO Multicompany Remove this. Useless. Var should be read when required. +// TODO Multicompany Remove this. Useless. Var should be read when required. $conf->multicompany->transverse_mode = empty($multicompany_transverse_mode)?'':$multicompany_transverse_mode; // Force Multi-Company transverse mode $conf->multicompany->force_entity = empty($multicompany_force_entity)?'':(int) $multicompany_force_entity; // Force entity in login page @@ -143,7 +143,7 @@ if (! defined('NOREQUIREDB')) { $conf->entity = DOLENTITY; } - // TODO Multicompany Remove this. + // TODO Multicompany Remove this. else if (! empty($conf->multicompany->force_entity) && is_int($conf->multicompany->force_entity)) // To force entity in login page { $conf->entity = $conf->multicompany->force_entity; diff --git a/htdocs/product/index.php b/htdocs/product/index.php index f0ab56ae6f0..8e3c3e795fd 100644 --- a/htdocs/product/index.php +++ b/htdocs/product/index.php @@ -69,7 +69,7 @@ print_fiche_titre($transAreaType); //print '
'; +print '
'; // Search contract @@ -286,8 +286,8 @@ if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire) } -//print '
'; -print '
'; +//print '
'; +print '
'; // Last modified contracts diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 36eb166f499..0f4264b223f 100755 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -197,25 +197,25 @@ abstract class CommonDocGenerator } - /** - * Define array with couple subtitution key => subtitution value - * - * @param Translate $outputlangs Language object for output - * @return array Array of substitution key->code - */ - function get_substitutionarray_other($outputlangs) - { - global $conf; + /** + * Define array with couple subtitution key => subtitution value + * + * @param Translate $outputlangs Language object for output + * @return array Array of substitution key->code + */ + function get_substitutionarray_other($outputlangs) + { + global $conf; $now=dol_now('gmt'); // gmt - $array_other = array( + $array_other = array( 'current_date'=>dol_print_date($now,'day','tzuser'), 'current_datehour'=>dol_print_date($now,'dayhour','tzuser'), 'current_server_date'=>dol_print_date($now,'day','tzserver'), 'current_server_datehour'=>dol_print_date($now,'dayhour','tzserver'), - ); + ); - return $array_other; + return $array_other; } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index b128455b8ff..4f7ce047d9b 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1556,8 +1556,8 @@ abstract class CommonObject $i++; } - // Add revenue stamp to total - $this->total_ttc += isset($this->revenuestamp)?$this->revenuestamp:0; + // Add revenue stamp to total + $this->total_ttc += isset($this->revenuestamp)?$this->revenuestamp:0; $this->db->free($resql); @@ -2720,12 +2720,12 @@ abstract class CommonObject // Product if ($line->fk_product > 0) { - $product_static = new Product($this->db); - - $product_static->type=$line->fk_product_type; - $product_static->id=$line->fk_product; - $product_static->ref=$line->ref; - $text=$product_static->getNomUrl(1); + $product_static = new Product($this->db); + + $product_static->type=$line->fk_product_type; + $product_static->id=$line->fk_product; + $product_static->ref=$line->ref; + $text=$product_static->getNomUrl(1); // Define output language (TODO Does this works ?) if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 4807ec768fa..7d7713b297c 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -691,19 +691,19 @@ class Form //$minLength = (is_numeric($conf->global->COMPANY_USE_SEARCH_TO_SELECT)?$conf->global->COMPANY_USE_SEARCH_TO_SELECT:2); $out.= ajax_combobox($htmlname, $event, $conf->global->COMPANY_USE_SEARCH_TO_SELECT); /* - if ($selected && empty($selected_input_value)) - { - require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; - $product = new Product($this->db); - $product->fetch($selected); - $selected_input_value=$product->ref; - } + if ($selected && empty($selected_input_value)) + { + require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; + $product = new Product($this->db); + $product->fetch($selected); + $selected_input_value=$product->ref; + } // mode=1 means customers products - $ajaxoptions=array(); - $urloption='htmlname='.$htmlname.'&outjson=1&filter='.urlencode($filter).'&showtype='.$showtype; - $out.=ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/societe/ajax/company.php', $urloption, $conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, $ajaxoptions); + $ajaxoptions=array(); + $urloption='htmlname='.$htmlname.'&outjson=1&filter='.urlencode($filter).'&showtype='.$showtype; + $out.=ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/societe/ajax/company.php', $urloption, $conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, $ajaxoptions); $out.=''; - */ + */ } $out.= ''; - $num = $this->db->num_rows($resql); - $i = 0; - $out.=''."\n"; - if ($num) - { - while ($i < $num) - { - $obj = $this->db->fetch_object($resql); - if (($selected && $selected == $obj->taux) || $num == 1) - { - $out.=''; - $i++; - } - } - $out.=''; - return $out; - } - else - { - dol_print_error($this->db); - return ''; - } + $sql = "SELECT r.taux"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_revenuestamp as r,".MAIN_DB_PREFIX."c_pays as p"; + $sql.= " WHERE r.active = 1 AND r.fk_pays = p.rowid"; + $sql.= " AND p.code = '".$country_code."'"; + + dol_syslog(get_class($this).'::select_revenue_stamp sql='.$sql); + $resql=$this->db->query($sql); + if ($resql) + { + $out.=''; + return $out; + } + else + { + dol_print_error($this->db); + return ''; + } } diff --git a/htdocs/core/getmenu_jmobile.php b/htdocs/core/getmenu_jmobile.php index f7eaada8283..4075bbc77b6 100644 --- a/htdocs/core/getmenu_jmobile.php +++ b/htdocs/core/getmenu_jmobile.php @@ -51,42 +51,42 @@ $left=($langs->trans("DIRECTION")=='rtl'?'right':'left'); */ // URL http://mydolibarr/core/getmenu_jmobime?mainmenu=mainmenu&leftmenu=leftmenu can be used for tests -$arrayofjs=array('/includes/jquery/plugins/mobile/jquery.mobile-latest.min.js'); +$arrayofjs=array('/includes/jquery/plugins/mobile/jquery.mobile-latest.min.js'); $arrayofcss=array('/includes/jquery/plugins/mobile/jquery.mobile-latest.min.css'); top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); print ''."\n"; -if (empty($user->societe_id)) // If internal user or not defined -{ - $conf->standard_menu=(empty($conf->global->MAIN_MENU_STANDARD_FORCED)?(empty($conf->global->MAIN_MENU_STANDARD)?'eldy_menu.php':$conf->global->MAIN_MENU_STANDARD):$conf->global->MAIN_MENU_STANDARD_FORCED); - $conf->smart_menu=(empty($conf->global->MAIN_MENU_SMARTPHONE_FORCED)?(empty($conf->global->MAIN_MENU_SMARTPHONE)?'smartphone_menu.php':$conf->global->MAIN_MENU_SMARTPHONE):$conf->global->MAIN_MENU_SMARTPHONE_FORCED); -} -else // If external user -{ - $conf->standard_menu=(empty($conf->global->MAIN_MENUFRONT_STANDARD_FORCED)?(empty($conf->global->MAIN_MENUFRONT_STANDARD)?'eldy_menu.php':$conf->global->MAIN_MENUFRONT_STANDARD):$conf->global->MAIN_MENUFRONT_STANDARD_FORCED); - $conf->smart_menu=(empty($conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED)?(empty($conf->global->MAIN_MENUFRONT_SMARTPHONE)?'smartphone_menu.php':$conf->global->MAIN_MENUFRONT_SMARTPHONE):$conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED); -} - -// Load the menu manager (only if not already done) -$file_menu=empty($conf->browser->phone)?$conf->standard_menu:$conf->smart_menu; -if (GETPOST('menu')) $file_menu=GETPOST('menu'); // example: menu=eldy_menu.php -if (! class_exists('MenuManager')) -{ - $menufound=0; - $dirmenus=array_merge(array("/core/menus/"),(array) $conf->modules_parts['menus']); - foreach($dirmenus as $dirmenu) - { - $menufound=dol_include_once($dirmenu."standard/".$file_menu); - if ($menufound) break; - } - if (! $menufound) // If failed to include, we try with standard - { - dol_syslog("You define a menu manager '".$file_menu."' that can not be loaded.", LOG_WARNING); - $file_menu='eldy_menu.php'; - include_once DOL_DOCUMENT_ROOT."/core/menus/standard/".$file_menu; - } -} +if (empty($user->societe_id)) // If internal user or not defined +{ + $conf->standard_menu=(empty($conf->global->MAIN_MENU_STANDARD_FORCED)?(empty($conf->global->MAIN_MENU_STANDARD)?'eldy_menu.php':$conf->global->MAIN_MENU_STANDARD):$conf->global->MAIN_MENU_STANDARD_FORCED); + $conf->smart_menu=(empty($conf->global->MAIN_MENU_SMARTPHONE_FORCED)?(empty($conf->global->MAIN_MENU_SMARTPHONE)?'smartphone_menu.php':$conf->global->MAIN_MENU_SMARTPHONE):$conf->global->MAIN_MENU_SMARTPHONE_FORCED); +} +else // If external user +{ + $conf->standard_menu=(empty($conf->global->MAIN_MENUFRONT_STANDARD_FORCED)?(empty($conf->global->MAIN_MENUFRONT_STANDARD)?'eldy_menu.php':$conf->global->MAIN_MENUFRONT_STANDARD):$conf->global->MAIN_MENUFRONT_STANDARD_FORCED); + $conf->smart_menu=(empty($conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED)?(empty($conf->global->MAIN_MENUFRONT_SMARTPHONE)?'smartphone_menu.php':$conf->global->MAIN_MENUFRONT_SMARTPHONE):$conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED); +} + +// Load the menu manager (only if not already done) +$file_menu=empty($conf->browser->phone)?$conf->standard_menu:$conf->smart_menu; +if (GETPOST('menu')) $file_menu=GETPOST('menu'); // example: menu=eldy_menu.php +if (! class_exists('MenuManager')) +{ + $menufound=0; + $dirmenus=array_merge(array("/core/menus/"),(array) $conf->modules_parts['menus']); + foreach($dirmenus as $dirmenu) + { + $menufound=dol_include_once($dirmenu."standard/".$file_menu); + if ($menufound) break; + } + if (! $menufound) // If failed to include, we try with standard + { + dol_syslog("You define a menu manager '".$file_menu."' that can not be loaded.", LOG_WARNING); + $file_menu='eldy_menu.php'; + include_once DOL_DOCUMENT_ROOT."/core/menus/standard/".$file_menu; + } +} $menumanager = new MenuManager($db, empty($user->societe_id)?0:1); $menumanager->loadMenu(); diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index b7d012cc51a..9b74e999fbe 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -90,11 +90,11 @@ function societe_prepare_head($object) $head[$h][2] = 'note'; $h++; - $head[$h][0] = DOL_URL_ROOT.'/societe/consumption.php?socid='.$object->id; - $head[$h][1] = $langs->trans("Referers"); - $head[$h][2] = 'consumption'; - $h++; - + $head[$h][0] = DOL_URL_ROOT.'/societe/consumption.php?socid='.$object->id; + $head[$h][1] = $langs->trans("Referers"); + $head[$h][2] = 'consumption'; + $h++; + // Attached files $head[$h][0] = DOL_URL_ROOT.'/societe/document.php?socid='.$object->id; $head[$h][1] = $langs->trans("Documents"); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index edc39c6d164..d0ad263d71a 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2630,9 +2630,9 @@ function price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerou { $listofcurrenciesbefore=array('USD'); if (in_array($currency_code,$listofcurrenciesbefore)) $cursymbolbefore.=$outlangs->getCurrencySymbol($currency_code); - else $cursymbolafter.=$outlangs->getCurrencySymbol($currency_code); + else $cursymbolafter.=$outlangs->getCurrencySymbol($currency_code); } - $output.=$cursymbolbefore.$end.$cursymbolafter; + $output.=$cursymbolbefore.$end.$cursymbolafter; return $output; } @@ -3660,21 +3660,21 @@ function dolGetFirstLastname($firstname,$lastname,$nameorder=-1) { global $conf; - $ret=''; - // If order not defined, we use the setup - if ($nameorder < 0) $nameorder=(empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)); - if ($nameorder) - { - $ret.=$firstname; - if ($firstname && $lastname) $ret.=' '; - $ret.=$lastname; - } - else - { - $ret.=$lastname; - if ($firstname && $lastname) $ret.=' '; - $ret.=$firstname; - } + $ret=''; + // If order not defined, we use the setup + if ($nameorder < 0) $nameorder=(empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)); + if ($nameorder) + { + $ret.=$firstname; + if ($firstname && $lastname) $ret.=' '; + $ret.=$lastname; + } + else + { + $ret.=$lastname; + if ($firstname && $lastname) $ret.=' '; + $ret.=$firstname; + } return $ret; } @@ -4293,18 +4293,18 @@ function colorArrayToHex($arraycolor,$colorifnotfound='888888') return dechex($arraycolor[0]).dechex($arraycolor[1]).dechex($arraycolor[2]); } -/** - * Set focus onto field with selector - * - * @param string $selector Selector ('#id') - * @return string HTML code to set focus - */ -function dol_set_focus($selector) -{ - print ''."\n"; - print ''."\n"; -} - +/** + * Set focus onto field with selector + * + * @param string $selector Selector ('#id') + * @return string HTML code to set focus + */ +function dol_set_focus($selector) +{ + print ''."\n"; + print ''."\n"; +} + if (! function_exists('getmypid')) { diff --git a/htdocs/core/lib/treeview.lib.php b/htdocs/core/lib/treeview.lib.php index f565467575e..2e87dfceea8 100644 --- a/htdocs/core/lib/treeview.lib.php +++ b/htdocs/core/lib/treeview.lib.php @@ -23,7 +23,7 @@ */ -// ------------------------------- Used by ajax tree view ----------------- +// ------------------------------- Used by ajax tree view ----------------- /** * Show indent and picto of a tree line. Return array with information of line. @@ -159,7 +159,7 @@ function tree_recur($tab, $pere, $rang, $iddivjstree='iddivjstree') print ''; } } - if (! empty($ulprinted) && ! empty($pere['rowid'])) { print ''."\n"; } + if (! empty($ulprinted) && ! empty($pere['rowid'])) { print ''."\n"; } if (empty($pere['rowid'])) print ''; } diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php index 6faf6e90a50..ebf70b6d9c9 100644 --- a/htdocs/core/menus/standard/auguria.lib.php +++ b/htdocs/core/menus/standard/auguria.lib.php @@ -21,7 +21,7 @@ * \file htdocs/core/menus/standard/auguria.lib.php * \brief Library for file auguria menus */ -require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php'; @@ -40,8 +40,8 @@ function print_auguria_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0) { global $user,$conf,$langs,$dolibarr_main_db_name; - $mainmenu=$_SESSION["mainmenu"]; - $leftmenu=$_SESSION["leftmenu"]; + $mainmenu=$_SESSION["mainmenu"]; + $leftmenu=$_SESSION["leftmenu"]; $id='mainmenu'; $listofmodulesforexternal=explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL); @@ -75,7 +75,7 @@ function print_auguria_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0) $shorturl = $newTabMenu[$i]['url'].$param; } $url=preg_replace('/__LOGIN__/',$user->login,$url); - $shorturl=preg_replace('/__LOGIN__/',$user->login,$shorturl); + $shorturl=preg_replace('/__LOGIN__/',$user->login,$shorturl); // Define the class (top menu selected or not) if (! empty($_SESSION['idmenu']) && $newTabMenu[$i]['rowid'] == $_SESSION['idmenu']) $classname='class="tmenusel"'; @@ -84,9 +84,9 @@ function print_auguria_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0) } else if ($showmode == 2) $classname='class="tmenu"'; - if (empty($noout)) print_start_menu_entry_auguria($idsel,$classname,$showmode); - if (empty($noout)) print_text_menu_entry_auguria($newTabMenu[$i]['titre'], $showmode, $url, $id, $idsel, $classname, ($newTabMenu[$i]['target']?$newTabMenu[$i]['target']:$atarget)); - if (empty($noout)) print_end_menu_entry_auguria($showmode); + if (empty($noout)) print_start_menu_entry_auguria($idsel,$classname,$showmode); + if (empty($noout)) print_text_menu_entry_auguria($newTabMenu[$i]['titre'], $showmode, $url, $id, $idsel, $classname, ($newTabMenu[$i]['target']?$newTabMenu[$i]['target']:$atarget)); + if (empty($noout)) print_end_menu_entry_auguria($showmode); $menu->add($shorturl, $newTabMenu[$i]['titre'], 0, $showmode, ($newTabMenu[$i]['target']?$newTabMenu[$i]['target']:$atarget), ($newTabMenu[$i]['mainmenu']?$newTabMenu[$i]['mainmenu']:$newTabMenu[$i]['rowid']), ''); } @@ -138,23 +138,23 @@ function print_start_menu_entry_auguria($idsel,$classname,$showmode) */ function print_text_menu_entry_auguria($text, $showmode, $url, $id, $idsel, $classname, $atarget) { - global $langs; + global $langs; - if ($showmode == 1) - { - print ''; - print '
'; - print '
'; - print ''; - print ''; - print $text; - print ''; - print ''; - } - if ($showmode == 2) - { - print '
'; - print ''; + if ($showmode == 1) + { + print ''; + print '
'; + print '
'; + print ''; + print ''; + print $text; + print ''; + print ''; + } + if ($showmode == 2) + { + print '
'; + print ''; print ''; print $text; print ''; @@ -245,7 +245,7 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM if (is_array($menu_array_before)) $menu_array=array_merge($menu_array_before, $menu_array); if (is_array($menu_array_after)) $menu_array=array_merge($menu_array, $menu_array_after); //var_dump($menu_array);exit; - if (! is_array($menu_array)) return 0; + if (! is_array($menu_array)) return 0; // Show menu if (empty($noout)) diff --git a/htdocs/core/menus/standard/auguria_menu.php b/htdocs/core/menus/standard/auguria_menu.php index 19b4b15764f..e33d08403ac 100644 --- a/htdocs/core/menus/standard/auguria_menu.php +++ b/htdocs/core/menus/standard/auguria_menu.php @@ -36,7 +36,7 @@ class MenuManager var $menu_array; var $menu_array_after; - var $tabMenu; + var $tabMenu; /** @@ -52,59 +52,59 @@ class MenuManager } - /** - * Load this->tabMenu - * - * @return void - */ - function loadMenu() - { + /** + * Load this->tabMenu + * + * @return void + */ + function loadMenu() + { global $conf, $user, $langs; - // On sauve en session le menu principal choisi - if (isset($_GET["mainmenu"])) $_SESSION["mainmenu"]=$_GET["mainmenu"]; - if (isset($_GET["idmenu"])) $_SESSION["idmenu"]=$_GET["idmenu"]; - - // Read mainmenu and leftmenu that define which menu to show - if (isset($_GET["mainmenu"])) - { - // On sauve en session le menu principal choisi - $mainmenu=$_GET["mainmenu"]; - $_SESSION["mainmenu"]=$mainmenu; - $_SESSION["leftmenuopened"]=""; - } - else - { - // On va le chercher en session si non defini par le lien - $mainmenu=isset($_SESSION["mainmenu"])?$_SESSION["mainmenu"]:''; - } - - if (isset($_GET["leftmenu"])) - { - // On sauve en session le menu principal choisi - $leftmenu=$_GET["leftmenu"]; - $_SESSION["leftmenu"]=$leftmenu; - - if ($_SESSION["leftmenuopened"]==$leftmenu) // To collapse - { - //$leftmenu=""; - $_SESSION["leftmenuopened"]=""; - } - else - { - $_SESSION["leftmenuopened"]=$leftmenu; - } - } else { - // On va le chercher en session si non defini par le lien - $leftmenu=isset($_SESSION["leftmenu"])?$_SESSION["leftmenu"]:''; - } - - require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php'; - $tabMenu=array(); - $menuArbo = new Menubase($this->db,'auguria'); + // On sauve en session le menu principal choisi + if (isset($_GET["mainmenu"])) $_SESSION["mainmenu"]=$_GET["mainmenu"]; + if (isset($_GET["idmenu"])) $_SESSION["idmenu"]=$_GET["idmenu"]; + + // Read mainmenu and leftmenu that define which menu to show + if (isset($_GET["mainmenu"])) + { + // On sauve en session le menu principal choisi + $mainmenu=$_GET["mainmenu"]; + $_SESSION["mainmenu"]=$mainmenu; + $_SESSION["leftmenuopened"]=""; + } + else + { + // On va le chercher en session si non defini par le lien + $mainmenu=isset($_SESSION["mainmenu"])?$_SESSION["mainmenu"]:''; + } + + if (isset($_GET["leftmenu"])) + { + // On sauve en session le menu principal choisi + $leftmenu=$_GET["leftmenu"]; + $_SESSION["leftmenu"]=$leftmenu; + + if ($_SESSION["leftmenuopened"]==$leftmenu) // To collapse + { + //$leftmenu=""; + $_SESSION["leftmenuopened"]=""; + } + else + { + $_SESSION["leftmenuopened"]=$leftmenu; + } + } else { + // On va le chercher en session si non defini par le lien + $leftmenu=isset($_SESSION["leftmenu"])?$_SESSION["leftmenu"]:''; + } + + require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php'; + $tabMenu=array(); + $menuArbo = new Menubase($this->db,'auguria'); $menuArbo->menuLoad($mainmenu, $leftmenu, $this->type_user, 'auguria', $tabMenu); - // Modules system tools + // Modules system tools // TODO Find a way to add parent menu only if child menu exists. For the moment, no other method than hard coded methods. if (! empty($conf->product->enabled) || ! empty($conf->service->enabled) || ! empty($conf->global->MAIN_MENU_ENABLE_MODULETOOLS)) { @@ -141,8 +141,8 @@ class MenuManager 'type'=>'left', 'position'=>20 )); - } - } + } + } $this->tabMenu=$tabMenu; } @@ -169,58 +169,58 @@ class MenuManager $res='ErrorBadParameterForMode'; require_once DOL_DOCUMENT_ROOT.'/core/class/menu.class.php'; - $this->menu=new Menu(); + $this->menu=new Menu(); if ($mode == 'top') $res=print_auguria_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu); if ($mode == 'left') $res=print_left_auguria_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$this->menu); - if ($mode == 'jmobile') - { - $res=print_auguria_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,1); - - foreach($this->menu->liste as $key => $val) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu' - { - print '
    '; - print '
  • '; - if ($val['enabled'] == 1) - { - $relurl=dol_buildpath($val['url'],1); - - print ''.$val['titre'].''."\n"; - // Search submenu fot this entry - $tmpmainmenu=$val['mainmenu']; - $tmpleftmenu='all'; - $submenu=new Menu(); - $res=print_left_auguria_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$submenu,1,$tmpmainmenu,$tmpleftmenu); - $nexturl=dol_buildpath($submenu->liste[0]['url'],1); - $canonrelurl=preg_replace('/\?.*$/','',$relurl); - $canonnexturl=preg_replace('/\?.*$/','',$nexturl); - //var_dump($canonrelurl); - //var_dump($canonnexturl); - print '
      '; - if ($canonrelurl != $canonnexturl && $val['mainmenu'] != 'home') - { - // We add sub entry - print '
    • '.$langs->trans("MainArea").'-'.$val['titre'].'
    • '."\n"; - } - foreach($submenu->liste as $key2 => $val2) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu' - { - $relurl2=dol_buildpath($val2['url'],1); - //var_dump($val2); - print ''.$val2['titre'].''."\n"; - } - //var_dump($submenu); - print '
    '; - } - if ($val['enabled'] == 2) - { - print ''.$val['titre'].''; - } - print '
  • '; - print '
'."\n"; - } + if ($mode == 'jmobile') + { + $res=print_auguria_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,1); + + foreach($this->menu->liste as $key => $val) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu' + { + print '
    '; + print '
  • '; + if ($val['enabled'] == 1) + { + $relurl=dol_buildpath($val['url'],1); + + print ''.$val['titre'].''."\n"; + // Search submenu fot this entry + $tmpmainmenu=$val['mainmenu']; + $tmpleftmenu='all'; + $submenu=new Menu(); + $res=print_left_auguria_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$submenu,1,$tmpmainmenu,$tmpleftmenu); + $nexturl=dol_buildpath($submenu->liste[0]['url'],1); + $canonrelurl=preg_replace('/\?.*$/','',$relurl); + $canonnexturl=preg_replace('/\?.*$/','',$nexturl); + //var_dump($canonrelurl); + //var_dump($canonnexturl); + print '
      '; + if ($canonrelurl != $canonnexturl && $val['mainmenu'] != 'home') + { + // We add sub entry + print '
    • '.$langs->trans("MainArea").'-'.$val['titre'].'
    • '."\n"; + } + foreach($submenu->liste as $key2 => $val2) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu' + { + $relurl2=dol_buildpath($val2['url'],1); + //var_dump($val2); + print ''.$val2['titre'].''."\n"; + } + //var_dump($submenu); + print '
    '; + } + if ($val['enabled'] == 2) + { + print ''.$val['titre'].''; + } + print '
  • '; + print '
'."\n"; + } } - unset($this->menu); + unset($this->menu); return $res; } diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 23970e6897c..42ab594b387 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -22,7 +22,7 @@ * \file htdocs/core/menus/standard/eldy.lib.php * \brief Library for file eldy menus */ -require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php'; /** @@ -58,7 +58,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0) if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode); if (empty($noout)) print_text_menu_entry($langs->trans("Home"), 1, DOL_URL_ROOT.'/index.php?mainmenu=home&leftmenu=', $id, $idsel, $classname, $atarget); if (empty($noout)) print_end_menu_entry($showmode); - $menu->add('/index.php?mainmenu=home&leftmenu=', $langs->trans("Home"), 0, $showmode, $atarget, "home", ''); + $menu->add('/index.php?mainmenu=home&leftmenu=', $langs->trans("Home"), 0, $showmode, $atarget, "home", ''); // Third parties $tmpentry=array('enabled'=>(! empty($conf->societe->enabled) || ! empty($conf->fournisseur->enabled)), 'perms'=>(! empty($user->rights->societe->lire) || ! empty($user->rights->fournisseur->lire)), 'module'=>'societe|fournisseur'); @@ -187,9 +187,9 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0) else $classname = 'class="tmenu"'; $idsel='project'; - if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode); - if (empty($noout)) print_text_menu_entry($langs->trans("Projects"), $showmode, DOL_URL_ROOT.'/projet/index.php?mainmenu=project&leftmenu=', $id, $idsel, $classname, $atarget); - if (empty($noout)) print_end_menu_entry($showmode); + if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode); + if (empty($noout)) print_text_menu_entry($langs->trans("Projects"), $showmode, DOL_URL_ROOT.'/projet/index.php?mainmenu=project&leftmenu=', $id, $idsel, $classname, $atarget); + if (empty($noout)) print_end_menu_entry($showmode); $menu->add('/projet/index.php?mainmenu=project&leftmenu=', $langs->trans("Projects"), 0, $showmode, $atarget, "project", ''); } @@ -279,7 +279,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0) $shorturl = $newTabMenu[$i]['url'].$param; } $url=preg_replace('/__LOGIN__/',$user->login,$url); - $shorturl=preg_replace('/__LOGIN__/',$user->login,$shorturl); + $shorturl=preg_replace('/__LOGIN__/',$user->login,$shorturl); // Define the class (top menu selected or not) if (! empty($_SESSION['idmenu']) && $newTabMenu[$i]['rowid'] == $_SESSION['idmenu']) $classname='class="tmenusel"'; @@ -344,10 +344,10 @@ function print_text_menu_entry($text, $showmode, $url, $id, $idsel, $classname, if ($showmode == 1) { - print ''; - print '
'; - print '
'; - print ''; + print ''; + print '
'; + print '
'; + print ''; print ''; print $text; print ''; @@ -355,8 +355,8 @@ function print_text_menu_entry($text, $showmode, $url, $id, $idsel, $classname, } if ($showmode == 2) { - print '
'; - print '
'; + print '
'; + print '
'; print ''; print $text; print ''; @@ -1168,7 +1168,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if (is_array($menu_array_before)) $menu_array=array_merge($menu_array_before, $menu_array); if (is_array($menu_array_after)) $menu_array=array_merge($menu_array, $menu_array_after); //var_dump($menu_array);exit; - if (! is_array($menu_array)) return 0; + if (! is_array($menu_array)) return 0; // Show menu if (empty($noout)) diff --git a/htdocs/core/menus/standard/eldy_menu.php b/htdocs/core/menus/standard/eldy_menu.php index fdf3a93e2fb..8b381ed7038 100644 --- a/htdocs/core/menus/standard/eldy_menu.php +++ b/htdocs/core/menus/standard/eldy_menu.php @@ -76,29 +76,29 @@ class MenuManager $mainmenu=isset($_SESSION["mainmenu"])?$_SESSION["mainmenu"]:''; } - if (isset($_GET["leftmenu"])) - { - // On sauve en session le menu principal choisi - $leftmenu=$_GET["leftmenu"]; - $_SESSION["leftmenu"]=$leftmenu; + if (isset($_GET["leftmenu"])) + { + // On sauve en session le menu principal choisi + $leftmenu=$_GET["leftmenu"]; + $_SESSION["leftmenu"]=$leftmenu; - if ($_SESSION["leftmenuopened"]==$leftmenu) // To collapse - { - //$leftmenu=""; - $_SESSION["leftmenuopened"]=""; - } - else - { - $_SESSION["leftmenuopened"]=$leftmenu; - } - } else { - // On va le chercher en session si non defini par le lien - $leftmenu=isset($_SESSION["leftmenu"])?$_SESSION["leftmenu"]:''; - } + if ($_SESSION["leftmenuopened"]==$leftmenu) // To collapse + { + //$leftmenu=""; + $_SESSION["leftmenuopened"]=""; + } + else + { + $_SESSION["leftmenuopened"]=$leftmenu; + } + } else { + // On va le chercher en session si non defini par le lien + $leftmenu=isset($_SESSION["leftmenu"])?$_SESSION["leftmenu"]:''; + } - require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php'; + require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php'; $tabMenu=array(); - $menuArbo = new Menubase($this->db,'eldy'); + $menuArbo = new Menubase($this->db,'eldy'); $menuArbo->menuLoad($mainmenu, $leftmenu, $this->type_user, 'eldy', $tabMenu); $this->tabMenu=$tabMenu; } @@ -126,7 +126,7 @@ class MenuManager require_once DOL_DOCUMENT_ROOT.'/core/class/menu.class.php'; $this->menu=new Menu(); - + if ($mode == 'top') $res=print_eldy_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu); if ($mode == 'left') $res=print_left_eldy_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$this->menu); if ($mode == 'jmobile') @@ -156,7 +156,7 @@ class MenuManager if ($canonrelurl != $canonnexturl && $val['mainmenu'] != 'home') { // We add sub entry - print '
  • '.$langs->trans("MainArea").'-'.$val['titre'].'
  • '."\n"; + print '
  • '.$langs->trans("MainArea").'-'.$val['titre'].'
  • '."\n"; } foreach($submenu->liste as $key2 => $val2) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu' { @@ -165,7 +165,7 @@ class MenuManager print ''.$val2['titre'].''."\n"; } //var_dump($submenu); - print ''; + print ''; } if ($val['enabled'] == 2) { diff --git a/htdocs/core/menus/standard/empty.php b/htdocs/core/menus/standard/empty.php index 2e401e3cf10..14093ce5995 100644 --- a/htdocs/core/menus/standard/empty.php +++ b/htdocs/core/menus/standard/empty.php @@ -46,12 +46,12 @@ class MenuManager } - /** - * Load this->tabMenu - * - * @return void - */ - function loadMenu() + /** + * Load this->tabMenu + * + * @return void + */ + function loadMenu() { } @@ -70,7 +70,7 @@ class MenuManager $id='mainmenu'; require_once DOL_DOCUMENT_ROOT.'/core/class/menu.class.php'; - $this->menu=new Menu(); + $this->menu=new Menu(); if ($mode == 'top') { @@ -183,7 +183,7 @@ class MenuManager */ function print_start_menu_array_empty() { - print '
    '; + print '
    '; print '
    '; +print '
    '; llxFooter(); diff --git a/htdocs/exports/class/export.class.php b/htdocs/exports/class/export.class.php index 9def962c8ec..2311c6fe66e 100644 --- a/htdocs/exports/class/export.class.php +++ b/htdocs/exports/class/export.class.php @@ -237,7 +237,7 @@ class Export } $sql.=$sqlWhere; } - $sql.=$this->array_export_sql_order[$indice]; + $sql.=$this->array_export_sql_order[$indice]; return $sql; } diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php index fcd968eeeb0..b40988ca571 100644 --- a/htdocs/exports/export.php +++ b/htdocs/exports/export.php @@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/export/modules_export.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $langs->load("exports"); -$langs->load("users"); +$langs->load("users"); // Everybody should be able to go on this page //if (! $user->admin) diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index b3ae77d7ac3..4e93a5710b1 100755 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -234,7 +234,7 @@ if (! file_exists(DOL_DOCUMENT_ROOT ."/core/lib/functions.lib.php")) print "Please run dolibarr setup by calling page /install.
    \n"; exit; } - + // Included by default include_once DOL_DOCUMENT_ROOT .'/core/lib/functions.lib.php'; diff --git a/htdocs/fourn/index.php b/htdocs/fourn/index.php index ec832a670d2..a4a9e06ccef 100644 --- a/htdocs/fourn/index.php +++ b/htdocs/fourn/index.php @@ -53,7 +53,7 @@ print_fiche_titre($langs->trans("SuppliersArea")); //print ''; //print '
    '; -print '
    '; +print '
    '; // Orders @@ -226,7 +226,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture- //print '
    '; -print '
    '; +print '
    '; /* @@ -321,7 +321,7 @@ if (count($companystatic->SupplierCategories)) //print "
    \n"; -print '
    '; +print '
    '; llxFooter(); diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 27e45118fa8..8dfaf85ac71 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -82,12 +82,12 @@ class Holiday extends CommonObject */ function updateSold() { - // Mets à jour les congés payés en début de mois - $this->updateSoldeCP(); - - // Vérifie le nombre d'utilisateur et mets à jour si besoin - $this->verifNbUsers($this->countActiveUsers(),$this->getConfCP('nbUser')); - return 1; + // Mets à jour les congés payés en début de mois + $this->updateSoldeCP(); + + // Vérifie le nombre d'utilisateur et mets à jour si besoin + $this->verifNbUsers($this->countActiveUsers(),$this->getConfCP('nbUser')); + return 1; } /** diff --git a/htdocs/holiday/define_holiday.php b/htdocs/holiday/define_holiday.php index e5b609e36d1..e654dfe0117 100644 --- a/htdocs/holiday/define_holiday.php +++ b/htdocs/holiday/define_holiday.php @@ -74,10 +74,10 @@ if ($action == 'update' && isset($_POST['update_cp'])) // If it first update of sold, we set date to havoid to have sold incremented by new month $now=dol_now(); - $sql = "UPDATE ".MAIN_DB_PREFIX."holiday_config SET"; - $sql.= " value = '".dol_print_date($now,'%Y%m%d%H%M%S')."'"; - $sql.= " WHERE name = 'lastUpdate' and value IS NULL"; // Add value IS NULL to be sure to update only at init. - dol_syslog('define_holiday update lastUpdate entry sql='.$sql); + $sql = "UPDATE ".MAIN_DB_PREFIX."holiday_config SET"; + $sql.= " value = '".dol_print_date($now,'%Y%m%d%H%M%S')."'"; + $sql.= " WHERE name = 'lastUpdate' and value IS NULL"; // Add value IS NULL to be sure to update only at init. + dol_syslog('define_holiday update lastUpdate entry sql='.$sql); $result = $db->query($sql); $mesg='
    '.$langs->trans('UpdateConfCPOK').'
    '; diff --git a/htdocs/holiday/index.php b/htdocs/holiday/index.php index eb6d5dd5d7c..36f7afd87b1 100644 --- a/htdocs/holiday/index.php +++ b/htdocs/holiday/index.php @@ -30,11 +30,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php'; require_once DOL_DOCUMENT_ROOT.'/holiday/common.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; -$langs->load('users'); -$langs->load('holidays'); +$langs->load('users'); +$langs->load('holidays'); // Protection if external user if ($user->societe_id > 0) accessforbidden(); @@ -79,7 +79,7 @@ $search_statut = GETPOST('select_statut'); $holiday = new Holiday($db); $holidaystatic=new Holiday($db); -$fuser = new User($db); +$fuser = new User($db); // Update sold $holiday->updateSold(); @@ -165,12 +165,12 @@ if(!empty($search_statut) && $search_statut != -1) { // Récupération de l'ID de l'utilisateur $user_id = $user->id; -if ($id > 0) -{ - // Charge utilisateur edite - $fuser->fetch($id); +if ($id > 0) +{ + // Charge utilisateur edite + $fuser->fetch($id); $fuser->getrights(); - $user_id = $fuser->id; + $user_id = $fuser->id; } // Récupération des congés payés de l'utilisateur ou de tous les users if (!$user->rights->holiday->lire_tous || $id > 0) @@ -197,38 +197,38 @@ if ($holiday_payes == '-1') * Affichage du tableau des congés payés *************************************/ -$var=true; $num = count($holiday->holiday); -$form = new Form($db); -$formother = new FormOther($db); +$var=true; $num = count($holiday->holiday); +$form = new Form($db); +$formother = new FormOther($db); if ($id > 0) { - $head = user_prepare_head($fuser); - - $title = $langs->trans("User"); + $head = user_prepare_head($fuser); + + $title = $langs->trans("User"); dol_fiche_head($head, 'paidholidays', $title, 0, 'user'); - print ''; - - // Ref - print ''; - print ''; - print ''; - - // LastName - print ''; - print ''; - print "\n"; - - // FirstName - print ''; - print ''; - print "\n"; - - print '
    '.$langs->trans("Ref").''; - print $form->showrefnav($fuser,'id','',$user->rights->user->user->lire || $user->admin); - print '
    '.$langs->trans("LastName").''.$fuser->lastname.'
    '.$langs->trans("FirstName").''.$fuser->firstname.'

    '; - + print ''; + + // Ref + print ''; + print ''; + print ''; + + // LastName + print ''; + print ''; + print "\n"; + + // FirstName + print ''; + print ''; + print "\n"; + + print '
    '.$langs->trans("Ref").''; + print $form->showrefnav($fuser,'id','',$user->rights->user->user->lire || $user->admin); + print '
    '.$langs->trans("LastName").''.$fuser->lastname.'
    '.$langs->trans("FirstName").''.$fuser->firstname.'

    '; + } else { diff --git a/htdocs/install/etape5.php b/htdocs/install/etape5.php index 0ae7303bf38..08651603e61 100644 --- a/htdocs/install/etape5.php +++ b/htdocs/install/etape5.php @@ -142,8 +142,8 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i',$action)) $db=getDoliDBInstance($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name,$conf->db->port); - // Create the global $hookmanager object - include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; + // Create the global $hookmanager object + include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; $hookmanager=new HookManager($db); $ok = 0; diff --git a/htdocs/install/inc.php b/htdocs/install/inc.php index ad9af68a6b9..7d4a22fffa2 100644 --- a/htdocs/install/inc.php +++ b/htdocs/install/inc.php @@ -314,25 +314,25 @@ function conf($dolibarr_main_document_root) //print 'SYSLOG_FILE='.SYSLOG_FILE;exit; } if (! defined('SYSLOG_FILE_NO_ERROR')) define('SYSLOG_FILE_NO_ERROR',1); - // We init log handler for install - $handlers = array('mod_syslog_file'); - foreach ($handlers as $handler) - { - $file = DOL_DOCUMENT_ROOT.'/core/modules/syslog/'.$handler.'.php'; - if (!file_exists($file)) - { - throw new Exception('Missing log handler file '.$handler.'.php'); - } - - require_once $file; - $loghandlerinstance = new $handler(); - if (!$loghandlerinstance instanceof LogHandlerInterface) - { - throw new Exception('Log handler does not extend LogHandlerInterface'); - } - + // We init log handler for install + $handlers = array('mod_syslog_file'); + foreach ($handlers as $handler) + { + $file = DOL_DOCUMENT_ROOT.'/core/modules/syslog/'.$handler.'.php'; + if (!file_exists($file)) + { + throw new Exception('Missing log handler file '.$handler.'.php'); + } + + require_once $file; + $loghandlerinstance = new $handler(); + if (!$loghandlerinstance instanceof LogHandlerInterface) + { + throw new Exception('Log handler does not extend LogHandlerInterface'); + } + if (empty($conf->loghandlers[$handler])) $conf->loghandlers[$handler]=$loghandlerinstance; - } + } return 1; } diff --git a/htdocs/install/upgrade.php b/htdocs/install/upgrade.php index e04a3a94261..811f41f64e8 100644 --- a/htdocs/install/upgrade.php +++ b/htdocs/install/upgrade.php @@ -374,30 +374,30 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action'))) // Run sql script $ok=run_sql($dir.$file, 0, '', 1); - // Scan if there is migration scripts for modules htdocs/module/sql or htdocs/custom/module/sql - $modulesfile = array(); - foreach ($conf->file->dol_document_root as $type => $dirroot) - { - $handlemodule=@opendir($dirroot); - if (is_resource($handlemodule)) + // Scan if there is migration scripts for modules htdocs/module/sql or htdocs/custom/module/sql + $modulesfile = array(); + foreach ($conf->file->dol_document_root as $type => $dirroot) + { + $handlemodule=@opendir($dirroot); + if (is_resource($handlemodule)) { - while (($filemodule = readdir($handlemodule))!==false) - { - if (is_dir($dirroot.'/'.$filemodule.'/sql')) + while (($filemodule = readdir($handlemodule))!==false) + { + if (is_dir($dirroot.'/'.$filemodule.'/sql')) { - //print "Scan for ".$dirroot . '/' . $filemodule . '/sql/'.$file; - if (is_file($dirroot . '/' . $filemodule . '/sql/'.$file)) - { - $modulesfile[$dirroot . '/' . $filemodule . '/sql/'.$file] = '/' . $filemodule . '/sql/'.$file; - } - } - } - closedir($handlemodule); - } - } + //print "Scan for ".$dirroot . '/' . $filemodule . '/sql/'.$file; + if (is_file($dirroot . '/' . $filemodule . '/sql/'.$file)) + { + $modulesfile[$dirroot . '/' . $filemodule . '/sql/'.$file] = '/' . $filemodule . '/sql/'.$file; + } + } + } + closedir($handlemodule); + } + } foreach ($modulesfile as $modulefilelong => $modulefileshort) - { + { print '

    '.$langs->trans("ChoosedMigrateScript").' (external modules)'.$modulefileshort.'
    '; //print '
    '; -print '
    '; +print '
    '; /* @@ -160,7 +160,7 @@ print '
    '; //print '
    '; -print '
    '; +print '
    '; /* @@ -259,7 +259,7 @@ else } //print '
    '; -print '
    '; +print '
    '; llxFooter(); diff --git a/htdocs/product/stock/index.php b/htdocs/product/stock/index.php index d544175b2fd..beb4c7829ba 100644 --- a/htdocs/product/stock/index.php +++ b/htdocs/product/stock/index.php @@ -45,7 +45,7 @@ print_fiche_titre($langs->trans("StocksArea")); //print ''; //print '
    '; -print '
    '; +print '
    '; /* @@ -106,7 +106,7 @@ else //print '
    '; -print '
    '; +print '
    '; // Last movements @@ -164,7 +164,7 @@ if ($resql) } //print '
    '; -print '
    '; +print '
    '; llxFooter(); diff --git a/htdocs/public/paybox/paymentko.php b/htdocs/public/paybox/paymentko.php index 0b6635fa390..5afeab8d639 100644 --- a/htdocs/public/paybox/paymentko.php +++ b/htdocs/public/paybox/paymentko.php @@ -58,9 +58,9 @@ $langs->load("paypal"); dol_syslog("Callback url when a PayBox payment was canceled. query_string=".(empty($_SERVER["QUERY_STRING"])?'':$_SERVER["QUERY_STRING"])." script_uri=".(empty($_SERVER["SCRIPT_URI"])?'':$_SERVER["SCRIPT_URI"]), LOG_DEBUG, 0, '_paybox'); -$tracepost = ""; -foreach($_POST as $k => $v) $tracepost .= "{$k} - {$v}\n"; -dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_paybox'); +$tracepost = ""; +foreach($_POST as $k => $v) $tracepost .= "{$k} - {$v}\n"; +dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_paybox'); llxHeaderPayBox($langs->trans("PaymentForm")); diff --git a/htdocs/public/paybox/paymentok.php b/htdocs/public/paybox/paymentok.php index d46ae4f33a7..5553956ce82 100644 --- a/htdocs/public/paybox/paymentok.php +++ b/htdocs/public/paybox/paymentok.php @@ -57,9 +57,9 @@ $langs->load("paypal"); dol_syslog("Callback url when a PayBox payment was done. query_string=".(empty($_SERVER["QUERY_STRING"])?'':$_SERVER["QUERY_STRING"])." script_uri=".(empty($_SERVER["SCRIPT_URI"])?'':$_SERVER["SCRIPT_URI"]), LOG_DEBUG, 0, '_paybox'); -$tracepost = ""; -foreach($_POST as $k => $v) $tracepost .= "{$k} - {$v}\n"; -dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_paybox'); +$tracepost = ""; +foreach($_POST as $k => $v) $tracepost .= "{$k} - {$v}\n"; +dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_paybox'); llxHeaderPayBox($langs->trans("PaymentForm")); diff --git a/htdocs/public/paypal/paymentko.php b/htdocs/public/paypal/paymentko.php index 610e68c93e3..13c4718c361 100755 --- a/htdocs/public/paypal/paymentko.php +++ b/htdocs/public/paypal/paymentko.php @@ -66,9 +66,9 @@ $langs->load("paypal"); dol_syslog("Callback url when a PayPal payment was canceled. query_string=".(empty($_SERVER["QUERY_STRING"])?'':$_SERVER["QUERY_STRING"])." script_uri=".(empty($_SERVER["SCRIPT_URI"])?'':$_SERVER["SCRIPT_URI"]), LOG_DEBUG, 0, '_paypal'); -$tracepost = ""; -foreach($_POST as $k => $v) $tracepost .= "{$k} - {$v}\n"; -dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_paypal'); +$tracepost = ""; +foreach($_POST as $k => $v) $tracepost .= "{$k} - {$v}\n"; +dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_paypal'); llxHeaderPaypal($langs->trans("PaymentForm")); diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index ecf387e13c2..37b81403acd 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -82,9 +82,9 @@ class Societe extends CommonObject var $idprof1; // IdProf1 (Ex: Siren in France) var $idprof2; // IdProf2 (Ex: Siret in France) var $idprof3; // IdProf3 (Ex: Ape in France) - var $idprof4; // IdProf4 (Ex: RCS in France) - var $idprof5; // IdProf5 - var $idprof6; // IdProf6 + var $idprof4; // IdProf4 (Ex: RCS in France) + var $idprof5; // IdProf5 + var $idprof6; // IdProf6 var $prefix_comm; diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index 4f61d24a4aa..0edb8291677 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -70,9 +70,9 @@ if (GETPOST("button_removefilter")) $thirdTypeSelect = GETPOST("third_select_id"); $type_element = GETPOST('type_element')?GETPOST('type_element'):'invoice'; -$langs->load("bills"); -$langs->load("orders"); -$langs->load("suppliers"); +$langs->load("bills"); +$langs->load("orders"); +$langs->load("suppliers"); /* @@ -87,7 +87,7 @@ $langs->load("suppliers"); $form = new Form($db); $formother = new FormOther($db); -$productstatic=new Product($db); +$productstatic=new Product($db); $titre = $langs->trans("Referer",$object->name); llxHeader('',$titre,''); @@ -174,7 +174,7 @@ if ($type_element == 'order') { // TODO -} +} if ($type_element == 'supplier_order') { // Supplier : Show products from orders. $documentstatic=new CommandeFournisseur($db); @@ -217,13 +217,13 @@ $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit + 1, $offset); -// Define type of elements -$typeElementString = $form->selectarray("type_element",$elementTypeArray,GETPOST('type_element')); -$button = ''; -$param="&sref=".$sref."&month=".$month."&year=".$year."&sprod_fulldescr=".$sprod_fulldescr."&socid=".$socid; - -print_barre_liste($langs->trans('ProductsIntoElements', $typeElementString.' '.$button), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, '', ''); - +// Define type of elements +$typeElementString = $form->selectarray("type_element",$elementTypeArray,GETPOST('type_element')); +$button = ''; +$param="&sref=".$sref."&month=".$month."&year=".$year."&sprod_fulldescr=".$sprod_fulldescr."&socid=".$socid; + +print_barre_liste($langs->trans('ProductsIntoElements', $typeElementString.' '.$button), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, '', ''); + if ($sql_select) { dol_syslog("sql=".$sql); @@ -276,115 +276,115 @@ if ($sql_select) print ''; // Define text, description and type - $text=''; $description=''; $type=0; + $text=''; $description=''; $type=0; - // Code to show product duplicated from commonobject->printObjectLine - if ($objp->fk_product > 0) - { - $product_static = new Product($db); - - $product_static->type=$objp->fk_product_type; - $product_static->id=$objp->fk_product; - $product_static->ref=$objp->ref; - $text=$product_static->getNomUrl(1); + // Code to show product duplicated from commonobject->printObjectLine + if ($objp->fk_product > 0) + { + $product_static = new Product($db); + + $product_static->type=$objp->fk_product_type; + $product_static->id=$objp->fk_product; + $product_static->ref=$objp->ref; + $text=$product_static->getNomUrl(1); } - // Product - if ($objp->fk_product > 0) - { - // Define output language - if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) - { - $this->fetch_thirdparty(); - $prod = new Product($db); - $prod->fetch($objp->fk_product); - - $outputlangs = $langs; - $newlang=''; - if (empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id'); - if (empty($newlang)) $newlang=$this->client->default_lang; - if (! empty($newlang)) - { - $outputlangs = new Translate("",$conf); - $outputlangs->setDefaultLang($newlang); - } - - $label = (! empty($prod->multilangs[$outputlangs->defaultlang]["label"])) ? $prod->multilangs[$outputlangs->defaultlang]["label"] : $objp->product_label; - } - else - { - $label = $objp->product_label; - } - - $text.= ' - '.(! empty($objp->label)?$objp->label:$label); - $description=(! empty($conf->global->PRODUIT_DESC_IN_FORM)?'':dol_htmlentitiesbr($objp->description)); + // Product + if ($objp->fk_product > 0) + { + // Define output language + if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) + { + $this->fetch_thirdparty(); + $prod = new Product($db); + $prod->fetch($objp->fk_product); + + $outputlangs = $langs; + $newlang=''; + if (empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id'); + if (empty($newlang)) $newlang=$this->client->default_lang; + if (! empty($newlang)) + { + $outputlangs = new Translate("",$conf); + $outputlangs->setDefaultLang($newlang); + } + + $label = (! empty($prod->multilangs[$outputlangs->defaultlang]["label"])) ? $prod->multilangs[$outputlangs->defaultlang]["label"] : $objp->product_label; + } + else + { + $label = $objp->product_label; + } + + $text.= ' - '.(! empty($objp->label)?$objp->label:$label); + $description=(! empty($conf->global->PRODUIT_DESC_IN_FORM)?'':dol_htmlentitiesbr($objp->description)); } - if (($objp->info_bits & 2) == 2) { ?> - - trans("ShowReduc"),'reduc').' '; - if ($objp->description == '(DEPOSIT)') $txt=$langs->trans("Deposit"); - //else $txt=$langs->trans("Discount"); - print $txt; - ?> - - description) - { - if ($objp->description == '(CREDIT_NOTE)' && $objp->fk_remise_except > 0) - { - $discount=new DiscountAbsolute($db); - $discount->fetch($objp->fk_remise_except); - echo ($txt?' - ':'').$langs->transnoentities("DiscountFromCreditNote",$discount->getNomUrl(0)); - } - elseif ($objp->description == '(DEPOSIT)' && $objp->fk_remise_except > 0) - { - $discount=new DiscountAbsolute($db); - $discount->fetch($objp->fk_remise_except); - echo ($txt?' - ':'').$langs->transnoentities("DiscountFromDeposit",$discount->getNomUrl(0)); - // Add date of deposit - if (! empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) echo ' ('.dol_print_date($discount->datec).')'; - } - else - { - echo ($txt?' - ':'').dol_htmlentitiesbr($objp->description); - } - } - } - else - { - if ($objp->fk_product > 0) { - - echo $form->textwithtooltip($text,$description,3,'','',$i,0,''); - - // Show range - echo get_date_range($objp->date_start, $objp->date_end); - - // Add description in form - if (! empty($conf->global->PRODUIT_DESC_IN_FORM)) - { - print (! empty($objp->description) && $objp->description!=$objp->product_label)?'
    '.dol_htmlentitiesbr($objp->description):''; - } - - } else { - - //if (! empty($objp->fk_parent_line)) echo img_picto('', 'rightarrow'); - if ($type==1) $text = img_object($langs->trans('Service'),'service'); - else $text = img_object($langs->trans('Product'),'product'); - - if (! empty($objp->label)) { - $text.= ' '.$objp->label.''; - echo $form->textwithtooltip($text,dol_htmlentitiesbr($objp->description),3,'','',$i,0,''); - } else { - echo $text.' '.dol_htmlentitiesbr($objp->description); - } - - // Show range - echo get_date_range($objp->date_start,$objp->date_end); - } - } + if (($objp->info_bits & 2) == 2) { ?> + + trans("ShowReduc"),'reduc').' '; + if ($objp->description == '(DEPOSIT)') $txt=$langs->trans("Deposit"); + //else $txt=$langs->trans("Discount"); + print $txt; + ?> + + description) + { + if ($objp->description == '(CREDIT_NOTE)' && $objp->fk_remise_except > 0) + { + $discount=new DiscountAbsolute($db); + $discount->fetch($objp->fk_remise_except); + echo ($txt?' - ':'').$langs->transnoentities("DiscountFromCreditNote",$discount->getNomUrl(0)); + } + elseif ($objp->description == '(DEPOSIT)' && $objp->fk_remise_except > 0) + { + $discount=new DiscountAbsolute($db); + $discount->fetch($objp->fk_remise_except); + echo ($txt?' - ':'').$langs->transnoentities("DiscountFromDeposit",$discount->getNomUrl(0)); + // Add date of deposit + if (! empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) echo ' ('.dol_print_date($discount->datec).')'; + } + else + { + echo ($txt?' - ':'').dol_htmlentitiesbr($objp->description); + } + } + } + else + { + if ($objp->fk_product > 0) { + + echo $form->textwithtooltip($text,$description,3,'','',$i,0,''); + + // Show range + echo get_date_range($objp->date_start, $objp->date_end); + + // Add description in form + if (! empty($conf->global->PRODUIT_DESC_IN_FORM)) + { + print (! empty($objp->description) && $objp->description!=$objp->product_label)?'
    '.dol_htmlentitiesbr($objp->description):''; + } + + } else { + + //if (! empty($objp->fk_parent_line)) echo img_picto('', 'rightarrow'); + if ($type==1) $text = img_object($langs->trans('Service'),'service'); + else $text = img_object($langs->trans('Product'),'product'); + + if (! empty($objp->label)) { + $text.= ' '.$objp->label.''; + echo $form->textwithtooltip($text,dol_htmlentitiesbr($objp->description),3,'','',$i,0,''); + } else { + echo $text.' '.dol_htmlentitiesbr($objp->description); + } + + // Show range + echo get_date_range($objp->date_start,$objp->date_end); + } + } /* $prodreftxt=''; @@ -396,16 +396,16 @@ if ($sql_select) $prodreftxt = $productstatic->getNomUrl(0); if(!empty($objp->product_label)) $prodreftxt .= ' - '.$objp->product_label; } - // Show range - $prodreftxt .= get_date_range($objp->date_start, $objp->date_end); - // Add description in form - if (! empty($conf->global->PRODUIT_DESC_IN_FORM)) - { - $prodreftxt .= (! empty($objp->description) && $objp->description!=$objp->product_label)?'
    '.dol_htmlentitiesbr($objp->description):''; + // Show range + $prodreftxt .= get_date_range($objp->date_start, $objp->date_end); + // Add description in form + if (! empty($conf->global->PRODUIT_DESC_IN_FORM)) + { + $prodreftxt .= (! empty($objp->description) && $objp->description!=$objp->product_label)?'
    '.dol_htmlentitiesbr($objp->description):''; } */ - print ''; - + print ''; + //print ''.$prodreftxt.''; print ''.$objp->prod_qty.''; diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php index e113ad7e0e1..74d8b74c4d4 100644 --- a/htdocs/societe/index.php +++ b/htdocs/societe/index.php @@ -51,7 +51,7 @@ print_fiche_titre($transAreaType); //print ''; //print '
    '; -print '
    '; +print '
    '; /* @@ -152,7 +152,7 @@ print '
    '; //print ''; -print '
    '; +print '
    '; /* diff --git a/htdocs/theme/bureau2crea/style.css.php b/htdocs/theme/bureau2crea/style.css.php index 6f806f4594f..45e2285d44a 100644 --- a/htdocs/theme/bureau2crea/style.css.php +++ b/htdocs/theme/bureau2crea/style.css.php @@ -60,7 +60,7 @@ $fontsizesmaller=empty($conf->browser->phone)?'11':'11'; $fontlist='arial,tahoma,verdana,helvetica'; //$fontlist='Verdana,Helvetica,Arial,sans-serif'; -$path=''; // This value may be used in future for external module to overwrite theme +$path=''; // This value may be used in future for external module to overwrite theme $theme='bureau2crea'; // Value of theme if (! empty($conf->global->MAIN_OVERWRITE_THEME_RES)) { $path='/'.$conf->global->MAIN_OVERWRITE_THEME_RES; $theme=$conf->global->MAIN_OVERWRITE_THEME_RES; } diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 665f58b0b89..0cd62a11591 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -61,7 +61,7 @@ $left=($langs->trans("DIRECTION")=='rtl'?'right':'left'); $path=''; // This value may be used in future for external module to overwrite theme $theme='eldy'; // Value of theme -if (! empty($conf->global->MAIN_OVERWRITE_THEME_RES)) { $path='/'.$conf->global->MAIN_OVERWRITE_THEME_RES; $theme=$conf->global->MAIN_OVERWRITE_THEME_RES; } +if (! empty($conf->global->MAIN_OVERWRITE_THEME_RES)) { $path='/'.$conf->global->MAIN_OVERWRITE_THEME_RES; $theme=$conf->global->MAIN_OVERWRITE_THEME_RES; } // Define image path files $fontlist='arial,tahoma,verdana,helvetica'; //$fontlist='Verdana,Helvetica,Arial,sans-serif'; diff --git a/htdocs/theme/phones/smartphone/tpl/menu.tpl.php b/htdocs/theme/phones/smartphone/tpl/menu.tpl.php index 971dbc80885..d286345eada 100644 --- a/htdocs/theme/phones/smartphone/tpl/menu.tpl.php +++ b/htdocs/theme/phones/smartphone/tpl/menu.tpl.php @@ -15,14 +15,14 @@ * along with this program. If not, see . */ -// Load the smartphone menu manager -$result=@include_once DOL_DOCUMENT_ROOT ."/core/menus/smartphone/".$conf->smart_menu; -if (! $result) // If failed to include, we try with standard -{ - $conf->smart_menu='smartphone_menu.php'; - include_once DOL_DOCUMENT_ROOT ."/core/menus/smartphone/".$conf->smart_menu; -} -$menusmart = new MenuSmart($db, $user->societe_id?1:0); +// Load the smartphone menu manager +$result=@include_once DOL_DOCUMENT_ROOT ."/core/menus/smartphone/".$conf->smart_menu; +if (! $result) // If failed to include, we try with standard +{ + $conf->smart_menu='smartphone_menu.php'; + include_once DOL_DOCUMENT_ROOT ."/core/menus/smartphone/".$conf->smart_menu; +} +$menusmart = new MenuSmart($db, $user->societe_id?1:0); top_httphead(); diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index bd7095f4d03..c04f96b09db 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -913,10 +913,10 @@ class User extends CommonObject $this->office_fax = $contact->fax; $this->user_mobile = $contact->phone_mobile; $this->address = $contact->address; - $this->zip = $contact->zip; - $this->town = $contact->town; + $this->zip = $contact->zip; + $this->town = $contact->town; $this->state_id = $contact->state_id; - $this->country_id = $contact->country_id; + $this->country_id = $contact->country_id; if (empty($login)) $login=strtolower(substr($contact->firstname, 0, 4)) . strtolower(substr($contact->lastname, 0, 4)); $this->login = $login; @@ -984,11 +984,11 @@ class User extends CommonObject $this->email = $member->email; $this->fk_member = $member->id; $this->pass = $member->pass; - $this->address = $member->address; - $this->zip = $member->zip; - $this->town = $member->town; - $this->state_id = $member->state_id; - $this->country_id = $member->country_id; + $this->address = $member->address; + $this->zip = $member->zip; + $this->town = $member->town; + $this->state_id = $member->state_id; + $this->country_id = $member->country_id; if (empty($login)) $login=strtolower(substr($member->firstname, 0, 4)) . strtolower(substr($member->lastname, 0, 4)); $this->login = $login; @@ -2108,205 +2108,205 @@ class User extends CommonObject } - /** - * Return and array with all instanciated children users of current user - * - * @return void - */ - function get_children() - { - $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."user"; - $sql.= " WHERE fk_user = ".$this->id; + /** + * Return and array with all instanciated children users of current user + * + * @return void + */ + function get_children() + { + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."user"; + $sql.= " WHERE fk_user = ".$this->id; - dol_syslog(get_class($this)."::get_children result=".$result, LOG_DEBUG); - $res = $this->db->query($sql); - if ($res) - { - $users = array (); - while ($rec = $this->db->fetch_array($res)) - { - $user = new User($this->db); - $user->fetch($rec['rowid']); - $users[] = $user; - } - return $users; - } - else - { - dol_print_error($this->db); - return -1; - } - } - - - /** - * Load this->parentof that is array(id_son=>id_parent, ...) - * - * @return int <0 if KO, >0 if OK - */ - private function load_parentof() - { - global $conf; - - $this->parentof=array(); - - // Load array[child]=parent - $sql = "SELECT fk_user as id_parent, rowid as id_son"; - $sql.= " FROM ".MAIN_DB_PREFIX."user"; - $sql.= " WHERE fk_user != 0"; - $sql.= " AND entity = ".$conf->entity; - - dol_syslog(get_class($this)."::load_parentof sql=".$sql); - $resql = $this->db->query($sql); - if ($resql) - { - while ($obj= $this->db->fetch_object($resql)) - { - $this->parentof[$obj->id_son]=$obj->id_parent; - } - return 1; - } - else - { - dol_print_error($this->db); - return -1; - } - } - - /** - * Reconstruit l'arborescence hierarchique des users sous la forme d'un tableau - * Renvoi un tableau de tableau('id','id_parent',...) trie selon arbre et avec: - * id = id du user - * id_parent = id du user parent - * id_children = tableau des id enfant - * name = nom du user - * fullname = nom avec chemin complet du user - * fullpath = chemin complet compose des id - * - * @param int $markafterid Removed all users including the leaf $markafterid in user tree. - * @return array Array of users. this->users and this->parentof are set. - */ - function get_full_tree($markafterid=0) - { - $this->users = array(); - - // Init this->parentof that is array(id_son=>id_parent, ...) - $this->load_parentof(); - - // Init $this->users array - $sql = "SELECT DISTINCT u.rowid, u.firstname, u.lastname, u.fk_user, u.login, u.statut"; // Distinct reduce pb with old tables with duplicates - $sql.= " FROM ".MAIN_DB_PREFIX."user as u"; - $sql.= " WHERE u.entity IN (".getEntity('user',1).")"; - - dol_syslog(get_class($this)."::get_full_tree get user list sql=".$sql, LOG_DEBUG); - $resql = $this->db->query($sql); - if ($resql) - { - $i=0; - while ($obj = $this->db->fetch_object($resql)) - { - $this->users[$obj->rowid]['rowid'] = $obj->rowid; - $this->users[$obj->rowid]['id'] = $obj->rowid; - $this->users[$obj->rowid]['fk_user'] = $obj->fk_user; - $this->users[$obj->rowid]['firstname'] = $obj->firstname; - $this->users[$obj->rowid]['lastname'] = $obj->lastname; + dol_syslog(get_class($this)."::get_children result=".$result, LOG_DEBUG); + $res = $this->db->query($sql); + if ($res) + { + $users = array (); + while ($rec = $this->db->fetch_array($res)) + { + $user = new User($this->db); + $user->fetch($rec['rowid']); + $users[] = $user; + } + return $users; + } + else + { + dol_print_error($this->db); + return -1; + } + } + + + /** + * Load this->parentof that is array(id_son=>id_parent, ...) + * + * @return int <0 if KO, >0 if OK + */ + private function load_parentof() + { + global $conf; + + $this->parentof=array(); + + // Load array[child]=parent + $sql = "SELECT fk_user as id_parent, rowid as id_son"; + $sql.= " FROM ".MAIN_DB_PREFIX."user"; + $sql.= " WHERE fk_user != 0"; + $sql.= " AND entity = ".$conf->entity; + + dol_syslog(get_class($this)."::load_parentof sql=".$sql); + $resql = $this->db->query($sql); + if ($resql) + { + while ($obj= $this->db->fetch_object($resql)) + { + $this->parentof[$obj->id_son]=$obj->id_parent; + } + return 1; + } + else + { + dol_print_error($this->db); + return -1; + } + } + + /** + * Reconstruit l'arborescence hierarchique des users sous la forme d'un tableau + * Renvoi un tableau de tableau('id','id_parent',...) trie selon arbre et avec: + * id = id du user + * id_parent = id du user parent + * id_children = tableau des id enfant + * name = nom du user + * fullname = nom avec chemin complet du user + * fullpath = chemin complet compose des id + * + * @param int $markafterid Removed all users including the leaf $markafterid in user tree. + * @return array Array of users. this->users and this->parentof are set. + */ + function get_full_tree($markafterid=0) + { + $this->users = array(); + + // Init this->parentof that is array(id_son=>id_parent, ...) + $this->load_parentof(); + + // Init $this->users array + $sql = "SELECT DISTINCT u.rowid, u.firstname, u.lastname, u.fk_user, u.login, u.statut"; // Distinct reduce pb with old tables with duplicates + $sql.= " FROM ".MAIN_DB_PREFIX."user as u"; + $sql.= " WHERE u.entity IN (".getEntity('user',1).")"; + + dol_syslog(get_class($this)."::get_full_tree get user list sql=".$sql, LOG_DEBUG); + $resql = $this->db->query($sql); + if ($resql) + { + $i=0; + while ($obj = $this->db->fetch_object($resql)) + { + $this->users[$obj->rowid]['rowid'] = $obj->rowid; + $this->users[$obj->rowid]['id'] = $obj->rowid; + $this->users[$obj->rowid]['fk_user'] = $obj->fk_user; + $this->users[$obj->rowid]['firstname'] = $obj->firstname; + $this->users[$obj->rowid]['lastname'] = $obj->lastname; $this->users[$obj->rowid]['login'] = $obj->login; $this->users[$obj->rowid]['statut'] = $obj->statut; - $i++; - } - } - else - { - dol_print_error($this->db); - return -1; - } - - // We add the fullpath property to each elements of first level (no parent exists) - dol_syslog(get_class($this)."::get_full_tree call to build_path_from_id_user", LOG_DEBUG); - foreach($this->users as $key => $val) - { - $this->build_path_from_id_user($key,0); // Process a branch from the root user key (this user has no parent) - } - - // Exclude leaf including $markafterid from tree - if ($markafterid) - { - //print "Look to discard user ".$markafterid."\n"; - $keyfilter1='^'.$markafterid.'$'; - $keyfilter2='_'.$markafterid.'$'; - $keyfilter3='^'.$markafterid.'_'; - $keyfilter4='_'.$markafterid.'_'; - foreach($this->users as $key => $val) - { - if (preg_match('/'.$keyfilter1.'/',$val['fullpath']) || preg_match('/'.$keyfilter2.'/',$val['fullpath']) - || preg_match('/'.$keyfilter3.'/',$val['fullpath']) || preg_match('/'.$keyfilter4.'/',$val['fullpath'])) - { - unset($this->users[$key]); - } - } - } - - dol_syslog(get_class($this)."::get_full_tree dol_sort_array", LOG_DEBUG); - $this->users=dol_sort_array($this->users, 'fullname', 'asc', true, false); - - //$this->debug_users(); - - return $this->users; - } - - /** - * For user id_user and its childs available in this->users, define property fullpath and fullname - * - * @param int $id_user id_user entry to update - * @param int $protection Deep counter to avoid infinite loop - * @return void - */ - function build_path_from_id_user($id_user,$protection=1000) - { - dol_syslog(get_class($this)."::build_path_from_id_user id_user=".$id_user." protection=".$protection, LOG_DEBUG); - - if (! empty($this->users[$id_user]['fullpath'])) - { - // Already defined - dol_syslog(get_class($this)."::build_path_from_id_user fullpath and fullname already defined", LOG_WARNING); - return; - } - - // Define fullpath and fullname - $this->users[$id_user]['fullpath'] = '_'.$id_user; - $this->users[$id_user]['fullname'] = $this->users[$id_user]['label']; - $i=0; $cursor_user=$id_user; - - while ((empty($protection) || $i < $protection) && ! empty($this->parentof[$cursor_user])) - { - $this->users[$id_user]['fullpath'] = '_'.$this->parentof[$cursor_user].$this->users[$id_user]['fullpath']; - $this->users[$id_user]['fullname'] = $this->users[$this->parentof[$cursor_user]]['label'].' >> '.$this->users[$id_user]['fullname']; - $i++; $cursor_user=$this->parentof[$cursor_user]; - } - - // We count number of _ to have level - $this->users[$id_user]['level']=dol_strlen(preg_replace('/[^_]/i','',$this->users[$id_user]['fullpath'])); - - return; - } - - /** - * Affiche contenu de $this->users - * - * @return void - */ - function debug_users() - { - // Affiche $this->users - foreach($this->users as $key => $val) - { - print 'id: '.$this->users[$key]['id']; - print ' name: '.$this->users[$key]['name']; - print ' parent: '.$this->users[$key]['fk_user']; - print ' fullpath: '.$this->users[$key]['fullpath']; - print ' fullname: '.$this->users[$key]['fullname']; - print "
    \n"; - } + $i++; + } + } + else + { + dol_print_error($this->db); + return -1; + } + + // We add the fullpath property to each elements of first level (no parent exists) + dol_syslog(get_class($this)."::get_full_tree call to build_path_from_id_user", LOG_DEBUG); + foreach($this->users as $key => $val) + { + $this->build_path_from_id_user($key,0); // Process a branch from the root user key (this user has no parent) + } + + // Exclude leaf including $markafterid from tree + if ($markafterid) + { + //print "Look to discard user ".$markafterid."\n"; + $keyfilter1='^'.$markafterid.'$'; + $keyfilter2='_'.$markafterid.'$'; + $keyfilter3='^'.$markafterid.'_'; + $keyfilter4='_'.$markafterid.'_'; + foreach($this->users as $key => $val) + { + if (preg_match('/'.$keyfilter1.'/',$val['fullpath']) || preg_match('/'.$keyfilter2.'/',$val['fullpath']) + || preg_match('/'.$keyfilter3.'/',$val['fullpath']) || preg_match('/'.$keyfilter4.'/',$val['fullpath'])) + { + unset($this->users[$key]); + } + } + } + + dol_syslog(get_class($this)."::get_full_tree dol_sort_array", LOG_DEBUG); + $this->users=dol_sort_array($this->users, 'fullname', 'asc', true, false); + + //$this->debug_users(); + + return $this->users; + } + + /** + * For user id_user and its childs available in this->users, define property fullpath and fullname + * + * @param int $id_user id_user entry to update + * @param int $protection Deep counter to avoid infinite loop + * @return void + */ + function build_path_from_id_user($id_user,$protection=1000) + { + dol_syslog(get_class($this)."::build_path_from_id_user id_user=".$id_user." protection=".$protection, LOG_DEBUG); + + if (! empty($this->users[$id_user]['fullpath'])) + { + // Already defined + dol_syslog(get_class($this)."::build_path_from_id_user fullpath and fullname already defined", LOG_WARNING); + return; + } + + // Define fullpath and fullname + $this->users[$id_user]['fullpath'] = '_'.$id_user; + $this->users[$id_user]['fullname'] = $this->users[$id_user]['label']; + $i=0; $cursor_user=$id_user; + + while ((empty($protection) || $i < $protection) && ! empty($this->parentof[$cursor_user])) + { + $this->users[$id_user]['fullpath'] = '_'.$this->parentof[$cursor_user].$this->users[$id_user]['fullpath']; + $this->users[$id_user]['fullname'] = $this->users[$this->parentof[$cursor_user]]['label'].' >> '.$this->users[$id_user]['fullname']; + $i++; $cursor_user=$this->parentof[$cursor_user]; + } + + // We count number of _ to have level + $this->users[$id_user]['level']=dol_strlen(preg_replace('/[^_]/i','',$this->users[$id_user]['fullpath'])); + + return; + } + + /** + * Affiche contenu de $this->users + * + * @return void + */ + function debug_users() + { + // Affiche $this->users + foreach($this->users as $key => $val) + { + print 'id: '.$this->users[$key]['id']; + print ' name: '.$this->users[$key]['name']; + print ' parent: '.$this->users[$key]['fk_user']; + print ' fullpath: '.$this->users[$key]['fullpath']; + print ' fullname: '.$this->users[$key]['fullname']; + print "
    \n"; + } } } diff --git a/htdocs/user/fiche.php b/htdocs/user/fiche.php index 0d2586c9639..a614416dcf8 100644 --- a/htdocs/user/fiche.php +++ b/htdocs/user/fiche.php @@ -682,7 +682,7 @@ if (($action == 'create') || ($action == 'adduserldap')) print '
    '; } - print dol_set_focus('#lastname'); + print dol_set_focus('#lastname'); print '
    '; print ''; @@ -1199,18 +1199,18 @@ else print ''.$langs->trans('Signature').''; print dol_htmlentitiesbr($object->signature); print "\n"; - - // Hierarchy - print ''.$langs->trans("HierarchicalResponsible").''; - print ''; - if (empty($object->fk_user)) print $langs->trans("None"); - else { - $huser=new User($db); - $huser->fetch($object->fk_user); - print $huser->getNomUrl(1); - } - print ''; - print "\n"; + + // Hierarchy + print ''.$langs->trans("HierarchicalResponsible").''; + print ''; + if (empty($object->fk_user)) print $langs->trans("None"); + else { + $huser=new User($db); + $huser->fetch($object->fk_user); + print $huser->getNomUrl(1); + } + print ''; + print "\n"; // Status print ''.$langs->trans("Status").''; @@ -1283,22 +1283,22 @@ else print ''."\n"; } - // Multicompany - if (! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity) - { - print ''.$langs->trans("Entity").''; - if ($object->admin && ! $object->entity) - { - print $langs->trans("AllEntities"); - } - else - { - $mc->getInfo($object->entity); - print $mc->label; - } - print "\n"; - } - + // Multicompany + if (! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity) + { + print ''.$langs->trans("Entity").''; + if ($object->admin && ! $object->entity) + { + print $langs->trans("AllEntities"); + } + else + { + $mc->getInfo($object->entity); + print $mc->label; + } + print "\n"; + } + // Other attributes $parameters=array('colspan' => ' colspan="2"'); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook @@ -1814,7 +1814,7 @@ else print dol_htmlentitiesbr($object->signature); } print ''; - + // openid if (isset($conf->authmode) && preg_match('/myopenid/',$conf->authmode)) { @@ -1832,10 +1832,10 @@ else print ''; } - // Hierarchy - print ''.$langs->trans("HierarchicalResponsible").''; + // Hierarchy + print ''.$langs->trans("HierarchicalResponsible").''; print ''; - if ($caneditfield) + if ($caneditfield) { print $form->select_dolusers($object->fk_user,'fk_user',1,array($object->id),0,'',0,$object->entity); } @@ -1845,9 +1845,9 @@ else $huser=new User($db); $huser->fetch($object->fk_user); print $huser->getNomUrl(1); - } - print ''; - print "\n"; + } + print ''; + print "\n"; // Status print ''.$langs->trans("Status").''; diff --git a/htdocs/user/hierarchy.php b/htdocs/user/hierarchy.php index afcd72ec76a..0f2ccff204d 100644 --- a/htdocs/user/hierarchy.php +++ b/htdocs/user/hierarchy.php @@ -26,12 +26,12 @@ */ require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/treeview.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/treeview.lib.php'; if (! $user->rights->user->user->lire && ! $user->admin) accessforbidden(); -$langs->load("users"); +$langs->load("users"); $langs->load("companies"); // Security check (for external users) @@ -53,12 +53,12 @@ $companystatic = new Societe($db); $form = new Form($db); -$arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js'); -$arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css'); +$arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js'); +$arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css'); llxHeader('',$langs->trans("ListOfUsers"). ' ('.$langs->trans("HierarchicView").')','','',0,0,$arrayofjs,$arrayofcss); - -print_fiche_titre($langs->trans("ListOfUsers"). ' ('.$langs->trans("HierarchicView").')', '
    '); + +print_fiche_titre($langs->trans("ListOfUsers"). ' ('.$langs->trans("HierarchicView").')', '
    '); @@ -67,51 +67,51 @@ $user_arbo = $userstatic->get_full_tree(); // Define fulltree array $fulltree=$user_arbo; - -// Define data (format for treeview) -$data=array(); -$data[] = array('rowid'=>0,'fk_menu'=>-1,'title'=>"racine",'mainmenu'=>'','leftmenu'=>'','fk_mainmenu'=>'','fk_leftmenu'=>''); -foreach($fulltree as $key => $val) + +// Define data (format for treeview) +$data=array(); +$data[] = array('rowid'=>0,'fk_menu'=>-1,'title'=>"racine",'mainmenu'=>'','leftmenu'=>'','fk_mainmenu'=>'','fk_leftmenu'=>''); +foreach($fulltree as $key => $val) { - $userstatic->id=$val['id']; - $userstatic->ref=$val['label']; + $userstatic->id=$val['id']; + $userstatic->ref=$val['label']; $userstatic->firstname=$val['firstname']; $userstatic->lastname=$val['name']; $userstatic->statut=$val['statut']; - $li=$userstatic->getNomUrl(1,'').' ('.$val['login'].')'; - - $data[] = array( - 'rowid'=>$val['rowid'], - 'fk_menu'=>$val['fk_user'], - 'entry'=>'
    '.$li.''.$userstatic->getLibStatut(5).'
    ' - ); -} - - -print ''; + $li=$userstatic->getNomUrl(1,'').' ('.$val['login'].')'; + + $data[] = array( + 'rowid'=>$val['rowid'], + 'fk_menu'=>$val['fk_user'], + 'entry'=>'
    '.$li.''.$userstatic->getLibStatut(5).'
    ' + ); +} + + +print ''; print ''; - -$nbofentries=(count($data) - 1); - -if ($nbofentries > 0) -{ - print ''; -} -else -{ - print ''; - print ''; - print ''; -} - +print ' | '.img_picto('','object_category-expanded').' '.$langs->trans("ExpandAll").''; + +$nbofentries=(count($data) - 1); + +if ($nbofentries > 0) +{ + print ''; +} +else +{ + print ''; + print ''; + print ''; +} + print "
    '.$langs->trans("HierarchicView").'
    '; - tree_recur($data,$data[0],0); - print '
    '; - print ''; - print ''; - print '
    '.img_picto_common('','treemenu/branchbottom.gif').''; - print $langs->trans("NoCategoryYet"); - print ' 
    '; + tree_recur($data,$data[0],0); + print '
    '; + print ''; + print ''; + print '
    '.img_picto_common('','treemenu/branchbottom.gif').''; + print $langs->trans("NoCategoryYet"); + print ' 
    "; diff --git a/htdocs/user/home.php b/htdocs/user/home.php index 66c74e5d290..8c2de389a39 100644 --- a/htdocs/user/home.php +++ b/htdocs/user/home.php @@ -58,7 +58,7 @@ print_fiche_titre($langs->trans("MenuUsersAndGroups")); //print ''; //print '
    '; -print '
    '; +print '
    '; // Search User @@ -90,7 +90,7 @@ if ($canreadperms) //print '
    '; -print '
    '; +print '
    '; /* @@ -254,7 +254,7 @@ if ($canreadperms) } //print '
    '; -print '
    '; +print '
    '; llxFooter(); diff --git a/htdocs/webservices/server_invoice.php b/htdocs/webservices/server_invoice.php index ef7384a11c7..014eba8fcb4 100755 --- a/htdocs/webservices/server_invoice.php +++ b/htdocs/webservices/server_invoice.php @@ -398,7 +398,7 @@ function getInvoicesForThirdParty($authentication,$idthirdparty) //$sql.=" WHERE f.fk_soc = s.rowid AND nom = '".$db->escape($idthirdparty)."'"; //$sql.=" WHERE f.fk_soc = s.rowid AND nom = '".$db->escape($idthirdparty)."'"; $sql.=" WHERE f.entity = ".$conf->entity; - if ($idthirdparty != 'all' ) $sql.=" AND f.fk_soc = ".$db->escape($idthirdparty); + if ($idthirdparty != 'all' ) $sql.=" AND f.fk_soc = ".$db->escape($idthirdparty); $resql=$db->query($sql); if ($resql) @@ -413,11 +413,11 @@ function getInvoicesForThirdParty($authentication,$idthirdparty) $invoice=new Facture($db); $invoice->fetch($obj->facid); - // Sécurité pour utilisateur externe - if( $socid && ( $socid != $order->socid) ) - { - $error++; - $errorcode='PERMISSION_DENIED'; $errorlabel=$order->socid.' User does not have permission for this request'; + // Sécurité pour utilisateur externe + if( $socid && ( $socid != $order->socid) ) + { + $error++; + $errorcode='PERMISSION_DENIED'; $errorlabel=$order->socid.' User does not have permission for this request'; } // Define lines of invoice diff --git a/htdocs/webservices/server_order.php b/htdocs/webservices/server_order.php index 6ba0fa2cd5e..ee311e17bc1 100644 --- a/htdocs/webservices/server_order.php +++ b/htdocs/webservices/server_order.php @@ -71,18 +71,18 @@ $server->wsdl->addComplexType( 'entity' => array('name'=>'entity','type'=>'xsd:string') ) ); -// Define WSDL Return object -$server->wsdl->addComplexType( - 'result', - 'complexType', - 'struct', - 'all', - '', - array( - 'result_code' => array('name'=>'result_code','type'=>'xsd:string'), - 'result_label' => array('name'=>'result_label','type'=>'xsd:string'), - ) -); +// Define WSDL Return object +$server->wsdl->addComplexType( + 'result', + 'complexType', + 'struct', + 'all', + '', + array( + 'result_code' => array('name'=>'result_code','type'=>'xsd:string'), + 'result_label' => array('name'=>'result_label','type'=>'xsd:string'), + ) +); // Define other specific objects $server->wsdl->addComplexType( @@ -389,9 +389,9 @@ function getOrder($authentication,$id='',$ref='',$ref_ext='') 'project_id' => $order->fk_project, 'date' => $order->date_commande?dol_print_date($order->date_commande,'dayrfc'):'', - 'date_creation' => $invoice->date_creation?dol_print_date($invoice->date_creation,'dayhourrfc'):'', - 'date_validation' => $invoice->date_validation?dol_print_date($invoice->date_creation,'dayhourrfc'):'', - 'date_modification' => $invoice->datem?dol_print_date($invoice->datem,'dayhourrfc'):'', + 'date_creation' => $invoice->date_creation?dol_print_date($invoice->date_creation,'dayhourrfc'):'', + 'date_validation' => $invoice->date_validation?dol_print_date($invoice->date_creation,'dayhourrfc'):'', + 'date_modification' => $invoice->datem?dol_print_date($invoice->datem,'dayhourrfc'):'', 'remise' => $order->remise, 'remise_percent' => $order->remise_percent, @@ -406,7 +406,7 @@ function getOrder($authentication,$id='',$ref='',$ref_ext='') 'cond_reglement' => $order->cond_reglement, 'mode_reglement_id' => $order->mode_reglement_id, 'mode_reglement_code' => $order->mode_reglement_code, - 'mode_reglement' => $order->mode_reglement, + 'mode_reglement' => $order->mode_reglement, 'date_livraison' => $order->date_livraison, 'fk_delivery_address' => $order->fk_delivery_address, @@ -674,13 +674,13 @@ function createOrder($authentication,$order) } - if ($newobject->statut == 1) // We want order validated - { - $result=$newobject->validate($fuser); - if ($result < 0) - { - $error++; - } + if ($newobject->statut == 1) // We want order validated + { + $result=$newobject->validate($fuser); + if ($result < 0) + { + $error++; + } } if (! $error) diff --git a/htdocs/webservices/server_productorservice.php b/htdocs/webservices/server_productorservice.php index 04708072d0e..e51caadb124 100755 --- a/htdocs/webservices/server_productorservice.php +++ b/htdocs/webservices/server_productorservice.php @@ -145,12 +145,12 @@ $server->wsdl->addComplexType( 'sequence', '', array( - 'image' => array( - 'name' => 'image', - 'type' => 'tns:image', - 'minOccurs' => '0', + 'image' => array( + 'name' => 'image', + 'type' => 'tns:image', + 'minOccurs' => '0', 'maxOccurs' => 'unbounded' - ) + ) ) ); diff --git a/scripts/cron/cron_run_jobs.php b/scripts/cron/cron_run_jobs.php index 159fadd3a61..151af859fcd 100755 --- a/scripts/cron/cron_run_jobs.php +++ b/scripts/cron/cron_run_jobs.php @@ -31,33 +31,33 @@ if (! defined('NOLOGIN')) define('NOLOGIN','1'); //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); -$sapi_type = php_sapi_name(); -$script_file = basename(__FILE__); -$path=dirname(__FILE__).'/'; - -// Test if batch mode -if (substr($sapi_type, 0, 3) == 'cgi') { - echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n"; - exit; -} - +$sapi_type = php_sapi_name(); +$script_file = basename(__FILE__); +$path=dirname(__FILE__).'/'; + +// Test if batch mode +if (substr($sapi_type, 0, 3) == 'cgi') { + echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n"; + exit; +} + if (! isset($argv[1]) || ! $argv[1]) { print "Usage: ".$script_file." securitykey userlogin cronjobid(optional)\n"; exit; } -$key=$argv[1]; +$key=$argv[1]; + +if (! isset($argv[2]) || ! $argv[2]) { + print "Usage: ".$script_file." securitykey userlogin cronjobid(optional)\n"; + exit; +} else { + $userlogin=$argv[2]; +} -if (! isset($argv[2]) || ! $argv[2]) { - print "Usage: ".$script_file." securitykey userlogin cronjobid(optional)\n"; - exit; -} else { - $userlogin=$argv[2]; -} - require_once ($path."../../htdocs/master.inc.php"); require_once (DOL_DOCUMENT_ROOT."/cron/class/cronjob.class.php"); -require_once (DOL_DOCUMENT_ROOT.'/user/class/user.class.php'); -require_once (DOL_DOCUMENT_ROOT."/cron/class/cronjob.class.php"); +require_once (DOL_DOCUMENT_ROOT.'/user/class/user.class.php'); +require_once (DOL_DOCUMENT_ROOT."/cron/class/cronjob.class.php"); /* diff --git a/scripts/invoices/email_unpaid_invoices_to_representatives.php b/scripts/invoices/email_unpaid_invoices_to_representatives.php index 83c27b23aab..e62403366fb 100755 --- a/scripts/invoices/email_unpaid_invoices_to_representatives.php +++ b/scripts/invoices/email_unpaid_invoices_to_representatives.php @@ -44,7 +44,7 @@ if (! isset($argv[1]) || ! $argv[1] || ! in_array($argv[1],array('test','confirm print "If you add a delay (nb of days), only invoice with due date < today + delay are included.\n"; exit; } -$mode=$argv[1]; +$mode=$argv[1]; require($path."../../htdocs/master.inc.php"); @@ -60,7 +60,7 @@ $now=dol_now('tzserver'); $duration_value=$argv[2]; $error = 0; -print $script_file." launched with mode ".$mode.($duration_value?" delay=".$duration_value:"")."\n"; +print $script_file." launched with mode ".$mode.($duration_value?" delay=".$duration_value:"")."\n"; $sql = "SELECT f.facnumber, f.total_ttc, s.nom as name, u.rowid as uid, u.lastname, u.firstname, u.email, u.lang"; $sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; @@ -155,8 +155,8 @@ function envoi_mail($mode,$oldemail,$message,$total,$userlang) $newlangs=new Translate('',$conf); $newlangs->setDefaultLang($userlang); - $newlangs->load("main"); - $newlangs->load("bills"); + $newlangs->load("main"); + $newlangs->load("bills"); $subject = "[".(empty($conf->global->MAIN_APPLICATION_TITLE)?'Dolibarr':$conf->global->MAIN_APPLICATION_TITLE)."] ".$newlangs->trans("ListOfYourUnpaidInvoices"); $sendto = $oldemail; @@ -168,8 +168,8 @@ function envoi_mail($mode,$oldemail,$message,$total,$userlang) dol_syslog("email_unpaid_invoices_to_representatives.php: send mail to ".$oldemail); $usehtml=0; - if (dol_textishtml($conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_FOOTER)) $usehtml+=1; - if (dol_textishtml($conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_HEADER)) $usehtml+=1; + if (dol_textishtml($conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_FOOTER)) $usehtml+=1; + if (dol_textishtml($conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_HEADER)) $usehtml+=1; $allmessage=''; if (! empty($conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_HEADER)) @@ -188,7 +188,7 @@ function envoi_mail($mode,$oldemail,$message,$total,$userlang) { $allmessage.=$conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_FOOTER; if (dol_textishtml($conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_FOOTER)) $usehtml+=1; - } + } $mail = new CMailFile( $subject, @@ -207,8 +207,8 @@ function envoi_mail($mode,$oldemail,$message,$total,$userlang) $mail->errors_to = $errorsto; // Send or not email - if ($mode == 'confirm') - { + if ($mode == 'confirm') + { $result=$mail->sendfile(); } else diff --git a/test/phpunit/AllTests.php b/test/phpunit/AllTests.php index 38d90d19fdf..b22dd5b1ea2 100644 --- a/test/phpunit/AllTests.php +++ b/test/phpunit/AllTests.php @@ -137,8 +137,8 @@ class AllTests $suite->addTestSuite('CompanyBankAccountTest'); require_once dirname(__FILE__).'/ChargeSocialesTest.php'; $suite->addTestSuite('ChargeSocialesTest'); - require_once dirname(__FILE__).'/HolidayTest.php'; - $suite->addTestSuite('HolidayTest'); + require_once dirname(__FILE__).'/HolidayTest.php'; + $suite->addTestSuite('HolidayTest'); require_once dirname(__FILE__).'/CategorieTest.php'; $suite->addTestSuite('CategorieTest'); @@ -147,12 +147,12 @@ class AllTests $suite->addTestSuite('WebservicesInvoicesTest'); require_once dirname(__FILE__).'/WebservicesOrdersTest.php'; $suite->addTestSuite('WebservicesOrdersTest'); - require_once dirname(__FILE__).'/WebservicesOtherTest.php'; - $suite->addTestSuite('WebservicesOtherTest'); - require_once dirname(__FILE__).'/WebservicesThirdpartyTest.php'; - $suite->addTestSuite('WebservicesThirdpartyTest'); - require_once dirname(__FILE__).'/WebservicesUserTest.php'; - $suite->addTestSuite('WebservicesUserTest'); + require_once dirname(__FILE__).'/WebservicesOtherTest.php'; + $suite->addTestSuite('WebservicesOtherTest'); + require_once dirname(__FILE__).'/WebservicesThirdpartyTest.php'; + $suite->addTestSuite('WebservicesThirdpartyTest'); + require_once dirname(__FILE__).'/WebservicesUserTest.php'; + $suite->addTestSuite('WebservicesUserTest'); require_once dirname(__FILE__).'/ExportTest.php'; $suite->addTestSuite('ExportTest'); diff --git a/test/phpunit/ContactTest.php b/test/phpunit/ContactTest.php index 2a920d0bb37..3f0beed9ba5 100755 --- a/test/phpunit/ContactTest.php +++ b/test/phpunit/ContactTest.php @@ -30,10 +30,10 @@ require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; require_once dirname(__FILE__).'/../../htdocs/contact/class/contact.class.php'; $langs->load("dict"); -if ($langs->defaultlang != 'en_US') -{ - print "Error: Default language for company to run tests must be set to en_US or auto. Current is ".$langs->defaultlang."\n"; - exit; +if ($langs->defaultlang != 'en_US') +{ + print "Error: Default language for company to run tests must be set to en_US or auto. Current is ".$langs->defaultlang."\n"; + exit; } if (empty($user->id)) diff --git a/test/phpunit/CoreTest.php b/test/phpunit/CoreTest.php index eba01ef016a..a59308f4628 100755 --- a/test/phpunit/CoreTest.php +++ b/test/phpunit/CoreTest.php @@ -126,10 +126,10 @@ class CoreTest extends PHPUnit_Framework_TestCase global $dolibarr_main_prod; global $dolibarr_main_url_root; - global $dolibarr_main_data_root; - global $dolibarr_main_document_root; - global $dolibarr_main_data_root_alt; - global $dolibarr_main_document_root_alt; + global $dolibarr_main_data_root; + global $dolibarr_main_document_root; + global $dolibarr_main_data_root_alt; + global $dolibarr_main_document_root_alt; global $dolibarr_main_db_host; global $dolibarr_main_db_port; global $dolibarr_main_db_type; diff --git a/test/phpunit/WebservicesInvoicesTest.php b/test/phpunit/WebservicesInvoicesTest.php index 17be4938ef5..65983390cfd 100755 --- a/test/phpunit/WebservicesInvoicesTest.php +++ b/test/phpunit/WebservicesInvoicesTest.php @@ -116,63 +116,63 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase print __METHOD__."\n"; } - - /** - * testWSInvoices_xxx - * - * @return int - */ - public function testWSInvoices_xxx() - { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; - - $WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_invoice.php'; - $WS_METHOD = 'xxx'; - $ns='http://www.dolibarr.org/ns/'; - - // Set the WebService URL - print __METHOD__."Create nusoap_client for URL=".$WS_DOL_URL."\n"; - $soapclient = new nusoap_client($WS_DOL_URL); - if ($soapclient) - { - $soapclient->soap_defencoding='UTF-8'; - $soapclient->decodeUTF8(false); - } - - // Call the WebService method and store its result in $result. - $authentication=array( - 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, - 'sourceapplication'=>'DEMO', - 'login'=>'admin', - 'password'=>'admin', - 'entity'=>''); - - // Test URL - if ($WS_METHOD) - { - $parameters = array('authentication'=>$authentication); - print __METHOD__."Call method ".$WS_METHOD."\n"; - $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); - if (! $result) - { - //var_dump($soapclient); - print $soapclient->error_str; - print "
    \n\n"; - print $soapclient->request; - print "
    \n\n"; - print $soapclient->response; - exit; - } - } - - print __METHOD__." result=".$result."\n"; - //$this->assertEquals('OK',$result['result']['result_code']); - - return $result; + + /** + * testWSInvoices_xxx + * + * @return int + */ + public function testWSInvoices_xxx() + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + $WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_invoice.php'; + $WS_METHOD = 'xxx'; + $ns='http://www.dolibarr.org/ns/'; + + // Set the WebService URL + print __METHOD__."Create nusoap_client for URL=".$WS_DOL_URL."\n"; + $soapclient = new nusoap_client($WS_DOL_URL); + if ($soapclient) + { + $soapclient->soap_defencoding='UTF-8'; + $soapclient->decodeUTF8(false); + } + + // Call the WebService method and store its result in $result. + $authentication=array( + 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, + 'sourceapplication'=>'DEMO', + 'login'=>'admin', + 'password'=>'admin', + 'entity'=>''); + + // Test URL + if ($WS_METHOD) + { + $parameters = array('authentication'=>$authentication); + print __METHOD__."Call method ".$WS_METHOD."\n"; + $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); + if (! $result) + { + //var_dump($soapclient); + print $soapclient->error_str; + print "
    \n\n"; + print $soapclient->request; + print "
    \n\n"; + print $soapclient->response; + exit; + } + } + + print __METHOD__." result=".$result."\n"; + //$this->assertEquals('OK',$result['result']['result_code']); + + return $result; } } diff --git a/test/phpunit/WebservicesOrdersTest.php b/test/phpunit/WebservicesOrdersTest.php index f14aa1db9f8..a4571557a48 100755 --- a/test/phpunit/WebservicesOrdersTest.php +++ b/test/phpunit/WebservicesOrdersTest.php @@ -116,242 +116,242 @@ class WebservicesOrdersTest extends PHPUnit_Framework_TestCase print __METHOD__."\n"; } - - /** - * testWSOrder_xxx - * - * @return int - */ - public function testWSOrder_xxx() - { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; - - $WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_order.php'; - $WS_METHOD = 'xxx'; - $ns='http://www.dolibarr.org/ns/'; - - // Set the WebService URL - print __METHOD__."Create nusoap_client for URL=".$WS_DOL_URL."\n"; - $soapclient = new nusoap_client($WS_DOL_URL); - if ($soapclient) - { - $soapclient->soap_defencoding='UTF-8'; - $soapclient->decodeUTF8(false); - } - - // Call the WebService method and store its result in $result. - $authentication=array( - 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, - 'sourceapplication'=>'DEMO', - 'login'=>'admin', - 'password'=>'admin', - 'entity'=>''); - - // Test URL - if ($WS_METHOD) - { - $parameters = array('authentication'=>$authentication); - print __METHOD__."Call method ".$WS_METHOD."\n"; - $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); - if (! $result) - { - //var_dump($soapclient); - print $soapclient->error_str; - print "
    \n\n"; - print $soapclient->request; - print "
    \n\n"; - print $soapclient->response; - exit; - } - } - - print __METHOD__." result=".$result."\n"; - //$this->assertEquals('OK',$result['result']['result_code']); - - return $result; + + /** + * testWSOrder_xxx + * + * @return int + */ + public function testWSOrder_xxx() + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + $WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_order.php'; + $WS_METHOD = 'xxx'; + $ns='http://www.dolibarr.org/ns/'; + + // Set the WebService URL + print __METHOD__."Create nusoap_client for URL=".$WS_DOL_URL."\n"; + $soapclient = new nusoap_client($WS_DOL_URL); + if ($soapclient) + { + $soapclient->soap_defencoding='UTF-8'; + $soapclient->decodeUTF8(false); + } + + // Call the WebService method and store its result in $result. + $authentication=array( + 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, + 'sourceapplication'=>'DEMO', + 'login'=>'admin', + 'password'=>'admin', + 'entity'=>''); + + // Test URL + if ($WS_METHOD) + { + $parameters = array('authentication'=>$authentication); + print __METHOD__."Call method ".$WS_METHOD."\n"; + $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); + if (! $result) + { + //var_dump($soapclient); + print $soapclient->error_str; + print "
    \n\n"; + print $soapclient->request; + print "
    \n\n"; + print $soapclient->response; + exit; + } + } + + print __METHOD__." result=".$result."\n"; + //$this->assertEquals('OK',$result['result']['result_code']); + + return $result; } - - /** - * testWSOther_GetVersions - * - * @return int - */ - public function testWSOther_GetVersions() - { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; - - $WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_other.php'; - $WS_METHOD = 'getVersions'; - $ns='http://www.dolibarr.org/ns/'; - - // Set the WebService URL - print __METHOD__."Create nusoap_client for URL=".$WS_DOL_URL."\n"; - $soapclient = new nusoap_client($WS_DOL_URL); - if ($soapclient) - { - $soapclient->soap_defencoding='UTF-8'; - $soapclient->decodeUTF8(false); - } - - // Call the WebService method and store its result in $result. - $authentication=array( - 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, - 'sourceapplication'=>'DEMO', - 'login'=>'admin', - 'password'=>'admin', - 'entity'=>''); - - // Test URL - if ($WS_METHOD) - { - $parameters = array('authentication'=>$authentication); - print __METHOD__."Call method ".$WS_METHOD."\n"; - $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); - if (! $result) - { - //var_dump($soapclient); - print $soapclient->error_str; - print "
    \n\n"; - print $soapclient->request; - print "
    \n\n"; - print $soapclient->response; - exit; - } - } - - print __METHOD__." result=".$result."\n"; - $this->assertEquals('OK',$result['result']['result_code']); - - return $result; - } + + /** + * testWSOther_GetVersions + * + * @return int + */ + public function testWSOther_GetVersions() + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + $WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_other.php'; + $WS_METHOD = 'getVersions'; + $ns='http://www.dolibarr.org/ns/'; + + // Set the WebService URL + print __METHOD__."Create nusoap_client for URL=".$WS_DOL_URL."\n"; + $soapclient = new nusoap_client($WS_DOL_URL); + if ($soapclient) + { + $soapclient->soap_defencoding='UTF-8'; + $soapclient->decodeUTF8(false); + } + + // Call the WebService method and store its result in $result. + $authentication=array( + 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, + 'sourceapplication'=>'DEMO', + 'login'=>'admin', + 'password'=>'admin', + 'entity'=>''); + + // Test URL + if ($WS_METHOD) + { + $parameters = array('authentication'=>$authentication); + print __METHOD__."Call method ".$WS_METHOD."\n"; + $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); + if (! $result) + { + //var_dump($soapclient); + print $soapclient->error_str; + print "
    \n\n"; + print $soapclient->request; + print "
    \n\n"; + print $soapclient->response; + exit; + } + } + + print __METHOD__." result=".$result."\n"; + $this->assertEquals('OK',$result['result']['result_code']); + + return $result; + } - /** - * testWSThirdparty - * - * @return int - */ - public function testWSThirdparty() - { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; - - $WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_thirdparty.php'; - $WS_METHOD = 'xxx'; - $ns='http://www.dolibarr.org/ns/'; - - // Set the WebService URL - print __METHOD__."Create nusoap_client for URL=".$WS_DOL_URL."\n"; - $soapclient = new nusoap_client($WS_DOL_URL); - if ($soapclient) - { - $soapclient->soap_defencoding='UTF-8'; - $soapclient->decodeUTF8(false); - } - - // Call the WebService method and store its result in $result. - $authentication=array( - 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, - 'sourceapplication'=>'DEMO', - 'login'=>'admin', - 'password'=>'admin', - 'entity'=>''); - - // Test URL - if ($WS_METHOD) - { - $parameters = array('authentication'=>$authentication); - print __METHOD__."Call method ".$WS_METHOD."\n"; - $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); - if (! $result) - { - //var_dump($soapclient); - print $soapclient->error_str; - print "
    \n\n"; - print $soapclient->request; - print "
    \n\n"; - print $soapclient->response; - exit; - } - } - - print __METHOD__." result=".$result."\n"; - //$this->assertEquals('OK',$result['result']['result_code']); - - return $result; - } - - - /** - * testWSUser - * - * @return int - */ - public function testWSUser() - { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; - - $WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_user.php'; - $WS_METHOD = 'xxx'; - $ns='http://www.dolibarr.org/ns/'; - - // Set the WebService URL - print __METHOD__."Create nusoap_client for URL=".$WS_DOL_URL."\n"; - $soapclient = new nusoap_client($WS_DOL_URL); - if ($soapclient) - { - $soapclient->soap_defencoding='UTF-8'; - $soapclient->decodeUTF8(false); - } - - // Call the WebService method and store its result in $result. - $authentication=array( - 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, - 'sourceapplication'=>'DEMO', - 'login'=>'admin', - 'password'=>'admin', - 'entity'=>''); - - // Test URL - if ($WS_METHOD) - { - $parameters = array('authentication'=>$authentication); - print __METHOD__."Call method ".$WS_METHOD."\n"; - $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); - if (! $result) - { - //var_dump($soapclient); - print $soapclient->error_str; - print "
    \n\n"; - print $soapclient->request; - print "
    \n\n"; - print $soapclient->response; - exit; - } - } - - print __METHOD__." result=".$result."\n"; - //$this->assertEquals('OK',$result['result']['result_code']); - - return $result; - } + /** + * testWSThirdparty + * + * @return int + */ + public function testWSThirdparty() + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + $WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_thirdparty.php'; + $WS_METHOD = 'xxx'; + $ns='http://www.dolibarr.org/ns/'; + + // Set the WebService URL + print __METHOD__."Create nusoap_client for URL=".$WS_DOL_URL."\n"; + $soapclient = new nusoap_client($WS_DOL_URL); + if ($soapclient) + { + $soapclient->soap_defencoding='UTF-8'; + $soapclient->decodeUTF8(false); + } + + // Call the WebService method and store its result in $result. + $authentication=array( + 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, + 'sourceapplication'=>'DEMO', + 'login'=>'admin', + 'password'=>'admin', + 'entity'=>''); + + // Test URL + if ($WS_METHOD) + { + $parameters = array('authentication'=>$authentication); + print __METHOD__."Call method ".$WS_METHOD."\n"; + $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); + if (! $result) + { + //var_dump($soapclient); + print $soapclient->error_str; + print "
    \n\n"; + print $soapclient->request; + print "
    \n\n"; + print $soapclient->response; + exit; + } + } + + print __METHOD__." result=".$result."\n"; + //$this->assertEquals('OK',$result['result']['result_code']); + + return $result; + } + + + /** + * testWSUser + * + * @return int + */ + public function testWSUser() + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + $WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_user.php'; + $WS_METHOD = 'xxx'; + $ns='http://www.dolibarr.org/ns/'; + + // Set the WebService URL + print __METHOD__."Create nusoap_client for URL=".$WS_DOL_URL."\n"; + $soapclient = new nusoap_client($WS_DOL_URL); + if ($soapclient) + { + $soapclient->soap_defencoding='UTF-8'; + $soapclient->decodeUTF8(false); + } + + // Call the WebService method and store its result in $result. + $authentication=array( + 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, + 'sourceapplication'=>'DEMO', + 'login'=>'admin', + 'password'=>'admin', + 'entity'=>''); + + // Test URL + if ($WS_METHOD) + { + $parameters = array('authentication'=>$authentication); + print __METHOD__."Call method ".$WS_METHOD."\n"; + $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); + if (! $result) + { + //var_dump($soapclient); + print $soapclient->error_str; + print "
    \n\n"; + print $soapclient->request; + print "
    \n\n"; + print $soapclient->response; + exit; + } + } + + print __METHOD__." result=".$result."\n"; + //$this->assertEquals('OK',$result['result']['result_code']); + + return $result; + } } ?> \ No newline at end of file diff --git a/test/phpunit/WebservicesOtherTest.php b/test/phpunit/WebservicesOtherTest.php index 14cb83488eb..e06477e7de9 100755 --- a/test/phpunit/WebservicesOtherTest.php +++ b/test/phpunit/WebservicesOtherTest.php @@ -116,64 +116,64 @@ class WebservicesOtherTest extends PHPUnit_Framework_TestCase print __METHOD__."\n"; } - - /** - * testWSOther_GetVersions - * - * @return int - */ - public function testWSOther_GetVersions() - { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; - - $WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_other.php'; - $WS_METHOD = 'getVersions'; - $ns='http://www.dolibarr.org/ns/'; - - // Set the WebService URL - print __METHOD__."Create nusoap_client for URL=".$WS_DOL_URL."\n"; - $soapclient = new nusoap_client($WS_DOL_URL); - if ($soapclient) - { - $soapclient->soap_defencoding='UTF-8'; - $soapclient->decodeUTF8(false); - } - - // Call the WebService method and store its result in $result. - $authentication=array( - 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, - 'sourceapplication'=>'DEMO', - 'login'=>'admin', - 'password'=>'admin', - 'entity'=>''); - - // Test URL - if ($WS_METHOD) - { - $parameters = array('authentication'=>$authentication); - print __METHOD__."Call method ".$WS_METHOD."\n"; - $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); - if (! $result) - { - //var_dump($soapclient); - print $soapclient->error_str; - print "
    \n\n"; - print $soapclient->request; - print "
    \n\n"; - print $soapclient->response; - exit; - } - } - - print __METHOD__." result=".$result."\n"; - $this->assertEquals('OK',$result['result']['result_code']); - - return $result; - } + + /** + * testWSOther_GetVersions + * + * @return int + */ + public function testWSOther_GetVersions() + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + $WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_other.php'; + $WS_METHOD = 'getVersions'; + $ns='http://www.dolibarr.org/ns/'; + + // Set the WebService URL + print __METHOD__."Create nusoap_client for URL=".$WS_DOL_URL."\n"; + $soapclient = new nusoap_client($WS_DOL_URL); + if ($soapclient) + { + $soapclient->soap_defencoding='UTF-8'; + $soapclient->decodeUTF8(false); + } + + // Call the WebService method and store its result in $result. + $authentication=array( + 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, + 'sourceapplication'=>'DEMO', + 'login'=>'admin', + 'password'=>'admin', + 'entity'=>''); + + // Test URL + if ($WS_METHOD) + { + $parameters = array('authentication'=>$authentication); + print __METHOD__."Call method ".$WS_METHOD."\n"; + $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); + if (! $result) + { + //var_dump($soapclient); + print $soapclient->error_str; + print "
    \n\n"; + print $soapclient->request; + print "
    \n\n"; + print $soapclient->response; + exit; + } + } + + print __METHOD__." result=".$result."\n"; + $this->assertEquals('OK',$result['result']['result_code']); + + return $result; + } } ?> \ No newline at end of file diff --git a/test/phpunit/WebservicesThirdpartyTest.php b/test/phpunit/WebservicesThirdpartyTest.php index 0d54a2d6434..b28ac8fa2d8 100755 --- a/test/phpunit/WebservicesThirdpartyTest.php +++ b/test/phpunit/WebservicesThirdpartyTest.php @@ -116,64 +116,64 @@ class WebservicesThirdpartyTest extends PHPUnit_Framework_TestCase print __METHOD__."\n"; } - - /** - * testWSThirdparty_xxx - * - * @return int - */ - public function testWSThirdparty_xxx() - { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; - - $WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_thirdparty.php'; - $WS_METHOD = 'xxx'; - $ns='http://www.dolibarr.org/ns/'; - - // Set the WebService URL - print __METHOD__."Create nusoap_client for URL=".$WS_DOL_URL."\n"; - $soapclient = new nusoap_client($WS_DOL_URL); - if ($soapclient) - { - $soapclient->soap_defencoding='UTF-8'; - $soapclient->decodeUTF8(false); - } - - // Call the WebService method and store its result in $result. - $authentication=array( - 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, - 'sourceapplication'=>'DEMO', - 'login'=>'admin', - 'password'=>'admin', - 'entity'=>''); - - // Test URL - if ($WS_METHOD) - { - $parameters = array('authentication'=>$authentication); - print __METHOD__."Call method ".$WS_METHOD."\n"; - $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); - if (! $result) - { - //var_dump($soapclient); - print $soapclient->error_str; - print "
    \n\n"; - print $soapclient->request; - print "
    \n\n"; - print $soapclient->response; - exit; - } - } - - print __METHOD__." result=".$result."\n"; - //$this->assertEquals('OK',$result['result']['result_code']); - - return $result; - } - + + /** + * testWSThirdparty_xxx + * + * @return int + */ + public function testWSThirdparty_xxx() + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + $WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_thirdparty.php'; + $WS_METHOD = 'xxx'; + $ns='http://www.dolibarr.org/ns/'; + + // Set the WebService URL + print __METHOD__."Create nusoap_client for URL=".$WS_DOL_URL."\n"; + $soapclient = new nusoap_client($WS_DOL_URL); + if ($soapclient) + { + $soapclient->soap_defencoding='UTF-8'; + $soapclient->decodeUTF8(false); + } + + // Call the WebService method and store its result in $result. + $authentication=array( + 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, + 'sourceapplication'=>'DEMO', + 'login'=>'admin', + 'password'=>'admin', + 'entity'=>''); + + // Test URL + if ($WS_METHOD) + { + $parameters = array('authentication'=>$authentication); + print __METHOD__."Call method ".$WS_METHOD."\n"; + $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); + if (! $result) + { + //var_dump($soapclient); + print $soapclient->error_str; + print "
    \n\n"; + print $soapclient->request; + print "
    \n\n"; + print $soapclient->response; + exit; + } + } + + print __METHOD__." result=".$result."\n"; + //$this->assertEquals('OK',$result['result']['result_code']); + + return $result; + } + } ?> \ No newline at end of file diff --git a/test/phpunit/WebservicesUserTest.php b/test/phpunit/WebservicesUserTest.php index 5cfa0f735f1..9ef2278015b 100755 --- a/test/phpunit/WebservicesUserTest.php +++ b/test/phpunit/WebservicesUserTest.php @@ -116,64 +116,64 @@ class WebservicesUserTest extends PHPUnit_Framework_TestCase print __METHOD__."\n"; } - - /** - * testWSUser_xxx - * - * @return int - */ - public function testWSUser_xxx() - { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; - - $WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_other.php'; - $WS_METHOD = 'xxx'; - $ns='http://www.dolibarr.org/ns/'; - - // Set the WebService URL - print __METHOD__."Create nusoap_client for URL=".$WS_DOL_URL."\n"; - $soapclient = new nusoap_client($WS_DOL_URL); - if ($soapclient) - { - $soapclient->soap_defencoding='UTF-8'; - $soapclient->decodeUTF8(false); - } - - // Call the WebService method and store its result in $result. - $authentication=array( - 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, - 'sourceapplication'=>'DEMO', - 'login'=>'admin', - 'password'=>'admin', - 'entity'=>''); - - // Test URL - if ($WS_METHOD) - { - $parameters = array('authentication'=>$authentication); - print __METHOD__."Call method ".$WS_METHOD."\n"; - $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); - if (! $result) - { - //var_dump($soapclient); - print $soapclient->error_str; - print "
    \n\n"; - print $soapclient->request; - print "
    \n\n"; - print $soapclient->response; - exit; - } - } - - print __METHOD__." result=".$result."\n"; - //$this->assertEquals('OK',$result['result']['result_code']); - - return $result; - } + + /** + * testWSUser_xxx + * + * @return int + */ + public function testWSUser_xxx() + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + $WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_other.php'; + $WS_METHOD = 'xxx'; + $ns='http://www.dolibarr.org/ns/'; + + // Set the WebService URL + print __METHOD__."Create nusoap_client for URL=".$WS_DOL_URL."\n"; + $soapclient = new nusoap_client($WS_DOL_URL); + if ($soapclient) + { + $soapclient->soap_defencoding='UTF-8'; + $soapclient->decodeUTF8(false); + } + + // Call the WebService method and store its result in $result. + $authentication=array( + 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, + 'sourceapplication'=>'DEMO', + 'login'=>'admin', + 'password'=>'admin', + 'entity'=>''); + + // Test URL + if ($WS_METHOD) + { + $parameters = array('authentication'=>$authentication); + print __METHOD__."Call method ".$WS_METHOD."\n"; + $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); + if (! $result) + { + //var_dump($soapclient); + print $soapclient->error_str; + print "
    \n\n"; + print $soapclient->request; + print "
    \n\n"; + print $soapclient->response; + exit; + } + } + + print __METHOD__." result=".$result."\n"; + //$this->assertEquals('OK',$result['result']['result_code']); + + return $result; + } } ?> \ No newline at end of file From ee7490a30acb94c0d2a819224260831179d418e3 Mon Sep 17 00:00:00 2001 From: Grand Philippe Date: Sat, 30 Mar 2013 14:31:10 +0100 Subject: [PATCH 078/194] fix : language error --- htdocs/langs/bg_BG/errors.lang | 2 +- htdocs/langs/ca_ES/errors.lang | 2 +- htdocs/langs/en_US/errors.lang | 2 +- htdocs/langs/es_ES/errors.lang | 2 +- htdocs/langs/fr_FR/errors.lang | 2 +- htdocs/product/admin/product_tools.php | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/langs/bg_BG/errors.lang b/htdocs/langs/bg_BG/errors.lang index 83d491cae38..9bf9742abdb 100644 --- a/htdocs/langs/bg_BG/errors.lang +++ b/htdocs/langs/bg_BG/errors.lang @@ -115,7 +115,7 @@ ErrorFileMustBeADolibarrPackage=Файлове %s трябва да бъде ц ErrorFileRequired=Отнема файла пакет Dolibarr ErrorPhpCurlNotInstalled=PHP навийте не е инсталиран, това е от съществено значение, за да разговаря с Paypal ErrorFailedToAddToMailmanList=Неуспешно добавяне на запис на пощальона списък или база СПИП -ErrorNewVaueCantMatchOldValue=Новата стойност не може да бъде равна на стария +ErrorNewValueCantMatchOldValue=Новата стойност не може да бъде равна на стария WarningMandatorySetupNotComplete=Задължителни параметри на настройката все още не са определени WarningSafeModeOnCheckExecDir=Внимание, PHP опция защитният режим е включен, така че командата трябва да бъдат съхранени в директория, декларирани с параметър PHP safe_mode_exec_dir. WarningAllowUrlFopenMustBeOn=Параметър allow_url_fopen трябва да бъде поставен в Filer php.ini за това, че този модул да работи напълно. Трябва да промените този файл ръчно. diff --git a/htdocs/langs/ca_ES/errors.lang b/htdocs/langs/ca_ES/errors.lang index 8fd41caa1ab..d6dce2cd433 100644 --- a/htdocs/langs/ca_ES/errors.lang +++ b/htdocs/langs/ca_ES/errors.lang @@ -116,7 +116,7 @@ ErrorFileMustBeADolibarrPackage=El fitxer %s ha de ser un paquet Dolibarr en for ErrorFileRequired=Es requereix un fitxer de paquet Dolibarr en format zip ErrorPhpCurlNotInstalled=L'extensió PHP CURL no es troba instal·lada, és indispensable per dialogar amb Paypal. ErrorFailedToAddToMailmanList=S'ha produït un error en intentar afegir un registre a la llista Mailman o base de dades SPIP -ErrorNewVaueCantMatchOldValue=El Nou valor no pot ser igual al antic +ErrorNewValueCantMatchOldValue=El Nou valor no pot ser igual al antic ErrorFailedToValidatePasswordReset=No s'ha pogut restablir la contrasenya. És possible que aquest enllaç ja s'hagi utilitzat (aquest enllaç només es pot utilitzar una vegada). Si no és el cas prova de reiniciar el procés de restabliment de contrasenya des del principi. # Warnings diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index a4c5251bb69..3c7ecb50274 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -115,7 +115,7 @@ ErrorFileMustBeADolibarrPackage=The file %s must be a Dolibarr zip package ErrorFileRequired=It takes a package Dolibarr file ErrorPhpCurlNotInstalled=The PHP CURL is not installed, this is essential to talk with Paypal ErrorFailedToAddToMailmanList=Failed to add record to Mailman list or SPIP base -ErrorNewVaueCantMatchOldValue=New value can't be equal to old one +ErrorNewValueCantMatchOldValue=New value can't be equal to old one ErrorFailedToValidatePasswordReset=Failed to reinit password. May be the reinit was already done (this link can be used only one time). If not, try to restart the reinit process. # Warnings diff --git a/htdocs/langs/es_ES/errors.lang b/htdocs/langs/es_ES/errors.lang index d3c39094ef3..5a5ce7639d6 100644 --- a/htdocs/langs/es_ES/errors.lang +++ b/htdocs/langs/es_ES/errors.lang @@ -116,7 +116,7 @@ ErrorFileMustBeADolibarrPackage=El archivo %s debe ser un paquete Dolibarr en fo ErrorFileRequired=Se requiere un archivo de paquete Dolibarr en formato zip ErrorPhpCurlNotInstalled=La extensión PHP CURL no se encuentra instalada, es indispensable para dialogar con Paypal. ErrorFailedToAddToMailmanList=Ha ocurrido un error al intentar añadir un registro a la lista Mailman o base de datos SPIP -ErrorNewVaueCantMatchOldValue=El nuevo valor no puede ser igual al antiguo +ErrorNewValueCantMatchOldValue=El nuevo valor no puede ser igual al antiguo ErrorFailedToValidatePasswordReset=No se ha podido restablecer la contraseña. Es posible que este enlace ya se haya utilizado (este enlace sólo puede usarse una vez). Si no es el caso, trate de reiniciar el proceso de restablecimiento de contraseña desde el principio. # Warnings diff --git a/htdocs/langs/fr_FR/errors.lang b/htdocs/langs/fr_FR/errors.lang index 3c7d1e275ed..bcc141dfdc6 100644 --- a/htdocs/langs/fr_FR/errors.lang +++ b/htdocs/langs/fr_FR/errors.lang @@ -116,7 +116,7 @@ ErrorFileMustBeADolibarrPackage=Le fichier doit être un package Dolibarr ErrorFileRequired=Il faut un fichier de package Dolibarr ErrorPhpCurlNotInstalled=L'extension PHP CURL n'est pas installée, ceci est indispensable pour dialoguer avec Paypal. ErrorFailedToAddToMailmanList=Echec de l'ajout à une liste Mailman ou base SPIP -ErrorNewVaueCantMatchOldValue=La nouvelle valeur ne peut être égale à l'ancienne +ErrorNewValueCantMatchOldValue=La nouvelle valeur ne peut être égale à l'ancienne ErrorFailedToValidatePasswordReset=Echec de la réinitialisation du mot de passe. Il est possible que ce lien ait déjà été utilisé (l'utilisation de ce lien ne fonctionne qu'une fois). Si ce n'est pas le cas, essayer de recommencer le processus de réinit de mot de passe depuis le début. # Warnings diff --git a/htdocs/product/admin/product_tools.php b/htdocs/product/admin/product_tools.php index d99ad64253d..3c17429e9c9 100644 --- a/htdocs/product/admin/product_tools.php +++ b/htdocs/product/admin/product_tools.php @@ -54,7 +54,7 @@ if ($action == 'convert') if ($oldvatrate == $newvatrate) { $langs->load("errors"); - setEventMessage($langs->trans("ErrorNewVaueCantMatchOldValue"),'errors'); + setEventMessage($langs->trans("ErrorNewValueCantMatchOldValue"),'errors'); $error++; } From 4208f11d8717744830fc546c3f19c0bd2399f5c4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 30 Mar 2013 15:57:54 +0100 Subject: [PATCH 079/194] Enhance fixutf8bomfiles and fixdosfiles tools. --- dev/findutf8bom.sh | 10 ------- dev/fixdosfiles.sh | 4 +-- dev/fixutf8bomfiles.sh | 33 ++++++++++++++++++++++ dev/removeutf8bom.sh | 15 ---------- htdocs/core/login/README.txt | 52 +++++++++++++++++------------------ htdocs/langs/pt_PT/admin.lang | 2 +- 6 files changed, 62 insertions(+), 54 deletions(-) delete mode 100755 dev/findutf8bom.sh create mode 100755 dev/fixutf8bomfiles.sh delete mode 100755 dev/removeutf8bom.sh diff --git a/dev/findutf8bom.sh b/dev/findutf8bom.sh deleted file mode 100755 index b7e290fec84..00000000000 --- a/dev/findutf8bom.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -# -# Checks if files contains UTF-8 BOM -# in dolibarr source tree excluding -# git repository, custom modules and incuded libraries -# -# Raphaël Doursenaud - rdoursenaud@gpcsolutions.fr -grep -rlI \ ---exclude-dir='.git' --exclude-dir='includes' --exclude-dir='custom' \ -$'\xEF\xBB\xBF' . diff --git a/dev/fixdosfiles.sh b/dev/fixdosfiles.sh index da1e1a12af5..ac4a305834c 100755 --- a/dev/fixdosfiles.sh +++ b/dev/fixdosfiles.sh @@ -16,13 +16,13 @@ fi # To detec if [ "x$1" = "xlist" ] then - find . -type f -iname "*.php" -exec file "{}" + | grep CRLF + find . -iname "*.php" -o -iname "*.sh" -o -iname "*.pl" -o -iname "*.lang" -o -iname "*.txt" -exec file "{}" + | grep -v 'htdocs\/includes' | grep CRLF fi # To convert if [ "x$1" = "xfix" ] then - for fic in `find . -type f -iname "*.php" -exec file "{}" + | grep CRLF | awk -F':' '{ print $1 }' ` + for fic in `find . -iname "*.php" -o -iname "*.sh" -o -iname "*.pl" -o -iname "*.lang" -o -iname "*.txt" -exec file "{}" + | grep -v 'htdocs\/includes' | grep CRLF | awk -F':' '{ print $1 }' ` do echo "Fix file $fic" dos2unix $fic diff --git a/dev/fixutf8bomfiles.sh b/dev/fixutf8bomfiles.sh new file mode 100755 index 00000000000..058c1c8a483 --- /dev/null +++ b/dev/fixutf8bomfiles.sh @@ -0,0 +1,33 @@ +#!/bin/sh +# +# Checks of fix files contains UTF-8 BOM in dolibarr source tree, +# excluding git repository, custom modules and included libraries. +# +# Raphaël Doursenaud - rdoursenaud@gpcsolutions.fr +# Laurent Destailleur eldy@users.sourceforge.net +#------------------------------------------------------ +# Usage: fixutf8bomfiles.sh [list|fix] +#------------------------------------------------------ + +# Syntax +if [ "x$1" != "xlist" -a "x$1" != "xfix" ] +then + echo "Usage: fixutf8bomfiles.sh [list|fix]" +fi + +# To detec +if [ "x$1" = "xlist" ] +then + #find . -iname '*.php' -print0 -o -iname '*.sh' -print0 -o -iname '*.pl' -print0 -o -iname '*.lang' -print0 -o -iname '*.txt' -print0 | xargs -0 awk '/^\xEF\xBB\xBF/ {print FILENAME} {nextfile}' + grep -rlIZ --include='*.php' --include='*.sh' --include='*.pl' --include='*.lang' --include='*.txt' --exclude-dir='.git' --exclude-dir='includes' --exclude-dir='custom' . . | xargs -0 awk '/^\xEF\xBB\xBF/ {print FILENAME} {nextfile}' +fi + +# To convert +if [ "x$1" = "xfix" ] +then + for fic in `grep -rlIZ --include='*.php' --include='*.sh' --include='*.pl' --include='*.lang' --include='*.txt' --exclude-dir='.git' --exclude-dir='includes' --exclude-dir='custom' . . | xargs -0 awk '/^\xEF\xBB\xBF/ {print FILENAME} {nextfile}'` + do + echo "Fixing $fic" + sed -i '1s/^\xEF\xBB\xBF//' $fic + done; +fi diff --git a/dev/removeutf8bom.sh b/dev/removeutf8bom.sh deleted file mode 100755 index 54924c51d49..00000000000 --- a/dev/removeutf8bom.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# -# Removes UTF-8 BOM from a file list on STDIN -# Use by piping the output of a findutf8bom script -# -# Raphaël Doursenaud - rdoursenaud@gpcsolutions.fr -# -# Example: -# cd dirwithfiles -# ls | /path/dev/removeutf8bom.sh - -while read f; do - echo "Fixing $f" - sed -i '1s/^\xEF\xBB\xBF//' $f -done diff --git a/htdocs/core/login/README.txt b/htdocs/core/login/README.txt index 7c00a86887f..8128dfacd57 100644 --- a/htdocs/core/login/README.txt +++ b/htdocs/core/login/README.txt @@ -1,26 +1,26 @@ -README (english) ---------------------------------------------- -Decription of htdocs/core/login directory ---------------------------------------------- - -This directory contains files that handle way to validate passwords. - -If you want to add a new password checker function, just add a file in -this directory that follow example of already existing files. -This file must be called for example : -functions_mypasschecker.php - -Edit function name to call it: -check_user_mypasschecker - -Change code of this function to return true if couple -$usertotest / $passwordtotest is ok for you. - -Then, you must edit you conf.php file to change the value of -$dolibarr_main_authentication -parameter to set it to : -mypasschecker - -Once this is done, when you log in to Dolibarr, the function -check_user_mypasschecker in this file is called. -If the function return true and login exists, login is accepted. +README (english) +--------------------------------------------- +Decription of htdocs/core/login directory +--------------------------------------------- + +This directory contains files that handle way to validate passwords. + +If you want to add a new password checker function, just add a file in +this directory that follow example of already existing files. +This file must be called for example : +functions_mypasschecker.php + +Edit function name to call it: +check_user_mypasschecker + +Change code of this function to return true if couple +$usertotest / $passwordtotest is ok for you. + +Then, you must edit you conf.php file to change the value of +$dolibarr_main_authentication +parameter to set it to : +mypasschecker + +Once this is done, when you log in to Dolibarr, the function +check_user_mypasschecker in this file is called. +If the function return true and login exists, login is accepted. diff --git a/htdocs/langs/pt_PT/admin.lang b/htdocs/langs/pt_PT/admin.lang index a3de0cb68dd..a1af76ae0c1 100644 --- a/htdocs/langs/pt_PT/admin.lang +++ b/htdocs/langs/pt_PT/admin.lang @@ -1,5 +1,5 @@ # Dolibarr language file - pt_PT - admin -CHARSET = UTF-8 +CHARSET = UTF-8 AccountCodeManager = Módulo de geração dos códigos contabilisticos (Clientes/Fornecedores) ActivateFCKeditor = Activar FCKeditor para : ActivateOn = Activar sobre From bd4e62a5e786d57bb5b5109247d5dbfbe4976502 Mon Sep 17 00:00:00 2001 From: jfefe Date: Sat, 30 Mar 2013 16:58:49 +0100 Subject: [PATCH 080/194] Implement extrafields : calendar on date type and new separator type --- htdocs/product/fiche.php | 109 +++++++++++++++++++++++++-------------- 1 file changed, 69 insertions(+), 40 deletions(-) diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php index 1ccc7e2c8b3..80a93028a05 100644 --- a/htdocs/product/fiche.php +++ b/htdocs/product/fiche.php @@ -56,6 +56,9 @@ if (! empty($user->societe_id)) $socid=$user->societe_id; $object = new Product($db); $extrafields = new ExtraFields($db); +// fetch optionals attributes and labels +$extralabels=$extrafields->fetch_name_optionals_label('product'); + if ($id > 0 || ! empty($ref)) { $object = new Product($db); @@ -212,14 +215,8 @@ if (empty($reshook)) } } - // Get extra fields - foreach($_POST as $key => $value) - { - if (preg_match("/^options_/",$key)) - { - $object->array_options[$key]=$_POST[$key]; - } - } + // Fill array 'array_options' with data from add form + $ret = $extrafields->setOptionalsFromPost($extralabels,$object); $id = $object->create($user); @@ -272,14 +269,8 @@ if (empty($reshook)) $object->finished = GETPOST('finished'); $object->hidden = GETPOST('hidden')=='yes'?1:0; - // Get extra fields - foreach($_POST as $key => $value) - { - if (preg_match("/^options_/",$key)) - { - $object->array_options[$key]=$_POST[$key]; - } - } + // Fill array 'array_options' with data from add form + $ret = $extrafields->setOptionalsFromPost($extralabels,$object); if ($object->check()) { @@ -632,9 +623,6 @@ if (GETPOST("cancel") == $langs->trans("Cancel")) * View */ -// fetch optionals attributes and labels -$extralabels=$extrafields->fetch_name_optionals_label('product'); - $helpurl=''; if (GETPOST("type") == '0') $helpurl='EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos'; if (GETPOST("type") == '1') $helpurl='EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios'; @@ -792,15 +780,29 @@ else $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if (empty($reshook) && ! empty($extrafields->attribute_label)) { - foreach($extrafields->attribute_label as $key=>$label) - { - $value=(GETPOST('options_'.$key)?GETPOST('options_'.$key):$object->array_options["options_".$key]); - print 'attribute_required[$key])) print ' class="fieldrequired"'; - print '>'.$label.''; - print $extrafields->showInputField($key,$value); - print ''."\n"; - } + foreach($extrafields->attribute_label as $key=>$label) + { + $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); + // Show separator only + if ($extrafields->attribute_type[$key] == 'separate') + { + print $extrafields->showSeparator($key); + } + else + { + // Convert date into timestamp format + if (in_array($extrafields->attribute_type[$key],array('date','datetime'))) + { + $value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$object->array_options['options_'.$key]; + } + + print 'attribute_required[$key])) print ' class="fieldrequired"'; + print '>'.$label.''; + print $extrafields->showInputField($key,$value); + print ''."\n"; + } + } } // Note (private, no output on invoices, propales...) @@ -1000,14 +1002,28 @@ else if (empty($reshook) && ! empty($extrafields->attribute_label)) { foreach($extrafields->attribute_label as $key=>$label) - { - $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); - print 'attribute_required[$key])) print ' class="fieldrequired"'; - print '>'.$label.''; - print $extrafields->showInputField($key,$value); - print ''."\n"; - } + { + $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); + // Show separator only + if ($extrafields->attribute_type[$key] == 'separate') + { + print $extrafields->showSeparator($key); + } + else + { + // Convert date into timestamp format + if (in_array($extrafields->attribute_type[$key],array('date','datetime'))) + { + $value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$object->array_options['options_'.$key]; + } + + print 'attribute_required[$key])) print ' class="fieldrequired"'; + print '>'.$label.''; + print $extrafields->showInputField($key,$value); + print ''."\n"; + } + } } // Note @@ -1230,13 +1246,26 @@ else $parameters=array('colspan' => ' colspan="'.(2+(($showphoto||$showbarcode)?1:0)).'"'); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if (empty($reshook) && ! empty($extrafields->attribute_label)) - { + { foreach($extrafields->attribute_label as $key=>$label) { + $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); - print ''.$label.''; - print $extrafields->showOutputField($key,$value); - print ''."\n"; + if ($extrafields->attribute_type[$key] == 'separate') + { + print $extrafields->showSeparator($key); + } + else + { + // Convert date into timestamp format + if (in_array($extrafields->attribute_type[$key],array('date','datetime'))) + { + $value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$object->array_options['options_'.$key]; + } + print ''.$label.''; + print $extrafields->showOutputField($key,$value); + print ''."\n"; + } } } From 3fe1b261368f30c674045155fd02f4d7cbb28f94 Mon Sep 17 00:00:00 2001 From: jfefe Date: Sat, 30 Mar 2013 17:43:21 +0100 Subject: [PATCH 081/194] New method to CommonObject to display extrafields data output Try for product --- htdocs/core/class/commonobject.class.php | 38 ++++++++++++++++++++++++ htdocs/product/fiche.php | 21 +------------ 2 files changed, 39 insertions(+), 20 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index b128455b8ff..af5122adbc3 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2189,6 +2189,44 @@ abstract class CommonObject } else return 0; } + + /** + * Function to show lines of extrafields with output datas + * + * @param object $extrafields extrafield Object + * + * return string + */ + function showOptionals($extrafields) + { + global $_POST; + + $out = ''; + + if (! empty($this->array_options)) + { + foreach($extrafields->attribute_label as $key=>$label) + { + $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$this->array_options["options_".$key]); + if ($extrafields->attribute_type[$key] == 'separate') + { + $out = $extrafields->showSeparator($key); + } + else + { + // Convert date into timestamp format + if (in_array($extrafields->attribute_type[$key],array('date','datetime'))) + { + $value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$this->array_options['options_'.$key]; + } + $out .= ''.$label.''; + $out .= $extrafields->showOutputField($key,$value); + $out .= ''."\n"; + } + } + } + return $out; + } /** diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php index 80a93028a05..98a6c35aa09 100644 --- a/htdocs/product/fiche.php +++ b/htdocs/product/fiche.php @@ -1247,26 +1247,7 @@ else $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if (empty($reshook) && ! empty($extrafields->attribute_label)) { - foreach($extrafields->attribute_label as $key=>$label) - { - - $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); - if ($extrafields->attribute_type[$key] == 'separate') - { - print $extrafields->showSeparator($key); - } - else - { - // Convert date into timestamp format - if (in_array($extrafields->attribute_type[$key],array('date','datetime'))) - { - $value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$object->array_options['options_'.$key]; - } - print ''.$label.''; - print $extrafields->showOutputField($key,$value); - print ''."\n"; - } - } + print $object->showOptionals($extrafields); } // Note From 1ab1d74c77b10af35f191b61a7bf25ac245b770f Mon Sep 17 00:00:00 2001 From: jfefe Date: Sat, 30 Mar 2013 17:52:59 +0100 Subject: [PATCH 082/194] New option (MAIN_EXTRAFIELDS_USE_TWO_COLUMS) to split extrafields display into 2 columns --- htdocs/core/class/commonobject.class.php | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index af5122adbc3..f9a1bad9ef7 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2205,8 +2205,10 @@ abstract class CommonObject if (! empty($this->array_options)) { + $e = 0; foreach($extrafields->attribute_label as $key=>$label) { + $colspan='3'; $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$this->array_options["options_".$key]); if ($extrafields->attribute_type[$key] == 'separate') { @@ -2214,14 +2216,28 @@ abstract class CommonObject } else { + if ( !empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0) + { + $out .= ''; + $colspan='0'; + } + else + { + $out .= ''; + } // Convert date into timestamp format if (in_array($extrafields->attribute_type[$key],array('date','datetime'))) { $value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$this->array_options['options_'.$key]; } - $out .= ''.$label.''; + $out .= ''.$label.''; + $out .=''; $out .= $extrafields->showOutputField($key,$value); - $out .= ''."\n"; + $out .= ''."\n"; + + if (! empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && (($e % 2) == 1)) $out .= ''; + else $out .= ''; + $e++; } } } From 000fe2c864a13f0472e6a85f3d67610764c6a937 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 30 Mar 2013 18:04:33 +0100 Subject: [PATCH 083/194] New: Better error management for add/remove of memeber into mailman. --- htdocs/adherents/class/adherent.class.php | 37 ++++++++++++++++--- htdocs/adherents/fiche.php | 21 ++++++++--- htdocs/langs/en_US/errors.lang | 3 +- htdocs/langs/en_US/mailmanspip.lang | 4 +- htdocs/langs/fr_FR/errors.lang | 3 +- htdocs/langs/fr_FR/mailmanspip.lang | 3 ++ .../mailmanspip/class/mailmanspip.class.php | 26 ++++++++++++- 7 files changed, 81 insertions(+), 16 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 3527535809b..f222d6e63e5 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -41,6 +41,10 @@ class Adherent extends CommonObject public $table_element='adherent'; protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + var $error; + var $errors; + var $mesgs; + var $id; var $ref; var $civilite_id; @@ -1370,10 +1374,10 @@ class Adherent extends CommonObject */ function add_to_abo() { - global $conf; + global $conf,$langs; include_once DOL_DOCUMENT_ROOT.'/mailmanspip/class/mailmanspip.class.php'; - $mailmanspip=new MailmanSpip($db); + $mailmanspip=new MailmanSpip($this->db); $err=0; @@ -1386,6 +1390,16 @@ class Adherent extends CommonObject $this->error=$mailmanspip->error; $err+=1; } + foreach ($mailmanspip->mladded_ko as $tmplist => $tmpemail) + { + $langs->load("errors"); + $this->errors[]=$langs->trans("ErrorFailedToAddToMailmanList",$tmpemail,$tmplist); + } + foreach ($mailmanspip->mladded_ok as $tmplist => $tmpemail) + { + $langs->load("mailmanspip"); + $this->mesgs[]=$langs->trans("SuccessToAddToMailmanList",$tmpemail,$tmplist); + } } // spip @@ -1400,11 +1414,10 @@ class Adherent extends CommonObject } if ($err) { - // error return -$err; } else - { + { return 1; } } @@ -1418,10 +1431,10 @@ class Adherent extends CommonObject */ function del_to_abo() { - global $conf; + global $conf,$langs; include_once DOL_DOCUMENT_ROOT.'/mailmanspip/class/mailmanspip.class.php'; - $mailmanspip=new MailmanSpip($db); + $mailmanspip=new MailmanSpip($this->db); $err=0; @@ -1431,8 +1444,20 @@ class Adherent extends CommonObject $result=$mailmanspip->del_to_mailman($this); if ($result < 0) { + $this->error=$mailmanspip->error; $err+=1; } + + foreach ($mailmanspip->mlremoved_ko as $tmplist => $tmpemail) + { + $langs->load("errors"); + $this->errors[]=$langs->trans("ErrorFailedToRemoveToMailmanList",$tmpemail,$tmplist); + } + foreach ($mailmanspip->mlremoved_ok as $tmplist => $tmpemail) + { + $langs->load("mailmanspip"); + $this->mesgs[]=$langs->trans("SuccessToRemoveToMailmanList",$tmpemail,$tmplist); + } } if ($conf->global->ADHERENT_USE_SPIP && ! empty($conf->mailmanspip->enabled)) diff --git a/htdocs/adherents/fiche.php b/htdocs/adherents/fiche.php index 787cad2664f..d34da06987d 100644 --- a/htdocs/adherents/fiche.php +++ b/htdocs/adherents/fiche.php @@ -356,15 +356,24 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->adherent->creer) { if ($object->oldcopy->del_to_abo() < 0) { - // error - $errmsgs[]= $langs->trans("FailedToCleanMailmanList").': '.$object->error."
    \n"; + if (! empty($object->oldcopy->error)) setEventMessage($langs->trans("ErrorFailedToRemoveToMailmanList").': '.$object->oldcopy->error, 'errors'); + setEventMessage($object->oldcopy->errors, 'errors'); + } + else + { + setEventMessage($object->oldcopy->mesgs,'mesgs'); } } - if ($object->add_to_abo() < 0) // We add subscription if new email or new type (new type may means more mailing-list to subscribe) + // We add subscription if new email or new type (new type may means more mailing-list to subscribe) + if ($object->add_to_abo() < 0) + { + if (! empty($object->error)) setEventMessage($langs->trans("ErrorFailedToAddToMailmanList").': '.$object->error, 'errors'); + setEventMessage($object->errors, 'errors'); + } + else { - // error - $errmsgs[]= $langs->trans("FailedToAddToMailmanList").': '.$object->error."
    \n"; - } + setEventMessage($object->mesgs, 'mesgs'); + } } $rowid=$object->id; diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 3c7ecb50274..d66449ecf5d 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -114,7 +114,8 @@ ErrNoZipEngine=No engine to unzip %s file in this PHP ErrorFileMustBeADolibarrPackage=The file %s must be a Dolibarr zip package ErrorFileRequired=It takes a package Dolibarr file ErrorPhpCurlNotInstalled=The PHP CURL is not installed, this is essential to talk with Paypal -ErrorFailedToAddToMailmanList=Failed to add record to Mailman list or SPIP base +ErrorFailedToAddToMailmanList=Failed to add record %s to Mailman list %s or SPIP base +ErrorFailedToRemoveToMailmanList=Failed to remove record %s to Mailman list %s or SPIP base ErrorNewValueCantMatchOldValue=New value can't be equal to old one ErrorFailedToValidatePasswordReset=Failed to reinit password. May be the reinit was already done (this link can be used only one time). If not, try to restart the reinit process. diff --git a/htdocs/langs/en_US/mailmanspip.lang b/htdocs/langs/en_US/mailmanspip.lang index 18f1a684c7a..50887cc082e 100644 --- a/htdocs/langs/en_US/mailmanspip.lang +++ b/htdocs/langs/en_US/mailmanspip.lang @@ -23,4 +23,6 @@ AddIntoSpipError=Failed to add the user in SPIP DeleteIntoSpip=Remove from SPIP DeleteIntoSpipConfirmation=Are you sure you want to remove this member from SPIP? DeleteIntoSpipError=Failed to suppress the user from SPIP -SPIPConnectionFailed=Failed to connect to SPIP \ No newline at end of file +SPIPConnectionFailed=Failed to connect to SPIP +SuccessToAddToMailmanList=Add of %s to mailman list %s or SPIP database done +SuccessToRemoveToMailmanList=Removal of %s from mailman list %s or SPIP database done \ No newline at end of file diff --git a/htdocs/langs/fr_FR/errors.lang b/htdocs/langs/fr_FR/errors.lang index bcc141dfdc6..8110d224355 100644 --- a/htdocs/langs/fr_FR/errors.lang +++ b/htdocs/langs/fr_FR/errors.lang @@ -115,7 +115,8 @@ ErrNoZipEngine=Pas de moteur pour décompresser le fichier %s dans ce PHP ErrorFileMustBeADolibarrPackage=Le fichier doit être un package Dolibarr ErrorFileRequired=Il faut un fichier de package Dolibarr ErrorPhpCurlNotInstalled=L'extension PHP CURL n'est pas installée, ceci est indispensable pour dialoguer avec Paypal. -ErrorFailedToAddToMailmanList=Echec de l'ajout à une liste Mailman ou base SPIP +ErrorFailedToAddToMailmanList=Echec de l'ajout de %s à la liste Mailman %s ou base SPIP +ErrorFailedToRemoveToMailmanList=Echec de la suppression de %s de la liste Mailman %s ou base SPIP ErrorNewValueCantMatchOldValue=La nouvelle valeur ne peut être égale à l'ancienne ErrorFailedToValidatePasswordReset=Echec de la réinitialisation du mot de passe. Il est possible que ce lien ait déjà été utilisé (l'utilisation de ce lien ne fonctionne qu'une fois). Si ce n'est pas le cas, essayer de recommencer le processus de réinit de mot de passe depuis le début. diff --git a/htdocs/langs/fr_FR/mailmanspip.lang b/htdocs/langs/fr_FR/mailmanspip.lang index ac88688a3bd..3f27ae0d9c9 100644 --- a/htdocs/langs/fr_FR/mailmanspip.lang +++ b/htdocs/langs/fr_FR/mailmanspip.lang @@ -23,3 +23,6 @@ DeleteIntoSpip=Supprimer de spip DeleteIntoSpipConfirmation=Êtes-vous sur de vouloir effacer cet adhérent de SPIP? DeleteIntoSpipError=Échec de la suppression de l'utilisateur de SPIP SPIPConnectionFailed=Échec de connexion à SPIP +SuccessToAddToMailmanList=Ajout de %s à la liste Mailman %s ou base SPIP réalisé +SuccessToRemoveToMailmanList=Suppression de %s de la liste Mailman %s ou base SPIP réalisé + diff --git a/htdocs/mailmanspip/class/mailmanspip.class.php b/htdocs/mailmanspip/class/mailmanspip.class.php index 9e10c315dfa..5a015ba1c64 100644 --- a/htdocs/mailmanspip/class/mailmanspip.class.php +++ b/htdocs/mailmanspip/class/mailmanspip.class.php @@ -40,6 +40,11 @@ class MailmanSpip var $db; var $error; + var $mladded_ok; + var $mladded_ko; + var $mlremoved_ok; + var $mlremoved_ko; + /** * Constructor @@ -299,6 +304,9 @@ class MailmanSpip dol_syslog(get_class($this)."::add_to_mailman"); + $this->mladded_ok=array(); + $this->mladded_ko=array(); + if (! function_exists("curl_init")) { $langs->load("errors"); @@ -335,13 +343,15 @@ class MailmanSpip if ($result === false) { + $this->mladded_ko[$list]=$object->email; return -2; } + else $this->mladded_ok[$list]=$object->email; } return count($lists); } else - { + { $this->error="ADHERENT_MAILMAN_URL not defined"; return -1; } @@ -359,6 +369,18 @@ class MailmanSpip { global $conf,$langs,$user; + dol_syslog(get_class($this)."::del_to_mailman"); + + $this->mlremoved_ok=array(); + $this->mlremoved_ko=array(); + + if (! function_exists("curl_init")) + { + $langs->load("errors"); + $this->error=$langs->trans("ErrorFunctionNotAvailableInPHP","curl_init"); + return -1; + } + if (! empty($conf->global->ADHERENT_MAILMAN_UNSUB_URL)) { if ($listes=='' && ! empty($conf->global->ADHERENT_MAILMAN_LISTS)) @@ -388,8 +410,10 @@ class MailmanSpip if ($result === false) { + $this->mlremoved_ko[$list]=$object->email; return -2; } + else $this->mlremoved_ok[$list]=$object->email; } return count($lists); } From 2b587e1742fbdf7baabbac86882361a00002c3af Mon Sep 17 00:00:00 2001 From: jfefe Date: Sat, 30 Mar 2013 18:54:51 +0100 Subject: [PATCH 084/194] For thirdparty use new method to display extrafield values --- htdocs/societe/soc.php | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 0972d93f26a..5b3106afa0d 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -1761,31 +1761,7 @@ else $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if (empty($reshook) && ! empty($extrafields->attribute_label)) { - $e=0; - foreach($extrafields->attribute_label as $key=>$label) - { - $colspan='3'; - $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:(isset($object->array_options['options_'.$key])?$object->array_options['options_'.$key]:'')); - if ($extrafields->attribute_type[$key] == 'separate') - { - print $extrafields->showSeparator($key); - } - else - { - if (($e % 2) == 0) - { - print ''; - $colspan='0'; - } - print ''.$label.''; - print ''; - print $extrafields->showOutputField($key,$value); - print ""; - - if (($e % 2) == 1) print ''; - $e++; - } - } + print $object->showOptionals($extrafields); } // Ban From 4c1f17f42f4e802e1ce1f3611410151e24e7e576 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 30 Mar 2013 19:11:52 +0100 Subject: [PATCH 085/194] Qual: More robust error management for menu description --- htdocs/core/modules/DolibarrModules.class.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 80becf69573..1885662a512 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -433,7 +433,7 @@ abstract class DolibarrModules if (is_resource($handle)) { $dirfound++; - + // Run llx_mytable.sql files while (($file = readdir($handle))!==false) { @@ -443,7 +443,7 @@ abstract class DolibarrModules if ($result <= 0) $error++; } } - + rewinddir($handle); // Run llx_mytable.key.sql files (Must be done after llx_mytable.sql) @@ -457,7 +457,7 @@ abstract class DolibarrModules } rewinddir($handle); - + // Run data_xxx.sql files (Must be done after llx_mytable.key.sql) while (($file = readdir($handle))!==false) { @@ -467,9 +467,9 @@ abstract class DolibarrModules if ($result <= 0) $error++; } } - + rewinddir($handle); - + // Run update_xxx.sql files while (($file = readdir($handle))!==false) { @@ -479,7 +479,7 @@ abstract class DolibarrModules if ($result <= 0) $error++; } } - + closedir($handle); } @@ -990,7 +990,7 @@ abstract class DolibarrModules //print 'xxx'.$this->menu[$key]['fk_menu'];exit; $foundparent=0; $fk_parent=$this->menu[$key]['fk_menu']; - if (preg_match('/r=/',$fk_parent)) + if (preg_match('/^r=/',$fk_parent)) // old deprecated method { $fk_parent=str_replace('r=','',$fk_parent); if (isset($this->menu[$fk_parent]['rowid'])) @@ -999,14 +999,14 @@ abstract class DolibarrModules $foundparent=1; } } - elseif (preg_match('/fk_mainmenu=(.*),fk_leftmenu=(.*)/',$fk_parent,$reg)) + elseif (preg_match('/^fk_mainmenu=([a-zA-Z0-9_]+),fk_leftmenu=([a-zA-Z0-9_]+)$/',$fk_parent,$reg)) { $menu->fk_menu=-1; $menu->fk_mainmenu=$reg[1]; $menu->fk_leftmenu=$reg[2]; $foundparent=1; } - elseif (preg_match('/fk_mainmenu=(.*)/',$fk_parent,$reg)) + elseif (preg_match('/^fk_mainmenu=([a-zA-Z0-9_]+)$/',$fk_parent,$reg)) { $menu->fk_menu=-1; $menu->fk_mainmenu=$reg[1]; From fe895adb95732d334ebeb0837e69e4c956cd7e33 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 30 Mar 2013 19:37:09 +0100 Subject: [PATCH 086/194] Fix: Bad div --- htdocs/categories/index.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php index aeed1760f00..4e9f376977c 100644 --- a/htdocs/categories/index.php +++ b/htdocs/categories/index.php @@ -121,12 +121,13 @@ if ($catname || $id > 0) } print ""; } +else print ' '; //print ''; -print '
    '; +print ''; -print '
    '; +print '

    '; // Charge tableau des categories @@ -187,6 +188,7 @@ else print ""; +print '
    '; llxFooter(); From f52fe71018286ee5d469d60276f7b26976f92529 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 30 Mar 2013 19:40:52 +0100 Subject: [PATCH 087/194] Fix: Bad div closing --- htdocs/adherents/index.php | 2 +- htdocs/comm/index.php | 2 +- htdocs/comm/mailing/index.php | 2 +- htdocs/comm/propal/index.php | 2 +- htdocs/comm/prospect/index.php | 2 +- htdocs/commande/index.php | 2 +- htdocs/compta/index.php | 2 +- htdocs/compta/paiement/cheque/index.php | 2 +- htdocs/compta/prelevement/index.php | 2 +- htdocs/compta/ventilation/index.php | 2 +- htdocs/contrat/index.php | 2 +- htdocs/expedition/index.php | 2 +- htdocs/fourn/index.php | 2 +- htdocs/product/index.php | 2 +- htdocs/product/stock/index.php | 2 +- htdocs/societe/index.php | 2 +- htdocs/user/home.php | 2 +- 17 files changed, 17 insertions(+), 17 deletions(-) diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php index fc5994f3086..27b3403efa0 100644 --- a/htdocs/adherents/index.php +++ b/htdocs/adherents/index.php @@ -419,7 +419,7 @@ print "\n"; print "
    \n"; //print ''; -print '
    '; +print ''; llxFooter(); diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index d3acdd87593..48a07dcacba 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -546,7 +546,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire) //print ''; -print '
    '; +print ''; llxFooter(); diff --git a/htdocs/comm/mailing/index.php b/htdocs/comm/mailing/index.php index fd12402f050..8ef75c9712d 100644 --- a/htdocs/comm/mailing/index.php +++ b/htdocs/comm/mailing/index.php @@ -201,7 +201,7 @@ else //print ''; -print '
    '; +print ''; if ($langs->file_exists("html/spam.html",0)) { diff --git a/htdocs/comm/propal/index.php b/htdocs/comm/propal/index.php index 6347f68c87a..971f6d10a86 100644 --- a/htdocs/comm/propal/index.php +++ b/htdocs/comm/propal/index.php @@ -513,7 +513,7 @@ if (! empty($conf->propal->enabled)) */ //print ''; -print '
    '; +print ''; llxFooter(); diff --git a/htdocs/comm/prospect/index.php b/htdocs/comm/prospect/index.php index e08228b5c61..e6496c32a58 100644 --- a/htdocs/comm/prospect/index.php +++ b/htdocs/comm/prospect/index.php @@ -279,7 +279,7 @@ if ($resql) //print ''; -print '
    '; +print ''; llxFooter(); diff --git a/htdocs/commande/index.php b/htdocs/commande/index.php index cb6e85ac117..e0e2e09df73 100644 --- a/htdocs/commande/index.php +++ b/htdocs/commande/index.php @@ -425,7 +425,7 @@ if (! empty($conf->commande->enabled)) //print ''; -print '
    '; +print ''; llxFooter(); diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 925e55f02fc..ec2dc5997e2 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -1033,7 +1033,7 @@ if ($resql) } //print ''; -print '
    '; +print ''; llxFooter(); diff --git a/htdocs/compta/paiement/cheque/index.php b/htdocs/compta/paiement/cheque/index.php index ac67e103a82..b3ccf19ae19 100644 --- a/htdocs/compta/paiement/cheque/index.php +++ b/htdocs/compta/paiement/cheque/index.php @@ -146,7 +146,7 @@ else //print "\n"; -print '
    '; +print ''; llxFooter(); diff --git a/htdocs/compta/prelevement/index.php b/htdocs/compta/prelevement/index.php index 916c3fccec5..100a6eb0861 100644 --- a/htdocs/compta/prelevement/index.php +++ b/htdocs/compta/prelevement/index.php @@ -221,7 +221,7 @@ else //print ''; -print '
    '; +print ''; llxFooter(); diff --git a/htdocs/compta/ventilation/index.php b/htdocs/compta/ventilation/index.php index 316f5c41e1e..f98b3ed7ac1 100644 --- a/htdocs/compta/ventilation/index.php +++ b/htdocs/compta/ventilation/index.php @@ -94,7 +94,7 @@ if ($resql) print "\n"; //print ''; -print '
    '; +print ''; llxFooter(); diff --git a/htdocs/contrat/index.php b/htdocs/contrat/index.php index bd35af4d55b..2e9ab1b1cb6 100644 --- a/htdocs/contrat/index.php +++ b/htdocs/contrat/index.php @@ -604,7 +604,7 @@ else //print ''; -print '
    '; +print ''; llxFooter(); diff --git a/htdocs/expedition/index.php b/htdocs/expedition/index.php index 961365ca15e..1d4fc31d706 100644 --- a/htdocs/expedition/index.php +++ b/htdocs/expedition/index.php @@ -275,7 +275,7 @@ else dol_print_error($db); //print ''; -print '
    '; +print ''; llxFooter(); diff --git a/htdocs/fourn/index.php b/htdocs/fourn/index.php index a4a9e06ccef..25f781ccf0d 100644 --- a/htdocs/fourn/index.php +++ b/htdocs/fourn/index.php @@ -321,7 +321,7 @@ if (count($companystatic->SupplierCategories)) //print "\n"; -print '
    '; +print ''; llxFooter(); diff --git a/htdocs/product/index.php b/htdocs/product/index.php index 8e3c3e795fd..e973516f5f9 100644 --- a/htdocs/product/index.php +++ b/htdocs/product/index.php @@ -259,7 +259,7 @@ else } //print ''; -print '
    '; +print ''; llxFooter(); diff --git a/htdocs/product/stock/index.php b/htdocs/product/stock/index.php index beb4c7829ba..a25e1e4357d 100644 --- a/htdocs/product/stock/index.php +++ b/htdocs/product/stock/index.php @@ -164,7 +164,7 @@ if ($resql) } //print ''; -print '
    '; +print ''; llxFooter(); diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php index 74d8b74c4d4..90513c239de 100644 --- a/htdocs/societe/index.php +++ b/htdocs/societe/index.php @@ -249,7 +249,7 @@ else } //print ''; -print '
    '; +print ''; llxFooter(); diff --git a/htdocs/user/home.php b/htdocs/user/home.php index 8c2de389a39..537a4671b5a 100644 --- a/htdocs/user/home.php +++ b/htdocs/user/home.php @@ -254,7 +254,7 @@ if ($canreadperms) } //print ''; -print '
    '; +print ''; llxFooter(); From 0b9602e4e6373136fad124f6a7ffdd14a91bacd8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 30 Mar 2013 20:32:50 +0100 Subject: [PATCH 088/194] Optionnal entries at end --- htdocs/main.inc.php | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index d94fcab199d..3f3695c7d27 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1516,6 +1516,19 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me print "\n"; } + //Dolibarr version + $doliurl='http://www.dolibarr.org'; + $appli='Dolibarr'; + if (! empty($conf->global->MAIN_APPLICATION_TITLE)) { + $appli=$conf->global->MAIN_APPLICATION_TITLE; $doliurl=''; + } + $appli.=" ".DOL_VERSION; + print '
    '; + if ($doliurl) print ''; + print $appli; + if ($doliurlx) print ''; + print '
    '; + // Link to Dolibarr wiki pages if ($helppagename && empty($conf->global->MAIN_HELP_DISABLELINK)) { @@ -1566,18 +1579,6 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me } print "\n"; - //Dolibarr version - $doliurl='http://www.dolibarr.org'; - $appli='Dolibarr'; - if (! empty($conf->global->MAIN_APPLICATION_TITLE)) { $appli=$conf->global->MAIN_APPLICATION_TITLE; $doliurl=''; } - $appli.=" ".DOL_VERSION; - - print '
    '; - if ($doliurl) print ''; - print $appli; - if ($doliurlx) print ''; - print '
    '; - print "\n"; print "\n"; From 79f40f27b31a3f693fd94d4d757ee57e3a1d01cf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 30 Mar 2013 20:33:42 +0100 Subject: [PATCH 089/194] Removed entry specific to external module --- htdocs/theme/eldy/style.css.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 0cd62a11591..eb5d6b058f6 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -596,10 +596,6 @@ div.mainmenu.companies { background-image: url(); } -div.mainmenu.contacts { - background-image: url(); -} - div.mainmenu.commercial { background-image: url(); } @@ -2543,7 +2539,7 @@ div.dolEventError h1, div.dolEventError h2 { background-image: -ms-linear-gradient(top,#fdfdfd,#aaa) !important; background-image: -o-linear-gradient(top,#fdfdfd,#aaa) !important; background-image: linear-gradient(top,#fdfdfd,#aaa) !important; -} +} .ui-bar-b .ui-link { border: none; font-weight: bold !important; From ef571de960ae7d506588b2aabc10b0734b537baa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 30 Mar 2013 20:34:13 +0100 Subject: [PATCH 090/194] New: Support __USERID__ into menu entries --- htdocs/core/menus/standard/auguria.lib.php | 8 +++++--- htdocs/core/menus/standard/eldy.lib.php | 6 +++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php index ebf70b6d9c9..068ff241f49 100644 --- a/htdocs/core/menus/standard/auguria.lib.php +++ b/htdocs/core/menus/standard/auguria.lib.php @@ -76,7 +76,9 @@ function print_auguria_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0) } $url=preg_replace('/__LOGIN__/',$user->login,$url); $shorturl=preg_replace('/__LOGIN__/',$user->login,$shorturl); - + $url=preg_replace('/__USERID__/',$user->id,$url); + $shorturl=preg_replace('/__USERID__/',$user->id,$shorturl); + // Define the class (top menu selected or not) if (! empty($_SESSION['idmenu']) && $newTabMenu[$i]['rowid'] == $_SESSION['idmenu']) $classname='class="tmenusel"'; else if (! empty($_SESSION["mainmenu"]) && $newTabMenu[$i]['mainmenu'] == $_SESSION["mainmenu"]) $classname='class="tmenusel"'; @@ -256,7 +258,7 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM { $showmenu=true; if (! empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED) && empty($menu_array[$i]['enabled'])) $showmenu=false; - + $alt++; if (empty($menu_array[$i]['level']) && $showmenu) { @@ -335,7 +337,7 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM } } } - + return count($menu_array); } diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 42ab594b387..34ac773b1d1 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -280,6 +280,8 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0) } $url=preg_replace('/__LOGIN__/',$user->login,$url); $shorturl=preg_replace('/__LOGIN__/',$user->login,$shorturl); + $url=preg_replace('/__USERID__/',$user->id,$url); + $shorturl=preg_replace('/__USERID__/',$user->id,$shorturl); // Define the class (top menu selected or not) if (! empty($_SESSION['idmenu']) && $newTabMenu[$i]['rowid'] == $_SESSION['idmenu']) $classname='class="tmenusel"'; @@ -414,7 +416,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $mainmenu=($forcemainmenu?$forcemainmenu:$_SESSION["mainmenu"]); $leftmenu=($forceleftmenu?'':(empty($_SESSION["leftmenu"])?'none':$_SESSION["leftmenu"])); - + // Show logo company if (empty($noout) && ! empty($conf->global->MAIN_SHOW_LOGO)) { @@ -1206,6 +1208,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu // For external modules $url = dol_buildpath($menu_array[$i]['url'], 1); + $url=preg_replace('/__LOGIN__/',$user->login,$url); + $url=preg_replace('/__USERID__/',$user->id,$url); print ''."\n"; From a5799b3ae8e55c584836ac8aacf7c8d8a194b36b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 30 Mar 2013 21:25:00 +0100 Subject: [PATCH 091/194] Trans for SMS --- htdocs/core/menus/init_menu_auguria.sql | 22 +++++++++++----------- htdocs/langs/fr_FR/admin.lang | 1 + 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index 733dc0a54d7..9beedd143be 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -8,16 +8,16 @@ delete from llx_menu where menu_handler=__HANDLER__ and entity=__ENTITY__; -- -- table llx_menu -- -insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '1', 1__+MAX_llx_menu__, __HANDLER__, 'top', 'home', '', 0, '/index.php?mainmenu=home&leftmenu=', 'Home', -1, '', '', '', 2, 1, __ENTITY__); -insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('societe|fournisseur', '$conf->societe->enabled || $conf->fournisseur->enabled', 2__+MAX_llx_menu__, __HANDLER__, 'top', 'companies', '', 0, '/societe/index.php?mainmenu=companies&leftmenu=', 'ThirdParties', -1, 'companies', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 2, __ENTITY__); -insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('product|service', '$conf->product->enabled || $conf->service->enabled', 3__+MAX_llx_menu__, __HANDLER__, 'top', 'products', '', 0, '/product/index.php?mainmenu=products&leftmenu=', 'Products/Services', -1, 'products', '$user->rights->produit->lire||$user->rights->service->lire', '', 0, 3, __ENTITY__); -insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('propal|commande|fournisseur|contrat|ficheinter', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->deplacement->enabled || $conf->don->enabled || $conf->tax->enabled', 5__+MAX_llx_menu__, __HANDLER__, 'top', 'commercial', '', 0, '/comm/index.php?mainmenu=commercial&leftmenu=', 'Commercial', -1, 'commercial', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 5, __ENTITY__); -insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('comptabilite|accounting|facture|deplacement|don|tax', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->deplacement->enabled || $conf->don->enabled || $conf->tax->enabled', 6__+MAX_llx_menu__, __HANDLER__, 'top', 'accountancy', '', 0, '/compta/index.php?mainmenu=accountancy&leftmenu=', 'MenuFinancial', -1, 'compta', '$user->rights->compta->resultat->lire || $user->rights->accounting->plancompte->lire || $user->rights->facture->lire|| $user->rights->deplacement->lire || $user->rights->don->lire || $user->rights->tax->charges->lire', '', 2, 6, __ENTITY__); -insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('banque|prelevement', '$conf->banque->enabled || $conf->prelevement->enabled', 14__+MAX_llx_menu__, __HANDLER__, 'top', 'bank', '', 0, '/compta/bank/index.php?mainmenu=bank&leftmenu=bank', 'MenuBankCash', -1, 'banks', '$user->rights->banque->lire || $user->rights->prelevement->bons->lire', '', 0, 6, __ENTITY__); -insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('projet', '$conf->projet->enabled', 7__+MAX_llx_menu__, __HANDLER__, 'top', 'project', '', 0, '/projet/index.php?mainmenu=project&leftmenu=', 'Projects', -1, 'projects', '$user->rights->projet->lire', '', 2, 7, __ENTITY__); -insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('mailing|export|import', '$conf->mailing->enabled || $conf->export->enabled || $conf->import->enabled', 8__+MAX_llx_menu__, __HANDLER__, 'top', 'tools', '', 0, '/core/tools.php?mainmenu=tools&leftmenu=', 'Tools', -1, 'other', '$user->rights->mailing->lire || $user->rights->export->lire || $user->rights->import->run', '', 2, 8, __ENTITY__); -insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('boutique', '! empty($conf->boutique->enabled)', 11__+MAX_llx_menu__, __HANDLER__, 'top', 'shop', '', 0, '/boutique/index.php?mainmenu=shop&leftmenu=', 'OSCommerce', -1, 'shop', '', '', 0, 11, __ENTITY__); -insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('adherent', '$conf->adherent->enabled', 13__+MAX_llx_menu__, __HANDLER__, 'top', 'members', '', 0, '/adherents/index.php?mainmenu=members&leftmenu=', 'Members', -1, 'members', '$user->rights->adherent->lire', '', 2, 15, __ENTITY__); +insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '1', 1__+MAX_llx_menu__, __HANDLER__, 'top', 'home', '', 0, '/index.php?mainmenu=home&leftmenu=', 'Home', -1, '', '', '', 2, 10, __ENTITY__); +insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('societe|fournisseur', '$conf->societe->enabled || $conf->fournisseur->enabled', 2__+MAX_llx_menu__, __HANDLER__, 'top', 'companies', '', 0, '/societe/index.php?mainmenu=companies&leftmenu=', 'ThirdParties', -1, 'companies', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 20, __ENTITY__); +insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('product|service', '$conf->product->enabled || $conf->service->enabled', 3__+MAX_llx_menu__, __HANDLER__, 'top', 'products', '', 0, '/product/index.php?mainmenu=products&leftmenu=', 'Products/Services', -1, 'products', '$user->rights->produit->lire||$user->rights->service->lire', '', 0, 30, __ENTITY__); +insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('propal|commande|fournisseur|contrat|ficheinter', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->deplacement->enabled || $conf->don->enabled || $conf->tax->enabled', 5__+MAX_llx_menu__, __HANDLER__, 'top', 'commercial', '', 0, '/comm/index.php?mainmenu=commercial&leftmenu=', 'Commercial', -1, 'commercial', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 40, __ENTITY__); +insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('comptabilite|accounting|facture|deplacement|don|tax', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->deplacement->enabled || $conf->don->enabled || $conf->tax->enabled', 6__+MAX_llx_menu__, __HANDLER__, 'top', 'accountancy', '', 0, '/compta/index.php?mainmenu=accountancy&leftmenu=', 'MenuFinancial', -1, 'compta', '$user->rights->compta->resultat->lire || $user->rights->accounting->plancompte->lire || $user->rights->facture->lire|| $user->rights->deplacement->lire || $user->rights->don->lire || $user->rights->tax->charges->lire', '', 2, 50, __ENTITY__); +insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('banque|prelevement', '$conf->banque->enabled || $conf->prelevement->enabled', 14__+MAX_llx_menu__, __HANDLER__, 'top', 'bank', '', 0, '/compta/bank/index.php?mainmenu=bank&leftmenu=bank', 'MenuBankCash', -1, 'banks', '$user->rights->banque->lire || $user->rights->prelevement->bons->lire', '', 0, 60, __ENTITY__); +insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('projet', '$conf->projet->enabled', 7__+MAX_llx_menu__, __HANDLER__, 'top', 'project', '', 0, '/projet/index.php?mainmenu=project&leftmenu=', 'Projects', -1, 'projects', '$user->rights->projet->lire', '', 2, 70, __ENTITY__); +insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('mailing|export|import', '$conf->mailing->enabled || $conf->export->enabled || $conf->import->enabled', 8__+MAX_llx_menu__, __HANDLER__, 'top', 'tools', '', 0, '/core/tools.php?mainmenu=tools&leftmenu=', 'Tools', -1, 'other', '$user->rights->mailing->lire || $user->rights->export->lire || $user->rights->import->run', '', 2, 80, __ENTITY__); +insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('boutique', '! empty($conf->boutique->enabled)', 11__+MAX_llx_menu__, __HANDLER__, 'top', 'shop', '', 0, '/boutique/index.php?mainmenu=shop&leftmenu=', 'OSCommerce', -1, 'shop', '', '', 0, 90, __ENTITY__); +insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('adherent', '$conf->adherent->enabled', 13__+MAX_llx_menu__, __HANDLER__, 'top', 'members', '', 0, '/adherents/index.php?mainmenu=members&leftmenu=', 'Members', -1, 'members', '$user->rights->adherent->lire', '', 2, 100, __ENTITY__); -- Home - Setup insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$user->admin', __HANDLER__, 'left', 100__+MAX_llx_menu__, 'home', 'setup', 1__+MAX_llx_menu__, '/admin/index.php?leftmenu=setup', 'Setup', 0, 'admin', '', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu==\'setup\'', __HANDLER__, 'left', 101__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/company.php?leftmenu=setup', 'MenuCompanySetup', 1, 'admin', '', '', 2, 1, __ENTITY__); @@ -30,7 +30,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu==\'setup\'', __HANDLER__, 'left', 110__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/limits.php?leftmenu=setup', 'MenuLimits', 1, 'admin', '', '', 2, 8, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu==\'setup\'', __HANDLER__, 'left', 107__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/pdf.php?leftmenu=setup', 'PDF', 1, 'admin', '', '', 2, 9, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu==\'setup\'', __HANDLER__, 'left', 109__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/mails.php?leftmenu=setup', 'Emails', 1, 'admin', '', '', 2, 10, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu==\'setup\'', __HANDLER__, 'left', 113__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/sms.php?leftmenu=setup', 'Sms', 1, 'admin', '', '', 2, 11, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu==\'setup\'', __HANDLER__, 'left', 113__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/sms.php?leftmenu=setup', 'SMS', 1, 'admin', '', '', 2, 11, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu==\'setup\'', __HANDLER__, 'left', 111__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/dict.php?leftmenu=setup', 'DictionnarySetup', 1, 'admin', '', '', 2, 12, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu==\'setup\'', __HANDLER__, 'left', 112__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/const.php?leftmenu=setup', 'OtherSetup', 1, 'admin', '', '', 2, 13, __ENTITY__); -- Home - Sytem info diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index e688d9eab8c..ecc78fc4273 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -359,6 +359,7 @@ LibraryToBuildPDF=Bibliothèque utilisée pour la génération des PDF WarningUsingFPDF=Attention: Votre fichier conf.php contient la directive dolibarr_pdf_force_fpdf=1. Cela signifie que vous utilisez la librairie FPDF pour générer vos fichiers PDF. Cette librairie est ancienne et ne couvre pas de nombreuses fonctionnalitée (Unicode, transparence des images, langues cyrillic, arabes ou asiatiques...), aussi vous pouvez rencontrez des problèmes durant la génération des PDF.
    Pour résoudre cela et avoir un support complet de PDF, vous pouvez télécharger la librairie TCPDF puis commenter ou supprimer la ligne $dolibarr_pdf_force_fpdf=1, et ajouter à la place $dolibarr_lib_TCPDF_PATH='chemin_vers_TCPDF' LocalTaxDesc=Certains pays appliquent 2 voir 3 taux sur chaque ligne de facture. Si c'est le cas, choisissez le type du deuxième et troisième taux et sa valeur. Les types possibles sont:
    1 : taxe locale sur les produits et services hors tva (la tva n'est pas appliquée sur la taxe locale)
    2 : taxe locale sur les produits et services avant tva (la tva est appliquée sur le montant + la taxe locale)
    3 : taxe locale uniquement sur les produits hors tva (la tva n'est pas appliquée sur la taxe locale)
    4 : taxe locale uniquement sur les produits avant tva (la tva est appliquée sur le montant + la taxe locale)
    5 : taxe locale uniquement sur les services hors tva (la tva n'est pas appliquée sur la taxe locale)
    6 : taxe locale uniquement sur les service avant tva (la tva est appliquée sur le montant + la taxe locale) SuhosinSessionEncrypt=Stockage des sessions encryptés par Suhosin +SMS=SMS # Modules= undefined Module0Name= Utilisateurs & groupes From fa6e9d2d47db19c0c06e2d1e438b47fa4e217b83 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 30 Mar 2013 21:25:37 +0100 Subject: [PATCH 092/194] Missing trans key --- htdocs/langs/en_US/admin.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 2a010d4733b..c46ab4545c8 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -360,6 +360,7 @@ ExtrafieldSelect = Select list LibraryToBuildPDF=Library used to build PDF WarningUsingFPDF=Warning: Your conf.php contains directive dolibarr_pdf_force_fpdf=1. This means you use the FPDF library to generate PDF files. This library is old and does not support a lot of features (Unicode, image transparency, cyrillic, arab and asiatic languages, ...), so you may experience errors during PDF generation.
    To solve this and have a full support of PDF generation, please download TCPDF library, then comment or remove the line $dolibarr_pdf_force_fpdf=1, and add instead $dolibarr_lib_TCPDF_PATH='path_to_TCPDF_dir' LocalTaxDesc=Some countries apply 2 or 3 taxes on each invoice line. If this is the case, choose type for second and third tax and its rate. Possible type are:
    1 : local tax apply on products and services without vat (vat is not applied on local tax)
    2 : local tax apply on products and services before vat (vat is calculated on amount + localtax)
    3 : local tax apply on products without vat (vat is not applied on local tax)
    4 : local tax apply on products before vat (vat is calculated on amount + localtax)
    5 : local tax apply on services without vat (vat is not applied on local tax)
    6 : local tax apply on services before vat (vat is calculated on amount + localtax) +SMS=SMS # Modules Module0Name=Users & groups From dca3179bfece97185dccebd2d727559da4dadc7c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 30 Mar 2013 21:29:14 +0100 Subject: [PATCH 093/194] New: Support __LOGIN__ and __USERID__ on left menu entries --- htdocs/core/menus/standard/auguria.lib.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php index 068ff241f49..1a40de3c713 100644 --- a/htdocs/core/menus/standard/auguria.lib.php +++ b/htdocs/core/menus/standard/auguria.lib.php @@ -285,6 +285,8 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM // Add mainmenu in GET url. This make to go back on correct menu even when using Back on browser. $url=dol_buildpath($menu_array[$i]['url'],1); + $url=preg_replace('/__LOGIN__/',$user->login,$url); + $url=preg_replace('/__USERID__/',$user->id,$url); if (! preg_match('/mainmenu=/i',$menu_array[$i]['url'])) { From 294a085047e0b9c177e51ab12702de54e71096f7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 31 Mar 2013 04:03:08 +0200 Subject: [PATCH 094/194] New: ClickToDial setup is easier --- htdocs/admin/clicktodial.php | 39 +++++++++++++++++++++++-------- htdocs/core/lib/functions.lib.php | 9 +++---- htdocs/langs/en_US/admin.lang | 1 + htdocs/langs/en_US/errors.lang | 3 ++- htdocs/langs/fr_FR/admin.lang | 1 + htdocs/langs/fr_FR/errors.lang | 3 ++- htdocs/user/class/user.class.php | 4 ++++ scripts/clicktodial/linphone.sh | 11 +++++++++ 8 files changed, 55 insertions(+), 16 deletions(-) create mode 100755 scripts/clicktodial/linphone.sh diff --git a/htdocs/admin/clicktodial.php b/htdocs/admin/clicktodial.php index 05d35049061..99241a8342f 100644 --- a/htdocs/admin/clicktodial.php +++ b/htdocs/admin/clicktodial.php @@ -69,7 +69,7 @@ print ''; $var=true; -print ''; +print '
    '; print ''; print ''; print ''; @@ -83,19 +83,38 @@ print $langs->trans("ClickToDialUrlDesc").'
    '; print $langs->trans("Example").':
    http://myphoneserver/mypage?login=__LOGIN__&password=__PASS__&caller=__PHONEFROM__&called=__PHONETO__'; print ''; -print ''; -print '
    '.$langs->trans("Name").''.$langs->trans("Value").'

    '; +print ''; -/*if (! empty($conf->global->CLICKTODIAL_URL)) - { - print $langs->trans("Test"); - // Add a phone number to test - } - */ +print '

    '; + +print ''; + + +if (! empty($conf->global->CLICKTODIAL_URL)) +{ + $user->fetch_clicktodial(); + + print $langs->trans("LinkToTestClickToDial").' : '; + + $setupcomplete=1; + if (preg_match('/__LOGIN__/',$conf->global->CLICKTODIAL_URL) && empty($user->clicktodial_login)) $setupcomplete=0; + if (preg_match('/__PASSWORD__/',$conf->global->CLICKTODIAL_URL) && empty($user->clicktodial_password)) $setupcomplete=0; + if (preg_match('/__PHONEFROM__/',$conf->global->CLICKTODIAL_URL) && empty($user->clicktodial_poste)) $setupcomplete=0; + + if ($setupcomplete) + { + print dol_print_phone($mysoc->phone, '', 0, 0, 'AC_TEL'); + } + else + { + $langs->load("errors"); + print '
    '.$langs->trans("WarningClickToDialUserSetupNotComplete").'
    '; + } +} dol_htmloutput_mesg($mesg); $db->close(); llxFooter(); -?> +?> \ No newline at end of file diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index d0ad263d71a..c1e4f2b61d1 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1155,17 +1155,18 @@ function dol_print_email($email,$cid=0,$socid=0,$addlink=0,$max=64,$showinvalid= * @param string $country Country code to use for formatting * @param int $cid Id of contact if known * @param int $socid Id of third party if known - * @param int $addlink 0=no link to create action - * @param string $separ separation between numbers for a better visibility example : xx.xx.xx.xx.xx + * @param int $addlink ''=no link to create action, 'AC_TEL'=add link to clicktodial (if module enabled) and add link to create event (if conf->global->AGENDA_ADDACTIONFORPHONE set) + * @param string $separ Separation between numbers for a better visibility example : xx.xx.xx.xx.xx * @return string Formated phone number */ -function dol_print_phone($phone,$country="FR",$cid=0,$socid=0,$addlink=0,$separ=" ") +function dol_print_phone($phone,$country='',$cid=0,$socid=0,$addlink='',$separ=" ") { - global $conf,$user,$langs; + global $conf,$user,$langs,$mysoc; // Clean phone parameter $phone = preg_replace("/[\s.-]/","",trim($phone)); if (empty($phone)) { return ''; } + if (empty($country)) $country=$mysoc->country_code; $newphone=$phone; if (strtoupper($country) == "FR") diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index c46ab4545c8..fef12f037fa 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -361,6 +361,7 @@ LibraryToBuildPDF=Library used to build PDF WarningUsingFPDF=Warning: Your conf.php contains directive dolibarr_pdf_force_fpdf=1. This means you use the FPDF library to generate PDF files. This library is old and does not support a lot of features (Unicode, image transparency, cyrillic, arab and asiatic languages, ...), so you may experience errors during PDF generation.
    To solve this and have a full support of PDF generation, please download TCPDF library, then comment or remove the line $dolibarr_pdf_force_fpdf=1, and add instead $dolibarr_lib_TCPDF_PATH='path_to_TCPDF_dir' LocalTaxDesc=Some countries apply 2 or 3 taxes on each invoice line. If this is the case, choose type for second and third tax and its rate. Possible type are:
    1 : local tax apply on products and services without vat (vat is not applied on local tax)
    2 : local tax apply on products and services before vat (vat is calculated on amount + localtax)
    3 : local tax apply on products without vat (vat is not applied on local tax)
    4 : local tax apply on products before vat (vat is calculated on amount + localtax)
    5 : local tax apply on services without vat (vat is not applied on local tax)
    6 : local tax apply on services before vat (vat is calculated on amount + localtax) SMS=SMS +LinkToTestClickToDial=Link to test the ClickToDial # Modules Module0Name=Users & groups diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index d66449ecf5d..184c6bcc325 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -132,4 +132,5 @@ WarningNoDocumentModelActivated=No model, for document generation, has been acti WarningLockFileDoesNotExists=Warning, once setup is finished, you must disable install/migrate tools by adding a file install.lock into directory %s. Missing this file is a security hole. WarningUntilDirRemoved=All security warnings (visible by admin users only) will remain active as long as the vulnerability is present (or that constant MAIN_REMOVE_INSTALL_WARNING is added in Setup->Other setup). WarningCloseAlways=Warning, closing is done even if amount differs between source and target elements. Enable this feature with caution. -WarningUsingThisBoxSlowDown=Warning, using this box slow down seriously all pages showing the box. \ No newline at end of file +WarningUsingThisBoxSlowDown=Warning, using this box slow down seriously all pages showing the box. +WarningClickToDialUserSetupNotComplete=Setup of ClickToDial information for your user are not complete (see tab ClickToDial onto your user card). \ No newline at end of file diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index ecc78fc4273..6ffd8fba44a 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -360,6 +360,7 @@ WarningUsingFPDF=Attention: Votre fichier conf.php contient la directive LocalTaxDesc=Certains pays appliquent 2 voir 3 taux sur chaque ligne de facture. Si c'est le cas, choisissez le type du deuxième et troisième taux et sa valeur. Les types possibles sont:
    1 : taxe locale sur les produits et services hors tva (la tva n'est pas appliquée sur la taxe locale)
    2 : taxe locale sur les produits et services avant tva (la tva est appliquée sur le montant + la taxe locale)
    3 : taxe locale uniquement sur les produits hors tva (la tva n'est pas appliquée sur la taxe locale)
    4 : taxe locale uniquement sur les produits avant tva (la tva est appliquée sur le montant + la taxe locale)
    5 : taxe locale uniquement sur les services hors tva (la tva n'est pas appliquée sur la taxe locale)
    6 : taxe locale uniquement sur les service avant tva (la tva est appliquée sur le montant + la taxe locale) SuhosinSessionEncrypt=Stockage des sessions encryptés par Suhosin SMS=SMS +LinkToTestClickToDial=Lien pour tester le ClickToDial # Modules= undefined Module0Name= Utilisateurs & groupes diff --git a/htdocs/langs/fr_FR/errors.lang b/htdocs/langs/fr_FR/errors.lang index 8110d224355..576d9d4bcb6 100644 --- a/htdocs/langs/fr_FR/errors.lang +++ b/htdocs/langs/fr_FR/errors.lang @@ -133,4 +133,5 @@ WarningNoDocumentModelActivated=Aucun modèle, pour la génération de document, WarningLockFileDoesNotExists=Attention, une fois l'installation terminée, les outils d'installation/migration doivent être désactivés en ajoutant un fichier install.lock dans le répertoire %s. L'absence de ce fichier représente une faille de sécurité. WarningUntilDirRemoved=Les alertes de sécurité sont visibles par les administrateurs uniquement et resteront actives tant que la vulnérabilité sera avérée (ou que la constante MAIN_REMOVE_INSTALL_WARNING aura été définie dans Configuration->Divers) WarningCloseAlways=Attention, la fermeture se fait même lorsque le montant diffère. N'activez cette fonctionnalité qu'en connaissance de cause. -WarningUsingThisBoxSlowDown=Attention, l'utilisation de cette boite provoque de sérieux ralentissement des pages affichant cette boite. \ No newline at end of file +WarningUsingThisBoxSlowDown=Attention, l'utilisation de cette boite provoque de sérieux ralentissement des pages affichant cette boite. +WarningClickToDialUserSetupNotComplete=La configuration ClickToDial pour votre compte utilisateur n'est pas complète (voir l'onglet ClickToDial sur votre fiche utilisateur) \ No newline at end of file diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index c04f96b09db..de4876bd275 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -81,6 +81,10 @@ class User extends CommonObject var $phenix_pass; var $phenix_pass_crypted; + var $clicktodial_login; + var $clicktodial_password; + var $clicktodial_poste; + var $datelastlogin; var $datepreviouslogin; var $statut; diff --git a/scripts/clicktodial/linphone.sh b/scripts/clicktodial/linphone.sh new file mode 100755 index 00000000000..b2dc13e77e8 --- /dev/null +++ b/scripts/clicktodial/linphone.sh @@ -0,0 +1,11 @@ +#!/bin/bash +#--------------------------------------------------------- +# Script to launch LinPhone softphone. +# This script can be used to setup a ClickToDial system +# when using LinPhone soft phone. +# More information on http://wiki.dolibarr.org/index.php/Module_ClickToDial_En +#--------------------------------------------------------- + +echo Launch Linphone $1 $2 +param=`echo $1 | sed -s 's/^sip:[\/]*//' ` +/usr/bin/linphone-3 -c $param From a0dc4ae62ebeafb17ce86a177ed701ee7395b1af Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 31 Mar 2013 04:12:20 +0200 Subject: [PATCH 095/194] Avoid terminal --- scripts/clicktodial/linphone.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/clicktodial/linphone.sh b/scripts/clicktodial/linphone.sh index b2dc13e77e8..97c3bcb18d7 100755 --- a/scripts/clicktodial/linphone.sh +++ b/scripts/clicktodial/linphone.sh @@ -6,6 +6,13 @@ # More information on http://wiki.dolibarr.org/index.php/Module_ClickToDial_En #--------------------------------------------------------- +# Note: Adding handler into gconf-tools seems to do nothing +# gconftool-2 -t string -s /desktop/gnome/url-handlers/sip/command "linphone-3 -c %s" +# gconftool-2 -s /desktop/gnome/url-handlers/sip/needs_terminal false -t bool +# gconftool-2 -t bool -s /desktop/gnome/url-handlers/sip/enabled true + echo Launch Linphone $1 $2 + param=`echo $1 | sed -s 's/^sip:[\/]*//' ` -/usr/bin/linphone-3 -c $param + +/usr/bin/linphone-3 -c $param & From cc69cf7b76bb5cbd4b39316403ea3d830eaa7a21 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 31 Mar 2013 16:44:24 +0200 Subject: [PATCH 096/194] New: Can defined a clicktodial setup per user --- ChangeLog | 1 + htdocs/admin/clicktodial.php | 27 +++++++++--- htdocs/core/lib/functions.lib.php | 9 ++-- .../install/mysql/migration/3.3.0-3.4.0.sql | 2 + .../mysql/tables/llx_user_clicktodial.sql | 1 + htdocs/langs/en_US/admin.lang | 7 ++- htdocs/langs/fr_FR/admin.lang | 7 ++- htdocs/user/class/user.class.php | 20 +++++---- htdocs/user/clicktodial.php | 43 ++++++++++++------- 9 files changed, 84 insertions(+), 33 deletions(-) diff --git a/ChangeLog b/ChangeLog index db9fc3b9f8e..ab1fe32aa8f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -27,6 +27,7 @@ For users: - New: [ task #748 ] Add a link "Dolibarr" into left menu - New: Script email_unpaid_invoices_to_representative accepts now a parameter test and a delay. +- New: Can define a different clicktodial setup per user. - First change to prepare feature click to print for PDF. For translators: diff --git a/htdocs/admin/clicktodial.php b/htdocs/admin/clicktodial.php index 99241a8342f..0ddd7f1abdc 100644 --- a/htdocs/admin/clicktodial.php +++ b/htdocs/admin/clicktodial.php @@ -38,7 +38,7 @@ $action = GETPOST("action"); */ if ($action == 'setvalue' && $user->admin) { - $result=dolibarr_set_const($db, "CLICKTODIAL_URL",GETPOST("url"),'chaine',0,'',$conf->entity); + $result=dolibarr_set_const($db, "CLICKTODIAL_URL", GETPOST("url"), 'chaine', 0, '', $conf->entity); if ($result >= 0) { $mesg = "".$langs->trans("SetupSaved").""; @@ -54,6 +54,8 @@ if ($action == 'setvalue' && $user->admin) * View */ +$user->fetch_clicktodial(); + $wikihelp='EN:Module_ClickToDial_En|FR:Module_ClickToDial|ES:Módulo_ClickTodial_Es'; llxHeader('',$langs->trans("ClickToDialSetup"),$wikihelp); @@ -76,11 +78,18 @@ print ''.$langs->trans("Value").''; print "\n"; $var=!$var; print ''; -print $langs->trans("URL").''; +print $langs->trans("DefaultLink").''; print '
    '; print '
    '; print $langs->trans("ClickToDialUrlDesc").'
    '; print $langs->trans("Example").':
    http://myphoneserver/mypage?login=__LOGIN__&password=__PASS__&caller=__PHONEFROM__&called=__PHONETO__'; + +if (! empty($user->clicktodial_url)) +{ + print '
    '; + print info_admin($langs->trans("ValueOverwrittenByUserSetup")); +} + print ''; print ''; @@ -94,7 +103,14 @@ if (! empty($conf->global->CLICKTODIAL_URL)) { $user->fetch_clicktodial(); - print $langs->trans("LinkToTestClickToDial").' : '; + $phonefortest=$mysoc->phone; + if (GETPOST('phonefortest')) $phonefortest=GETPOST('phonefortest'); + + print '
    '; + print $langs->trans("LinkToTestClickToDial",$user->login).' : '; + print ''; + print ''; + print '
    '; $setupcomplete=1; if (preg_match('/__LOGIN__/',$conf->global->CLICKTODIAL_URL) && empty($user->clicktodial_login)) $setupcomplete=0; @@ -103,7 +119,7 @@ if (! empty($conf->global->CLICKTODIAL_URL)) if ($setupcomplete) { - print dol_print_phone($mysoc->phone, '', 0, 0, 'AC_TEL'); + print $langs->trans("LinkToTest",$user->login).': '.dol_print_phone($phonefortest, '', 0, 0, 'AC_TEL'); } else { @@ -114,7 +130,8 @@ if (! empty($conf->global->CLICKTODIAL_URL)) dol_htmloutput_mesg($mesg); -$db->close(); llxFooter(); + +$db->close(); ?> \ No newline at end of file diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index c1e4f2b61d1..656841297ad 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1199,8 +1199,11 @@ function dol_print_phone($phone,$country='',$cid=0,$socid=0,$addlink='',$separ=" { if (empty($user->clicktodial_loaded)) $user->fetch_clicktodial(); - if (empty($conf->global->CLICKTODIAL_URL)) $urlmask='ErrorClickToDialModuleNotConfigured'; - else $urlmask=$conf->global->CLICKTODIAL_URL; + // Define urlmask + $urlmask='ErrorClickToDialModuleNotConfigured'; + if (! empty($conf->global->CLICKTODIAL_URL)) $urlmask=$conf->global->CLICKTODIAL_URL; + if (! empty($user->clicktodial_url)) $urlmask=$user->clicktodial_url; + $clicktodial_poste=(! empty($user->clicktodial_poste)?urlencode($user->clicktodial_poste):''); $clicktodial_login=(! empty($user->clicktodial_login)?urlencode($user->clicktodial_login):''); $clicktodial_password=(! empty($user->clicktodial_password)?urlencode($user->clicktodial_password):''); @@ -1224,7 +1227,7 @@ function dol_print_phone($phone,$country='',$cid=0,$socid=0,$addlink='',$separ=" $type='AC_TEL'; $link=''; if ($addlink == 'AC_FAX') $type='AC_FAX'; if (! empty($conf->global->AGENDA_ADDACTIONFORPHONE)) $link=''.img_object($langs->trans("AddAction"),"calendar").''; - $newphone='
    '.$newphone.'  '.$link.'
    '; + if ($link) $newphone='
    '.$newphone.'  '.$link.'
    '; } } diff --git a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql index db609d76ad1..5c2a86122ea 100755 --- a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql +++ b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql @@ -208,3 +208,5 @@ ALTER TABLE llx_user ADD COLUMN town varchar(50); ALTER TABLE llx_user ADD COLUMN fk_state integer DEFAULT 0; ALTER TABLE llx_user ADD COLUMN fk_country integer DEFAULT 0; + +ALTER TABLE llx_user_clicktodial ADD COLUMN url varchar(255); diff --git a/htdocs/install/mysql/tables/llx_user_clicktodial.sql b/htdocs/install/mysql/tables/llx_user_clicktodial.sql index da97b33057b..bdaf90e8ae9 100644 --- a/htdocs/install/mysql/tables/llx_user_clicktodial.sql +++ b/htdocs/install/mysql/tables/llx_user_clicktodial.sql @@ -22,6 +22,7 @@ create table llx_user_clicktodial ( fk_user integer PRIMARY KEY, + url varchar(255), login varchar(32), pass varchar(64), poste varchar(20) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index fef12f037fa..ff28b59e083 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -361,7 +361,12 @@ LibraryToBuildPDF=Library used to build PDF WarningUsingFPDF=Warning: Your conf.php contains directive dolibarr_pdf_force_fpdf=1. This means you use the FPDF library to generate PDF files. This library is old and does not support a lot of features (Unicode, image transparency, cyrillic, arab and asiatic languages, ...), so you may experience errors during PDF generation.
    To solve this and have a full support of PDF generation, please download TCPDF library, then comment or remove the line $dolibarr_pdf_force_fpdf=1, and add instead $dolibarr_lib_TCPDF_PATH='path_to_TCPDF_dir' LocalTaxDesc=Some countries apply 2 or 3 taxes on each invoice line. If this is the case, choose type for second and third tax and its rate. Possible type are:
    1 : local tax apply on products and services without vat (vat is not applied on local tax)
    2 : local tax apply on products and services before vat (vat is calculated on amount + localtax)
    3 : local tax apply on products without vat (vat is not applied on local tax)
    4 : local tax apply on products before vat (vat is calculated on amount + localtax)
    5 : local tax apply on services without vat (vat is not applied on local tax)
    6 : local tax apply on services before vat (vat is calculated on amount + localtax) SMS=SMS -LinkToTestClickToDial=Link to test the ClickToDial +LinkToTestClickToDial=Enter a phone number to call to show a link to test the ClickToDial url for user %s +RefreshPhoneLink=Refresh link +LinkToTest=Clickable link generated for user %s (click phone number to test) +KeepEmptyToUseDefault=Keep empty to use default value +DefaultLink=Default link +ValueOverwrittenByUserSetup=Warning, this value may be overwritten by user specific setup (each user can set his own clicktodial url) # Modules Module0Name=Users & groups diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 6ffd8fba44a..8b56650b43b 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -360,7 +360,12 @@ WarningUsingFPDF=Attention: Votre fichier conf.php contient la directive LocalTaxDesc=Certains pays appliquent 2 voir 3 taux sur chaque ligne de facture. Si c'est le cas, choisissez le type du deuxième et troisième taux et sa valeur. Les types possibles sont:
    1 : taxe locale sur les produits et services hors tva (la tva n'est pas appliquée sur la taxe locale)
    2 : taxe locale sur les produits et services avant tva (la tva est appliquée sur le montant + la taxe locale)
    3 : taxe locale uniquement sur les produits hors tva (la tva n'est pas appliquée sur la taxe locale)
    4 : taxe locale uniquement sur les produits avant tva (la tva est appliquée sur le montant + la taxe locale)
    5 : taxe locale uniquement sur les services hors tva (la tva n'est pas appliquée sur la taxe locale)
    6 : taxe locale uniquement sur les service avant tva (la tva est appliquée sur le montant + la taxe locale) SuhosinSessionEncrypt=Stockage des sessions encryptés par Suhosin SMS=SMS -LinkToTestClickToDial=Lien pour tester le ClickToDial +LinkToTestClickToDial=Entrez un numéro de téléphone à appeler pour tester le lien d'appel ClickToDial pour l'utilisateur %s +RefreshPhoneLink=Rafraichir lien +LinkToTest=Lien clicable généré pour l'utilisateur %s (cliquer le numéro pour tester) +KeepEmptyToUseDefault=Laisser ce champ vide pour utiliser la valeure par défaut +DefaultLink=Lien par défaut +ValueOverwrittenByUserSetup=Attention, cette valeur peut être écrasée par une valeur spécifique à la configuration de l'utilisateur (chaque utilisateur pouvant avoir sa propre url clicktodial) # Modules= undefined Module0Name= Utilisateurs & groupes diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index de4876bd275..a61289e7d09 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -81,6 +81,7 @@ class User extends CommonObject var $phenix_pass; var $phenix_pass_crypted; + var $clicktodial_url; var $clicktodial_login; var $clicktodial_password; var $clicktodial_poste; @@ -1549,7 +1550,7 @@ class User extends CommonObject */ function fetch_clicktodial() { - $sql = "SELECT login, pass, poste "; + $sql = "SELECT url, login, pass, poste "; $sql.= " FROM ".MAIN_DB_PREFIX."user_clicktodial as u"; $sql.= " WHERE u.fk_user = ".$this->id; @@ -1560,6 +1561,7 @@ class User extends CommonObject { $obj = $this->db->fetch_object($resql); + $this->clicktodial_url = $obj->url; $this->clicktodial_login = $obj->login; $this->clicktodial_password = $obj->pass; $this->clicktodial_poste = $obj->poste; @@ -1589,26 +1591,28 @@ class User extends CommonObject $sql = "DELETE FROM ".MAIN_DB_PREFIX."user_clicktodial"; $sql .= " WHERE fk_user = ".$this->id; + dol_syslog(get_class($this).'::update_clicktodial sql='.$sql); $result = $this->db->query($sql); $sql = "INSERT INTO ".MAIN_DB_PREFIX."user_clicktodial"; - $sql .= " (fk_user,login,pass,poste)"; + $sql .= " (fk_user,url,login,pass,poste)"; $sql .= " VALUES (".$this->id; - $sql .= ", '". $this->clicktodial_login ."'"; - $sql .= ", '". $this->clicktodial_password ."'"; - $sql .= ", '". $this->clicktodial_poste."')"; + $sql .= ", '". $this->db->escape($this->clicktodial_url) ."'"; + $sql .= ", '". $this->db->escape($this->clicktodial_login) ."'"; + $sql .= ", '". $this->db->escape($this->clicktodial_password) ."'"; + $sql .= ", '". $this->db->escape($this->clicktodial_poste) ."')"; + dol_syslog(get_class($this).'::update_clicktodial sql='.$sql); $result = $this->db->query($sql); - if ($result) { $this->db->commit(); - return 0; + return 1; } else { $this->db->rollback(); - $this->error=$this->db->error(); + $this->error=$this->db->lasterror(); return -1; } } diff --git a/htdocs/user/clicktodial.php b/htdocs/user/clicktodial.php index bd39655b730..48f02ca5603 100644 --- a/htdocs/user/clicktodial.php +++ b/htdocs/user/clicktodial.php @@ -51,11 +51,13 @@ if ($action == 'update' && ! $_POST['cancel']) $edituser = new User($db); $edituser->fetch($id); - $edituser->clicktodial_login = $_POST["login"]; - $edituser->clicktodial_password = $_POST["password"]; - $edituser->clicktodial_poste = $_POST["poste"]; + $edituser->clicktodial_url = GETPOST("url"); + $edituser->clicktodial_login = GETPOST("login"); + $edituser->clicktodial_password = GETPOST("password"); + $edituser->clicktodial_poste = GETPOST("poste"); $result=$edituser->update_clicktodial(); + if ($result < 0) setEventMessage($edituser->error,'errors'); } @@ -110,7 +112,7 @@ if ($id > 0) print "\n"; print "
    \n"; - + // Edit mode if ($action == 'edit') { print '
    '; @@ -122,13 +124,17 @@ if ($id > 0) { print 'ClickToDial URL'; print ''; - if (empty($conf->global->CLICKTODIAL_URL)) + print ''; + if (empty($conf->global->CLICKTODIAL_URL) && empty($fuser->clicktodial_url)) { $langs->load("errors"); print ''.$langs->trans("ErrorModuleSetupNotComplete").''; } - else print $form->textwithpicto($conf->global->CLICKTODIAL_URL,$langs->trans("ClickToDialUrlDesc")); - print ''; + else + { + print '     '.$form->textwithpicto($langs->trans("KeepEmptyToUseDefault").': '.$conf->global->CLICKTODIAL_URL,$langs->trans("ClickToDialUrlDesc")); + } + print ''; print ''; } @@ -147,14 +153,16 @@ if ($id > 0) print ''; print "\n"; - print ''; - print '     '; - print ''; - print ''; + print ''; - print '
    '; + print '
    '; + print '     '; + print ''; + print '
    '; + + print ''; } - else + else // View mode { print ''; @@ -163,12 +171,17 @@ if ($id > 0) { print "".''; print ''; print ''; } From d752a41f05d5415e12630368a5a7eaffd5ea5c51 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 31 Mar 2013 16:51:49 +0200 Subject: [PATCH 097/194] Add helper --- htdocs/admin/clicktodial.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/admin/clicktodial.php b/htdocs/admin/clicktodial.php index 0ddd7f1abdc..726bd912964 100644 --- a/htdocs/admin/clicktodial.php +++ b/htdocs/admin/clicktodial.php @@ -84,11 +84,11 @@ print '
    '; print $langs->trans("ClickToDialUrlDesc").'
    '; print $langs->trans("Example").':
    http://myphoneserver/mypage?login=__LOGIN__&password=__PASS__&caller=__PHONEFROM__&called=__PHONETO__'; -if (! empty($user->clicktodial_url)) -{ +//if (! empty($user->clicktodial_url)) +//{ print '
    '; print info_admin($langs->trans("ValueOverwrittenByUserSetup")); -} +//} print ''; @@ -96,7 +96,7 @@ print '
    ClickToDial URL'; - if (empty($conf->global->CLICKTODIAL_URL)) + $url=$conf->global->CLICKTODIAL_URL; + if (! empty($fuser->clicktodial_url)) $url=$fuser->clicktodial_url; + if (empty($url)) { $langs->load("errors"); print ''.$langs->trans("ErrorModuleSetupNotComplete").''; } - else print $form->textwithpicto($conf->global->CLICKTODIAL_URL,$langs->trans("ClickToDialUrlDesc")); + else + { + print $form->textwithpicto((empty($fuser->clicktodial_url)?$langs->trans("DefaultLink").': ':'').$url,$langs->trans("ClickToDialUrlDesc")); + } print '
    '; print '

    '; -print ''; +print '

    '; if (! empty($conf->global->CLICKTODIAL_URL)) From e352e4a56f65885a7d3ed589090079b15b63f3e2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 31 Mar 2013 19:54:56 +0200 Subject: [PATCH 098/194] New: Work on new menu management. --- htdocs/core/class/menubase.class.php | 13 ++++++--- htdocs/core/getmenu_jmobile.php | 2 +- htdocs/core/menus/standard/auguria_menu.php | 32 ++++++++++++++------- htdocs/core/menus/standard/eldy_menu.php | 24 +++++++++------- 4 files changed, 46 insertions(+), 25 deletions(-) diff --git a/htdocs/core/class/menubase.class.php b/htdocs/core/class/menubase.class.php index 7ae947ee518..5ebccdeb1bd 100644 --- a/htdocs/core/class/menubase.class.php +++ b/htdocs/core/class/menubase.class.php @@ -512,6 +512,7 @@ class Menubase if ($type_user == 0) $sql.= " AND m.usertype IN (0,2)"; if ($type_user == 1) $sql.= " AND m.usertype IN (1,2)"; $sql.= " ORDER BY m.position, m.rowid"; + //print $sql; //$tmp1=dol_microtime_float(); //print '>>> 1 0
    '; @@ -533,17 +534,21 @@ class Menubase $perms = true; if ($menu['perms']) { - $perms = verifCond($menu['perms']); - //print "verifCond rowid=".$menu['rowid']." ".$menu['perms'].":".$perms."
    \n"; + $tmpcond=$menu['perms']; + if ($leftmenu == 'all') $tmpcond=preg_replace('/\$leftmenu\s*==\s*["\'a-zA-Z]+/','1==1',$tmpcond); // Force part of condition to true + $perms = verifCond($tmpcond); + //print "verifCond rowid=".$menu['rowid']." ".$tmpcond.":".$perms."
    \n"; } // Define $enabled $enabled = true; if ($menu['enabled']) { - $enabled = verifCond($menu['enabled']); + $tmpcond=$menu['enabled']; + if ($leftmenu == 'all') $tmpcond=preg_replace('/\$leftmenu\s*==\s*["\'a-zA-Z]+/','1==1',$tmpcond); // Force part of condition to true + $enabled = verifCond($tmpcond); if ($conf->use_javascript_ajax && ! empty($conf->global->MAIN_MENU_USE_JQUERY_ACCORDION) && preg_match('/^\$leftmenu/',$menu['enabled'])) $enabled=1; - //print "verifCond rowid=".$menu['rowid']." ".$menu['enabled'].":".$enabled."
    \n"; + //print "verifCond rowid=".$menu['rowid']." ".$tmpcond.":".$enabled."
    \n"; } // Define $title diff --git a/htdocs/core/getmenu_jmobile.php b/htdocs/core/getmenu_jmobile.php index 4075bbc77b6..78c46c60fbb 100644 --- a/htdocs/core/getmenu_jmobile.php +++ b/htdocs/core/getmenu_jmobile.php @@ -88,7 +88,7 @@ if (! class_exists('MenuManager')) } } $menumanager = new MenuManager($db, empty($user->societe_id)?0:1); -$menumanager->loadMenu(); +$menumanager->loadMenu('all','all'); $menumanager->showmenu('jmobile'); diff --git a/htdocs/core/menus/standard/auguria_menu.php b/htdocs/core/menus/standard/auguria_menu.php index e33d08403ac..343edaf5201 100644 --- a/htdocs/core/menus/standard/auguria_menu.php +++ b/htdocs/core/menus/standard/auguria_menu.php @@ -51,13 +51,15 @@ class MenuManager $this->db=$db; } - + /** * Load this->tabMenu * + * @param string $forcemainmenu To force mainmenu to load + * @param string $forceleftmenu To force leftmenu to load * @return void */ - function loadMenu() + function loadMenu($forcemainmenu='',$forceleftmenu='') { global $conf, $user, $langs; @@ -78,6 +80,7 @@ class MenuManager // On va le chercher en session si non defini par le lien $mainmenu=isset($_SESSION["mainmenu"])?$_SESSION["mainmenu"]:''; } + if (! empty($forcemainmenu)) $mainmenu=$forcemainmenu; if (isset($_GET["leftmenu"])) { @@ -98,6 +101,7 @@ class MenuManager // On va le chercher en session si non defini par le lien $leftmenu=isset($_SESSION["leftmenu"])?$_SESSION["leftmenu"]:''; } + if (! empty($forceleftmenu)) $leftmenu=$forceleftmenu; require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php'; $tabMenu=array(); @@ -167,16 +171,16 @@ class MenuManager } $res='ErrorBadParameterForMode'; - + require_once DOL_DOCUMENT_ROOT.'/core/class/menu.class.php'; $this->menu=new Menu(); - + if ($mode == 'top') $res=print_auguria_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu); if ($mode == 'left') $res=print_left_auguria_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$this->menu); if ($mode == 'jmobile') { $res=print_auguria_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,1); - + foreach($this->menu->liste as $key => $val) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu' { print '
      '; @@ -184,13 +188,15 @@ class MenuManager if ($val['enabled'] == 1) { $relurl=dol_buildpath($val['url'],1); - + print ''.$val['titre'].''."\n"; // Search submenu fot this entry $tmpmainmenu=$val['mainmenu']; $tmpleftmenu='all'; $submenu=new Menu(); + //var_dump($tmpmainmenu.' - '.$tmpleftmenu); $res=print_left_auguria_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$submenu,1,$tmpmainmenu,$tmpleftmenu); + //var_dump($submenu->liste); $nexturl=dol_buildpath($submenu->liste[0]['url'],1); $canonrelurl=preg_replace('/\?.*$/','',$relurl); $canonnexturl=preg_replace('/\?.*$/','',$nexturl); @@ -205,8 +211,14 @@ class MenuManager foreach($submenu->liste as $key2 => $val2) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu' { $relurl2=dol_buildpath($val2['url'],1); - //var_dump($val2); - print ''.$val2['titre'].''."\n"; + $canonurl2=preg_replace('/\?.*$/','',$val2['url']); + //var_dump($val2['url'].' - '.$canonurl2.' - '.$val2['level']); + if (in_array($canonurl2,array('/admin/index.php','/admin/tools/index.php'))) $relurl2=''; + print ''; + if ($relurl2) print ''; + print $val2['titre']; + if ($relurl2) print ''; + print ''."\n"; } //var_dump($submenu); print '
    '; @@ -219,9 +231,9 @@ class MenuManager print ''."\n"; } } - + unset($this->menu); - + return $res; } } diff --git a/htdocs/core/menus/standard/eldy_menu.php b/htdocs/core/menus/standard/eldy_menu.php index 8b381ed7038..18d64839fdc 100644 --- a/htdocs/core/menus/standard/eldy_menu.php +++ b/htdocs/core/menus/standard/eldy_menu.php @@ -49,14 +49,16 @@ class MenuManager $this->type_user=$type_user; $this->db=$db; } - - + + /** * Load this->tabMenu - * + * + * @param string $forcemainmenu To force mainmenu to load + * @param string $forceleftmenu To force leftmenu to load * @return void */ - function loadMenu() + function loadMenu($forcemainmenu='',$forceleftmenu='') { // On sauve en session le menu principal choisi if (isset($_GET["mainmenu"])) $_SESSION["mainmenu"]=$_GET["mainmenu"]; @@ -75,6 +77,7 @@ class MenuManager // On va le chercher en session si non defini par le lien $mainmenu=isset($_SESSION["mainmenu"])?$_SESSION["mainmenu"]:''; } + if (! empty($forcemainmenu)) $mainmenu=$forcemainmenu; if (isset($_GET["leftmenu"])) { @@ -95,6 +98,7 @@ class MenuManager // On va le chercher en session si non defini par le lien $leftmenu=isset($_SESSION["leftmenu"])?$_SESSION["leftmenu"]:''; } + if (! empty($forceleftmenu)) $leftmenu=$forceleftmenu; require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php'; $tabMenu=array(); @@ -123,13 +127,13 @@ class MenuManager } $res='ErrorBadParameterForMode'; - + require_once DOL_DOCUMENT_ROOT.'/core/class/menu.class.php'; $this->menu=new Menu(); - + if ($mode == 'top') $res=print_eldy_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu); if ($mode == 'left') $res=print_left_eldy_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$this->menu); - if ($mode == 'jmobile') + if ($mode == 'jmobile') { $res=print_eldy_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,1); @@ -166,18 +170,18 @@ class MenuManager } //var_dump($submenu); print ''; - } + } if ($val['enabled'] == 2) { print ''.$val['titre'].''; - } + } print ''; print ''."\n"; } } unset($this->menu); - + //print 'xx'.$mode; return $res; } From df08d838d7eeb6c1ad1777e332ac25bda4df1066 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 1 Apr 2013 14:49:33 +0200 Subject: [PATCH 099/194] More robust phpunit tests --- htdocs/user/class/user.class.php | 6 ++- test/phpunit/UserTest.php | 63 ++++++++++++++++++++++++++++++-- 2 files changed, 65 insertions(+), 4 deletions(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index a61289e7d09..607e0563e7d 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1969,6 +1969,8 @@ class User extends CommonObject $this->admin=0; $this->login='dolibspec'; $this->pass='dolibspec'; + //$this->pass_indatabase='dolibspec'; Set after a fetch + //$this->pass_indatabase_crypted='e80ca5a88c892b0aaaf7e154853bccab'; Set after a fetch $this->datec=time(); $this->datem=time(); $this->webcal_login='dolibspec'; @@ -1977,7 +1979,9 @@ class User extends CommonObject $this->datepreviouslogin=time(); $this->statut=1; - $this->societe_id = 1; + //$this->societe_id = 1; For external users + //$this->contact_id = 1; For external users + $this->entity = 1; } /** diff --git a/test/phpunit/UserTest.php b/test/phpunit/UserTest.php index abb7ab80cc5..088115a64ec 100644 --- a/test/phpunit/UserTest.php +++ b/test/phpunit/UserTest.php @@ -176,12 +176,19 @@ class UserTest extends PHPUnit_Framework_TestCase $langs=$this->savlangs; $db=$this->savdb; - $localobject->note='New note after update'; - $result=$localobject->update($user); + $this->changeProperties($localobject); + $result=$localobject->update($user); print __METHOD__." id=".$localobject->id." result=".$result."\n"; $this->assertLessThan($result, 0); - return $localobject; + + // Test everything are still same than specimen + $newlocalobject=new User($this->savdb); + $newlocalobject->initAsSpecimen(); + $this->changeProperties($newlocalobject); + $this->assertEquals($this->objCompare($localobject,$newlocalobject,true,array('id','ref','pass_indatabase','pass_indatabase_crypted','date_creation','datelastlogin','datepreviouslogin')), array()); // Actual, Expected + + return $localobject; } /** @@ -204,6 +211,7 @@ class UserTest extends PHPUnit_Framework_TestCase print __METHOD__." id=".$localobject->id." result=".$result."\n"; $this->assertLessThan($result, 0); + return $localobject; } @@ -260,5 +268,54 @@ class UserTest extends PHPUnit_Framework_TestCase return $result; } + + /** + * Edit an object to test updates + * + * @param mixed &$localobject Object Facture + * @return void + */ + public function changeProperties(&$localobject) + { + $localobject->note='New note after update'; + } + + /** + * Compare all public properties values of 2 objects + * + * @param Object $oA Object operand 1 + * @param Object $oB Object operand 2 + * @param boolean $ignoretype False will not report diff if type of value differs + * @param array $fieldstoignorearray Array of fields to ignore in diff + * @return array Array with differences + */ + public function objCompare($oA,$oB,$ignoretype=true,$fieldstoignorearray=array('id')) + { + $retAr=array(); + + if (get_class($oA) !== get_class($oB)) + { + $retAr[]="Supplied objects are not of same class."; + } + else + { + $oVarsA=get_object_vars($oA); + $oVarsB=get_object_vars($oB); + $aKeys=array_keys($oVarsA); + foreach($aKeys as $sKey) + { + if (in_array($sKey,$fieldstoignorearray)) continue; + if (! $ignoretype && $oVarsA[$sKey] !== $oVarsB[$sKey]) + { + $retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey])?get_class($oVarsA[$sKey]):$oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey])?get_class($oVarsB[$sKey]):$oVarsB[$sKey]); + } + if ($ignoretype && $oVarsA[$sKey] != $oVarsB[$sKey]) + { + $retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey])?get_class($oVarsA[$sKey]):$oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey])?get_class($oVarsB[$sKey]):$oVarsB[$sKey]); + } + } + } + return $retAr; + } } ?> \ No newline at end of file From bbe68e341ca73462c8a4f9c6783fc17bf1afd447 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 1 Apr 2013 15:28:53 +0200 Subject: [PATCH 100/194] Fix: dol_hide_topmenu and dol_hide_leftmenu not lost after logout --- htdocs/user/logout.php | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/htdocs/user/logout.php b/htdocs/user/logout.php index 5830d809c0b..f5523c791f2 100644 --- a/htdocs/user/logout.php +++ b/htdocs/user/logout.php @@ -33,12 +33,12 @@ if (! defined('EVEN_IF_ONLY_LOGIN_ALLOWED')) define('EVEN_IF_ONLY_LOGIN_ALLOWED require_once '../main.inc.php'; // This can happen only with a bookmark or forged url call. -if (!empty($_SESSION["dol_authmode"]) && ($_SESSION["dol_authmode"] == 'forceuser' - || $_SESSION["dol_authmode"] == 'http')) +if (!empty($_SESSION["dol_authmode"]) && ($_SESSION["dol_authmode"] == 'forceuser' || $_SESSION["dol_authmode"] == 'http')) { die("Disconnection does not work when connection was made in mode ".$_SESSION["dol_authmode"]); } + // Appel des triggers include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; $interface=new Interfaces($db); @@ -53,13 +53,16 @@ $urlfrom=empty($_SESSION["urlfrom"])?'':$_SESSION["urlfrom"]; // TODO external module if (! empty($conf->phenix->enabled) && ! empty($conf->phenix->cookie)) { - // Destroy cookie setcookie($conf->phenix->cookie, '', 1, "/"); } -// Destroy object of session -unset($_SESSION['dol_login']); -unset($_SESSION['dol_entity']); +// Define url to go +$url=DOL_URL_ROOT."/index.php"; // By default go to login page +if ($urlfrom) $url=DOL_URL_ROOT.$urlfrom; +if (! empty($conf->global->MAIN_LOGOUT_GOTO_URL)) $url=$conf->global->MAIN_LOGOUT_GOTO_URL; + +if (! empty($_SESSION['dol_hide_topmenu'])) $url.=(preg_match('/\?/',$url)?'&':'?').'dol_hide_topmenu=1'; +if (! empty($_SESSION['dol_hide_leftmenu'])) $url.=(preg_match('/\?/',$url)?'&':'?').'dol_hide_leftmenu=1'; // Destroy session $prefix=dol_getprefix(); @@ -70,10 +73,9 @@ session_name($sessionname); session_destroy(); dol_syslog("End of session ".$sessionname); -// Define url to go -$url=DOL_URL_ROOT."/index.php"; // By default go to login page -if ($urlfrom) $url=DOL_URL_ROOT.$urlfrom; -if (! empty($conf->global->MAIN_LOGOUT_GOTO_URL)) $url=$conf->global->MAIN_LOGOUT_GOTO_URL; +// TODO Not sure this is required +unset($_SESSION['dol_login']); +unset($_SESSION['dol_entity']); //print 'url='.$url;exit; header("Location: ".$url); From 3c37f89d2e5781f95953869e79cad20dcb19080e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 1 Apr 2013 16:02:16 +0200 Subject: [PATCH 101/194] Work on new menu managers - step x --- htdocs/core/menus/standard/auguria.lib.php | 160 ++++++++++---------- htdocs/core/menus/standard/auguria_menu.php | 9 +- htdocs/core/menus/standard/eldy_menu.php | 7 +- htdocs/user/logout.php | 4 +- 4 files changed, 95 insertions(+), 85 deletions(-) diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php index 1a40de3c713..d3be68503c0 100644 --- a/htdocs/core/menus/standard/auguria.lib.php +++ b/htdocs/core/menus/standard/auguria.lib.php @@ -252,92 +252,92 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM // Show menu if (empty($noout)) { - $alt=0; - $num=count($menu_array); - for ($i = 0; $i < $num; $i++) - { - $showmenu=true; - if (! empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED) && empty($menu_array[$i]['enabled'])) $showmenu=false; - - $alt++; - if (empty($menu_array[$i]['level']) && $showmenu) + $alt=0; + $num=count($menu_array); + for ($i = 0; $i < $num; $i++) { - if (($alt%2==0)) + $showmenu=true; + if (! empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED) && empty($menu_array[$i]['enabled'])) $showmenu=false; + + $alt++; + if (empty($menu_array[$i]['level']) && $showmenu) { - print '
    '."\n"; + if (($alt%2==0)) + { + print '
    '."\n"; + } + else + { + print '
    '."\n"; + } } - else + + // Place tabulation + $tabstring=''; + $tabul=($menu_array[$i]['level'] - 1); + if ($tabul > 0) { - print '
    '."\n"; + for ($j=0; $j < $tabul; $j++) + { + $tabstring.='   '; + } + } + + // Add mainmenu in GET url. This make to go back on correct menu even when using Back on browser. + $url=dol_buildpath($menu_array[$i]['url'],1); + $url=preg_replace('/__LOGIN__/',$user->login,$url); + $url=preg_replace('/__USERID__/',$user->id,$url); + + if (! preg_match('/mainmenu=/i',$menu_array[$i]['url'])) + { + if (! preg_match('/\?/',$url)) $url.='?'; + else $url.='&'; + $url.='mainmenu='.$mainmenu; + } + + print ''."\n"; + + // Menu niveau 0 + if ($menu_array[$i]['level'] == 0) + { + if ($menu_array[$i]['enabled']) + { + print ''; + } + else if ($showmenu) + { + print ''."\n"; + } + if ($showmenu) + print ''."\n"; + } + // Menu niveau > 0 + if ($menu_array[$i]['level'] > 0) + { + if ($menu_array[$i]['enabled']) + { + print ''."\n"; + } + else if ($showmenu) + { + print ''."\n"; + } + } + + // If next is a new block or end + if (empty($menu_array[$i+1]['level'])) + { + if ($showmenu) + print ''."\n"; + print "
    \n"; } } - - // Place tabulation - $tabstring=''; - $tabul=($menu_array[$i]['level'] - 1); - if ($tabul > 0) - { - for ($j=0; $j < $tabul; $j++) - { - $tabstring.='   '; - } - } - - // Add mainmenu in GET url. This make to go back on correct menu even when using Back on browser. - $url=dol_buildpath($menu_array[$i]['url'],1); - $url=preg_replace('/__LOGIN__/',$user->login,$url); - $url=preg_replace('/__USERID__/',$user->id,$url); - - if (! preg_match('/mainmenu=/i',$menu_array[$i]['url'])) - { - if (! preg_match('/\?/',$url)) $url.='?'; - else $url.='&'; - $url.='mainmenu='.$mainmenu; - } - - print ''."\n"; - - // Menu niveau 0 - if ($menu_array[$i]['level'] == 0) - { - if ($menu_array[$i]['enabled']) - { - print ''; - } - else if ($showmenu) - { - print ''."\n"; - } - if ($showmenu) - print ''."\n"; - } - // Menu niveau > 0 - if ($menu_array[$i]['level'] > 0) - { - if ($menu_array[$i]['enabled']) - { - print ''."\n"; - } - else if ($showmenu) - { - print ''."\n"; - } - } - - // If next is a new block or end - if (empty($menu_array[$i+1]['level'])) - { - if ($showmenu) - print ''."\n"; - print "
    \n"; - } - } } return count($menu_array); diff --git a/htdocs/core/menus/standard/auguria_menu.php b/htdocs/core/menus/standard/auguria_menu.php index 343edaf5201..35d73f55dcc 100644 --- a/htdocs/core/menus/standard/auguria_menu.php +++ b/htdocs/core/menus/standard/auguria_menu.php @@ -160,7 +160,7 @@ class MenuManager */ function showmenu($mode) { - global $conf, $langs; + global $conf, $langs, $user; require_once DOL_DOCUMENT_ROOT.'/core/menus/standard/auguria.lib.php'; @@ -188,6 +188,8 @@ class MenuManager if ($val['enabled'] == 1) { $relurl=dol_buildpath($val['url'],1); + $relurl=preg_replace('/__LOGIN__/',$user->login,$relurl); + $relurl=preg_replace('/__USERID__/',$user->id,$relurl); print ''.$val['titre'].''."\n"; // Search submenu fot this entry @@ -198,6 +200,7 @@ class MenuManager $res=print_left_auguria_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$submenu,1,$tmpmainmenu,$tmpleftmenu); //var_dump($submenu->liste); $nexturl=dol_buildpath($submenu->liste[0]['url'],1); + $canonrelurl=preg_replace('/\?.*$/','',$relurl); $canonnexturl=preg_replace('/\?.*$/','',$nexturl); //var_dump($canonrelurl); @@ -211,9 +214,11 @@ class MenuManager foreach($submenu->liste as $key2 => $val2) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu' { $relurl2=dol_buildpath($val2['url'],1); + $relurl2=preg_replace('/__LOGIN__/',$user->login,$relurl2); + $relurl2=preg_replace('/__USERID__/',$user->id,$relurl2); $canonurl2=preg_replace('/\?.*$/','',$val2['url']); //var_dump($val2['url'].' - '.$canonurl2.' - '.$val2['level']); - if (in_array($canonurl2,array('/admin/index.php','/admin/tools/index.php'))) $relurl2=''; + if (in_array($canonurl2,array('/admin/index.php','/admin/tools/index.php','/core/tools.php'))) $relurl2=''; print ''; if ($relurl2) print ''; print $val2['titre']; diff --git a/htdocs/core/menus/standard/eldy_menu.php b/htdocs/core/menus/standard/eldy_menu.php index 18d64839fdc..d1751ead59c 100644 --- a/htdocs/core/menus/standard/eldy_menu.php +++ b/htdocs/core/menus/standard/eldy_menu.php @@ -116,7 +116,7 @@ class MenuManager */ function showmenu($mode) { - global $conf, $langs; + global $conf, $langs, $user; require_once DOL_DOCUMENT_ROOT.'/core/menus/standard/eldy.lib.php'; @@ -144,6 +144,8 @@ class MenuManager if ($val['enabled'] == 1) { $relurl=dol_buildpath($val['url'],1); + $relurl=preg_replace('/__LOGIN__/',$user->login,$relurl); + $relurl=preg_replace('/__USERID__/',$user->id,$relurl); print ''.$val['titre'].''."\n"; // Search submenu fot this entry @@ -152,6 +154,7 @@ class MenuManager $submenu=new Menu(); $res=print_left_eldy_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$submenu,1,$tmpmainmenu,$tmpleftmenu); $nexturl=dol_buildpath($submenu->liste[0]['url'],1); + $canonrelurl=preg_replace('/\?.*$/','',$relurl); $canonnexturl=preg_replace('/\?.*$/','',$nexturl); //var_dump($canonrelurl); @@ -165,6 +168,8 @@ class MenuManager foreach($submenu->liste as $key2 => $val2) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu' { $relurl2=dol_buildpath($val2['url'],1); + $relurl2=preg_replace('/__LOGIN__/',$user->login,$relurl2); + $relurl2=preg_replace('/__USERID__/',$user->id,$relurl2); //var_dump($val2); print ''.$val2['titre'].''."\n"; } diff --git a/htdocs/user/logout.php b/htdocs/user/logout.php index f5523c791f2..7113d2a459a 100644 --- a/htdocs/user/logout.php +++ b/htdocs/user/logout.php @@ -61,8 +61,8 @@ $url=DOL_URL_ROOT."/index.php"; // By default go to login page if ($urlfrom) $url=DOL_URL_ROOT.$urlfrom; if (! empty($conf->global->MAIN_LOGOUT_GOTO_URL)) $url=$conf->global->MAIN_LOGOUT_GOTO_URL; -if (! empty($_SESSION['dol_hide_topmenu'])) $url.=(preg_match('/\?/',$url)?'&':'?').'dol_hide_topmenu=1'; -if (! empty($_SESSION['dol_hide_leftmenu'])) $url.=(preg_match('/\?/',$url)?'&':'?').'dol_hide_leftmenu=1'; +if (GETPOST('dol_hide_topmenu')) $url.=(preg_match('/\?/',$url)?'&':'?').'dol_hide_topmenu=1'; +if (GETPOST('dol_hide_leftmenu')) $url.=(preg_match('/\?/',$url)?'&':'?').'dol_hide_leftmenu=1'; // Destroy session $prefix=dol_getprefix(); From e2623c6ad514383009296c2c88234e1518fd495e Mon Sep 17 00:00:00 2001 From: Grand Philippe Date: Mon, 1 Apr 2013 16:04:15 +0200 Subject: [PATCH 102/194] try to fix :supplier invoice numbering --- htdocs/compta/index.php | 18 ++++---- .../fourn/class/fournisseur.facture.class.php | 45 +++---------------- htdocs/fourn/facture/fiche.php | 17 +++---- htdocs/fourn/facture/impayees.php | 14 +++--- htdocs/fourn/facture/index.php | 10 ++--- htdocs/fourn/facture/paiement.php | 14 +++--- htdocs/fourn/fiche.php | 6 +-- htdocs/fourn/index.php | 6 +-- htdocs/fourn/paiement/fiche.php | 2 +- htdocs/fourn/recap-fourn.php | 2 +- .../install/mysql/migration/3.3.0-3.4.0.sql | 3 +- 11 files changed, 52 insertions(+), 85 deletions(-) diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index ec2dc5997e2..7600e05d0d8 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -258,7 +258,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) */ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire) { - $sql = "SELECT f.facnumber, f.rowid, f.total_ttc, f.type,"; + $sql = "SELECT f.ref_supplier, f.rowid, f.total_ttc, f.type,"; $sql.= " s.nom, s.rowid as socid"; $sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as f, ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -287,7 +287,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture- { $obj = $db->fetch_object($resql); print ''; - $facturesupplierstatic->ref=$obj->facnumber; + $facturesupplierstatic->ref=$obj->ref; $facturesupplierstatic->id=$obj->rowid; $facturesupplierstatic->type=$obj->type; print $facturesupplierstatic->getNomUrl(1,'',16); @@ -432,7 +432,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture- $langs->load("boxes"); $facstatic=new FactureFournisseur($db); - $sql = "SELECT ff.rowid, ff.facnumber, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_ttc, ff.tms, ff.paye"; + $sql = "SELECT ff.rowid, ff.ref_supplier, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_ttc, ff.tms, ff.paye"; $sql.= ", s.nom, s.rowid as socid"; $sql.= ", SUM(pf.amount) as am"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as ff"; @@ -442,7 +442,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture- $sql.= " AND ff.entity = ".$conf->entity; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; if ($socid) $sql.= " AND ff.fk_soc = ".$socid; - $sql.= " GROUP BY ff.rowid, ff.facnumber, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_ttc, ff.tms, ff.paye, s.nom, s.rowid"; + $sql.= " GROUP BY ff.rowid, ff.ref_supplier, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_ttc, ff.tms, ff.paye, s.nom, s.rowid"; $sql.= " ORDER BY ff.tms DESC "; $sql.= $db->plimit($max, 0); @@ -467,7 +467,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture- { $obj = $db->fetch_object($resql); print ''; - $facstatic->ref=$obj->facnumber; + $facstatic->ref=$obj->ref; $facstatic->id=$obj->rowid; print $facstatic->getNomUrl(1,''); print ''; @@ -930,7 +930,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture- { $facstatic=new FactureFournisseur($db); - $sql = "SELECT ff.rowid, ff.facnumber, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_ttc, ff.paye,"; + $sql = "SELECT ff.rowid, ff.ref_supplier, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_ttc, ff.paye,"; $sql.= " s.nom, s.rowid as socid,"; $sql.= " sum(pf.amount) as am"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as ff"; @@ -942,7 +942,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture- $sql.= " AND ff.fk_statut = 1"; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; if ($socid) $sql.= " AND ff.fk_soc = ".$socid; - $sql.= " GROUP BY ff.rowid, ff.facnumber, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_ttc, s.nom, s.rowid"; + $sql.= " GROUP BY ff.rowid, ff.ref_supplier, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_ttc, s.nom, s.rowid"; $resql=$db->query($sql); if ($resql) @@ -967,7 +967,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture- $obj = $db->fetch_object($resql); print ''; - $facstatic->ref=$obj->facnumber; + $facstatic->ref=$obj->ref; $facstatic->id=$obj->rowid; print $facstatic->getNomUrl(1,''); print ''; @@ -1033,7 +1033,7 @@ if ($resql) } //print ''; -print '
    '; +print '
    '; llxFooter(); diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 5b26339c8c8..3ca14f707e3 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -134,7 +134,7 @@ class FactureFournisseur extends CommonInvoice $sql = "INSERT INTO ".MAIN_DB_PREFIX."facture_fourn ("; $sql.= "ref"; - $sql.= ", facnumber"; + $sql.= ", ref_supplier"; $sql.= ", entity"; $sql.= ", libelle"; $sql.= ", fk_soc"; @@ -263,7 +263,7 @@ class FactureFournisseur extends CommonInvoice $sql = "SELECT"; $sql.= " t.rowid,"; $sql.= " t.ref,"; - $sql.= " t.facnumber,"; + $sql.= " t.ref_supplier,"; $sql.= " t.entity,"; $sql.= " t.type,"; $sql.= " t.fk_soc,"; @@ -298,7 +298,7 @@ class FactureFournisseur extends CommonInvoice $sql.= ' s.nom as socnom, s.rowid as socid'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as t,'.MAIN_DB_PREFIX.'societe as s'; if ($id) $sql.= " WHERE t.rowid=".$id; - if ($ref) $sql.= " WHERE t.ref='".$this->db->escape($ref)."'"; // ref is id (facnumber is supplier ref) + if ($ref) $sql.= " WHERE t.ref='".$this->db->escape($ref)."'"; $sql.= ' AND t.fk_soc = s.rowid'; dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); @@ -312,8 +312,7 @@ class FactureFournisseur extends CommonInvoice $this->id = $obj->rowid; $this->ref = $obj->ref; - $this->ref_supplier = $obj->facnumber; - $this->facnumber = $obj->facnumber; + $this->ref_supplier = $obj->ref_supplier; $this->entity = $obj->entity; $this->type = empty($obj->type)?0:$obj->type; $this->fk_soc = $obj->fk_soc; @@ -501,7 +500,7 @@ class FactureFournisseur extends CommonInvoice // Update request $sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn SET"; $sql.= " ref=".(isset($this->ref)?"'".$this->db->escape($this->ref)."'":"null").","; - $sql.= " facnumber=".(isset($this->facnumber)?"'".$this->db->escape($this->facnumber)."'":"null").","; + $sql.= " ref_supplier=".(isset($this->ref_supplier)?"'".$this->db->escape($this->ref_supplier)."'":"null").","; $sql.= " entity=".(isset($this->entity)?$this->entity:"null").","; $sql.= " type=".(isset($this->type)?$this->type:"null").","; $sql.= " fk_soc=".(isset($this->fk_soc)?$this->fk_soc:"null").","; @@ -664,39 +663,7 @@ class FactureFournisseur extends CommonInvoice return -$error; } } - - /** - * Set supplier ref - * - * @param User $user User that make change - * @param string $ref_supplier Supplier ref - * @return int <0 if KO, >0 if OK - */ - function set_ref_supplier($user, $ref_supplier) - { - if ($user->rights->fournisseur->facture->creer) - { - $sql = 'UPDATE '.MAIN_DB_PREFIX.'facture_fourn SET facnumber = '.(empty($ref_supplier) ? 'NULL' : '\''.$this->db->escape($ref_supplier).'\''); - $sql.= ' WHERE rowid = '.$this->id; - - dol_syslog("FactureFournisseur::set_ref_supplier sql=".$sql); - if ($this->db->query($sql)) - { - $this->ref_supplier = $ref_supplier; - return 1; - } - else - { - $this->error=$this->db->lasterror(); - dol_syslog('FactureFournisseur::set_ref_supplier '.$this->error.' - '.$sql, LOG_ERR); - return -2; - } - } - else - { - return -1; - } - } + /** * Tag invoice as a payed invoice diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index 9f63805a288..1e92ced62ab 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -170,12 +170,13 @@ elseif ($action == 'confirm_paid' && $confirm == 'yes' && $user->rights->fournis } // Set supplier ref -elseif ($action == 'setfacnumber' && $user->rights->fournisseur->facture->creer) +if ($action == 'setref_supplier' && $user->rights->fournisseur->commande->creer) { - $object->fetch($id); - $result=$object->set_ref_supplier($user, GETPOST('facnumber')); + $result=$object->setValueFrom('ref_supplier',GETPOST('ref_supplier','alpha')); + if ($result < 0) dol_print_error($db, $object->error); } + // Set label elseif ($action == 'setlabel' && $user->rights->fournisseur->facture->creer) { @@ -253,7 +254,7 @@ elseif ($action == 'add' && $user->rights->fournisseur->facture->creer) $_GET['socid']=$_POST['socid']; $error++; } - if (! GETPOST('facnumber')) + if (! GETPOST('ref_supplier')) { $mesg='
    '.$langs->trans('ErrorFieldRequired',$langs->transnoentities('RefSupplier')).'
    '; $action='create'; @@ -267,7 +268,7 @@ elseif ($action == 'add' && $user->rights->fournisseur->facture->creer) // Creation facture $object->ref = $_POST['ref']; - $object->facnumber = $_POST['facnumber']; + $object->ref_supplier = $_POST['ref_supplier']; $object->socid = $_POST['socid']; $object->libelle = $_POST['libelle']; $object->date = $datefacture; @@ -1048,7 +1049,7 @@ if ($action == 'create') print ''; // Ref supplier - print ''.$langs->trans('RefSupplier').''; + print ''.$langs->trans('RefSupplier').''; print ''; print ''.$langs->trans('Type').''; @@ -1352,8 +1353,8 @@ else print "\n"; // Ref supplier - print ''.$form->editfieldkey("RefSupplier",'facnumber',$object->ref_supplier,$object,($object->statut<2 && $user->rights->fournisseur->facture->creer)).''; - print $form->editfieldval("RefSupplier",'facnumber',$object->ref_supplier,$object,($object->statut<2 && $user->rights->fournisseur->facture->creer)); + print ''.$form->editfieldkey("RefSupplier",'ref_supplier',$object->ref_supplier,$object,($object->statut<2 && $user->rights->fournisseur->facture->creer)).''; + print $form->editfieldval("RefSupplier",'ref_supplier',$object->ref_supplier,$object,($object->statut<2 && $user->rights->fournisseur->facture->creer)); print ''; // Third party diff --git a/htdocs/fourn/facture/impayees.php b/htdocs/fourn/facture/impayees.php index 467d02e8726..e88350aad57 100644 --- a/htdocs/fourn/facture/impayees.php +++ b/htdocs/fourn/facture/impayees.php @@ -89,7 +89,7 @@ if (! $sortorder) $sortorder="ASC"; if ($user->rights->fournisseur->facture->lire) { $sql = "SELECT s.rowid as socid, s.nom,"; - $sql.= " f.rowid as ref, f.facnumber, f.total_ht, f.total_ttc,"; + $sql.= " f.rowid, f.ref, f.ref_supplier, f.total_ht, f.total_ttc,"; $sql.= " f.datef as df, f.date_lim_reglement as datelimite, "; $sql.= " f.paye as paye, f.rowid as facid, f.fk_statut"; $sql.= " ,sum(pf.amount) as am"; @@ -121,7 +121,7 @@ if ($user->rights->fournisseur->facture->lire) } if ($search_ref_supplier) { - $sql .= " AND f.facnumber LIKE '%".$search_ref_supplier."%'"; + $sql .= " AND f.ref_supplier LIKE '%".$search_ref_supplier."%'"; } if ($search_societe) @@ -141,14 +141,14 @@ if ($user->rights->fournisseur->facture->lire) if (dol_strlen(GETPOST('sf_re')) > 0) { - $sql .= " AND f.facnumber LIKE '%".GETPOST('sf_re')."%'"; + $sql .= " AND f.ref_supplier LIKE '%".GETPOST('sf_re')."%'"; } - $sql.= " GROUP BY f.facnumber, f.rowid, f.total_ht, f.total_ttc, f.datef, f.date_lim_reglement, f.paye, f.fk_statut, s.rowid, s.nom"; + $sql.= " GROUP BY f.ref_supplier, f.rowid, f.total_ht, f.total_ttc, f.datef, f.date_lim_reglement, f.paye, f.fk_statut, s.rowid, s.nom"; $sql.= " ORDER BY "; $listfield=explode(',',$sortfield); foreach ($listfield as $key => $value) $sql.=$listfield[$key]." ".$sortorder.","; - $sql.= " f.facnumber DESC"; + $sql.= " f.ref_supplier DESC"; $resql = $db->query($sql); if ($resql) @@ -191,7 +191,7 @@ if ($user->rights->fournisseur->facture->lire) print ''; print ''; print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"f.rowid","",$param,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("RefSupplier"),$_SERVER["PHP_SELF"],"f.facnumber","",$param,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("RefSupplier"),$_SERVER["PHP_SELF"],"f.ref_supplier","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"f.datef","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateDue"),$_SERVER["PHP_SELF"],"f.date_lim_reglement","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder); @@ -242,7 +242,7 @@ if ($user->rights->fournisseur->facture->lire) print $facturestatic->getNomUrl(1); print "\n"; - print "\n"; + print "\n"; print "\n"; print "
    ".dol_trunc($objp->facnumber,12)."".dol_trunc($objp->ref_supplier,12)."".dol_print_date($db->jdate($objp->df),'day')."".dol_print_date($db->jdate($objp->datelimite),'day'); diff --git a/htdocs/fourn/facture/index.php b/htdocs/fourn/facture/index.php index b5922f52b29..6a3415f02f0 100644 --- a/htdocs/fourn/facture/index.php +++ b/htdocs/fourn/facture/index.php @@ -103,7 +103,7 @@ $htmlother=new FormOther($db); llxHeader('',$langs->trans("SuppliersInvoices"),'EN:Suppliers_Invoices|FR:FactureFournisseur|ES:Facturas_de_proveedores'); $sql = "SELECT s.rowid as socid, s.nom, "; -$sql.= " fac.rowid as facid, fac.ref, fac.facnumber, fac.datef, fac.date_lim_reglement as date_echeance,"; +$sql.= " fac.rowid as facid, fac.ref, fac.ref_supplier, fac.datef, fac.date_lim_reglement as date_echeance,"; $sql.= " fac.total_ht, fac.total_ttc, fac.paye as paye, fac.fk_statut as fk_statut, fac.libelle"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user "; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as fac"; @@ -131,7 +131,7 @@ if (GETPOST("search_ref")) } if (GETPOST("search_ref_supplier")) { - $sql .= " AND fac.facnumber LIKE '%".$db->escape(GETPOST("search_ref_supplier"))."%'"; + $sql .= " AND fac.ref_supplier LIKE '%".$db->escape(GETPOST("search_ref_supplier"))."%'"; } if ($month > 0) { @@ -193,7 +193,7 @@ if ($resql) print ''; print ''; print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"fac.rowid","",$param,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("RefSupplier"),$_SERVER["PHP_SELF"],"facnumber","",$param,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("RefSupplier"),$_SERVER["PHP_SELF"],"ref_supplier","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"fac.datef,fac.rowid","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateDue"),$_SERVER["PHP_SELF"],"fac.date_lim_reglement","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"fac.libelle","",$param,"",$sortfield,$sortorder); @@ -249,10 +249,10 @@ if ($resql) print '\n"; - print '"; + print '"; print ''; print ''; print ''; - print ''; + print ''; if ($objp->df > 0 ) { print '\n"; // Lines for filters fields @@ -492,7 +492,7 @@ if (empty($action)) print ''; // Ref invoice - /*$invoicesupplierstatic->ref=$objp->facnumber; + /*$invoicesupplierstatic->ref=$objp->ref_supplier; $invoicesupplierstatic->id=$objp->facid; print ''; print ''; + print img_object($langs->trans('ShowBill'),'bill').' '.$obj->ref_supplier.' '.dol_trunc($obj->libelle,14).''; print ''; print ''; print '
    '; $facturestatic->id=$obj->facid; $facturestatic->ref=$obj->ref; - $facturestatic->ref_supplier=$obj->facnumber; + $facturestatic->ref_supplier=$obj->ref_supplier; print $facturestatic->getNomUrl(1); print "'.dol_trunc($obj->facnumber,10)."'.dol_trunc($obj->ref_supplier,10)."'.dol_print_date($db->jdate($obj->datef),'day').''.dol_print_date($db->jdate($obj->date_echeance),'day'); if (($obj->paye == 0) && ($obj->fk_statut > 0) && $db->jdate($obj->date_echeance) < ($now - $conf->facture->fournisseur->warning_delay)) print img_picto($langs->trans("Late"),"warning"); diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index 51b9972260e..9ee8f4d9a23 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -192,7 +192,7 @@ if ($action == 'create' || $action == 'add_paiement') $dateinvoice=($datefacture==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0):$datefacture); $sql = 'SELECT s.nom, s.rowid as socid,'; - $sql.= ' f.rowid as ref, f.facnumber, f.amount, f.total_ttc as total'; + $sql.= ' f.rowid, f.ref, f.ref_supplier, f.amount, f.total_ttc as total'; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user "; $sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'facture_fourn as f'; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -214,7 +214,7 @@ if ($action == 'create' || $action == 'add_paiement') print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; @@ -257,7 +257,7 @@ if ($action == 'create' || $action == 'add_paiement') /* * Autres factures impayees */ - $sql = 'SELECT f.rowid as facid, f.rowid as ref, f.facnumber, f.total_ht, f.total_ttc, f.datef as df'; + $sql = 'SELECT f.rowid as facid, f.ref, f.ref_supplier, f.total_ht, f.total_ttc, f.datef as df'; $sql.= ', SUM(pf.amount) as am'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as f'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf ON pf.fk_facturefourn = f.rowid'; @@ -265,7 +265,7 @@ if ($action == 'create' || $action == 'add_paiement') $sql.= ' AND f.fk_soc = '.$object->socid; $sql.= ' AND f.paye = 0'; $sql.= ' AND f.fk_statut = 1'; // Statut=0 => non validee, Statut=2 => annulee - $sql.= ' GROUP BY f.rowid, f.facnumber, f.total_ht, f.total_ttc, f.datef'; + $sql.= ' GROUP BY f.rowid, f.ref_supplier, f.total_ht, f.total_ttc, f.datef'; $resql = $db->query($sql); if ($resql) { @@ -298,7 +298,7 @@ if ($action == 'create' || $action == 'add_paiement') print '
    '.img_object($langs->trans('ShowBill'),'bill').' '.$objp->ref; print ''.$objp->facnumber.''.$objp->ref_supplier.''; @@ -441,7 +441,7 @@ if (empty($action)) print_liste_field_titre($langs->trans('Type'),'paiement.php','c.libelle','',$paramlist,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans('Account'),'paiement.php','ba.label','',$paramlist,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans('Amount'),'paiement.php','f.amount','',$paramlist,'align="right"',$sortfield,$sortorder); - //print_liste_field_titre($langs->trans('Invoice'),'paiement.php','facnumber','',$paramlist,'',$sortfield,$sortorder); + //print_liste_field_titre($langs->trans('Invoice'),'paiement.php','ref_supplier','',$paramlist,'',$sortfield,$sortorder); print "
    '.price($objp->pamount).''; print $invoicesupplierstatic->getNomUrl(1); diff --git a/htdocs/fourn/fiche.php b/htdocs/fourn/fiche.php index 4a745fc9ef9..2d9a7a151b3 100644 --- a/htdocs/fourn/fiche.php +++ b/htdocs/fourn/fiche.php @@ -319,12 +319,12 @@ if ($object->fetch($id)) if ($user->rights->fournisseur->facture->lire) { // TODO move to DAO class - $sql = 'SELECT f.rowid,f.libelle,f.facnumber,f.fk_statut,f.datef as df,f.total_ttc as amount,f.paye,'; + $sql = 'SELECT f.rowid,f.libelle,f.ref_supplier,f.fk_statut,f.datef as df,f.total_ttc as amount,f.paye,'; $sql.= ' SUM(pf.amount) as am'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as f'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf ON f.rowid=pf.fk_facturefourn'; $sql.= ' WHERE f.fk_soc = '.$object->id; - $sql.= ' GROUP BY f.rowid,f.libelle,f.facnumber,f.fk_statut,f.datef,f.total_ttc,f.paye'; + $sql.= ' GROUP BY f.rowid,f.libelle,f.ref_supplier,f.fk_statut,f.datef,f.total_ttc,f.paye'; $sql.= ' ORDER BY f.datef DESC'; $resql=$db->query($sql); if ($resql) @@ -349,7 +349,7 @@ if ($object->fetch($id)) print '
    '; print ''; - print img_object($langs->trans('ShowBill'),'bill').' '.$obj->facnumber.' '.dol_trunc($obj->libelle,14).''.dol_print_date($db->jdate($obj->df),'day').''.price($obj->amount).''; diff --git a/htdocs/fourn/index.php b/htdocs/fourn/index.php index 25f781ccf0d..49ab7bdaeae 100644 --- a/htdocs/fourn/index.php +++ b/htdocs/fourn/index.php @@ -163,7 +163,7 @@ if (! empty($conf->fournisseur->enabled)) // Draft invoices if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire) { - $sql = "SELECT ff.facnumber, ff.rowid, ff.total_ttc, ff.type"; + $sql = "SELECT ff.ref_supplier, ff.rowid, ff.total_ttc, ff.type"; $sql.= ", s.nom, s.rowid as socid"; $sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as ff"; $sql.= ", ".MAIN_DB_PREFIX."societe as s"; @@ -192,7 +192,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture- $obj = $db->fetch_object($resql); $var=!$var; print '
    '; - $facturestatic->ref=$obj->facnumber; + $facturestatic->ref=$obj->ref; $facturestatic->id=$obj->rowid; $facturestatic->type=$obj->type; print $facturestatic->getNomUrl(1,''); @@ -321,7 +321,7 @@ if (count($companystatic->SupplierCategories)) //print "
    \n"; -print ''; +print '
    '; llxFooter(); diff --git a/htdocs/fourn/paiement/fiche.php b/htdocs/fourn/paiement/fiche.php index b967a43984c..30afab7e935 100644 --- a/htdocs/fourn/paiement/fiche.php +++ b/htdocs/fourn/paiement/fiche.php @@ -234,7 +234,7 @@ if ($result > 0) * Liste des factures */ $allow_delete = 1 ; - $sql = 'SELECT f.rowid as ref, f.facnumber as ref_supplier, f.total_ttc, pf.amount, f.rowid as facid, f.paye, f.fk_statut, s.nom, s.rowid as socid'; + $sql = 'SELECT f.rowid, f.ref, f.ref_supplier, f.total_ttc, pf.amount, f.rowid as facid, f.paye, f.fk_statut, s.nom, s.rowid as socid'; $sql .= ' FROM '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf,'.MAIN_DB_PREFIX.'facture_fourn as f,'.MAIN_DB_PREFIX.'societe as s'; $sql .= ' WHERE pf.fk_facturefourn = f.rowid AND f.fk_soc = s.rowid'; $sql .= ' AND pf.fk_paiementfourn = '.$object->id; diff --git a/htdocs/fourn/recap-fourn.php b/htdocs/fourn/recap-fourn.php index ba10ab420c0..78cde75300f 100644 --- a/htdocs/fourn/recap-fourn.php +++ b/htdocs/fourn/recap-fourn.php @@ -90,7 +90,7 @@ if ($socid > 0) print ''; - $sql = "SELECT s.nom, s.rowid as socid, f.facnumber, f.amount, f.datef as df,"; + $sql = "SELECT s.nom, s.rowid as socid, f.ref_supplier, f.amount, f.datef as df,"; $sql.= " f.paye as paye, f.fk_statut as statut, f.rowid as facid,"; $sql.= " u.login, u.rowid as userid"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_fourn as f,".MAIN_DB_PREFIX."user as u"; diff --git a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql index 5c2a86122ea..c47b7a9adcf 100755 --- a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql +++ b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql @@ -85,6 +85,7 @@ alter table llx_societe_rib CHANGE COLUMN adresse_proprio owner_address text; alter table llx_societe_address CHANGE COLUMN ville town text; alter table llx_societe_address CHANGE COLUMN cp zip varchar(10); alter table llx_expedition CHANGE COLUMN fk_expedition_methode fk_shipping_method integer; +alter table llx_facture_fourn CHANGE COLUMN facnumber ref_supplier varchar(30); ALTER TABLE llx_c_shipment_mode ADD COLUMN tracking VARCHAR(256) NOT NULL DEFAULT '' AFTER description; @@ -208,5 +209,3 @@ ALTER TABLE llx_user ADD COLUMN town varchar(50); ALTER TABLE llx_user ADD COLUMN fk_state integer DEFAULT 0; ALTER TABLE llx_user ADD COLUMN fk_country integer DEFAULT 0; - -ALTER TABLE llx_user_clicktodial ADD COLUMN url varchar(255); From 6e66922a6b5b0e1f865124f2a332be7d74d4e29c Mon Sep 17 00:00:00 2001 From: jfefe Date: Mon, 1 Apr 2013 18:46:53 +0200 Subject: [PATCH 103/194] Fix : in extrafield force output for date selector --- 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 f9398c21cb8..5491c727ad6 100755 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -624,7 +624,7 @@ class ExtraFields $formstat = new Form($db); $showtime = in_array($type,array('datetime')) ? 1 : 0; - $out = $formstat->select_date($value, 'options_'.$key, $showtime, $showtime, $required, '', 1, 1, 0, 0, 1); + $out = $formstat->select_date($value, 'options_'.$key, $showtime, $showtime, $required, '', 1, 1, 1, 0, 1); //$out=''; } elseif (in_array($type,array('int','double'))) From ec52f54a522a0a6291f137d657c925c041271f17 Mon Sep 17 00:00:00 2001 From: jfefe Date: Mon, 1 Apr 2013 18:59:05 +0200 Subject: [PATCH 104/194] Unique function to show input or output of extrafields datas --- htdocs/core/class/commonobject.class.php | 104 +++++++++++++---------- 1 file changed, 60 insertions(+), 44 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index f9a1bad9ef7..43fb4234558 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2190,59 +2190,75 @@ abstract class CommonObject else return 0; } - /** + /** * Function to show lines of extrafields with output datas * * @param object $extrafields extrafield Object + * @param string $mode Show output (view) or input (edit) for extrafield * * return string */ - function showOptionals($extrafields) + function showOptionals($extrafields,$mode='view') { - global $_POST; + global $_POST; - $out = ''; + $out = ''; - if (! empty($this->array_options)) - { - $e = 0; - foreach($extrafields->attribute_label as $key=>$label) - { - $colspan='3'; - $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$this->array_options["options_".$key]); - if ($extrafields->attribute_type[$key] == 'separate') - { - $out = $extrafields->showSeparator($key); - } - else - { - if ( !empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0) - { - $out .= ''; - $colspan='0'; - } - else - { - $out .= ''; - } - // Convert date into timestamp format - if (in_array($extrafields->attribute_type[$key],array('date','datetime'))) - { - $value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$this->array_options['options_'.$key]; - } - $out .= ''; - $out .=''."\n"; - - if (! empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && (($e % 2) == 1)) $out .= ''; - else $out .= ''; - $e++; - } - } - } - return $out; - } + if(count($extrafields->attribute_label) > 0) + { + $out .= "\n"; + $out .= ' '; + $out .= "\n"; + + $e = 0; + foreach($extrafields->attribute_label as $key=>$label) + { + $colspan='3'; + $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$this->array_options["options_".$key]); + if ($extrafields->attribute_type[$key] == 'separate') + { + $out .= $extrafields->showSeparator($key); + } + else + { + if ( !empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0) + { + $out .= ''; + $colspan='0'; + } + else + { + $out .= ''; + } + // Convert date into timestamp format + if (in_array($extrafields->attribute_type[$key],array('date','datetime'))) + { + $value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$this->array_options['options_'.$key]; + } + $out .= ''; + $out .=''."\n"; + + if (! empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && (($e % 2) == 1)) $out .= ''; + else $out .= ''; + $e++; + } + } + $out .= "\n"; + $out .= ' '; + } + return $out; + } /** From 7ca7c552c06b87410a9857fe28c0944bdf7c7ea3 Mon Sep 17 00:00:00 2001 From: jfefe Date: Mon, 1 Apr 2013 18:59:41 +0200 Subject: [PATCH 105/194] Use new function to show extrafields on products --- htdocs/product/fiche.php | 50 +++------------------------------------- 1 file changed, 3 insertions(+), 47 deletions(-) diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php index 98a6c35aa09..e222476ac1e 100644 --- a/htdocs/product/fiche.php +++ b/htdocs/product/fiche.php @@ -779,30 +779,8 @@ else $parameters=array('colspan' => ' colspan="2"'); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if (empty($reshook) && ! empty($extrafields->attribute_label)) - { - foreach($extrafields->attribute_label as $key=>$label) - { - $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); - // Show separator only - if ($extrafields->attribute_type[$key] == 'separate') - { - print $extrafields->showSeparator($key); - } - else - { - // Convert date into timestamp format - if (in_array($extrafields->attribute_type[$key],array('date','datetime'))) - { - $value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$object->array_options['options_'.$key]; - } - - print 'attribute_required[$key])) print ' class="fieldrequired"'; - print '>'.$label.''."\n"; - } - } + { + print $object->showOptionals($extrafields,'edit'); } // Note (private, no output on invoices, propales...) @@ -1001,29 +979,7 @@ else $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if (empty($reshook) && ! empty($extrafields->attribute_label)) { - foreach($extrafields->attribute_label as $key=>$label) - { - $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); - // Show separator only - if ($extrafields->attribute_type[$key] == 'separate') - { - print $extrafields->showSeparator($key); - } - else - { - // Convert date into timestamp format - if (in_array($extrafields->attribute_type[$key],array('date','datetime'))) - { - $value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$object->array_options['options_'.$key]; - } - - print 'attribute_required[$key])) print ' class="fieldrequired"'; - print '>'.$label.''."\n"; - } - } + print $object->showOptionals($extrafields,'edit'); } // Note From a8874ebcc8eeb6bce82d64f044a231cafd732723 Mon Sep 17 00:00:00 2001 From: jfefe Date: Mon, 1 Apr 2013 19:43:26 +0200 Subject: [PATCH 106/194] Uniformize usage of extrafields methods --- htdocs/adherents/fiche.php | 54 +++++-------------------- htdocs/adherents/type.php | 58 ++++++--------------------- htdocs/comm/action/fiche.php | 58 ++++++--------------------- htdocs/comm/mailing/fiche.php | 35 +++-------------- htdocs/comm/propal.php | 21 +--------- htdocs/commande/fiche.php | 20 +--------- htdocs/compta/facture.php | 18 +-------- htdocs/contact/fiche.php | 74 +++++------------------------------ htdocs/societe/soc.php | 67 +------------------------------ htdocs/user/fiche.php | 50 ++++------------------- 10 files changed, 66 insertions(+), 389 deletions(-) diff --git a/htdocs/adherents/fiche.php b/htdocs/adherents/fiche.php index 787cad2664f..e76d41a6fd2 100644 --- a/htdocs/adherents/fiche.php +++ b/htdocs/adherents/fiche.php @@ -64,6 +64,9 @@ if (! empty($conf->mailmanspip->enabled)) $object = new Adherent($db); $extrafields = new ExtraFields($db); +// fetch optionals attributes and labels +$extralabels=$extrafields->fetch_name_optionals_label('member'); + // Get object canvas (By default, this is not defined, so standard usage of dolibarr) $object->getCanvas($socid); $canvas = $object->canvas?$object->canvas:GETPOST("canvas"); @@ -282,14 +285,8 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->adherent->creer) $object->statut = $_POST["statut"]; $object->public = $_POST["public"]; - // Get extra fields - foreach($_POST as $key => $value) - { - if (preg_match("/^options_/",$key)) - { - $object->array_options[$key]=$_POST[$key]; - } - } + // Fill array 'array_options' with data from add form + $ret = $extrafields->setOptionalsFromPost($extralabels,$object); // Check if we need to also synchronize user information $nosyncuser=0; @@ -451,14 +448,8 @@ if ($action == 'add' && $user->rights->adherent->creer) $object->fk_soc = $socid; $object->public = $public; - // Get extra fields - foreach($_POST as $key => $value) - { - if (preg_match("/^options_/",$key)) - { - $object->array_options[$key]=$_POST[$key]; - } - } + // Fill array 'array_options' with data from add form + $ret = $extrafields->setOptionalsFromPost($extralabels,$object); // Check parameters if (empty($morphy) || $morphy == "-1") { @@ -684,9 +675,6 @@ if ($user->rights->adherent->creer && $action == 'confirm_add_spip' && $confirm $form = new Form($db); $formcompany = new FormCompany($db); -// fetch optionals attributes and labels -$extralabels=$extrafields->fetch_name_optionals_label('member'); - $help_url='EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros'; llxHeader('',$langs->trans("Member"),$help_url); @@ -885,15 +873,7 @@ else $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if (empty($reshook) && ! empty($extrafields->attribute_label)) { - foreach($extrafields->attribute_label as $key=>$label) - { - $value=(isset($_POST["options_".$key])?GETPOST('options_'.$key,'alpha'):(isset($object->array_options["options_".$key])?$object->array_options["options_".$key]:'')); - print 'attribute_required[$key])) print ' class="fieldrequired"'; - print '>'.$label.''."\n"; - } + print $object->showOptionals($extrafields,'edit'); } /* @@ -1128,15 +1108,7 @@ else $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if (empty($reshook) && ! empty($extrafields->attribute_label)) { - foreach($extrafields->attribute_label as $key=>$label) - { - $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); - print 'attribute_required[$key])) print ' class="fieldrequired"'; - print '>'.$label.''."\n"; - } + print $object->showOptionals($extrafields,'edit'); } // Third party Dolibarr @@ -1458,13 +1430,7 @@ else $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if (empty($reshook) && ! empty($extrafields->attribute_label)) { - foreach($extrafields->attribute_label as $key=>$label) - { - $value=$object->array_options["options_$key"]; - print "\n"; - } + print $object->showOptionals($extrafields); } // Third party Dolibarr diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index f4a60f55cd9..72fc3cc2a37 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -56,6 +56,9 @@ $result=restrictedArea($user,'adherent',$rowid,'adherent_type'); $extrafields = new ExtraFields($db); +// fetch optionals attributes and labels +$extralabels=$extrafields->fetch_name_optionals_label('adherent_type'); + if (GETPOST('button_removefilter')) { $search_lastname=""; @@ -84,14 +87,8 @@ if ($action == 'add' && $user->rights->adherent->configurer) $adht->mail_valid = trim($_POST["mail_valid"]); $adht->vote = trim($_POST["vote"]); - // Get extra fields - foreach($_POST as $key => $value) - { - if (preg_match("/^options_/",$key)) - { - $adht->array_options[$key]=GETPOST($key); - } - } + // Fill array 'array_options' with data from add form + $ret = $extrafields->setOptionalsFromPost($extralabels,$adht); if ($adht->libelle) { @@ -127,14 +124,8 @@ if ($action == 'update' && $user->rights->adherent->configurer) $adht->mail_valid = trim($_POST["mail_valid"]); $adht->vote = trim($_POST["vote"]); - // Get extra fields - foreach($_POST as $key => $value) - { - if (preg_match("/^options_/",$key)) - { - $adht->array_options[$key]=GETPOST($key); - } - } + // Fill array 'array_options' with data from add form + $ret = $extrafields->setOptionalsFromPost($extralabels,$adht); $adht->update($user->id); @@ -167,8 +158,6 @@ llxHeader('',$langs->trans("MembersTypeSetup"),'EN:Module_Foundations|FR:Module_ $form=new Form($db); -// fetch optionals attributes and labels -$extralabels=$extrafields->fetch_name_optionals_label('adherent_type'); // Liste of members type @@ -245,6 +234,7 @@ if (! $rowid && $action != 'create' && $action != 'edit') if ($action == 'create') { $form = new Form($db); + $adht = new AdherentType($db); print_fiche_titre($langs->trans("NewMemberType")); @@ -278,23 +268,11 @@ if ($action == 'create') // Other attributes $parameters=array(); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook - - print "
    '.$label.''; - $out .= $extrafields->showOutputField($key,$value); - $out .= '
    '.$label.''; + + switch($mode) { + case "view": + $out .= $extrafields->showOutputField($key,$value); + break; + case "edit": + $out .= $extrafields->showInputField($key,$value); + break; + } + + $out .= '
    '; - print $extrafields->showInputField($key,$value); - print '
    '; - print $extrafields->showInputField($key,$value); - print '
    '; - print $extrafields->showInputField($key,$value); - print '
    '; - print $extrafields->showInputField($key,$value); - print '
    ".$label.""; - print $extrafields->showOutputField($key,$value); - print "
    \n"; - if (empty($reshook) && ! empty($extrafields->attribute_label)) { - print '

    '; - foreach($extrafields->attribute_label as $key=>$label) - { - $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$act->array_options["options_".$key]); - print 'attribute_required[$key])) print ' class="fieldrequired"'; - print ' width="30%">'.$label.''."\n"; - } - print '
    '; - print $extrafields->showInputField($key,$value); - print '


    '; + print $adht->showOptionals($extrafields,'edit'); } + print "
    \n"; print '
    '; print '
        '; @@ -356,23 +334,13 @@ if ($rowid > 0) // Other attributes $parameters=array(); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook - - print ''; - - //Extra field if (empty($reshook) && ! empty($extrafields->attribute_label)) { - print '

    '; - foreach($extrafields->attribute_label as $key=>$label) - { - $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:(isset($adht->array_options['options_'.$key])?$adht->array_options['options_'.$key]:'')); - print '\n"; - } - print '
    '.$label.''; - print $extrafields->showOutputField($key,$value); - print "


    '; + // View extrafields + print $adht->showOptionals($extrafields); } + print ''; print ''; /* diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php index 07a6647f4bb..2851e55dfd9 100644 --- a/htdocs/comm/action/fiche.php +++ b/htdocs/comm/action/fiche.php @@ -63,6 +63,9 @@ $actioncomm = new ActionComm($db); $contact = new Contact($db); $extrafields = new ExtraFields($db); +// fetch optionals attributes and labels +$extralabels=$extrafields->fetch_name_optionals_label('actioncomm'); + //var_dump($_POST); // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array @@ -203,14 +206,8 @@ if ($action == 'add_action') $mesg='
    '.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")).'
    '; } - // Get extra fields - foreach($_POST as $key => $value) - { - if (preg_match("/^options_/",$key)) - { - $actioncomm->array_options[$key]=GETPOST($key); - } - } + // Fill array 'array_options' with data from add form + $ret = $extrafields->setOptionalsFromPost($extralabels,$actioncomm); if (! $error) { @@ -343,14 +340,8 @@ if ($action == 'update') } $actioncomm->userdone = $userdone; - // Get extra fields - foreach($_POST as $key => $value) - { - if (preg_match("/^options_/",$key)) - { - $actioncomm->array_options[$key]=GETPOST($key); - } - } + // Fill array 'array_options' with data from add form + $ret = $extrafields->setOptionalsFromPost($extralabels,$actioncomm); if (! $error) { @@ -395,9 +386,6 @@ llxHeader('',$langs->trans("Agenda"),$help_url); $form = new Form($db); $htmlactions = new FormActions($db); -// fetch optionals attributes and labels -$extralabels=$extrafields->fetch_name_optionals_label('actioncomm'); - if ($action == 'create') { $contact = new Contact($db); @@ -603,22 +591,13 @@ if ($action == 'create') $parameters=array(); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$actioncomm,$action); // Note that $action and $object may have been modified by hook - print ''; if (empty($reshook) && ! empty($extrafields->attribute_label)) { - print '

    '; - foreach($extrafields->attribute_label as $key=>$label) - { - $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:(isset($actioncomm->array_options["options_".$key])?$actioncomm->array_options["options_".$key]:'')); - print 'attribute_required[$key])) print ' class="fieldrequired"'; - print ' width="30%">'.$label.''."\n"; - } - print '
    '; - print $extrafields->showInputField($key,$value); - print '

    '; + print $actioncomm->showOptionals($extrafields,'edit'); } + + print ''; print '

    '; print ''; @@ -838,24 +817,13 @@ if ($id > 0) // Other attributes $parameters=array('colspan' => ' colspan="3"', 'colspanvalue' => '3'); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook - - print ''; - if (empty($reshook) && ! empty($extrafields->attribute_label)) { - print '

    '; - foreach($extrafields->attribute_label as $key=>$label) - { - $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$act->array_options["options_".$key]); - print 'attribute_required[$key])) print ' class="fieldrequired"'; - print ' width="30%">'.$label.''."\n"; - } - print '
    '; - print $extrafields->showInputField($key,$value); - print '


    '; + print $actioncomm->showOptionals($extrafields,'edit'); + } + print ''; print '

    '; print '     '; diff --git a/htdocs/comm/mailing/fiche.php b/htdocs/comm/mailing/fiche.php index d04b9c7aefe..195db2d53a8 100644 --- a/htdocs/comm/mailing/fiche.php +++ b/htdocs/comm/mailing/fiche.php @@ -48,6 +48,9 @@ $result=$object->fetch($id); $extrafields = new ExtraFields($db); +// fetch optionals attributes and labels +$extralabels=$extrafields->fetch_name_optionals_label('mailing'); + // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('mailingcard')); @@ -631,8 +634,6 @@ if (! empty($_POST["cancel"])) * View */ -// fetch optionals attributes and labels -$extralabels=$extrafields->fetch_name_optionals_label('mailing'); $help_url='EN:Module_EMailing|FR:Module_Mailing|ES:Módulo_Mailing'; llxHeader('',$langs->trans("Mailing"),$help_url); @@ -661,15 +662,7 @@ if ($action == 'create') $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if (empty($reshook) && ! empty($extrafields->attribute_label)) { - foreach($extrafields->attribute_label as $key=>$label) - { - $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); - print 'attribute_required[$key])) print ' class="fieldrequired"'; - print '>'.$label.''; - print $extrafields->showInputField($key,$value); - print ''."\n"; - } + print $object->showOptionals($extrafields,'edit'); } print ''; @@ -823,15 +816,7 @@ else $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if (empty($reshook) && ! empty($extrafields->attribute_label)) { - foreach($extrafields->attribute_label as $key=>$label) - { - $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); - print 'attribute_required[$key])) print ' class="fieldrequired"'; - print '>'.$label.''; - print $extrafields->showInputField($key,$value); - print "\n"; - } + print $object->showOptionals($extrafields); } print ''; @@ -1072,15 +1057,7 @@ else $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if (empty($reshook) && ! empty($extrafields->attribute_label)) { - foreach($extrafields->attribute_label as $key=>$label) - { - $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); - print 'attribute_required[$key])) print ' class="fieldrequired"'; - print '>'.$label.''; - print $extrafields->showInputField($key,$value); - print "\n"; - } + print $object->showOptionals($extrafields,'edit'); } print ''; diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 7cf90691655..8c51c4ff941 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -1347,24 +1347,7 @@ if ($action == 'create') $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if (empty($reshook) && ! empty($extrafields->attribute_label)) { - foreach($extrafields->attribute_label as $key=>$label) - { - $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); - - // Show separator only - if ($extrafields->attribute_type[$key] == 'separate') - { - print $extrafields->showSeparator($key); - } - else - { - print 'attribute_required[$key])) print ' class="fieldrequired"'; - print '>'.$label.''; - print $extrafields->showInputField($key,$value); - print ''."\n"; - } - } + print $object->showOptionals($extrafields,'edit'); } print ""; @@ -1849,7 +1832,7 @@ else print ''; } - + // TODO : use showOptionals($extrafields) function foreach($extrafields->attribute_label as $key=>$label) { $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index bdd61a6ace3..116fd5fe3cb 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -1564,15 +1564,7 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if (empty($reshook) && ! empty($extrafields->attribute_label)) { - foreach($extrafields->attribute_label as $key=>$label) - { - $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); - print 'attribute_required[$key])) print ' class="fieldrequired"'; - print '>'.$label.''; - print $extrafields->showInputField($key,$value); - print ''."\n"; - } + print $object->showOptionals($extrafields,'edit'); } // Template to use by default @@ -2091,15 +2083,7 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if (empty($reshook) && ! empty($extrafields->attribute_label)) { - foreach($extrafields->attribute_label as $key=>$label) - { - $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); - print 'attribute_required[$key])) print ' class="fieldrequired"'; - print '>'.$label.''; - print $extrafields->showInputField($key,$value); - print ''."\n"; - } + print $object->showOptionals($extrafields,'edit'); } // Total HT diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 935d475bb9e..c24f09f4baa 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -2097,23 +2097,7 @@ if ($action == 'create') $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if (empty($reshook) && ! empty($extrafields->attribute_label)) { - foreach($extrafields->attribute_label as $key=>$label) - { - $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); - // Show separator only - if ($extrafields->attribute_type[$key] == 'separate') - { - print $extrafields->showSeparator($key); - } - else - { - print 'attribute_required[$key])) print ' class="fieldrequired"'; - print '>'.$label.''; - print $extrafields->showInputField($key,$value); - print ''."\n"; - } - } + print $object->showOptionals($extrafields,'edit'); } // Modele PDF diff --git a/htdocs/contact/fiche.php b/htdocs/contact/fiche.php index 885711bb526..db0fe091cd9 100644 --- a/htdocs/contact/fiche.php +++ b/htdocs/contact/fiche.php @@ -50,6 +50,9 @@ if ($user->societe_id) $socid=$user->societe_id; $object = new Contact($db); $extrafields = new ExtraFields($db); +// fetch optionals attributes and labels +$extralabels=$extrafields->fetch_name_optionals_label('contact'); + // Get object canvas (By default, this is not defined, so standard usage of dolibarr) $object->getCanvas($id); $objcanvas=null; @@ -155,14 +158,8 @@ if (empty($reshook)) $object->birthday = dol_mktime(0,0,0,$_POST["birthdaymonth"],$_POST["birthdayday"],$_POST["birthdayyear"]); $object->birthday_alert = $_POST["birthday_alert"]; - // Get extra fields - foreach($_POST as $key => $value) - { - if (preg_match("/^options_/",$key)) - { - $object->array_options[$key]=GETPOST($key); - } - } + // Fill array 'array_options' with data from add form + $ret = $extrafields->setOptionalsFromPost($extralabels,$object); if (! $_POST["lastname"]) { @@ -252,14 +249,8 @@ if (empty($reshook)) $object->priv = $_POST["priv"]; $object->note = $_POST["note"]; - // Get extra fields - foreach($_POST as $key => $value) - { - if (preg_match("/^options_/",$key)) - { - $object->array_options[$key]=GETPOST($key); - } - } + // Fill array 'array_options' with data from add form + $ret = $extrafields->setOptionalsFromPost($extralabels,$object); $result = $object->update($_POST["contactid"], $user); @@ -283,8 +274,6 @@ if (empty($reshook)) * View */ -// fetch optionals attributes and labels -$extralabels=$extrafields->fetch_name_optionals_label('contact'); $help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; llxHeader('',$langs->trans("ContactsAddresses"),$help_url); @@ -518,22 +507,7 @@ else $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if (empty($reshook) && ! empty($extrafields->attribute_label)) { - foreach($extrafields->attribute_label as $key=>$label) - { - $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:(isset($object->array_options["options_".$key])?$object->array_options["options_".$key]:'')); - if ($extrafields->attribute_type[$key] == 'separate') - { - print $extrafields->showSeparator($key); - } - else - { - print 'attribute_required[$key])) print ' class="fieldrequired"'; - print '>'.$label.''; - print $extrafields->showInputField($key,$value); - print ''."\n"; - } - } + print $object->showOptionals($extrafields,'edit'); } print "
    "; @@ -740,22 +714,7 @@ else $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if (empty($reshook) && ! empty($extrafields->attribute_label)) { - foreach($extrafields->attribute_label as $key=>$label) - { - $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); - if ($extrafields->attribute_type[$key] == 'separate') - { - print $extrafields->showSeparator($key); - } - else - { - print 'attribute_required[$key])) print ' class="fieldrequired"'; - print '>'.$label.''; - print $extrafields->showInputField($key,$value); - print "\n"; - } - } + print $object->showOptionals($extrafields,'edit'); } $object->load_ref_elements(); @@ -959,20 +918,7 @@ else $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if (empty($reshook) && ! empty($extrafields->attribute_label)) { - foreach($extrafields->attribute_label as $key=>$label) - { - $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:(isset($object->array_options['options_'.$key])?$object->array_options['options_'.$key]:'')); - if ($extrafields->attribute_type[$key] == 'separate') - { - print $extrafields->showSeparator($key); - } - else - { - print ''.$label.''; - print $extrafields->showOutputField($key,$value); - print "\n"; - } - } + print $object->showOptionals($extrafields); } $object->load_ref_elements(); diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 5b3106afa0d..17892d4631d 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -974,40 +974,7 @@ else $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if (empty($reshook) && ! empty($extrafields->attribute_label)) { - $e=0; - foreach($extrafields->attribute_label as $key=>$label) - { - $colspan='3'; - $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:(isset($object->array_options["options_".$key])?$object->array_options["options_".$key]:'')); - if ($extrafields->attribute_type[$key] == 'separate') - { - print $extrafields->showSeparator($key); - } - else - { - if (($e % 2) == 0) - { - print ''; - $colspan='0'; - } - print 'attribute_required[$key])) print ' class="fieldrequired"'; - print '>'.$label.''; - print ''; - - // Convert date into timestamp format - if (in_array($extrafields->attribute_type[$key],array('date','datetime'))) - { - $value = dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]); - } - - print $extrafields->showInputField($key,$value); - print ''; - - if (($e % 2) == 1) print ''."\n"; - $e++; - } - } + print $object->showOptionals($extrafields,'edit'); } // Ajout du logo @@ -1416,37 +1383,7 @@ else $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if (empty($reshook) && ! empty($extrafields->attribute_label)) { - $old_pos=0; - $e=0; - foreach($extrafields->attribute_label as $key=>$label) - { - $colspan = '3'; - $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); - if ($extrafields->attribute_type[$key] == 'separate') - { - print $extrafields->showSeparator($key); - } - else - { - if (($e % 2) == 0) - { - print ''."\n"; - $colspan = '0'; - } - print 'attribute_required[$key])) print ' class="fieldrequired"'; - print '>'.$label.''."\n"; - print ''; - print $extrafields->showInputField($key,$value); - print ""."\n"; - - if (($e % 2) == 1 ) - { - print "\n"; - } - $e++; - } - } + print $object->showOptionals($extrafields,'edit'); } // Logo print ''; diff --git a/htdocs/user/fiche.php b/htdocs/user/fiche.php index 1ef52efc85b..be62afba37f 100644 --- a/htdocs/user/fiche.php +++ b/htdocs/user/fiche.php @@ -187,14 +187,8 @@ if ($action == 'add' && $canadduser) $object->note = GETPOST("note"); $object->ldap_sid = GETPOST("ldap_sid"); - // Get extra fields - foreach($_POST as $key => $value) - { - if (preg_match("/^options_/",$key)) - { - $object->array_options[$key]=GETPOST($key); - } - } + // Fill array 'array_options' with data from add form + $ret = $extrafields->setOptionalsFromPost($extralabels,$object); // If multicompany is off, admin users must all be on entity 0. if (! empty($conf->multicompany->enabled)) @@ -329,14 +323,8 @@ if ($action == 'update' && ! $_POST["cancel"]) $object->openid = GETPOST("openid"); $object->fk_user = GETPOST("fk_user")>0?GETPOST("fk_user"):0; - // Get extra fields - foreach($_POST as $key => $value) - { - if (preg_match("/^options_/",$key)) - { - $object->array_options[$key]=GETPOST($key); - } - } + // Fill array 'array_options' with data from add form + $ret = $extrafields->setOptionalsFromPost($extralabels,$object); if (! empty($conf->multicompany->enabled)) { @@ -927,15 +915,7 @@ if (($action == 'create') || ($action == 'adduserldap')) $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if (empty($reshook) && ! empty($extrafields->attribute_label)) { - foreach($extrafields->attribute_label as $key=>$label) - { - $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); - print 'attribute_required[$key])) print ' class="fieldrequired"'; - print '>'.$label.''; - print $extrafields->showInputField($key,$value); - print ''."\n"; - } + print $object->showOptionals($extrafields,'edit'); } print "\n"; @@ -1304,15 +1284,7 @@ else $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if (empty($reshook) && ! empty($extrafields->attribute_label)) { - foreach($extrafields->attribute_label as $key=>$label) - { - $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); - print 'attribute_required[$key])) print ' class="fieldrequired"'; - print '>'.$label.''; - print $extrafields->showOutputField($key,$value); - print ''."\n"; - } + print $object->showOptionals($extrafields); } print "\n"; @@ -1921,15 +1893,7 @@ else $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if (empty($reshook) && ! empty($extrafields->attribute_label)) { - foreach($extrafields->attribute_label as $key=>$label) - { - $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); - print 'attribute_required[$key])) print ' class="fieldrequired"'; - print '>'.$label.''; - print $extrafields->showInputField($key,$value); - print ''."\n"; - } + print $object->showOptionals($extrafields,'edit'); } print ''; From 94493453953788fa7cf2c33cbe2e0266e4f453f6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 1 Apr 2013 20:15:52 +0200 Subject: [PATCH 107/194] Another step for menu management rewriting --- htdocs/core/menus/standard/auguria.lib.php | 2 +- htdocs/core/menus/standard/auguria_menu.php | 6 +- htdocs/core/menus/standard/eldy.lib.php | 2 +- htdocs/core/menus/standard/eldy_menu.php | 4 +- htdocs/core/menus/standard/empty.php | 190 ++++++++++++++------ htdocs/cron/list.php | 41 ++--- htdocs/main.inc.php | 4 +- htdocs/theme/auguria/style.css.php | 5 +- htdocs/theme/bureau2crea/style.css.php | 3 +- htdocs/theme/cameleo/style.css.php | 3 +- htdocs/theme/eldy/style.css.php | 12 +- 11 files changed, 175 insertions(+), 97 deletions(-) diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php index d3be68503c0..43c270c188d 100644 --- a/htdocs/core/menus/standard/auguria.lib.php +++ b/htdocs/core/menus/standard/auguria.lib.php @@ -326,7 +326,7 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM } else if ($showmenu) { - print ''."\n"; + print ''."\n"; } } diff --git a/htdocs/core/menus/standard/auguria_menu.php b/htdocs/core/menus/standard/auguria_menu.php index 35d73f55dcc..bac7e57bc0d 100644 --- a/htdocs/core/menus/standard/auguria_menu.php +++ b/htdocs/core/menus/standard/auguria_menu.php @@ -175,8 +175,8 @@ class MenuManager require_once DOL_DOCUMENT_ROOT.'/core/class/menu.class.php'; $this->menu=new Menu(); - if ($mode == 'top') $res=print_auguria_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu); - if ($mode == 'left') $res=print_left_auguria_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$this->menu); + if ($mode == 'top') $res=print_auguria_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,0); + if ($mode == 'left') $res=print_left_auguria_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$this->menu,0); if ($mode == 'jmobile') { $res=print_auguria_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,1); @@ -206,7 +206,7 @@ class MenuManager //var_dump($canonrelurl); //var_dump($canonnexturl); print '