Maxi debug of multiprice feature

Prepare 2.5.1
This commit is contained in:
Laurent Destailleur 2009-01-10 01:11:17 +00:00
parent d724ee4427
commit 530c1312ac
16 changed files with 129 additions and 126 deletions

View File

@ -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

View File

@ -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

View File

@ -175,7 +175,7 @@ print '</form>';
// multiprix nombre de prix a proposer
if($conf->global->PRODUIT_MULTIPRICES == 1)
if($conf->global->PRODUIT_MULTIPRICES)
{
$var=!$var;
print "<form method=\"post\" action=\"produit.php\">";

View File

@ -270,7 +270,7 @@ if ($_GET["action"] == 'create')
{
print '<tr><td>';
// 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);

View File

@ -1,6 +1,6 @@
<?PHP
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
*
* 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 '<div class="error">'.$errmesg.'</div><br>';
}
/*
* 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 '<form method="POST" action="multiprix.php?id='.$objsoc->id.'">';
print '<input type="hidden" name="action" value="setpricelevel">';
print '<table width="100%" border="0">';
print '<tr><td valign="top">';
print '<table class="border" width="100%">';
print '<form method="POST" action="multiprix.php?id='.$objsoc->id.'">';
print '<input type="hidden" name="action" value="setpricelevel">';
print '<table width="100%" border="0">';
print '<tr><td valign="top">';
print '<table class="border" width="100%">';
print '<tr><td colspan="2" width="25%">';
print $langs->trans("PriceLevel").'</td><td colspan="2">'.$objsoc->price_level."</td></tr>";
print '<tr><td colspan="2" width="25%">';
print $langs->trans("PriceLevel").'</td><td colspan="2">'.$objsoc->price_level."</td></tr>";
print '<tr><td colspan="2">';
print $langs->trans("NewValue").'</td><td colspan="2">';
print '<select name="price_level">';
print '<tr><td colspan="2">';
print $langs->trans("NewValue").'</td><td colspan="2">';
print '<select name="price_level" class="flat">';
for($i=1;$i<=$conf->global->PRODUIT_MULTIPRICES_LIMIT;$i++)
{
print '<option value="'.$i.'"' ;
if($i == $objsoc->price_level)
print 'selected';
print '>'.$i.'</option>';
print '<option value="'.$i.'"' ;
if($i == $objsoc->price_level)
print 'selected';
print '>'.$i.'</option>';
}
print '</select>';
print '</td></tr>';
print '<tr><td colspan="4" align="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"></td></tr>';
print '<tr><td colspan="4" align="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"></td></tr>';
print "</table>";
print "</form>";
print "</td>\n";
print "</td></tr>";
print "</table></div>\n";
print '<br>';
/*
* 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 '<table class="noborder" width="100%">';
$tag = !$tag;
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Date").'</td>';
print '<td>'.$langs->trans("PriceLevel").'</td>';
print '<td>'.$langs->trans("User").'</td>';
print '</tr>';
$i = 0 ;
$num = $db->num_rows($resql);
while ($i < $num )
{
$obj = $db->fetch_object($resql);
$tag = !$tag;
print '<tr '.$bc[$tag].'>';
print '<td>'.dolibarr_print_date($obj->dc,"dayhour").'</td>';
print '<td>'.$obj->price_level.' </td>';
print '<td>'.$obj->login.'</td>';
print '</tr>';
$i++;
}
$db->free($resql);
print "</table>";
}
else
{
dolibarr_print_error($db);
}
print "</form>";
print "</td>\n";
print "</td></tr>";
print "</table></div>\n";
print '<br>';
/*
* 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 '<table class="noborder" width="100%">';
$tag = !$tag;
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Date").'</td>';
print '<td>'.$langs->trans("PriceLevel").'</td>';
print '<td align="right">'.$langs->trans("User").'</td>';
print '</tr>';
$i = 0 ;
$num = $db->num_rows($resql);
while ($i < $num )
{
$obj = $db->fetch_object($resql);
$tag = !$tag;
print '<tr '.$bc[$tag].'>';
print '<td>'.dolibarr_print_date($obj->dc,"dayhour").'</td>';
print '<td>'.$obj->price_level.' </td>';
$userstatic->id=$obj->uid;
$userstatic->nom=$obj->login;
print '<td align="right">'.$userstatic->getNomUrl(1).'</td>';
print '</tr>';
$i++;
}
$db->free($resql);
print "</table>";
}
else
{
dolibarr_print_error($db);
}
}

View File

@ -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 '<tr '.$bc[$var].'>';
print '<td '.$colspan.'>';
// multiprix
if($conf->global->PRODUIT_MULTIPRICES == 1)
if($conf->global->PRODUIT_MULTIPRICES)
{
$html->select_produits('','idprod','',$conf->produit->limit_size,$societe->price_level);
}

View File

@ -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;

View File

@ -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 '<tr><td>';
// 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 '<tr '.$bc[$var].'>';
print '<td colspan="3">';
// multiprix
if($conf->global->PRODUIT_MULTIPRICES == 1)
if($conf->global->PRODUIT_MULTIPRICES)
{
$html->select_produits('','idprod','',$conf->produit->limit_size,$soc->price_level);
}

View File

@ -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 '<tr>';
print '<td>';
// 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 '<tr '.$bc[$var].'>';
print '<td colspan="3">';
// multiprix
if($conf->global->PRODUIT_MULTIPRICES == 1)
if($conf->global->PRODUIT_MULTIPRICES)
{
$html->select_produits('','idprod','',$conf->produit->limit_size,$soc->price_level);
}

View File

@ -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 "<tr $bc[$var]>";
print '<td colspan="3">';
// 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);

View File

@ -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;

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2004 Sebastien DiCintio <sdicintio@ressource-toi.org>
* Copyright (C) 2007-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007-2009 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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');

View File

@ -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.

View File

@ -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 '<br>';
print '<table class="border" width="100%">';
if($conf->global->PRODUIT_MULTIPRICES == 1)
if($conf->global->PRODUIT_MULTIPRICES)
{
print '<tr><td>'.$langs->trans("SellingPrice").' 1</td>';
print '<td><input name="price" size="10" value="'.$product->price.'">';

View File

@ -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];
}

View File

@ -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;
}