From acad2191d570f2b0082d5640b1771fdc834ea5ce Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 31 Jul 2012 00:06:39 +0200 Subject: [PATCH 01/15] Fix: Style --- htdocs/commissions/admin/commissions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commissions/admin/commissions.php b/htdocs/commissions/admin/commissions.php index a48f6ead1ca..cbbd486e2d4 100644 --- a/htdocs/commissions/admin/commissions.php +++ b/htdocs/commissions/admin/commissions.php @@ -148,7 +148,7 @@ print ''; $var=!$var; print ''; print ''; -print ''; +print ''; print ''; print ''; From 40a57f63cb5780037f2d484d33c7a7bb24cd9c48 Mon Sep 17 00:00:00 2001 From: simnandez Date: Tue, 31 Jul 2012 09:26:35 +0200 Subject: [PATCH 02/15] Trad: Improve translations --- htdocs/langs/ca_ES/boxes.lang | 4 +++- htdocs/langs/es_ES/boxes.lang | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/langs/ca_ES/boxes.lang b/htdocs/langs/ca_ES/boxes.lang index f87373490c4..4f210a2b8cb 100644 --- a/htdocs/langs/ca_ES/boxes.lang +++ b/htdocs/langs/ca_ES/boxes.lang @@ -52,6 +52,7 @@ BoxTitleLastActionsToDo=Les %s últims esdeveniments a realitzar BoxTitleLastContracts=Els %s últims contractes BoxTitleLastModifiedDonations=Les %s últimes subvencions modificades BoxTitleLastModifiedExpenses=Els %s últims honoraris modificats +BoxTitleLatestSupplierOrders=Les %s últimes comandes a proveïdors FailedToRefreshDataInfoNotUpToDate=Error en el refresc del flux RSS. Data de l'últim refresc :%s LastRefreshDate=Data darrera actualització NoRecordedBookmarks=No hi ha marcadors personals. @@ -69,4 +70,5 @@ NoModifiedSupplierBills=Sense factures de proveïdors modificades NoRecordedProducts=Sense productes/serveis registrats NoRecordedProspects=Sense clients potencials registrats NoContractedProducts=Sense productes/serveis contractats -NoRecordedContracts=Sense contractes registrats \ No newline at end of file +NoRecordedContracts=Sense contractes registrats +NoSupplierOrder=Sense comandes a proveïdors \ No newline at end of file diff --git a/htdocs/langs/es_ES/boxes.lang b/htdocs/langs/es_ES/boxes.lang index c1db2198579..c47ce5b5ef7 100644 --- a/htdocs/langs/es_ES/boxes.lang +++ b/htdocs/langs/es_ES/boxes.lang @@ -52,7 +52,7 @@ BoxTitleLastActionsToDo=Los %s últimos eventos a realizar BoxTitleLastContracts=Los %s últimos contratos BoxTitleLastModifiedDonations=Las %s últimas donaciones modificadas BoxTitleLastModifiedExpenses=Los %s últimos honorarios modificados -BoxTitleLatestSupplierOrders=Las %s últimas órdenes de pedido de proveedores +BoxTitleLatestSupplierOrders=Las %s últimos pedidos a proveedores FailedToRefreshDataInfoNotUpToDate=Error en el refresco del flujo RSS. Fecha del último refresco: %s LastRefreshDate=Fecha última actualización NoRecordedBookmarks=No hay marcadores personales. @@ -71,4 +71,4 @@ NoRecordedProducts=Sin productos/servicios registrados NoRecordedProspects=Sin clientes potenciales registrados NoContractedProducts=Sin productos/servicios contratados NoRecordedContracts=Sin contratos registrados -NoSupplierOrder=Sin órdenes de pedido de proveedores \ No newline at end of file +NoSupplierOrder=Sin pedidos a proveedores \ No newline at end of file From 47335f0613e84dc7541c44c828694e1a78534086 Mon Sep 17 00:00:00 2001 From: simnandez Date: Tue, 31 Jul 2012 09:29:19 +0200 Subject: [PATCH 03/15] Trad: Improve translations --- htdocs/langs/es_ES/boxes.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/es_ES/boxes.lang b/htdocs/langs/es_ES/boxes.lang index c47ce5b5ef7..a1f72a51b1e 100644 --- a/htdocs/langs/es_ES/boxes.lang +++ b/htdocs/langs/es_ES/boxes.lang @@ -52,7 +52,7 @@ BoxTitleLastActionsToDo=Los %s últimos eventos a realizar BoxTitleLastContracts=Los %s últimos contratos BoxTitleLastModifiedDonations=Las %s últimas donaciones modificadas BoxTitleLastModifiedExpenses=Los %s últimos honorarios modificados -BoxTitleLatestSupplierOrders=Las %s últimos pedidos a proveedores +BoxTitleLatestSupplierOrders=Los %s últimos pedidos a proveedores FailedToRefreshDataInfoNotUpToDate=Error en el refresco del flujo RSS. Fecha del último refresco: %s LastRefreshDate=Fecha última actualización NoRecordedBookmarks=No hay marcadores personales. From 902f1c7e716b29a312b2f9e89ae60ad275c6879a Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 1 Aug 2012 08:23:37 +0200 Subject: [PATCH 04/15] Fix: typo --- htdocs/langs/fr_FR/commissions.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/fr_FR/commissions.lang b/htdocs/langs/fr_FR/commissions.lang index 61d8112010c..2ae2aef2332 100644 --- a/htdocs/langs/fr_FR/commissions.lang +++ b/htdocs/langs/fr_FR/commissions.lang @@ -9,7 +9,7 @@ ServiceCommissionRate=Taux de commissionnement sur les services ProductCommissionRateDetails=Taux utilisé pour calculer les commissions sur les ventes de produits ServiceCommissionRateDetails=Taux utilisé pour calculer les commissions sur les ventes de services -Commissions=Comissions +Commissions=Commissions CommissionDetails=Détail des commissions IncludeUnpayedInvoices=Inclure les factures non réglées From 29fea7bbf49ed3faacabc6e696bc9d8cf5427c62 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 1 Aug 2012 12:58:19 +0200 Subject: [PATCH 05/15] Fix: regression (multicompany) --- htdocs/core/class/html.form.class.php | 2 +- htdocs/user/fiche.php | 18 +++++++++--------- htdocs/user/group/fiche.php | 16 ++++++++-------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index d52ec6e334e..9075a8c6a25 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3755,7 +3755,7 @@ class Form * @param int $force_entity Possibility to force entity * @return void */ - function select_dolgroups($selected='',$htmlname='groupid',$show_empty=0,$exclude='',$disabled=0,$include='',$enableonly='',$force_entity='') + function select_dolgroups($selected='', $htmlname='groupid', $show_empty=0, $exclude='', $disabled=0, $include='', $enableonly='', $force_entity='') { global $conf,$user,$langs; diff --git a/htdocs/user/fiche.php b/htdocs/user/fiche.php index 8d5418636bc..0cbff5f77f7 100644 --- a/htdocs/user/fiche.php +++ b/htdocs/user/fiche.php @@ -1313,15 +1313,15 @@ else $usergroup=new UserGroup($db); $groupslist = $usergroup->listGroupsForUser($fuser->id); - if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)) + if (! empty($groupslist)) { - if (! empty($groupslist)) - { - foreach($groupslist as $groupforuser) - { - $exclude[]=$groupforuser->id; - } - } + if (! ($conf->multicompany->enabled && $conf->multicompany->transverse_mode)) + { + foreach($groupslist as $groupforuser) + { + $exclude[]=$groupforuser->id; + } + } } if ($caneditgroup) @@ -1333,7 +1333,7 @@ else print ''."\n"; print ''."\n"; print '"; print ''; } + else + { + //ODT templates + require_once(DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'); + $srcroot='./doctemplates'; + $destroot=$main_data_dir.'/doctemplates'; + $docs=array('thirdparties' => 'thirdparty', 'proposals' => 'proposal', 'orders' => 'order', 'invoices' => 'invoice'); + foreach($docs as $dir => $file) + { + $src=$srcroot.'/thirdparties/template_'.$file.'.odt'; + $dirodt=$destroot.'/'.$dir; + $dest=$dirodt.'/template_'.$file.'.odt'; + + dol_mkdir($dirodt); + $result=dol_copy($src,$dest,0,0); + if ($result < 0) + { + print ''; + } + } + } } } From 2e73cd7ddf385b82a60f8d752c359c6bc39de873 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 1 Aug 2012 17:36:15 +0200 Subject: [PATCH 09/15] Fix: missing fields and compatibility with milestone --- htdocs/comm/propal/class/propal.class.php | 69 ++++++++++--------- htdocs/commande/class/commande.class.php | 55 +++++++-------- htdocs/compta/facture/class/facture.class.php | 68 ++++++++---------- htdocs/core/class/commonobject.class.php | 18 ++--- 4 files changed, 98 insertions(+), 112 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 36da9e9840a..2d5a785e353 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -309,7 +309,7 @@ class Propal extends CommonObject * * @see add_product */ - function addline($propalid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $price_base_type='HT', $pu_ttc=0, $info_bits=0, $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=null, $pa_ht = 0) + function addline($propalid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $price_base_type='HT', $pu_ttc=0, $info_bits=0, $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=null, $pa_ht = 0) { global $conf; @@ -399,9 +399,9 @@ class Propal extends CommonObject $this->line->special_code=$special_code; $this->line->fk_parent_line=$fk_parent_line; - // infos marge - $this->line->fk_fournprice = $fk_fournprice; - $this->line->pa_ht = $pa_ht; + // infos marge + $this->line->fk_fournprice = $fk_fournprice; + $this->line->pa_ht = $pa_ht; // Mise en option de la ligne //if ($conf->global->PROPALE_USE_OPTION_LINE && !$qty) $ligne->special_code=3; @@ -1072,9 +1072,9 @@ class Propal extends CommonObject /* * Lignes propales liees a un produit ou non - */ + */ $sql = "SELECT d.rowid, d.fk_propal, d.fk_parent_line, d.description, d.price, d.tva_tx, d.localtax1_tx, d.localtax2_tx, d.qty, d.fk_remise_except, d.remise_percent, d.subprice, d.fk_product,"; - $sql.= " d.info_bits, d.total_ht, d.total_tva, d.total_localtax1, d.total_localtax2, d.total_ttc, d.fk_product_fournisseur_price as fk_fournprice, d.buy_price_ht as pa_ht, d.special_code, d.rang, d.product_type,"; + $sql.= " d.info_bits, d.total_ht, d.total_tva, d.total_localtax1, d.total_localtax2, d.total_ttc, d.fk_product_fournisseur_price as fk_fournprice, d.buy_price_ht as pa_ht, d.special_code, d.rang, d.product_type,"; $sql.= ' p.ref as product_ref, p.description as product_desc, p.fk_product_type, p.label as product_label'; $sql.= " FROM ".MAIN_DB_PREFIX."propaldet as d"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON d.fk_product = p.rowid"; @@ -1113,11 +1113,11 @@ class Propal extends CommonObject $line->total_localtax1 = $objp->total_localtax1; $line->total_localtax2 = $objp->total_localtax2; $line->total_ttc = $objp->total_ttc; - $line->fk_fournprice = $objp->fk_fournprice; - $marginInfos = getMarginInfos($objp->subprice, $objp->remise_percent, $objp->tva_tx, $objp->localtax1_tx, $objp->localtax2_tx, $line->fk_fournprice, $objp->pa_ht); - $line->pa_ht = $marginInfos[0]; - $line->marge_tx = $marginInfos[1]; - $line->marque_tx = $marginInfos[2]; + $line->fk_fournprice = $objp->fk_fournprice; + $marginInfos = getMarginInfos($objp->subprice, $objp->remise_percent, $objp->tva_tx, $objp->localtax1_tx, $objp->localtax2_tx, $line->fk_fournprice, $objp->pa_ht); + $line->pa_ht = $marginInfos[0]; + $line->marge_tx = $marginInfos[1]; + $line->marque_tx = $marginInfos[2]; $line->special_code = $objp->special_code; $line->rang = $objp->rang; @@ -2381,7 +2381,7 @@ class Propal extends CommonObject $sql = 'SELECT pt.rowid, pt.description, pt.fk_product, pt.fk_remise_except,'; $sql.= ' pt.qty, pt.tva_tx, pt.remise_percent, pt.subprice, pt.info_bits,'; $sql.= ' pt.total_ht, pt.total_tva, pt.total_ttc, pt.fk_product_fournisseur_price as fk_fournprice, pt.buy_price_ht as pa_ht, pt.special_code, pt.localtax1_tx, pt.localtax2_tx,'; - $sql.= ' pt.date_start, pt.date_end, pt.product_type, pt.rang,'; + $sql.= ' pt.date_start, pt.date_end, pt.product_type, pt.rang, pt.fk_parent_line,'; $sql.= ' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid,'; $sql.= ' p.description as product_desc'; $sql.= ' FROM '.MAIN_DB_PREFIX.'propaldet as pt'; @@ -2400,7 +2400,8 @@ class Propal extends CommonObject $obj = $this->db->fetch_object($resql); $this->lines[$i] = (object) array(); - $this->lines[$i]->id = $obj->rowid; + $this->lines[$i]->id = $obj->rowid; // for backward compatibility + $this->lines[$i]->rowid = $obj->rowid; $this->lines[$i]->description = $obj->description; $this->lines[$i]->fk_product = $obj->fk_product; $this->lines[$i]->ref = $obj->ref; @@ -2417,11 +2418,12 @@ class Propal extends CommonObject $this->lines[$i]->total_ht = $obj->total_ht; $this->lines[$i]->total_tva = $obj->total_tva; $this->lines[$i]->total_ttc = $obj->total_ttc; - $this->lines[$i]->fk_fournprice = $obj->fk_fournprice; - $marginInfos = getMarginInfos($obj->subprice, $obj->remise_percent, $obj->tva_tx, $obj->localtax1_tx, $obj->localtax2_tx, $this->lines[$i]->fk_fournprice, $obj->pa_ht); - $this->lines[$i]->pa_ht = $marginInfos[0]; + $this->lines[$i]->fk_fournprice = $obj->fk_fournprice; + $marginInfos = getMarginInfos($obj->subprice, $obj->remise_percent, $obj->tva_tx, $obj->localtax1_tx, $obj->localtax2_tx, $this->lines[$i]->fk_fournprice, $obj->pa_ht); + $this->lines[$i]->pa_ht = $marginInfos[0]; $this->lines[$i]->marge_tx = $marginInfos[1]; $this->lines[$i]->marque_tx = $marginInfos[2]; + $this->lines[$i]->fk_parent_line = $obj->fk_parent_line; $this->lines[$i]->special_code = $obj->special_code; $this->lines[$i]->rang = $obj->rang; $this->lines[$i]->date_start = $this->db->jdate($obj->date_start); @@ -2436,7 +2438,7 @@ class Propal extends CommonObject else { $this->error=$this->db->error(); - dol_syslog("Error sql=$sql, error=".$this->error,LOG_ERR); + dol_syslog(get_class($this)."::getLinesArray Error sql=$sql, error=".$this->error,LOG_ERR); return -1; } } @@ -2471,10 +2473,10 @@ class PropaleLigne var $rang = 0; - var $fk_fournprice; - var $pa_ht; - var $marge_tx; - var $marque_tx; + var $fk_fournprice; + var $pa_ht; + var $marge_tx; + var $marque_tx; var $special_code; // Liste d'options non cumulabels: // 1: frais de port @@ -2556,7 +2558,8 @@ class PropaleLigne $this->total_ttc = $objp->total_ttc; $this->fk_fournprice = $objp->fk_fournprice; - $marginInfos = getMarginInfos($objp->subprice, $objp->remise_percent, $objp->tva_tx, $objp->localtax1_tx, $objp->localtax2_tx, $this->fk_fournprice, $objp->pa_ht); + + $marginInfos = getMarginInfos($objp->subprice, $objp->remise_percent, $objp->tva_tx, $objp->localtax1_tx, $objp->localtax2_tx, $this->fk_fournprice, $objp->pa_ht); $this->pa_ht = $marginInfos[0]; $this->marge_tx = $marginInfos[1]; $this->marque_tx = $marginInfos[2]; @@ -2623,7 +2626,7 @@ class PropaleLigne $sql.= ' (fk_propal, fk_parent_line, description, fk_product, product_type, fk_remise_except, qty, tva_tx, localtax1_tx, localtax2_tx,'; $sql.= ' subprice, remise_percent, '; $sql.= ' info_bits, '; - $sql.= ' total_ht, total_tva, total_localtax1, total_localtax2, total_ttc, special_code, rang, fk_product_fournisseur_price, buy_price_ht)'; + $sql.= ' total_ht, total_tva, total_localtax1, total_localtax2, total_ttc, fk_product_fournisseur_price, buy_price_ht, special_code, rang)'; $sql.= " VALUES (".$this->fk_propal.","; $sql.= " ".($this->fk_parent_line>0?"'".$this->fk_parent_line."'":"null").","; $sql.= " '".$this->db->escape($this->desc)."',"; @@ -2648,7 +2651,7 @@ class PropaleLigne $sql.= ' '.$this->rang; $sql.= ')'; - dol_syslog("PropaleLigne::insert sql=$sql"); + dol_syslog(get_class($this).'::insert sql='.$sql, LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -2671,7 +2674,7 @@ class PropaleLigne else { $this->error=$this->db->error()." sql=".$sql; - dol_syslog("PropaleLigne::insert Error ".$this->error, LOG_ERR); + dol_syslog(get_class($this).'::insert Error '.$this->error, LOG_ERR); $this->db->rollback(); return -1; } @@ -2741,13 +2744,13 @@ class PropaleLigne if (empty($this->special_code)) $this->special_code=0; if (empty($this->fk_parent_line)) $this->fk_parent_line=0; - if (empty($this->pa_ht)) $this->pa_ht=0; + if (empty($this->pa_ht)) $this->pa_ht=0; - // si prix d'achat non renseign� et utilis� pour calcul des marges alors prix achat = prix vente (idem pour remises) - if ($this->pa_ht == 0) { - if ($this->subprice < 0 || ($conf->global->CalculateMarginsOnLinesWithoutBuyingPrice == 1)) - $this->pa_ht = $this->subprice * (1 - $this->remise_percent / 100); - } + // si prix d'achat non renseign� et utilis� pour calcul des marges alors prix achat = prix vente (idem pour remises) + if ($this->pa_ht == 0) { + if ($this->subprice < 0 || ($conf->global->CalculateMarginsOnLinesWithoutBuyingPrice == 1)) + $this->pa_ht = $this->subprice * (1 - $this->remise_percent / 100); + } $this->db->begin(); @@ -2769,8 +2772,8 @@ class PropaleLigne $sql.= " , total_tva=".price2num($this->total_tva).""; $sql.= " , total_ttc=".price2num($this->total_ttc).""; } - $sql.= " , fk_product_fournisseur_price='".$this->fk_fournprice."'"; - $sql.= " , buy_price_ht='".price2num($this->pa_ht)."'"; + $sql.= " , fk_product_fournisseur_price='".$this->fk_fournprice."'"; + $sql.= " , buy_price_ht='".price2num($this->pa_ht)."'"; $sql.= " , info_bits=".$this->info_bits; if (strlen($this->special_code)) $sql.= " , special_code=".$this->special_code; $sql.= " , fk_parent_line=".($this->fk_parent_line>0?$this->fk_parent_line:"null"); diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 031bd143db6..a010fd6579e 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -2743,10 +2743,9 @@ class Commande extends CommonOrder $lines = array(); $sql = 'SELECT l.rowid, l.fk_product, l.product_type, l.description, l.price, l.qty, l.tva_tx, '; - $sql.= ' l.fk_remise_except, l.remise_percent, l.subprice, l.info_bits,l.rang,l.special_code,'; + $sql.= ' l.fk_remise_except, l.remise_percent, l.subprice, l.info_bits, l.rang, l.special_code, l.fk_parent_line'; $sql.= ' l.total_ht, l.total_tva, l.total_ttc, l.fk_product_fournisseur_price as fk_fournprice, l.buy_price_ht as pa_ht, l.localtax1_tx, l.localtax2_tx,'; - $sql.= ' l.date_start,'; - $sql.= ' l.date_end,'; + $sql.= ' l.date_start, l.date_end,'; $sql.= ' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, '; $sql.= ' p.description as product_desc'; $sql.= ' FROM '.MAIN_DB_PREFIX.'commandedet as l'; @@ -2781,15 +2780,16 @@ class Commande extends CommonOrder $this->lines[$i]->total_ht = $obj->total_ht; $this->lines[$i]->total_tva = $obj->total_tva; $this->lines[$i]->total_ttc = $obj->total_ttc; + $this->lines[$i]->fk_parent_line = $obj->fk_parent_line; $this->lines[$i]->special_code = $obj->special_code; $this->lines[$i]->rang = $obj->rang; $this->lines[$i]->date_start = $this->db->jdate($obj->date_start); $this->lines[$i]->date_end = $this->db->jdate($obj->date_end); - $this->lines[$i]->fk_fournprice = $obj->fk_fournprice; - $marginInfos = getMarginInfos($obj->subprice, $obj->remise_percent, $obj->tva_tx, $obj->localtax1_tx, $obj->localtax2_tx, $this->lines[$i]->fk_fournprice, $obj->pa_ht); - $this->lines[$i]->pa_ht = $marginInfos[0]; - $this->lines[$i]->marge_tx = $marginInfos[1]; - $this->lines[$i]->marque_tx = $marginInfos[2]; + $this->lines[$i]->fk_fournprice = $obj->fk_fournprice; + $marginInfos = getMarginInfos($obj->subprice, $obj->remise_percent, $obj->tva_tx, $obj->localtax1_tx, $obj->localtax2_tx, $this->lines[$i]->fk_fournprice, $obj->pa_ht); + $this->lines[$i]->pa_ht = $marginInfos[0]; + $this->lines[$i]->marge_tx = $marginInfos[1]; + $this->lines[$i]->marque_tx = $marginInfos[2]; $i++; } @@ -3001,13 +3001,13 @@ class OrderLine if (empty($this->special_code)) $this->special_code=0; if (empty($this->fk_parent_line)) $this->fk_parent_line=0; - if (empty($this->pa_ht)) $this->pa_ht=0; + if (empty($this->pa_ht)) $this->pa_ht=0; - // si prix d'achat non renseign� et utilis� pour calcul des marges alors prix achat = prix vente (idem pour remises) - if ($this->pa_ht == 0) { - if ($this->subprice < 0 || ($conf->global->CalculateMarginsOnLinesWithoutBuyingPrice == 1)) - $this->pa_ht = $this->subprice * (1 - $this->remise_percent / 100); - } + // si prix d'achat non renseigne et utilise pour calcul des marges alors prix achat = prix vente (idem pour remises) + if ($this->pa_ht == 0) { + if ($this->subprice < 0 || ($conf->global->CalculateMarginsOnLinesWithoutBuyingPrice == 1)) + $this->pa_ht = $this->subprice * (1 - $this->remise_percent / 100); + } // Check parameters if ($this->product_type < 0) return -1; @@ -3027,34 +3027,28 @@ class OrderLine $sql.= " '".price2num($this->tva_tx)."',"; $sql.= " '".price2num($this->localtax1_tx)."',"; $sql.= " '".price2num($this->localtax2_tx)."',"; - if ($this->fk_product) { $sql.= "'".$this->fk_product."',"; } - else { $sql.='null,'; } + $sql.= ' '.(! empty($this->fk_product)?$this->fk_product:"null").','; $sql.= " '".$this->product_type."',"; $sql.= " '".price2num($this->remise_percent)."',"; $sql.= " ".($this->subprice!=''?"'".price2num($this->subprice)."'":"null").","; $sql.= " ".($this->price!=''?"'".price2num($this->price)."'":"null").","; $sql.= " '".price2num($this->remise)."',"; - if ($this->fk_remise_except) $sql.= $this->fk_remise_except.","; - else $sql.= 'null,'; + $sql.= ' '.(! empty($this->fk_remise_except)?$this->fk_remise_except:"null").','; $sql.= ' '.$this->special_code.','; $sql.= ' '.$this->rang.','; - if (isset($this->fk_fournprice)) $sql.= ' '.$this->fk_fournprice.','; - else $sql.= ' null,'; - if (isset($this->pa_ht)) $sql.= ' '.price2num($this->pa_ht).','; - else $sql.= ' null,'; + $sql.= ' '.(! empty($this->fk_fournprice)?$this->fk_fournprice:"null").','; + $sql.= ' '.price2num($this->pa_ht).','; $sql.= " '".$this->info_bits."',"; $sql.= " '".price2num($this->total_ht)."',"; $sql.= " '".price2num($this->total_tva)."',"; $sql.= " '".price2num($this->total_localtax1)."',"; $sql.= " '".price2num($this->total_localtax2)."',"; $sql.= " '".price2num($this->total_ttc)."',"; - if ($this->date_start) { $sql.= "'".$this->db->idate($this->date_start)."',"; } - else { $sql.='null,'; } - if ($this->date_end) { $sql.= "'".$this->db->idate($this->date_end)."'"; } - else { $sql.='null'; } + $sql.= " ".(! empty($this->date_start)?"'".$this->db->idate($this->date_start)."'":"null").','; + $sql.= " ".(! empty($this->date_end)?"'".$this->db->idate($this->date_end)."'":"null"); $sql.= ')'; - dol_syslog("OrderLine::insert sql=".$sql); + dol_syslog(get_class($this)."::insert sql=".$sql, LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -3076,7 +3070,7 @@ class OrderLine else { $this->error=$this->db->error(); - dol_syslog("OrderLine::insert Error ".$this->error, LOG_ERR); + dol_syslog(get_class($this)."::insert Error ".$this->error, LOG_ERR); $this->db->rollback(); return -2; } @@ -3140,9 +3134,8 @@ class OrderLine $sql.= " , total_localtax1=".price2num($this->total_localtax1); $sql.= " , total_localtax2=".price2num($this->total_localtax2); $sql.= " , info_bits=".$this->info_bits; - if ($this->date_start) { $sql.= " , date_start='".$this->db->idate($this->date_start)."'"; } - else { $sql.=' , date_start=null'; } - if ($this->date_end) { $sql.= " , date_end='".$this->db->idate($this->date_end)."'"; } + $sql.= " , date_start=".(! empty($this->date_start)?"'".$this->db->idate($this->date_start)."'":"null"); + $sql.= " , date_end=".(! empty($this->date_end)?"'".$this->db->idate($this->date_end)."'":"null"); $sql.= " , product_type=".$this->product_type; $sql.= " , fk_parent_line=".(! empty($this->fk_parent_line)?$this->fk_parent_line:"null"); if (! empty($this->rang)) $sql.= ", rang=".$this->rang; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 33660eee17b..f8c0872c20e 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -3010,7 +3010,7 @@ class Facture extends CommonInvoice { $sql = 'SELECT l.rowid, l.description, l.fk_product, l.product_type, l.qty, l.tva_tx,'; $sql.= ' l.fk_remise_except,'; - $sql.= ' l.remise_percent, l.subprice, l.info_bits, l.rang, l.special_code,'; + $sql.= ' l.remise_percent, l.subprice, l.info_bits, l.rang, l.special_code, l.fk_parent_line,'; $sql.= ' l.total_ht, l.total_tva, l.total_ttc, l.fk_product_fournisseur_price as fk_fournprice, l.buy_price_ht as pa_ht,'; $sql.= ' l.date_start,'; $sql.= ' l.date_end,'; @@ -3049,15 +3049,16 @@ class Facture extends CommonInvoice $this->lines[$i]->total_ht = $obj->total_ht; $this->lines[$i]->total_tva = $obj->total_tva; $this->lines[$i]->total_ttc = $obj->total_ttc; + $this->lines[$i]->fk_parent_line = $obj->fk_parent_line; $this->lines[$i]->special_code = $obj->special_code; $this->lines[$i]->rang = $obj->rang; $this->lines[$i]->date_start = $this->db->jdate($obj->date_start); $this->lines[$i]->date_end = $this->db->jdate($obj->date_end); - $this->lines[$i]->fk_fournprice = $obj->fk_fournprice; - $marginInfos = getMarginInfos($obj->subprice, $obj->remise_percent, $obj->tva_tx, $obj->localtax1_tx, $obj->localtax2_tx, $this->lines[$i]->fk_fournprice, $obj->pa_ht); - $this->lines[$i]->pa_ht = $marginInfos[0]; - $this->lines[$i]->marge_tx = $marginInfos[1]; - $this->lines[$i]->marque_tx = $marginInfos[2]; + $this->lines[$i]->fk_fournprice = $obj->fk_fournprice; + $marginInfos = getMarginInfos($obj->subprice, $obj->remise_percent, $obj->tva_tx, $obj->localtax1_tx, $obj->localtax2_tx, $this->lines[$i]->fk_fournprice, $obj->pa_ht); + $this->lines[$i]->pa_ht = $marginInfos[0]; + $this->lines[$i]->marge_tx = $marginInfos[1]; + $this->lines[$i]->marque_tx = $marginInfos[2]; $i++; } @@ -3266,14 +3267,13 @@ class FactureLigne if (empty($this->special_code)) $this->special_code=0; if (empty($this->fk_parent_line)) $this->fk_parent_line=0; + if (empty($this->pa_ht)) $this->pa_ht=0; - if (empty($this->pa_ht)) $this->pa_ht=0; - - // si prix d'achat non renseign� et utilis� pour calcul des marges alors prix achat = prix vente (idem pour remises) - if ($this->pa_ht == 0) { - if ($this->subprice < 0 || ($conf->global->CalculateMarginsOnLinesWithoutBuyingPrice == 1)) - $this->pa_ht = $this->subprice * (1 - $this->remise_percent / 100); - } + // si prix d'achat non renseigne et utilise pour calcul des marges alors prix achat = prix vente (idem pour remises) + if ($this->pa_ht == 0) { + if ($this->subprice < 0 || ($conf->global->CalculateMarginsOnLinesWithoutBuyingPrice == 1)) + $this->pa_ht = $this->subprice * (1 - $this->remise_percent / 100); + } // Check parameters if ($this->product_type < 0) return -1; @@ -3294,27 +3294,19 @@ class FactureLigne $sql.= " ".price2num($this->tva_tx).","; $sql.= " ".price2num($this->localtax1_tx).","; $sql.= " ".price2num($this->localtax2_tx).","; - if ($this->fk_product) { $sql.= "'".$this->fk_product."',"; } - else { $sql.='null,'; } + $sql.= ' '.(! empty($this->fk_product)?$this->fk_product:"null").','; $sql.= " ".$this->product_type.","; $sql.= " ".price2num($this->remise_percent).","; $sql.= " ".price2num($this->subprice).","; - //$sql.= " ".price2num($this->price).","; - //$sql.= " ".($this->remise?price2num($this->remise):'0').","; // Deprecated - if ($this->fk_remise_except) $sql.= $this->fk_remise_except.","; - else $sql.= 'null,'; - if ($this->date_start) { $sql.= "'".$this->db->idate($this->date_start)."',"; } - else { $sql.='null,'; } - if ($this->date_end) { $sql.= "'".$this->db->idate($this->date_end)."',"; } - else { $sql.='null,'; } + $sql.= ' '.(! empty($this->fk_remise_except)?$this->fk_remise_except:"null").','; + $sql.= " ".(! empty($this->date_start)?"'".$this->db->idate($this->date_start)."'":"null").","; + $sql.= " ".(! empty($this->date_end)?"'".$this->db->idate($this->date_end)."'":"null").","; $sql.= ' '.$this->fk_code_ventilation.','; $sql.= ' '.$this->fk_export_compta.','; $sql.= ' '.$this->rang.','; $sql.= ' '.$this->special_code.','; - if (isset($this->fk_fournprice)) $sql.= ' '.$this->fk_fournprice.','; - else $sql.= ' null,'; - if (isset($this->pa_ht)) $sql.= ' '.price2num($this->pa_ht).','; - else $sql.= ' null,'; + $sql.= ' '.(! empty($this->fk_fournprice)?$this->fk_fournprice:"null").','; + $sql.= ' '.price2num($this->pa_ht).','; $sql.= " '".$this->info_bits."',"; $sql.= " ".price2num($this->total_ht).","; $sql.= " ".price2num($this->total_tva).","; @@ -3429,13 +3421,13 @@ class FactureLigne // Check parameters if ($this->product_type < 0) return -1; - if (empty($this->pa_ht)) $this->pa_ht=0; + if (empty($this->pa_ht)) $this->pa_ht=0; - // si prix d'achat non renseign� et utilis� pour calcul des marges alors prix achat = prix vente (idem pour remises) - if ($this->pa_ht == 0) { - if ($this->subprice < 0 || ($conf->global->CalculateMarginsOnLinesWithoutBuyingPrice == 1)) - $this->pa_ht = $this->subprice * (1 - $this->remise_percent / 100); - } + // si prix d'achat non renseigne et utilise pour calcul des marges alors prix achat = prix vente (idem pour remises) + if ($this->pa_ht == 0) { + if ($this->subprice < 0 || ($conf->global->CalculateMarginsOnLinesWithoutBuyingPrice == 1)) + $this->pa_ht = $this->subprice * (1 - $this->remise_percent / 100); + } $this->db->begin(); @@ -3452,10 +3444,8 @@ class FactureLigne $sql.= ",localtax1_tx=".price2num($this->localtax1_tx).""; $sql.= ",localtax2_tx=".price2num($this->localtax2_tx).""; $sql.= ",qty=".price2num($this->qty).""; - if ($this->date_start) { $sql.= ",date_start='".$this->db->idate($this->date_start)."'"; } - else { $sql.=',date_start=null'; } - if ($this->date_end) { $sql.= ",date_end='".$this->db->idate($this->date_end)."'"; } - else { $sql.=',date_end=null'; } + $sql.= ",date_start=".(! empty($this->date_start)?"'".$this->db->idate($this->date_start)."'":"null"); + $sql.= ",date_end=".(! empty($this->date_end)?"'".$this->db->idate($this->date_end)."'":"null"); $sql.= ",product_type=".$this->product_type; $sql.= ",info_bits='".$this->info_bits."'"; if (empty($this->skip_update_total)) @@ -3464,8 +3454,8 @@ class FactureLigne $sql.= ",total_tva=".price2num($this->total_tva).""; $sql.= ",total_ttc=".price2num($this->total_ttc).""; } - $sql.= " , fk_product_fournisseur_price='".$this->fk_fournprice."'"; - $sql.= " , buy_price_ht='".price2num($this->pa_ht)."'"; + $sql.= " , fk_product_fournisseur_price='".$this->fk_fournprice."'"; + $sql.= " , buy_price_ht='".price2num($this->pa_ht)."'"; $sql.= ",total_localtax1=".price2num($this->total_localtax1).""; $sql.= ",total_localtax2=".price2num($this->total_localtax2).""; $sql.= ",fk_parent_line=".($this->fk_parent_line>0?$this->fk_parent_line:"null"); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index f72ba0a705d..f08e8a62331 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2521,7 +2521,7 @@ abstract class CommonObject * @param HookManager $hookmanager Hookmanager * @return void */ - function printObjectLines($action,$seller,$buyer,$selected=0,$dateSelector=0,$hookmanager=false) + function printObjectLines($action, $seller, $buyer, $selected=0, $dateSelector=0, $hookmanager=false) { global $conf,$langs; @@ -2535,16 +2535,16 @@ abstract class CommonObject print ''; print ''; print ''; - if (! empty($conf->margin->enabled)) { - if ($conf->global->MARGIN_TYPE == "1") + if (! empty($conf->margin->enabled)) { + if ($conf->global->MARGIN_TYPE == "1") print ''; else print ''; - if($conf->global->DISPLAY_MARGIN_RATES) - print ''; - if($conf->global->DISPLAY_MARK_RATES) - print ''; - } + if (! empty($conf->global->DISPLAY_MARGIN_RATES)) + print ''; + if (! empty($conf->global->DISPLAY_MARK_RATES)) + print ''; + } print ''; print ''; print ''; @@ -2564,7 +2564,7 @@ abstract class CommonObject if (empty($line->fk_parent_line)) { $parameters = array('line'=>$line,'var'=>$var,'num'=>$num,'i'=>$i,'dateSelector'=>$dateSelector,'seller'=>$seller,'buyer'=>$buyer,'selected'=>$selected); - $reshook=$hookmanager->executeHooks('printObjectLine',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + $reshook=$hookmanager->executeHooks('printObjectLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks } } else From 9451edafd8b5eac0c11aeb20ae555b59cff5f3b1 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 1 Aug 2012 18:40:47 +0200 Subject: [PATCH 10/15] Fix: bad link and uniformize code --- htdocs/comm/propal/apercu.php | 4 ++-- htdocs/comm/propal/contact.php | 2 +- htdocs/comm/propal/index.php | 6 ++---- htdocs/comm/propal/info.php | 30 ++++++++++++++---------------- htdocs/comm/propal/list.php | 5 ++--- 5 files changed, 21 insertions(+), 26 deletions(-) diff --git a/htdocs/comm/propal/apercu.php b/htdocs/comm/propal/apercu.php index af6b1a9d4f3..a8a08f823d9 100644 --- a/htdocs/comm/propal/apercu.php +++ b/htdocs/comm/propal/apercu.php @@ -2,7 +2,7 @@ /* Copyright (C) 2002-2005 Rodolphe Quiedeville * Copyright (C) 2004 Eric Seigne * Copyright (C) 2004-2007 Laurent Destailleur - * Copyright (C) 2005-2011 Regis Houssin + * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2011 Juanjo Menent * * This program is free software; you can redistribute it and/or modify @@ -40,7 +40,7 @@ $socid=0; $id = GETPOST('id','int'); $ref = GETPOST("ref"); if ($user->societe_id) $socid=$user->societe_id; -$result = restrictedArea($user, 'propale', $id, 'propal'); +$result = restrictedArea($user, 'propal', $id); /* diff --git a/htdocs/comm/propal/contact.php b/htdocs/comm/propal/contact.php index 86a7e434f8a..a0ee9f76a47 100644 --- a/htdocs/comm/propal/contact.php +++ b/htdocs/comm/propal/contact.php @@ -43,7 +43,7 @@ $action=GETPOST('action','alpha'); // Security check if ($user->societe_id) $socid=$user->societe_id; -$result = restrictedArea($user, 'propale', $id, 'propal'); +$result = restrictedArea($user, 'propal', $id); $object = new Propal($db); diff --git a/htdocs/comm/propal/index.php b/htdocs/comm/propal/index.php index fd6e682b0fb..6d041e5e83e 100644 --- a/htdocs/comm/propal/index.php +++ b/htdocs/comm/propal/index.php @@ -27,8 +27,6 @@ require("../../main.inc.php"); require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php"); require_once(DOL_DOCUMENT_ROOT ."/comm/propal/class/propal.class.php"); -if (!$user->rights->propale->lire) accessforbidden(); - $langs->load("propal"); $langs->load("companies"); @@ -39,7 +37,7 @@ if (isset($user->societe_id) && $user->societe_id > 0) $action = ''; $socid = $user->societe_id; } - +$result = restrictedArea($user, 'propal'); /* @@ -65,7 +63,7 @@ print '
'.$langs->trans("GroupsToAdd").''; - print $form->select_dolgroups('','group',1,$exclude,0,'','',$fuser->entity); + print $form->select_dolgroups('', 'group', 1, $exclude, 0, '', '', $fuser->entity); print '   '; // Multicompany if (! empty($conf->multicompany->enabled)) diff --git a/htdocs/user/group/fiche.php b/htdocs/user/group/fiche.php index f347d52b83a..b70f6fa200c 100644 --- a/htdocs/user/group/fiche.php +++ b/htdocs/user/group/fiche.php @@ -350,15 +350,15 @@ else // On selectionne les users qui ne sont pas deja dans le groupe $exclude = array(); - if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)) + if (! empty($object->members)) { - if (! empty($object->members)) - { - foreach($object->members as $useringroup) - { - $exclude[]=$useringroup->id; - } - } + if (! ($conf->multicompany->enabled && $conf->multicompany->transverse_mode)) + { + foreach($object->members as $useringroup) + { + $exclude[]=$useringroup->id; + } + } } if ($caneditperms) From c558f2206ccb05bf71b51bb3667dc37b5fe01809 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 1 Aug 2012 13:30:38 +0200 Subject: [PATCH 06/15] Fix: strict mode pleasure --- htdocs/user/class/user.class.php | 4 ++-- htdocs/user/fiche.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index a78b4a91f55..d8b2d59a89c 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -255,8 +255,8 @@ class User extends CommonObject while ($i < $num) { $obj = $this->db->fetch_object($resql); - $p=$obj->param; - if ($p) $this->conf->$p = $obj->value; + $p=(! empty($obj->param)?$obj->param:''); + if (! empty($p)) $this->conf->$p = $obj->value; $i++; } $this->db->free($resql); diff --git a/htdocs/user/fiche.php b/htdocs/user/fiche.php index 0cbff5f77f7..a18a2698db3 100644 --- a/htdocs/user/fiche.php +++ b/htdocs/user/fiche.php @@ -1315,7 +1315,7 @@ else if (! empty($groupslist)) { - if (! ($conf->multicompany->enabled && $conf->multicompany->transverse_mode)) + if (! (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode))) { foreach($groupslist as $groupforuser) { From 2dcb158915f96db55a2fa56403122f542fda8ee7 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 1 Aug 2012 13:32:50 +0200 Subject: [PATCH 07/15] Fix: strict mode again --- htdocs/user/group/fiche.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/group/fiche.php b/htdocs/user/group/fiche.php index b70f6fa200c..85746ce537d 100644 --- a/htdocs/user/group/fiche.php +++ b/htdocs/user/group/fiche.php @@ -352,7 +352,7 @@ else if (! empty($object->members)) { - if (! ($conf->multicompany->enabled && $conf->multicompany->transverse_mode)) + if (! (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode))) { foreach($object->members as $useringroup) { From d6a4d5ef4185358bc17ed476b5c19917206e7456 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 1 Aug 2012 14:42:24 +0200 Subject: [PATCH 08/15] Fix: avoid errors if install directory is deleted before module activation --- htdocs/core/modules/modCommande.class.php | 29 +++++++++++++---------- htdocs/core/modules/modFacture.class.php | 28 +++++++++++++--------- htdocs/core/modules/modPropale.class.php | 27 ++++++++++++--------- htdocs/core/modules/modSociete.class.php | 22 ++++++++++------- htdocs/install/etape1.php | 22 +++++++++++++++++ 5 files changed, 86 insertions(+), 42 deletions(-) diff --git a/htdocs/core/modules/modCommande.class.php b/htdocs/core/modules/modCommande.class.php index 342f0d92480..45dd5de80a1 100644 --- a/htdocs/core/modules/modCommande.class.php +++ b/htdocs/core/modules/modCommande.class.php @@ -4,7 +4,7 @@ * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2005-2011 Regis Houssin + * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2012 Juanjo Menent * * This program is free software; you can redistribute it and/or modify @@ -201,22 +201,27 @@ class modCommande extends DolibarrModules $this->remove($options); //ODT template - require_once(DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'); + $src=DOL_DOCUMENT_ROOT.'/install/doctemplates/orders/template_order.odt'; $dirodt=DOL_DATA_ROOT.'/doctemplates/orders'; - dol_mkdir($dirodt); - $src=DOL_DOCUMENT_ROOT.'/install/doctemplates/orders/template_order.odt'; $dest=$dirodt.'/template_order.odt'; - $result=dol_copy($src,$dest,0,0); - if ($result < 0) + $dest=$dirodt.'/template_order.odt'; + + if (file_exists($src) && ! file_exists($dest)) { - $langs->load("errors"); - $this->error=$langs->trans('ErrorFailToCopyFile',$src,$dest); - return 0; + require_once(DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'); + dol_mkdir($dirodt); + $result=dol_copy($src,$dest,0,0); + if ($result < 0) + { + $langs->load("errors"); + $this->error=$langs->trans('ErrorFailToCopyFile',$src,$dest); + return 0; + } } $sql = array( - "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[0][2]."' AND entity = ".$conf->entity, - "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->const[0][2]."','order',".$conf->entity.")" - ); + "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[0][2]."' AND entity = ".$conf->entity, + "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->const[0][2]."','order',".$conf->entity.")" + ); return $this->_init($sql,$options); } diff --git a/htdocs/core/modules/modFacture.class.php b/htdocs/core/modules/modFacture.class.php index e072907f403..817b7c0fff2 100644 --- a/htdocs/core/modules/modFacture.class.php +++ b/htdocs/core/modules/modFacture.class.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2010 Laurent Destailleur * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier - * Copyright (C) 2005-2011 Regis Houssin + * Copyright (C) 2005-2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -223,21 +223,27 @@ class modFacture extends DolibarrModules // Remove permissions and default values $this->remove($options); - require_once(DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'); + //ODT template + $src=DOL_DOCUMENT_ROOT.'/install/doctemplates/invoices/template_invoice.odt'; $dirodt=DOL_DATA_ROOT.'/doctemplates/invoices'; - dol_mkdir($dirodt); - $src=DOL_DOCUMENT_ROOT.'/install/doctemplates/invoices/template_invoice.odt'; $dest=$dirodt.'/template_invoice.odt'; - $result=dol_copy($src,$dest,0,0); - if ($result < 0) + $dest=$dirodt.'/template_invoice.odt'; + + if (file_exists($src) && ! file_exists($dest)) { - $langs->load("errors"); - $this->error=$langs->trans('ErrorFailToCopyFile',$src,$dest); - return 0; + require_once(DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'); + dol_mkdir($dirodt); + $result=dol_copy($src,$dest,0,0); + if ($result < 0) + { + $langs->load("errors"); + $this->error=$langs->trans('ErrorFailToCopyFile',$src,$dest); + return 0; + } } $sql = array( - "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[0][2]."' AND entity = ".$conf->entity, - "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->const[0][2]."','invoice',".$conf->entity.")" + "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[0][2]."' AND entity = ".$conf->entity, + "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->const[0][2]."','invoice',".$conf->entity.")" ); return $this->_init($sql,$options); diff --git a/htdocs/core/modules/modPropale.class.php b/htdocs/core/modules/modPropale.class.php index 9594418d487..7c140968dd0 100644 --- a/htdocs/core/modules/modPropale.class.php +++ b/htdocs/core/modules/modPropale.class.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2010 Laurent Destailleur * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier - * Copyright (C) 2005-2011 Regis Houssin + * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2012 Juanjo Menentr * * This program is free software; you can redistribute it and/or modify @@ -199,21 +199,26 @@ class modPropale extends DolibarrModules $this->remove($options); //ODT template - require_once(DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'); + $src=DOL_DOCUMENT_ROOT.'/install/doctemplates/proposals/template_proposal.odt'; $dirodt=DOL_DATA_ROOT.'/doctemplates/proposals'; - dol_mkdir($dirodt); - $src=DOL_DOCUMENT_ROOT.'/install/doctemplates/proposals/template_proposal.odt'; $dest=$dirodt.'/template_proposal.odt'; - $result=dol_copy($src,$dest,0,0); - if ($result < 0) + $dest=$dirodt.'/template_proposal.odt'; + + if (file_exists($src) && ! file_exists($dest)) { - $langs->load("errors"); - $this->error=$langs->trans('ErrorFailToCopyFile',$src,$dest); - return 0; + require_once(DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'); + dol_mkdir($dirodt); + $result=dol_copy($src,$dest,0,0); + if ($result < 0) + { + $langs->load("errors"); + $this->error=$langs->trans('ErrorFailToCopyFile',$src,$dest); + return 0; + } } $sql = array( - "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[0][2]."' AND entity = ".$conf->entity, - "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->const[0][2]."','propal',".$conf->entity.")", + "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[0][2]."' AND entity = ".$conf->entity, + "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->const[0][2]."','propal',".$conf->entity.")", ); return $this->_init($sql,$options); diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index 040e82fa668..73cd9bb303b 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -368,16 +368,22 @@ class modSociete extends DolibarrModules // We disable this to prevent pb of modules not correctly disabled //$this->remove($options); - require_once(DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'); + //ODT template + $src=DOL_DOCUMENT_ROOT.'/install/doctemplates/thirdparties/template_thirdparty.odt'; $dirodt=DOL_DATA_ROOT.'/doctemplates/thirdparties'; - dol_mkdir($dirodt); - $src=DOL_DOCUMENT_ROOT.'/install/doctemplates/thirdparties/template_thirdparty.odt'; $dest=$dirodt.'/template_thirdparty.odt'; - $result=dol_copy($src,$dest,0,0); - if ($result < 0) + $dest=$dirodt.'/template_thirdparty.odt'; + + if (file_exists($src) && ! file_exists($dest)) { - $langs->load("errors"); - $this->error=$langs->trans('ErrorFailToCopyFile',$src,$dest); - return 0; + require_once(DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'); + dol_mkdir($dirodt); + $result=dol_copy($src,$dest,0,0); + if ($result < 0) + { + $langs->load("errors"); + $this->error=$langs->trans('ErrorFailToCopyFile',$src,$dest); + return 0; + } } $sql = array(); diff --git a/htdocs/install/etape1.php b/htdocs/install/etape1.php index 93af8facadd..f1383f3c13f 100644 --- a/htdocs/install/etape1.php +++ b/htdocs/install/etape1.php @@ -337,6 +337,7 @@ if (! $error && $db->connected && $action == "set") $dir[4] = $main_data_dir."/propale"; $dir[5] = $main_data_dir."/ficheinter"; $dir[6] = $main_data_dir."/produit"; + $dir[7] = $main_data_dir."/doctemplates"; // Boucle sur chaque repertoire de dir[] pour les creer s'ils nexistent pas $num=count($dir); @@ -372,6 +373,27 @@ if (! $error && $db->connected && $action == "set") print "

'.$langs->trans("CorrectProblemAndReloadPage",$_SERVER['PHP_SELF'].'?testget=ok').'

'.$langs->trans('ErrorFailToCopyFile',$src,$dest).'
'.$langs->trans('PriceUHT').''.$langs->trans('Qty').''.$langs->trans('ReductionShort').''.$langs->trans('BuyingPrice').''.$langs->trans('BuyingCost').''.$langs->trans('MarginRate').''.$langs->trans('MarkRate').''.$langs->trans('MarginRate').''.$langs->trans('MarkRate').''.$langs->trans('TotalHTShort').'  
'; */ $var=false; print ''; -print ''; +print ''; print ''; print ''; print ''; From 5ad211a1cad175b0f1f97f9c9919ca7dcb4f3a9c Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 1 Aug 2012 19:34:42 +0200 Subject: [PATCH 12/15] Fix: bad document path with multicompany --- htdocs/core/class/conf.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index be2fdce15fd..78255aa9084 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -281,8 +281,8 @@ class Conf $this->user->dir_temp=$rootforuser."/users/temp"; // For propal storage - $this->propal->dir_output=$rootforuser."/propale"; - $this->propal->dir_temp=$rootforuser."/propale/temp"; + $this->propal->dir_output=$rootfordata."/propale"; + $this->propal->dir_temp=$rootfordata."/propale/temp"; // Exception: Some dir are not the name of module. So we keep exception here // for backward compatibility. From fe4fc7f8dcfcb74fa4a17c2d80b633372ae461a7 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 2 Aug 2012 08:02:49 +0200 Subject: [PATCH 13/15] Fix: increase speed --- htdocs/core/lib/functions.lib.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 36350e1fb4c..9a20d25f431 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -226,12 +226,17 @@ function dol_getprefix() * To link to a module file from a core file, then this function can be used * * @param string $relpath Relative path to file (Ie: mydir/myfile, ../myfile, ...) + * @param string $classname Class name * @return int false if include fails. */ -function dol_include_once($relpath) +function dol_include_once($relpath, $classname='') { global $conf,$langs,$user,$mysoc; // Other global var must be retreived with $GLOBALS['var'] - return @include_once(dol_buildpath($relpath)); + if (! empty($classname) && ! class_exists($classname)) { + return @include dol_buildpath($relpath); + } else { + return @include_once dol_buildpath($relpath); + } } @@ -242,7 +247,7 @@ function dol_include_once($relpath) * @param int $type 0=Used for a Filesystem path, 1=Used for an URL path (output relative), 2=Used for an URL path (output full path) * @return string Full filsystem path (if mode=0), Full url path (if mode=1) */ -function dol_buildpath($path,$type=0) +function dol_buildpath($path, $type=0) { if (empty($type)) // For a filesystem path { @@ -270,7 +275,7 @@ function dol_buildpath($path,$type=0) } } } - if ($type == 2) + else if ($type == 2) { $res = DOL_MAIN_URL_ROOT.$path; // Standard value if (defined('DOL_URL_ROOT_ALT') && DOL_URL_ROOT_ALT) // We check only if alternate feature is used From e0385cf06fdafe8ffa569016fe345ccb7b8ad6ac Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 2 Aug 2012 10:07:55 +0200 Subject: [PATCH 14/15] Fix: strict mode palace --- htdocs/admin/system/database-tables.php | 25 +++++--- htdocs/admin/system/dbtable.php | 72 +++++++++++------------ htdocs/admin/system/dolibarr.php | 13 ++-- htdocs/admin/system/modules.php | 11 ++-- htdocs/admin/system/phpinfo.php | 20 ++++--- htdocs/admin/tools/dolibarr_export.php | 22 +++---- htdocs/admin/tools/dolibarr_import.php | 21 ++++--- htdocs/admin/tools/index.php | 20 +++---- htdocs/admin/tools/listevents.php | 30 +++++----- htdocs/admin/tools/listsessions.php | 26 ++++---- htdocs/admin/tools/purge.php | 34 ++++------- htdocs/core/class/html.formfile.class.php | 2 +- htdocs/support/index.php | 6 +- 13 files changed, 155 insertions(+), 147 deletions(-) diff --git a/htdocs/admin/system/database-tables.php b/htdocs/admin/system/database-tables.php index abba79fc5cc..7dfd6b9f2c8 100644 --- a/htdocs/admin/system/database-tables.php +++ b/htdocs/admin/system/database-tables.php @@ -1,8 +1,9 @@ - * Copyright (C) 2004-2005 Laurent Destailleur - * Copyright (C) 2004 Sebastien Di Cintio - * Copyright (C) 2004 Benoit Mortier +/* Copyright (C) 2003 Rodolphe Quiedeville + * Copyright (C) 2004-2005 Laurent Destailleur + * Copyright (C) 2004 Sebastien Di Cintio + * Copyright (C) 2004 Benoit Mortier + * Copyright (C) 2005-2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -27,10 +28,13 @@ require("../../main.inc.php"); $langs->load("admin"); -if (!$user->admin) accessforbidden(); +if (! $user->admin) + accessforbidden(); + +$action=GETPOST('action','alpha'); -if ($_GET["action"] == 'convert') +if ($action == 'convert') { $db->query("alter table ".$_GET["table"]." ENGINE=INNODB"); } @@ -103,7 +107,7 @@ else print ''; print ''; - if ($row[1] == "MyISAM") + if (isset($row[1]) && $row[1] == "MyISAM") { print ''; } @@ -138,7 +142,9 @@ else print ''; print ''; print "\n"; - $sql = "select relname,seq_tup_read,idx_tup_fetch,n_tup_ins,n_tup_upd,n_tup_del from pg_stat_user_tables;"; + + $sql = "SELECT relname, seq_tup_read, idx_tup_fetch, n_tup_ins, n_tup_upd, n_tup_del"; + $sql.= " FROM pg_stat_user_tables"; $resql = $db->query($sql); if ($resql) @@ -166,4 +172,5 @@ else } llxFooter(); -?> +$db->close(); +?> \ No newline at end of file diff --git a/htdocs/admin/system/dbtable.php b/htdocs/admin/system/dbtable.php index f389e73a053..bc6cc57405e 100644 --- a/htdocs/admin/system/dbtable.php +++ b/htdocs/admin/system/dbtable.php @@ -1,8 +1,9 @@ - * Copyright (C) 2004-2005 Laurent Destailleur - * Copyright (C) 2004 Sebastien Di Cintio - * Copyright (C) 2004 Benoit Mortier +/* Copyright (C) 2003 Rodolphe Quiedeville + * Copyright (C) 2004-2005 Laurent Destailleur + * Copyright (C) 2004 Sebastien Di Cintio + * Copyright (C) 2004 Benoit Mortier + * Copyright (C) 2005-2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -27,8 +28,10 @@ require("../../main.inc.php"); $langs->load("admin"); +if (! $user->admin) + accessforbidden(); -if (!$user->admin) accessforbidden(); +$table=GETPOST('table','alpha'); /* @@ -38,31 +41,29 @@ if (!$user->admin) accessforbidden(); llxHeader(); -print_fiche_titre($langs->trans("Table") . " ".$_GET["table"],'','setup'); +print_fiche_titre($langs->trans("Table") . " ".$table,'','setup'); // Define request to get table description $base=0; if (preg_match('/mysql/i',$conf->db->type)) { - $sql = "SHOW TABLE STATUS LIKE '".$_GET["table"]."'"; + $sql = "SHOW TABLE STATUS LIKE '".$db->escape($table)."'"; $base=1; } - -if ($conf->db->type == 'pgsql') +else if ($conf->db->type == 'pgsql') { $sql = "SELECT conname,contype FROM pg_constraint"; $base=2; } - if (! $base) { print $langs->trans("FeatureNotAvailableWithThisDatabaseDriver"); } else { - $result = $db->query($sql); - if ($result) + $resql = $db->query($sql); + if ($resql) { $num = $db->num_rows($resql); $var=True; @@ -74,24 +75,24 @@ else } } - - if ($base==1) + if ($base == 1) { - - $cons = explode(";",$row[14]); - - foreach ($cons as $cc) + $link=array(); + $cons = explode(";", $row[14]); + if (! empty($cons)) { - $cx = preg_replace("/\)\sREFER/", "", $cc); - $cx = preg_replace("/\(`/", "", $cx); - $cx = preg_replace("/`\)/", "", $cx); - $cx = preg_replace("/`\s/", "", $cx); + foreach($cons as $cc) + { + $cx = preg_replace("/\)\sREFER/", "", $cc); + $cx = preg_replace("/\(`/", "", $cx); + $cx = preg_replace("/`\)/", "", $cx); + $cx = preg_replace("/`\s/", "", $cx); - $val = explode("`",$cx); - - $link[trim($val[0])][0] = $val[1]; - $link[trim($val[0])][1] = $val[2]; + $val = explode("`",$cx); + $link[trim($val[0])][0] = (isset($val[1])?$val[1]:''); + $link[trim($val[0])][1] = (isset($val[2])?$val[2]:''); + } } // var_dump($link); @@ -100,26 +101,24 @@ else print ''; print ''; - $sql = "DESCRIBE ".$_GET["table"]; - $result = $db->query($sql); - if ($result) + $sql = "DESCRIBE ".$table; + $resql = $db->query($sql); + if ($resql) { - $num = $db->num_rows($result); + $num = $db->num_rows($resql); $var=True; $i=0; while ($i < $num) { - $row = $db->fetch_row($result); + $row = $db->fetch_row($resql); $var=!$var; print ""; - print ""; print ""; print ""; - print ""; - + print ""; print ''; $i++; @@ -130,4 +129,5 @@ else } llxFooter(); -?> +$db->close(); +?> \ No newline at end of file diff --git a/htdocs/admin/system/dolibarr.php b/htdocs/admin/system/dolibarr.php index 52da5ba5325..5c9a262a268 100644 --- a/htdocs/admin/system/dolibarr.php +++ b/htdocs/admin/system/dolibarr.php @@ -1,6 +1,7 @@ - * Copyright (C) 2007 Rodolphe Quiedeville +/* Copyright (C) 2005-2012 Laurent Destailleur + * Copyright (C) 2007 Rodolphe Quiedeville + * Copyright (C) 2007-2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,8 +30,8 @@ $langs->load("admin"); $langs->load("install"); $langs->load("other"); -if (!$user->admin) - accessforbidden(); +if (! $user->admin) + accessforbidden(); /* @@ -153,7 +154,7 @@ if (($thousand != ',' && $thousand != '.') || ($thousand != ' ')) $var=!$var; print ''; // Timezone -$txt =$langs->trans("OSTZ").' (variable system TZ): '.($_ENV["TZ"]?$_ENV["TZ"]:$langs->trans("NotDefined")).'
'."\n"; +$txt =$langs->trans("OSTZ").' (variable system TZ): '.(! empty($_ENV["TZ"])?$_ENV["TZ"]:$langs->trans("NotDefined")).'
'."\n"; $txt.=$langs->trans("PHPTZ").' (php.ini date.timezone): '.(ini_get("date.timezone")?ini_get("date.timezone"):$langs->trans("NotDefined")).''."\n"; // date.timezone must be in valued defined in http://fr3.php.net/manual/en/timezones.europe.php $var=!$var; print '
'.$langs->trans("SearchPropal").'
'; diff --git a/htdocs/comm/propal/info.php b/htdocs/comm/propal/info.php index 5c2f9e0728e..eec618f987f 100644 --- a/htdocs/comm/propal/info.php +++ b/htdocs/comm/propal/info.php @@ -1,7 +1,7 @@ - * Copyright (C) 2004-2006 Laurent Destailleur - * Copyright (C) 2005 Regis Houssin +/* Copyright (C) 2004 Rodolphe Quiedeville + * Copyright (C) 2004-2006 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -31,11 +31,12 @@ require_once(DOL_DOCUMENT_ROOT."/core/lib/propal.lib.php"); $langs->load('propal'); $langs->load('compta'); -$id = isset($_GET["id"])?$_GET["id"]:''; +$id=GETPOST('id','int'); +$socid=GETPOST('socid','int'); // Security check -if ($user->societe_id) $socid=$user->societe_id; -$result = restrictedArea($user, 'propale', $id, 'propal'); +if (! empty($user->societe_id)) $socid=$user->societe_id; +$result = restrictedArea($user, 'propal', $id); /* @@ -44,25 +45,22 @@ $result = restrictedArea($user, 'propale', $id, 'propal'); llxHeader('',$langs->trans('Proposal'),'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos'); -$propal = new Propal($db); -$propal->fetch($_GET["id"]); +$object = new Propal($db); +$object->fetch($id); +$object->fetch_thirdparty(); -$societe = new Societe($db); -$societe->fetch($propal->socid); - -$head = propal_prepare_head($propal); +$head = propal_prepare_head($object); dol_fiche_head($head, 'info', $langs->trans('Proposal'), 0, 'propal'); -$propal->info($propal->id); +$object->info($object->id); print '
'; -dol_print_object_info($propal); +dol_print_object_info($object); print '
'; print ''; -$db->close(); - llxFooter(); +$db->close(); ?> diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index ab967914c48..06b7320e3d3 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -67,7 +67,8 @@ $month=GETPOST("month"); $NBLINES=4; // Security check -$module='propale'; +$module='propal'; +$dbtable=''; if (isset($socid)) { $objectid=$socid; @@ -77,8 +78,6 @@ if (isset($socid)) else if (isset($id) && $id > 0) { $objectid=$id; - $module='propale'; - $dbtable='propal'; } if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, $module, $objectid, $dbtable); From b35240c899f462bc74624b3198702f6e6da07a6f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Aug 2012 19:29:36 +0200 Subject: [PATCH 11/15] Fix: Bad url --- htdocs/core/class/html.formfile.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index f33ac4460f9..a13523c115a 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -506,7 +506,7 @@ class FormFile { $out.= '
'; //$out.= ''.$obj->Name.''.$obj->Engine.''.$langs->trans("Convert").'Nb tuples modifyNb tuples delete
'.$langs->trans("Fields").''.$langs->trans("Type").''.$langs->trans("Index").''.$langs->trans("FieldsLinked").'
$row[0]$row[1]$row[3]".$link[$row[0]][0]."."; - print $link[$row[0]][1]."".(isset($link[$row[0]][0])?$link[$row[0]][0]:'')."."; + print (isset($link[$row[0]][1])?$link[$row[0]][1]:'')."
  => price(1234.56)'.price(1234.56).'
'.$langs->trans("CurrentTimeZone").''; // Timezone server PHP @@ -212,4 +213,4 @@ print '
'; llxFooter(); $db->close(); -?> +?> \ No newline at end of file diff --git a/htdocs/admin/system/modules.php b/htdocs/admin/system/modules.php index 616c551d00c..1a10f15ca1e 100644 --- a/htdocs/admin/system/modules.php +++ b/htdocs/admin/system/modules.php @@ -1,7 +1,7 @@ * Copyright (C) 2007 Rodolphe Quiedeville - * Copyright (C) 2010-2011 Regis Houssin + * Copyright (C) 2010-2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,7 +29,8 @@ $langs->load("admin"); $langs->load("install"); $langs->load("other"); -if (!$user->admin) accessforbidden(); +if (! $user->admin) + accessforbidden(); /* @@ -123,12 +124,14 @@ foreach($sortorder as $numero=>$name) print '
'; print '
'; sort($rights_ids); +$old=''; foreach($rights_ids as $right_id) { if ($old == $right_id) - print "Warning duplicate id on permission : ".$right_id."
"; + print "Warning duplicate id on permission : ".$right_id."
"; $old = $right_id; } llxFooter(); -?> +$db->close(); +?> \ No newline at end of file diff --git a/htdocs/admin/system/phpinfo.php b/htdocs/admin/system/phpinfo.php index 57fab93dc40..01ab2a200e3 100644 --- a/htdocs/admin/system/phpinfo.php +++ b/htdocs/admin/system/phpinfo.php @@ -1,6 +1,7 @@ - * Copyright (C) 2004-2005 Laurent Destailleur +/* Copyright (C) 2001-2002 Rodolphe Quiedeville + * Copyright (C) 2004-2005 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -25,8 +26,10 @@ require("../../main.inc.php"); $langs->load("admin"); -if (!$user->admin) -accessforbidden(); +if (! $user->admin) + accessforbidden(); + +$what=GETPOST('what','alpha'); /* @@ -61,17 +64,17 @@ llxHeader(); ob_start(); -if ($_GET["what"] == 'conf') +if ($what == 'conf') { $title = 'Setup'; phpinfo(INFO_CONFIGURATION); } -elseif ($_GET["what"] == 'env') +elseif ($what == 'env') { $title = 'OSEnv'; phpinfo(INFO_ENVIRONMENT); } -elseif ($_GET["what"] == 'modules') +elseif ($what == 'modules') { $title = 'Modules'; phpinfo(INFO_MODULES); @@ -115,4 +118,5 @@ print "$chaine\n"; // Ne pas centrer la reponse php car certains tableau du bas print "
\n"; llxFooter(); -?> +$db->close(); +?> \ No newline at end of file diff --git a/htdocs/admin/tools/dolibarr_export.php b/htdocs/admin/tools/dolibarr_export.php index e7442679c4d..047b9c6ffe9 100644 --- a/htdocs/admin/tools/dolibarr_export.php +++ b/htdocs/admin/tools/dolibarr_export.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2006-2012 Laurent Destailleur + * Copyright (C) 2006-2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,19 +29,19 @@ require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php"); $langs->load("admin"); -$action=GETPOST('action'); +$action=GETPOST('action','alpha'); -$sortfield = GETPOST("sortfield"); -$sortorder = GETPOST("sortorder"); -$page = GETPOST("page"); +$sortfield = GETPOST('sortfield','alpha'); +$sortorder = GETPOST('sortorder','alpha'); +$page = GETPOST('page','int'); if (! $sortorder) $sortorder="DESC"; if (! $sortfield) $sortfield="date"; if ($page < 0) { $page = 0; } $limit = $conf->liste_limit; $offset = $limit * $page; -if (! $user->admin) accessforbidden(); - +if (! $user->admin) + accessforbidden(); /* @@ -115,13 +116,6 @@ print $langs->trans("BackupDescX").'

'; print $langs->trans("BackupDesc3",DOL_DATA_ROOT).'
'; print $langs->trans("BackupDescY").'

'; -if ($_GET["msg"]) -{ - print '
'.$_GET["msg"].'
'; - print '
'; - print "\n"; -} - ?> diff --git a/htdocs/admin/tools/dolibarr_import.php b/htdocs/admin/tools/dolibarr_import.php index 325d1c834bc..cd2119ca4c8 100644 --- a/htdocs/admin/tools/dolibarr_import.php +++ b/htdocs/admin/tools/dolibarr_import.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2006-2012 Laurent Destailleur + * Copyright (C) 2006-2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -26,7 +27,11 @@ require("../../main.inc.php"); $langs->load("admin"); $langs->load("other"); -if (! $user->admin) accessforbidden(); +if (! $user->admin) + accessforbidden(); + +$radio_dump=GETPOST('radio_dump'); +$showpass=GETPOST('showpass'); /* @@ -41,8 +46,8 @@ llxHeader('','',$help_url); ?>