From 530c1312ac560ee656c49d6c48a1f4423531df93 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 10 Jan 2009 01:11:17 +0000 Subject: [PATCH] Maxi debug of multiprice feature Prepare 2.5.1 --- ChangeLog | 1 + build/exe/doliwamp/doliwamp.iss | 8 +- htdocs/admin/produit.php | 2 +- htdocs/comm/addpropal.php | 2 +- htdocs/comm/multiprix.php | 196 +++++++++++++++-------------- htdocs/comm/propal.php | 4 +- htdocs/commande/commande.class.php | 2 +- htdocs/commande/fiche.php | 6 +- htdocs/compta/facture.php | 6 +- htdocs/contrat/fiche.php | 4 +- htdocs/facture.class.php | 2 +- htdocs/install/inc.php | 4 +- htdocs/master.inc.php | 2 +- htdocs/product/fiche.php | 10 +- htdocs/propal.class.php | 2 +- htdocs/societe.class.php | 4 +- 16 files changed, 129 insertions(+), 126 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2c596f72f49..0f4b84f464d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -21,6 +21,7 @@ For users: back. - Fix: Category of a bank transaction was not saved. - Fix: Clicktodial plugin works correctly now +- Fix: Multiprices features works correctly. For translators: - Added ca_ES language files diff --git a/build/exe/doliwamp/doliwamp.iss b/build/exe/doliwamp/doliwamp.iss index 4ed152795f9..9535fb685e9 100644 --- a/build/exe/doliwamp/doliwamp.iss +++ b/build/exe/doliwamp/doliwamp.iss @@ -16,10 +16,10 @@ [Setup] ; ----- Change this ----- AppName=DoliWamp -; DoliWamp x.x or DoliWamp x.x-dev or DoliWamp x.x-beta -AppVerName=DoliWamp 2.6-dev -; DoliWamp x.x or DoliWamp x.x-dev or DoliWamp x.x-beta -OutputBaseFilename=DoliWamp 2.6-dev +; DoliWamp-x.x or DoliWamp-x.x-dev or DoliWamp-x.x-beta +AppVerName=DoliWamp-2.5.1-beta +; DoliWamp-x.x or DoliWamp-x.x-dev or DoliWamp-x.x-beta +OutputBaseFilename=DoliWamp-2.5.1-beta ; Define full path from wich all relative path are defined ; You must modify this to put here your dolibarr root directory SourceDir=E:\Mes Developpements\dolibarr diff --git a/htdocs/admin/produit.php b/htdocs/admin/produit.php index 909a676e318..696194fcc87 100644 --- a/htdocs/admin/produit.php +++ b/htdocs/admin/produit.php @@ -175,7 +175,7 @@ print ''; // multiprix nombre de prix a proposer -if($conf->global->PRODUIT_MULTIPRICES == 1) +if($conf->global->PRODUIT_MULTIPRICES) { $var=!$var; print "
"; diff --git a/htdocs/comm/addpropal.php b/htdocs/comm/addpropal.php index 0f3ee6b9381..d867a647fe6 100644 --- a/htdocs/comm/addpropal.php +++ b/htdocs/comm/addpropal.php @@ -270,7 +270,7 @@ if ($_GET["action"] == 'create') { print ''; // multiprix - if($conf->global->PRODUIT_MULTIPRICES == 1) + if($conf->global->PRODUIT_MULTIPRICES) $html->select_produits('',"idprod".$i,'',$conf->produit->limit_size,$soc->price_level); else $html->select_produits('',"idprod".$i,'',$conf->produit->limit_size); diff --git a/htdocs/comm/multiprix.php b/htdocs/comm/multiprix.php index 4b3f206a056..8c26eb1267a 100644 --- a/htdocs/comm/multiprix.php +++ b/htdocs/comm/multiprix.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2007 Laurent Destailleur + * Copyright (C) 2004-2009 Laurent Destailleur * Copyright (C) 2006 Andre Cianfarani * * This program is free software; you can redistribute it and/or modify @@ -16,65 +16,65 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ */ /** - \file htdocs/comm/multiprix.php - \ingroup commercial - \brief Onglet choix du niveau de prix - \version $Revision$ -*/ - + \file htdocs/comm/multiprix.php + \ingroup commercial + \brief Onglet choix du niveau de prix + \version $Id$ + */ + require_once("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php"); require_once(DOL_DOCUMENT_ROOT."/contact.class.php"); - $langs->load("orders"); $langs->load("companies"); +$_socid = $_GET["id"]; +// Security check +if ($user->societe_id > 0) +{ + $_socid = $user->societe_id; +} + + +/* + * Actions + */ if ($_POST["action"] == 'setpricelevel') { - $soc = New Societe($db); - $soc->fetch($_GET["id"]); - $soc->set_price_level($_POST["price_level"],$user); - - Header("Location: multiprix.php?id=".$_GET["id"]); - exit; + $soc = New Societe($db); + $soc->fetch($_GET["id"]); + $soc->set_price_level($_POST["price_level"],$user); + + Header("Location: multiprix.php?id=".$_GET["id"]); + exit; } +/* + * View + */ + llxHeader(); -$_socid = $_GET["id"]; +$userstatic=new User($db); - -// Sécurité si un client essaye d'accéder à une autre fiche que la sienne -if ($user->societe_id > 0) -{ - $_socid = $user->societe_id; -} - -/********************************************************************************* - * - * Mode fiche - * - *********************************************************************************/ if ($_socid > 0) { // On recupere les donnees societes par l'objet $objsoc = new Societe($db); $objsoc->id=$_socid; $objsoc->fetch($_socid,$to); - + if ($errmesg) { print '
'.$errmesg.'

'; } - + /* * Affichage onglets @@ -82,83 +82,85 @@ if ($_socid > 0) $head = societe_prepare_head($objsoc); - dolibarr_fiche_head($head, 'customer', $objsoc->nom); + dolibarr_fiche_head($head, 'customer', $langs->trans("ThirdParty")); - print ''; - print ''; - print ''; - print '\n"; + + + print ""; + print "
'; - print ''; + print ''; + print ''; + print '
'; + print '\n"; - - - print ""; - print "
'; + print ''; - print '"; + print '"; - print ''; - print ''; + print ''; - print "
'; - print $langs->trans("PriceLevel").''.$objsoc->price_level."
'; + print $langs->trans("PriceLevel").''.$objsoc->price_level."
'; - print $langs->trans("NewValue").''; - print '
'; + print $langs->trans("NewValue").''; + print ''; print '
"; - print ""; - - print "
\n"; - print '
'; - - - /* - * Liste de l'historique des remises - */ - $sql = "SELECT rc.rowid,rc.price_level,".$db->pdate("rc.datec")." as dc, u.login"; - $sql .= " FROM ".MAIN_DB_PREFIX."societe_prices as rc, ".MAIN_DB_PREFIX."user as u"; - $sql .= " WHERE rc.fk_soc =". $objsoc->id; - $sql .= " AND u.rowid = rc.fk_user_author"; - $sql .= " ORDER BY rc.datec DESC"; - - $resql=$db->query($sql); - if ($resql) - { - print ''; - $tag = !$tag; - print ''; - print ''; - print ''; - print ''; - print ''; - $i = 0 ; - $num = $db->num_rows($resql); - - while ($i < $num ) - { - $obj = $db->fetch_object($resql); - $tag = !$tag; - print ''; - print ''; - print ''; - print ''; - print ''; - $i++; - } - $db->free($resql); print "
'.$langs->trans("Date").''.$langs->trans("PriceLevel").''.$langs->trans("User").'
'.dolibarr_print_date($obj->dc,"dayhour").''.$obj->price_level.' '.$obj->login.'
"; - } - else - { - dolibarr_print_error($db); - } + print ""; + + print "
\n"; + print '
'; + + + /* + * Liste de l'historique des remises + */ + $sql = "SELECT rc.rowid,rc.price_level,".$db->pdate("rc.datec")." as dc, u.rowid as uid, u.login"; + $sql .= " FROM ".MAIN_DB_PREFIX."societe_prices as rc, ".MAIN_DB_PREFIX."user as u"; + $sql .= " WHERE rc.fk_soc =". $objsoc->id; + $sql .= " AND u.rowid = rc.fk_user_author"; + $sql .= " ORDER BY rc.datec DESC"; + + $resql=$db->query($sql); + if ($resql) + { + print ''; + $tag = !$tag; + print ''; + print ''; + print ''; + print ''; + print ''; + $i = 0 ; + $num = $db->num_rows($resql); + + while ($i < $num ) + { + $obj = $db->fetch_object($resql); + $tag = !$tag; + print ''; + print ''; + print ''; + $userstatic->id=$obj->uid; + $userstatic->nom=$obj->login; + print ''; + print ''; + $i++; + } + $db->free($resql); + print "
'.$langs->trans("Date").''.$langs->trans("PriceLevel").''.$langs->trans("User").'
'.dolibarr_print_date($obj->dc,"dayhour").''.$obj->price_level.' '.$userstatic->getNomUrl(1).'
"; + } + else + { + dolibarr_print_error($db); + } } diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 20fc071dfed..60ae2c7ec5f 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -597,7 +597,7 @@ if ($_POST['action'] == "addligne" && $user->rights->propale->creer) $tva_npr = get_default_npr($mysoc,$propal->client,$prod->tva_tx); // On defini prix unitaire - if ($conf->global->PRODUIT_MULTIPRICES == 1) + if ($conf->global->PRODUIT_MULTIPRICES) { $pu_ht = $prod->multiprices[$propal->client->price_level]; $pu_ttc = $prod->multiprices_ttc[$propal->client->price_level]; @@ -1592,7 +1592,7 @@ if ($_GET['propalid'] > 0) print ''; print ''; // multiprix - if($conf->global->PRODUIT_MULTIPRICES == 1) + if($conf->global->PRODUIT_MULTIPRICES) { $html->select_produits('','idprod','',$conf->produit->limit_size,$societe->price_level); } diff --git a/htdocs/commande/commande.class.php b/htdocs/commande/commande.class.php index efa78320e59..ba8badc5b7f 100644 --- a/htdocs/commande/commande.class.php +++ b/htdocs/commande/commande.class.php @@ -769,7 +769,7 @@ class Commande extends CommonObject $tva_tx = get_default_tva($mysoc,$this->client,$prod->tva_tx); // multiprix - if($conf->global->PRODUIT_MULTIPRICES == 1) + if($conf->global->PRODUIT_MULTIPRICES) $price = $prod->multiprices[$this->client->price_level]; else $price = $prod->price; diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 393e9182819..59342688df6 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -334,7 +334,7 @@ if ($_POST['action'] == 'addligne' && $user->rights->commande->creer) $tva_tx = get_default_tva($mysoc,$commande->client,$prod->tva_tx); // multiprix - if ($conf->global->PRODUIT_MULTIPRICES == 1) + if ($conf->global->PRODUIT_MULTIPRICES) { $pu_ht = $prod->multiprices[$commande->client->price_level]; $pu_ttc = $prod->multiprices_ttc[$commande->client->price_level]; @@ -1038,7 +1038,7 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer) { print ''; // multiprix - if($conf->global->PRODUIT_MULTIPRICES == 1) + if($conf->global->PRODUIT_MULTIPRICES) print $html->select_produits('','idprod'.$i,'',$conf->produit->limit_size,$soc->price_level); else print $html->select_produits('','idprod'.$i,'',$conf->produit->limit_size); @@ -1791,7 +1791,7 @@ else print ''; print ''; // multiprix - if($conf->global->PRODUIT_MULTIPRICES == 1) + if($conf->global->PRODUIT_MULTIPRICES) { $html->select_produits('','idprod','',$conf->produit->limit_size,$soc->price_level); } diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index db76fdd926f..6571ad504e1 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -874,7 +874,7 @@ if (($_POST['action'] == 'addligne' || $_POST['action'] == 'addligne_predef') && $tva_npr = get_default_npr($mysoc,$fac->client,$prod->tva_tx); // On defini prix unitaire - if ($conf->global->PRODUIT_MULTIPRICES == 1) + if ($conf->global->PRODUIT_MULTIPRICES) { $pu_ht = $prod->multiprices[$fac->client->price_level]; $pu_ttc = $prod->multiprices_ttc[$fac->client->price_level]; @@ -1714,7 +1714,7 @@ if ($_GET['action'] == 'create') print ''; print ''; // multiprix - if($conf->global->PRODUIT_MULTIPRICES == 1) + if($conf->global->PRODUIT_MULTIPRICES) $html->select_produits('','idprod'.$i,'',$conf->produit->limit_size,$soc->price_level); else $html->select_produits('','idprod'.$i,'',$conf->produit->limit_size); @@ -2864,7 +2864,7 @@ else print ''; print ''; // multiprix - if($conf->global->PRODUIT_MULTIPRICES == 1) + if($conf->global->PRODUIT_MULTIPRICES) { $html->select_produits('','idprod','',$conf->produit->limit_size,$soc->price_level); } diff --git a/htdocs/contrat/fiche.php b/htdocs/contrat/fiche.php index 23042510f05..8a9913b337b 100644 --- a/htdocs/contrat/fiche.php +++ b/htdocs/contrat/fiche.php @@ -226,7 +226,7 @@ if ($_POST["action"] == 'addligne' && $user->rights->contrat->creer) $tva_npr = get_default_npr($mysoc,$contrat->client,$prod->tva_npr); // On defini prix unitaire - if ($conf->global->PRODUIT_MULTIPRICES == 1) + if ($conf->global->PRODUIT_MULTIPRICES) { $pu_ht = $prod->multiprices[$contrat->client->price_level]; $pu_ttc = $prod->multiprices_ttc[$contrat->client->price_level]; @@ -1179,7 +1179,7 @@ else print ""; print ''; // multiprix - if($conf->global->PRODUIT_MULTIPRICES == 1) + if($conf->global->PRODUIT_MULTIPRICES) $form->select_produits('','p_idprod',1,$conf->produit->limit_size,$contrat->societe->price_level); else $form->select_produits('','p_idprod',1,$conf->produit->limit_size); diff --git a/htdocs/facture.class.php b/htdocs/facture.class.php index 9ea2cafce9d..47813d4a029 100644 --- a/htdocs/facture.class.php +++ b/htdocs/facture.class.php @@ -1457,7 +1457,7 @@ class Facture extends CommonObject $tva_tx = get_default_tva($mysoc,$this->client,$prod->tva_tx); // multiprix - if($conf->global->PRODUIT_MULTIPRICES == 1) + if($conf->global->PRODUIT_MULTIPRICES) $price = $prod->multiprices[$this->client->price_level]; else $price = $prod->price; diff --git a/htdocs/install/inc.php b/htdocs/install/inc.php index 30c981e087b..be08f68a6e2 100644 --- a/htdocs/install/inc.php +++ b/htdocs/install/inc.php @@ -2,7 +2,7 @@ /* Copyright (C) 2004 Rodolphe Quiedeville * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2004 Sebastien DiCintio - * Copyright (C) 2007-2008 Laurent Destailleur + * Copyright (C) 2007-2009 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,7 +24,7 @@ \version $Id$ */ -define('DOL_VERSION','2.6-dev'); // Also defined in htdocs/master.inc.php +define('DOL_VERSION','2.5.1-beta'); // Also defined in htdocs/master.inc.php require_once('../translate.class.php'); require_once('../lib/functions.lib.php'); diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index 90a3e93373c..d89b93a9b97 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -30,7 +30,7 @@ * \version $Id$ */ -define('DOL_VERSION','2.6-dev'); // Also defined in htdocs/install/inc.php +define('DOL_VERSION','2.5.1-beta'); // Also defined in htdocs/install/inc.php define('EURO',chr(128)); // La fonction clearstatcache ne doit pas etre appelée de manière globale car ralenti. diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php index 8fdf02a4822..1fa901e47c6 100644 --- a/htdocs/product/fiche.php +++ b/htdocs/product/fiche.php @@ -106,7 +106,7 @@ if ($_POST["action"] == 'add' && $user->rights->produit->creer) $product->volume_units = $_POST["volume_units"]; $product->finished = $_POST["finished"]; // MultiPrix - if($conf->global->PRODUIT_MULTIPRICES == 1) + if($conf->global->PRODUIT_MULTIPRICES) { for($i=2;$i<=$conf->global->PRODUIT_MULTIPRICES_LIMIT;$i++) { @@ -316,7 +316,7 @@ if ($_POST["action"] == 'addinpropal') $price_base_type = 'HT'; // multiprix - if ($conf->global->PRODUIT_MULTIPRICES == 1) + if ($conf->global->PRODUIT_MULTIPRICES) { $pu_ht = $prod->multiprices[$soc->price_level]; $pu_ttc = $prod->multiprices_ttc[$soc->price_level]; @@ -395,7 +395,7 @@ if ($_POST["action"] == 'addincommande') $tva_tx = get_default_tva($mysoc,$soc,$prod->tva_tx); // multiprix - if ($conf->global->PRODUIT_MULTIPRICES == 1) + if ($conf->global->PRODUIT_MULTIPRICES) { $pu_ht = $prod->multiprices[$soc->price_level]; $pu_ttc = $prod->multiprices_ttc[$soc->price_level]; @@ -475,7 +475,7 @@ if ($_POST["action"] == 'addinfacture' && $user->rights->facture->creer) $tva_tx = get_default_tva($mysoc,$soc,$prod->tva_tx); // multiprix - if ($conf->global->PRODUIT_MULTIPRICES == 1) + if ($conf->global->PRODUIT_MULTIPRICES) { $pu_ht = $prod->multiprices[$soc->price_level]; $pu_ttc = $prod->multiprices_ttc[$soc->price_level]; @@ -687,7 +687,7 @@ if ($_GET["action"] == 'create' && $user->rights->produit->creer) print '
'; print ''; - if($conf->global->PRODUIT_MULTIPRICES == 1) + if($conf->global->PRODUIT_MULTIPRICES) { print ''; print '
'.$langs->trans("SellingPrice").' 1'; diff --git a/htdocs/propal.class.php b/htdocs/propal.class.php index 7d88f162ec4..16279733644 100644 --- a/htdocs/propal.class.php +++ b/htdocs/propal.class.php @@ -149,7 +149,7 @@ class Propal extends CommonObject $tva_tx = get_default_tva($mysoc,$this->client,$prod->tva_tx); // multiprix - if($conf->global->PRODUIT_MULTIPRICES == 1) + if($conf->global->PRODUIT_MULTIPRICES) { $price = $prod->multiprices[$this->client->price_level]; } diff --git a/htdocs/societe.class.php b/htdocs/societe.class.php index e83cd576f87..1a337f452bb 100644 --- a/htdocs/societe.class.php +++ b/htdocs/societe.class.php @@ -501,7 +501,7 @@ class Societe extends CommonObject } $sql = 'SELECT s.rowid, s.nom, s.address,'.$this->db->pdate('s.datec').' as dc, s.prefix_comm'; - if($conf->global->PRODUIT_MULTIPRICES == 1) $sql .= ', s.price_level'; + if($conf->global->PRODUIT_MULTIPRICES) $sql .= ', s.price_level'; $sql .= ','. $this->db->pdate('s.tms').' as date_update'; $sql .= ', s.tel, s.fax, s.email, s.url, s.cp, s.ville, s.note, s.client, s.fournisseur'; $sql .= ', s.siren, s.siret, s.ape, s.idprof4'; @@ -605,7 +605,7 @@ class Societe extends CommonObject $this->rubrique = $obj->rubrique; $this->note = $obj->note; // multiprix - if($conf->global->PRODUIT_MULTIPRICES == 1) $this->price_level = $obj->price_level; + $this->price_level = $obj->price_level; $result = 1; }