integration support multiprix
This commit is contained in:
parent
6c8ef21003
commit
2fbd6ac90c
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2004-2005 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
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -41,8 +42,72 @@ if ($_POST["action"] == 'nbprod')
|
|||||||
Header("Location: produit.php");
|
Header("Location: produit.php");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
else if ($_POST["action"] == 'multiprix_num')
|
||||||
|
{
|
||||||
|
dolibarr_set_const($db, "PRODUIT_MULTIPRICES_LIMIT", $_POST["value"]);
|
||||||
|
Header("Location: produit.php");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
if ($_GET["action"] == 'activate_multiprix')
|
||||||
|
{
|
||||||
|
$res=$db -> desc_table(MAIN_DB_PREFIX."product_price","price_level");
|
||||||
|
if(! $db -> fetch_row())
|
||||||
|
{
|
||||||
|
// on ajoute le champ price_level dans la table product_price
|
||||||
|
$field_desc = array('type'=>'TINYINT','value'=>'4','default'=>'1');
|
||||||
|
if(! $db -> add_field(MAIN_DB_PREFIX."product_price","price_level",$field_desc,"after date_price"))
|
||||||
|
{
|
||||||
|
dolibarr_print_error($db);
|
||||||
|
print "<script language='JavaScript'>setTimeout(\"document.location='./produit.php'\",5000);</script>";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// on ajoute le champ price_level dans la table societe
|
||||||
|
if(! $db -> add_field(MAIN_DB_PREFIX."societe","price_level",$field_desc))
|
||||||
|
{
|
||||||
|
dolibarr_print_error($db);
|
||||||
|
print "<script language='JavaScript'>setTimeout(\"document.location='./produit.php'\",5000);</script>";
|
||||||
|
}
|
||||||
|
// on crée la table societe_prices
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$table = MAIN_DB_PREFIX."societe_prices";
|
||||||
|
$fields['rowid'] = array('type'=>'int','value'=>'11','null'=>'not null','extra'=> 'auto_increment');
|
||||||
|
$fields['fk_soc'] = array('type'=>'int','value'=>'11','null'=>'not null','default'=> '0');
|
||||||
|
$fields['tms'] = array('type'=>'timestamp','value'=>'14','null'=>'not null');
|
||||||
|
$fields['datec'] = array('type'=>'datetime','default'=> 'null');
|
||||||
|
$fields['fk_user_author'] = array('type'=>'int','value'=>'11','default'=> 'null');
|
||||||
|
$fields['price_level'] = array('type'=>'tinyint','value'=>'4','default'=> '1');
|
||||||
|
if(! $db -> create_table($table,$fields,"rowid","MyISAM"))
|
||||||
|
{
|
||||||
|
dolibarr_print_error($db);
|
||||||
|
print "<script language='JavaScript'>setTimeout(\"document.location='./produit.php'\",5000);</script>";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dolibarr_set_const($db, "PRODUIT_MULTIPRICES", "1");
|
||||||
|
dolibarr_set_const($db, "PRODUIT_MULTIPRICES_LIMIT", "6");
|
||||||
|
Header("Location: produit.php");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dolibarr_set_const($db, "PRODUIT_MULTIPRICES", "1");
|
||||||
|
dolibarr_set_const($db, "PRODUIT_MULTIPRICES_LIMIT", "6");
|
||||||
|
Header("Location: produit.php");
|
||||||
|
}
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
else if ($_GET["action"] == 'disable_multiprix')
|
||||||
|
{
|
||||||
|
//"ALTER TABLE ".MAIN_DB_PREFIX."product_price drop price_level"
|
||||||
|
dolibarr_del_const($db, "PRODUIT_MULTIPRICES");
|
||||||
|
dolibarr_del_const($db, "PRODUIT_MULTIPRICES_LIMIT");
|
||||||
|
Header("Location: produit.php");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Affiche page
|
* Affiche page
|
||||||
@ -72,6 +137,54 @@ print '<td><input type="submit" class="button" value="'.$langs->trans("Modify").
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
|
|
||||||
|
// multiprix activation/desactivation
|
||||||
|
print '<table class="noborder" width="100%">';
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print '<td width="140">'.$langs->trans("Name").'</td>';
|
||||||
|
print '<td align="center"> </td>';
|
||||||
|
print '<td align="center">'.$langs->trans("Active").'</td>';
|
||||||
|
print "</tr>\n";
|
||||||
|
print "<form method=\"post\" action=\"produit.php\">";
|
||||||
|
print "<input type=\"hidden\" name=\"action\" value=\"multiprix\">";
|
||||||
|
print "<tr ".$bc[false].">";
|
||||||
|
print '<td width="80%">'.$langs->trans("MultiPricesAbility").'</td>';
|
||||||
|
print '<td align="center">';
|
||||||
|
if($conf->global->PRODUIT_MULTIPRICES == 1)
|
||||||
|
print img_tick();
|
||||||
|
print '</td>';
|
||||||
|
print "<td align=\"center\">";
|
||||||
|
if($conf->global->PRODUIT_MULTIPRICES == 0)
|
||||||
|
print '<a href="produit.php?action=activate_multiprix">'.$langs->trans("Activate").'</a>';
|
||||||
|
else if($conf->global->PRODUIT_MULTIPRICES == 1)
|
||||||
|
print '<a href="produit.php?action=disable_multiprix">'.$langs->trans("Disable").'</a>';
|
||||||
|
print "</td>";
|
||||||
|
print '</tr>';
|
||||||
|
print '</table>';
|
||||||
|
print '</form>';
|
||||||
|
// multiprix nombre de prix a proposer
|
||||||
|
if($conf->global->PRODUIT_MULTIPRICES == 1)
|
||||||
|
{
|
||||||
|
print '<br>';
|
||||||
|
print "<form method=\"post\" action=\"produit.php\">";
|
||||||
|
print "<input type=\"hidden\" name=\"action\" value=\"multiprix_num\">";
|
||||||
|
print "<table class=\"noborder\" width=\"100%\">";
|
||||||
|
print "<tr class=\"liste_titre\">";
|
||||||
|
print ' <td width="80%">'.$langs->trans("Name")."</td>\n";
|
||||||
|
print " <td align=\"left\">".$langs->trans("Value")."</td>\n";
|
||||||
|
print " <td> </td>\n";
|
||||||
|
print "</tr><tr ".$bc[false].">";
|
||||||
|
print '<td>'.$langs->trans("MultiPricesNumPrices").'</td>';
|
||||||
|
print "<td align=\"left\"><input size=\"3\" type=\"text\" class=\"flat\" name=\"value\" value=\"".$conf->global->PRODUIT_MULTIPRICES_LIMIT."\"></td>";
|
||||||
|
print '<td><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
|
||||||
|
print '</tr>';
|
||||||
|
print '</table>';
|
||||||
|
print '</form>';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2005 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
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -190,7 +191,11 @@ if ($_GET["action"] == 'create')
|
|||||||
for ($i = 1 ; $i <= PROPALE_NEW_FORM_NB_PRODUCT ; $i++)
|
for ($i = 1 ; $i <= PROPALE_NEW_FORM_NB_PRODUCT ; $i++)
|
||||||
{
|
{
|
||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
$form->select_produits('',"idprod".$i,'',$conf->produit->limit_size);
|
// multiprix
|
||||||
|
if($conf->global->PRODUIT_MULTIPRICES == 1)
|
||||||
|
$form->select_produits('',"idprod".$i,'',$conf->produit->limit_size,$soc->price_level);
|
||||||
|
else
|
||||||
|
$form->select_produits('',"idprod".$i,'',$conf->produit->limit_size);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td><input type="text" size="2" name="qty'.$i.'" value="1"></td>';
|
print '<td><input type="text" size="2" name="qty'.$i.'" value="1"></td>';
|
||||||
print '<td><input type="text" size="3" name="remise'.$i.'" value="'.$soc->remise_client.'"> %</td></tr>';
|
print '<td><input type="text" size="3" name="remise'.$i.'" value="'.$soc->remise_client.'"> %</td></tr>';
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||||
|
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -308,6 +309,18 @@ if ($_socid > 0)
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
|
// multiprix
|
||||||
|
if($conf->global->PRODUIT_MULTIPRICES == 1)
|
||||||
|
{
|
||||||
|
print '<tr><td nowrap>';
|
||||||
|
print '<table width="100%" class="nobordernopadding"><tr><td nowrap>';
|
||||||
|
print $langs->trans("PriceLevel");
|
||||||
|
print '<td><td align="right">';
|
||||||
|
print '<a href="'.DOL_URL_ROOT.'/comm/multiprix.php?id='.$objsoc->id.'">'.img_edit($langs->trans("Modify")).'</a>';
|
||||||
|
print '</td></tr></table>';
|
||||||
|
print '</td><td colspan="3">'.$objsoc->price_level."</td>";
|
||||||
|
print '</tr>';
|
||||||
|
}
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||||
|
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -882,7 +883,11 @@ if ($_GET['propalid'] > 0)
|
|||||||
$var=!$var;
|
$var=!$var;
|
||||||
print '<tr '.$bc[$var].'>';
|
print '<tr '.$bc[$var].'>';
|
||||||
print '<td colspan="2">';
|
print '<td colspan="2">';
|
||||||
$html->select_produits('','idprod','',$conf->produit->limit_size);
|
// multiprix
|
||||||
|
if($conf->global->PRODUIT_MULTIPRICES == 1)
|
||||||
|
$html->select_produits('','idprod','',$conf->produit->limit_size,$societe->price_level);
|
||||||
|
else
|
||||||
|
$html->select_produits('','idprod','',$conf->produit->limit_size);
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '<textarea cols="50" name="np_desc" rows="'.ROWS_2.'"></textarea>';
|
print '<textarea cols="50" name="np_desc" rows="'.ROWS_2.'"></textarea>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2005 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
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -216,6 +217,7 @@ class Commande
|
|||||||
*/
|
*/
|
||||||
function create($user)
|
function create($user)
|
||||||
{
|
{
|
||||||
|
global $conf;
|
||||||
/* On positionne en mode brouillon la commande */
|
/* On positionne en mode brouillon la commande */
|
||||||
$this->brouillon = 1;
|
$this->brouillon = 1;
|
||||||
if (! $remise)
|
if (! $remise)
|
||||||
@ -241,12 +243,29 @@ class Commande
|
|||||||
$prod = new Product($this->db, $this->products[$i]);
|
$prod = new Product($this->db, $this->products[$i]);
|
||||||
if ($prod->fetch($this->products[$i]))
|
if ($prod->fetch($this->products[$i]))
|
||||||
{
|
{
|
||||||
$this->insert_product_generic($prod->libelle,
|
// multiprix
|
||||||
|
if($conf->global->PRODUIT_MULTIPRICES == 1)
|
||||||
|
{
|
||||||
|
$this->soc_id;
|
||||||
|
$client = new Societe($this->db);
|
||||||
|
$client->fetch($this->soc_id);
|
||||||
|
//$prod->multiprices[$client->price_level]
|
||||||
|
$this->insert_product_generic($prod->libelle,
|
||||||
|
$prod->multiprices[$client->price_level],
|
||||||
|
$this->products_qty[$i],
|
||||||
|
$prod->tva_tx,
|
||||||
|
$this->products[$i],
|
||||||
|
$this->products_remise_percent[$i]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->insert_product_generic($prod->libelle,
|
||||||
$prod->price,
|
$prod->price,
|
||||||
$this->products_qty[$i],
|
$this->products_qty[$i],
|
||||||
$prod->tva_tx,
|
$prod->tva_tx,
|
||||||
$this->products[$i],
|
$this->products[$i],
|
||||||
$this->products_remise_percent[$i]);
|
$this->products_remise_percent[$i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX."commande SET ref='(PROV".$this->id.")' WHERE rowid=".$this->id;
|
$sql = 'UPDATE '.MAIN_DB_PREFIX."commande SET ref='(PROV".$this->id.")' WHERE rowid=".$this->id;
|
||||||
@ -338,6 +357,7 @@ class Commande
|
|||||||
*/
|
*/
|
||||||
function addline($desc, $pu, $qty, $txtva, $fk_product=0, $remise_percent=0)
|
function addline($desc, $pu, $qty, $txtva, $fk_product=0, $remise_percent=0)
|
||||||
{
|
{
|
||||||
|
global $conf;
|
||||||
// Nettoyage parametres
|
// Nettoyage parametres
|
||||||
$qty = ereg_replace(',','.',$qty);
|
$qty = ereg_replace(',','.',$qty);
|
||||||
$pu = ereg_replace(',','.',$pu);
|
$pu = ereg_replace(',','.',$pu);
|
||||||
@ -358,7 +378,16 @@ class Commande
|
|||||||
if ($prod->fetch($fk_product) > 0)
|
if ($prod->fetch($fk_product) > 0)
|
||||||
{
|
{
|
||||||
$desc = $desc?$desc:$prod->libelle;
|
$desc = $desc?$desc:$prod->libelle;
|
||||||
$pu = $prod->price;
|
// multiprix
|
||||||
|
if($conf->global->PRODUIT_MULTIPRICES == 1)
|
||||||
|
{
|
||||||
|
$client = new Societe($this->db);
|
||||||
|
$client->fetch($this->soc_id);
|
||||||
|
$pu = $prod->multiprices[$client->price_level];
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$pu = $prod->price;
|
||||||
$txtva = $prod->tva_tx;
|
$txtva = $prod->tva_tx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -336,7 +336,11 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer)
|
|||||||
for ($i = 1 ; $i <= $NBLINES ; $i++)
|
for ($i = 1 ; $i <= $NBLINES ; $i++)
|
||||||
{
|
{
|
||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
print $html->select_produits('','idprod'.$i,'',$conf->produit->limit_size);
|
// multiprix
|
||||||
|
if($conf->global->PRODUIT_MULTIPRICES == 1)
|
||||||
|
print $html->select_produits('','idprod'.$i,'',$conf->produit->limit_size,$soc->price_level);
|
||||||
|
else
|
||||||
|
print $html->select_produits('','idprod'.$i,'',$conf->produit->limit_size);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td><input type="text" size="3" name="qty'.$i.'" value="1"></td>';
|
print '<td><input type="text" size="3" name="qty'.$i.'" value="1"></td>';
|
||||||
print '<td><input type="text" size="3" name="remise_percent'.$i.'" value="0">%</td></tr>';
|
print '<td><input type="text" size="3" name="remise_percent'.$i.'" value="0">%</td></tr>';
|
||||||
@ -808,7 +812,11 @@ else
|
|||||||
$var=!$var;
|
$var=!$var;
|
||||||
print '<tr '.$bc[$var].'>';
|
print '<tr '.$bc[$var].'>';
|
||||||
print '<td colspan="2">';
|
print '<td colspan="2">';
|
||||||
$html->select_produits('','p_idprod','',$conf->produit->limit_size);
|
// multiprix
|
||||||
|
if($conf->global->PRODUIT_MULTIPRICES == 1)
|
||||||
|
$html->select_produits('','p_idprod','',$conf->produit->limit_size,$soc->price_level);
|
||||||
|
else
|
||||||
|
$html->select_produits('','p_idprod','',$conf->produit->limit_size);
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '<textarea cols="50" name="np_desc" rows="1"></textarea>';
|
print '<textarea cols="50" name="np_desc" rows="1"></textarea>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
* Copyright (C) 2004 Éric Seigne <eric.seigne@ryxeo.com>
|
* Copyright (C) 2004 Éric Seigne <eric.seigne@ryxeo.com>
|
||||||
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||||
|
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -763,7 +764,11 @@ if ($_GET['action'] == 'create')
|
|||||||
for ($i = 1 ; $i <= $NBLINES ; $i++)
|
for ($i = 1 ; $i <= $NBLINES ; $i++)
|
||||||
{
|
{
|
||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
$html->select_produits('','idprod'.$i,'',$conf->produit->limit_size);
|
// multiprix
|
||||||
|
if($conf->global->PRODUIT_MULTIPRICES == 1)
|
||||||
|
$html->select_produits('','idprod'.$i,'',$conf->produit->limit_size,$soc->price_level);
|
||||||
|
else
|
||||||
|
$html->select_produits('','idprod'.$i,'',$conf->produit->limit_size);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td><input type="text" size="3" name="qty'.$i.'" value="1"></td>';
|
print '<td><input type="text" size="3" name="qty'.$i.'" value="1"></td>';
|
||||||
print '<td nowrap="nowrap"><input type="text" size="1" name="remise_percent'.$i.'" value="0">%</td>';
|
print '<td nowrap="nowrap"><input type="text" size="1" name="remise_percent'.$i.'" value="0">%</td>';
|
||||||
@ -1568,7 +1573,11 @@ else
|
|||||||
$var=! $var;
|
$var=! $var;
|
||||||
print '<tr '.$bc[$var].'>';
|
print '<tr '.$bc[$var].'>';
|
||||||
print '<td colspan="2">';
|
print '<td colspan="2">';
|
||||||
$html->select_produits('','idprod','',$conf->produit->limit_size);
|
// multiprix
|
||||||
|
if($conf->global->PRODUIT_MULTIPRICES == 1)
|
||||||
|
$html->select_produits('','idprod','',$conf->produit->limit_size,$soc->price_level);
|
||||||
|
else
|
||||||
|
$html->select_produits('','idprod','',$conf->produit->limit_size);
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '<textarea name="desc" cols="70" rows="'.ROWS_2.'"></textarea></td>';
|
print '<textarea name="desc" cols="70" rows="'.ROWS_2.'"></textarea></td>';
|
||||||
print '<td> </td>';
|
print '<td> </td>';
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2005 Destailleur Laurent <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2005 Destailleur Laurent <eldy@users.sourceforge.net>
|
||||||
*
|
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
@ -566,6 +566,7 @@ class Contrat
|
|||||||
function addline($desc, $pu, $qty, $txtva, $fk_product=0, $remise_percent=0, $datestart, $dateend)
|
function addline($desc, $pu, $qty, $txtva, $fk_product=0, $remise_percent=0, $datestart, $dateend)
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
global $conf;
|
||||||
|
|
||||||
dolibarr_syslog("contrat.class.php::addline $desc, $pu, $qty, $txtva, $fk_product, $remise_percent, $datestart, $dateend");
|
dolibarr_syslog("contrat.class.php::addline $desc, $pu, $qty, $txtva, $fk_product, $remise_percent, $datestart, $dateend");
|
||||||
|
|
||||||
@ -580,7 +581,11 @@ class Contrat
|
|||||||
if ($prod->fetch($fk_product) > 0)
|
if ($prod->fetch($fk_product) > 0)
|
||||||
{
|
{
|
||||||
$label = $prod->libelle;
|
$label = $prod->libelle;
|
||||||
$pu = $prod->price;
|
// multiprix
|
||||||
|
if($conf->global->PRODUIT_MULTIPRICES == 1)
|
||||||
|
$pu = $prod->multiprices[$this ->societe->price_level];
|
||||||
|
else
|
||||||
|
$pu = $prod->price;
|
||||||
$txtva = $prod->tva_tx;
|
$txtva = $prod->tva_tx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2005 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
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
@ -809,7 +809,11 @@ else
|
|||||||
|
|
||||||
print "<tr $bc[$var]>";
|
print "<tr $bc[$var]>";
|
||||||
print '<td colspan="3">';
|
print '<td colspan="3">';
|
||||||
$html->select_produits('','p_idprod','',$conf->produit->limit_size);
|
// multiprix
|
||||||
|
if($conf->global->PRODUIT_MULTIPRICES == 1)
|
||||||
|
$html->select_produits('','p_idprod','',$conf->produit->limit_size,$contrat->societe->price_level);
|
||||||
|
else
|
||||||
|
$html->select_produits('','p_idprod','',$conf->produit->limit_size);
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '<textarea name="desc" cols="70" rows="'.ROWS_2.'"></textarea>';
|
print '<textarea name="desc" cols="70" rows="'.ROWS_2.'"></textarea>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||||
* Copyright (C) 2005 Regis Houssin <regis.houssin@cap-networks.com>
|
* Copyright (C) 2005 Regis Houssin <regis.houssin@cap-networks.com>
|
||||||
* Copyright (C) 2005 Simon Tosser <simon@kornog-computing.com>
|
* Copyright (C) 2005 Simon Tosser <simon@kornog-computing.com>
|
||||||
|
* Copyright (C) 2005 Andre Cianfarani <andre.cianfarani@acdeveloppement.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -31,10 +32,10 @@
|
|||||||
\version $Revision$
|
\version $Revision$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
define('DOL_VERSION','2.1-alpha');
|
define('DOL_VERSION','2.0.0-alpha2');
|
||||||
|
|
||||||
// La fonction clearstatcache ne doit pas etre appelé de manière globale car ralenti.
|
// La fonction clearstatcache ne doit pas etre appel<EFBFBD>de mani<6E>e globale car ralenti.
|
||||||
// Elle doit etre appelée uniquement par les pages qui ont besoin d'un cache fichier vidé,
|
// Elle doit etre appel<EFBFBD> uniquement par les pages qui ont besoin d'un cache fichier vid<69>
|
||||||
// comme par exemple document.php
|
// comme par exemple document.php
|
||||||
//clearstatcache();
|
//clearstatcache();
|
||||||
|
|
||||||
@ -131,7 +132,488 @@ if ($result)
|
|||||||
{
|
{
|
||||||
$objp = $db->fetch_object($result);
|
$objp = $db->fetch_object($result);
|
||||||
$key=$objp->name;
|
$key=$objp->name;
|
||||||
$value=$objp->value; // Pas de stripslashes (ne s'applique pas sur lecture base mais après POST quand get_magic_quotes_gpc()==1)
|
$value=$objp->value; // Pas de stripslashes (ne s'applique pas sur lecture base mais apr<70> POST quand get_magic_quotes_gpc()==1)
|
||||||
|
define ("$key", $value);
|
||||||
|
$conf->global->$key=$value;
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$db->free($result);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Nettoyage variables des gestionnaires de menu
|
||||||
|
* conf->menu_top et conf->menu_left sont d?finis dans main.inc.php (selon user)
|
||||||
|
*/
|
||||||
|
if (! $conf->global->MAIN_MENU_BARRETOP) $conf->global->MAIN_MENU_BARRETOP="default.php";
|
||||||
|
if (! $conf->global->MAIN_MENUFRONT_BARRETOP) $conf->global->MAIN_MENUFRONT_BARRETOP="default.php";
|
||||||
|
if (! $conf->global->MAIN_MENU_BARRELEFT) $conf->global->MAIN_MENU_BARRELEFT="default.php";
|
||||||
|
if (! $conf->global->MAIN_MENUFRONT_BARRELEFT) $conf->global->MAIN_MENUFRONT_BARRELEFT="default.php";
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Charge l'objet de traduction et positionne langage courant global
|
||||||
|
*/
|
||||||
|
if (! $conf->global->MAIN_LANG_DEFAULT) $conf->global->MAIN_LANG_DEFAULT="fr_FR";
|
||||||
|
|
||||||
|
require_once(DOL_DOCUMENT_ROOT ."/translate.class.php");
|
||||||
|
$langs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
|
||||||
|
$langs->setDefaultLang($conf->global->MAIN_LANG_DEFAULT);
|
||||||
|
$langs->setPhpLang($conf->global->MAIN_LANG_DEFAULT);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Pour utiliser d'autres versions des librairies externes que les
|
||||||
|
* versions embarqu?es dans Dolibarr, d?finir les constantes adequates:
|
||||||
|
* Pour FPDF: FPDF_PATH
|
||||||
|
* Pour PEAR: PEAR_PATH
|
||||||
|
* Pour PHP_WriteExcel: PHP_WRITEEXCEL_PATH
|
||||||
|
* Pour PHPlot: PHPLOT_PATH
|
||||||
|
* Pour MagpieRss: MAGPIERSS_PATH
|
||||||
|
*/
|
||||||
|
if (! defined('FPDF_PATH')) { define('FPDF_PATH', DOL_DOCUMENT_ROOT .'/includes/fpdf/fpdf/'); }
|
||||||
|
if (! defined('PEAR_PATH')) { define('PEAR_PATH', DOL_DOCUMENT_ROOT .'/includes/pear/'); }
|
||||||
|
if (! defined('PHP_WRITEEXCEL_PATH')) { define('PHP_WRITEEXCEL_PATH',DOL_DOCUMENT_ROOT .'/includes/php_writeexcel/'); }
|
||||||
|
if (! defined('PHPLOT_PATH')) { define('PHPLOT_PATH', DOL_DOCUMENT_ROOT .'/includes/phplot/'); }
|
||||||
|
if (! defined('MAGPIERSS_PATH')) { define('MAGPIERSS_PATH', DOL_DOCUMENT_ROOT .'/includes/magpierss/'); }
|
||||||
|
if (! defined('JPGRAPH_PATH')) { define('JPGRAPH_PATH', DOL_DOCUMENT_ROOT .'/includes/jpgraph/'); }
|
||||||
|
define('FPDF_FONTPATH', FPDF_PATH . 'font/');
|
||||||
|
define('MAGPIE_DIR', MAGPIERSS_PATH);
|
||||||
|
|
||||||
|
// \todo Ajouter la ligne
|
||||||
|
// require_once(FPDF_PATH . "fpdf.php");
|
||||||
|
// dans le fichier pdfdetail_standard_modeles du module telephonie afin de pouvoir la suivante
|
||||||
|
if (defined("MAIN_MODULE_TELEPHONIE") && MAIN_MODULE_TELEPHONIE) require_once(FPDF_PATH . "fpdf.php");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Autres parametres globaux de configurations
|
||||||
|
*/
|
||||||
|
$conf->users->dir_output=DOL_DATA_ROOT."/users";
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Utilise dans tous les upload de fichier
|
||||||
|
* necessaire pour desactiver dans la demo
|
||||||
|
*/
|
||||||
|
if (defined('MAIN_UPLOAD_DOC') && MAIN_UPLOAD_DOC == 1)
|
||||||
|
{
|
||||||
|
$conf->upload = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$conf->upload = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Definition des parametres d'activation de module et dependants des modules
|
||||||
|
* Chargement d'include selon etat activation des modules
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Module bookmark4u
|
||||||
|
$conf->bookmark4u->enabled=defined('MAIN_MODULE_BOOKMARK4U')?MAIN_MODULE_BOOKMARK4U:0;
|
||||||
|
$conf->bookmark->enabled=defined('MAIN_MODULE_BOOKMARK')?MAIN_MODULE_BOOKMARK:0;
|
||||||
|
// Module deplacement
|
||||||
|
$conf->deplacement->enabled=defined("MAIN_MODULE_DEPLACEMENT")?MAIN_MODULE_DEPLACEMENT:0;
|
||||||
|
// Module mailing
|
||||||
|
$conf->mailing->enabled=defined("MAIN_MODULE_MAILING")?MAIN_MODULE_MAILING:0;
|
||||||
|
// Module externalrss
|
||||||
|
$conf->externalrss->enabled=defined("MAIN_MODULE_EXTERNALRSS")?MAIN_MODULE_EXTERNALRSS:0;
|
||||||
|
// Module commande client
|
||||||
|
$conf->commande->enabled=defined("MAIN_MODULE_COMMANDE")?MAIN_MODULE_COMMANDE:0;
|
||||||
|
$conf->commande->dir_output=DOL_DATA_ROOT."/commande";
|
||||||
|
$conf->commande->dir_images=DOL_DATA_ROOT."/commande/images";
|
||||||
|
// Module expeditions
|
||||||
|
$conf->expedition->enabled=defined("MAIN_MODULE_EXPEDITION")?MAIN_MODULE_EXPEDITION:0;
|
||||||
|
$conf->expedition->dir_output=DOL_DATA_ROOT."/expedition";
|
||||||
|
$conf->expedition->dir_images=DOL_DATA_ROOT."/expedition/images";
|
||||||
|
// Module societe
|
||||||
|
$conf->societe->enabled=defined("MAIN_MODULE_SOCIETE")?MAIN_MODULE_SOCIETE:0;
|
||||||
|
$conf->societe->dir_output=DOL_DATA_ROOT."/societe";
|
||||||
|
$conf->societe->dir_images=DOL_DATA_ROOT."/societe/images";
|
||||||
|
if (defined('SOCIETE_OUTPUTDIR') && SOCIETE_OUTPUTDIR) { $conf->societe->dir_output=SOCIETE_OUTPUTDIR; } # Pour passer outre le rep par d?faut
|
||||||
|
// Module commercial
|
||||||
|
$conf->commercial->enabled=defined("MAIN_MODULE_COMMERCIAL")?MAIN_MODULE_COMMERCIAL:0;
|
||||||
|
$conf->commercial->dir_output=DOL_DATA_ROOT."/rapport";
|
||||||
|
// Module comptaexpert
|
||||||
|
$conf->comptaexpert->enabled=defined("MAIN_MODULE_COMPTABILITE_EXPERT")?MAIN_MODULE_COMPTABILITE_EXPERT:0;
|
||||||
|
$conf->comptaexpert->dir_output=DOL_DATA_ROOT."/comptaexpert";
|
||||||
|
$conf->comptaexpert->dir_images=DOL_DATA_ROOT."/comptaexpert/images";
|
||||||
|
// Module compta
|
||||||
|
$conf->compta->enabled=defined("MAIN_MODULE_COMPTABILITE")?MAIN_MODULE_COMPTABILITE:0;
|
||||||
|
$conf->compta->dir_output=DOL_DATA_ROOT."/compta";
|
||||||
|
$conf->compta->dir_images=DOL_DATA_ROOT."/compta/images";
|
||||||
|
// Module banque
|
||||||
|
$conf->banque->enabled=defined("MAIN_MODULE_BANQUE")?MAIN_MODULE_BANQUE:0;
|
||||||
|
$conf->banque->dir_output=DOL_DATA_ROOT."/banque";
|
||||||
|
$conf->banque->dir_images=DOL_DATA_ROOT."/banque/images";
|
||||||
|
// Module don
|
||||||
|
$conf->don->enabled=defined("MAIN_MODULE_DON")?MAIN_MODULE_DON:0;
|
||||||
|
$conf->don->dir_output=DOL_DATA_ROOT."/dons";
|
||||||
|
$conf->don->dir_images=DOL_DATA_ROOT."/dons/images";
|
||||||
|
// Module syslog
|
||||||
|
$conf->syslog->enabled=defined("MAIN_MODULE_SYSLOG")?MAIN_MODULE_SYSLOG:0;
|
||||||
|
// Module fournisseur
|
||||||
|
$conf->fournisseur->enabled=defined("MAIN_MODULE_FOURNISSEUR")?MAIN_MODULE_FOURNISSEUR:0;
|
||||||
|
// Module ficheinter
|
||||||
|
$conf->fichinter->enabled=defined("MAIN_MODULE_FICHEINTER")?MAIN_MODULE_FICHEINTER:0;
|
||||||
|
$conf->fichinter->dir_output=DOL_DATA_ROOT."/ficheinter";
|
||||||
|
$conf->fichinter->dir_images=DOL_DATA_ROOT."/ficheinter/images";
|
||||||
|
if (defined('FICHEINTER_OUTPUTDIR') && FICHEINTER_OUTPUTDIR) { $conf->fichinter->dir_output=FICHEINTER_OUTPUTDIR; } # Pour passer outre le rep par defaut
|
||||||
|
// Module adherent
|
||||||
|
$conf->adherent->enabled=defined("MAIN_MODULE_ADHERENT")?MAIN_MODULE_ADHERENT:0;
|
||||||
|
$conf->adherent->dir_output=DOL_DATA_ROOT."/adherent";
|
||||||
|
// Module produit
|
||||||
|
$conf->produit->enabled=defined("MAIN_MODULE_PRODUIT")?MAIN_MODULE_PRODUIT:0;
|
||||||
|
$conf->produit->dir_output=DOL_DATA_ROOT."/produit";
|
||||||
|
$conf->produit->dir_images=DOL_DATA_ROOT."/produit/images";
|
||||||
|
$conf->produit->MultiPricesEnabled=defined("PRODUIT_MULTIPRICES")?PRODUIT_MULTIPRICES:0;
|
||||||
|
// Module service
|
||||||
|
$conf->service->enabled=defined("MAIN_MODULE_SERVICE")?MAIN_MODULE_SERVICE:0;
|
||||||
|
$conf->service->dir_output=DOL_DATA_ROOT."/produit";
|
||||||
|
$conf->service->dir_images=DOL_DATA_ROOT."/produit/images";
|
||||||
|
// Module stock
|
||||||
|
$conf->stock->enabled=defined("MAIN_MODULE_STOCK")?MAIN_MODULE_STOCK:0;
|
||||||
|
// Module code barre
|
||||||
|
$conf->barcode->enabled=defined("MAIN_MODULE_BARCODE")?MAIN_MODULE_BARCODE:0;
|
||||||
|
// Module categorie
|
||||||
|
$conf->categorie->enabled=defined("MAIN_MODULE_CATEGORIE")?MAIN_MODULE_CATEGORIE:0;
|
||||||
|
// Module contrat
|
||||||
|
$conf->contrat->enabled=defined("MAIN_MODULE_CONTRAT")?MAIN_MODULE_CONTRAT:0;
|
||||||
|
// Module projet
|
||||||
|
$conf->projet->enabled=defined("MAIN_MODULE_PROJET")?MAIN_MODULE_PROJET:0;
|
||||||
|
// Module oscommerce
|
||||||
|
$conf->boutique->enabled=defined("MAIN_MODULE_BOUTIQUE")?MAIN_MODULE_BOUTIQUE:0;
|
||||||
|
$conf->boutique->livre->enabled=defined("BOUTIQUE_LIVRE")?BOUTIQUE_LIVRE:0;
|
||||||
|
$conf->boutique->album->enabled=defined("BOUTIQUE_ALBUM")?BOUTIQUE_ALBUM:0;
|
||||||
|
// Module postnuke
|
||||||
|
$conf->postnuke->enabled=defined("MAIN_MODULE_POSTNUKE")?MAIN_MODULE_POSTNUKE:0;
|
||||||
|
// Module clicktodial
|
||||||
|
$conf->clicktodial->enabled=defined("MAIN_MODULE_CLICKTODIAL")?MAIN_MODULE_CLICKTODIAL:0;
|
||||||
|
// Module prelevement
|
||||||
|
$conf->prelevement->enabled=defined("MAIN_MODULE_PRELEVEMENT")?MAIN_MODULE_PRELEVEMENT:0;
|
||||||
|
$conf->prelevement->dir_output=DOL_DATA_ROOT."/prelevement";
|
||||||
|
$conf->prelevement->dir_images=DOL_DATA_ROOT."/prelevement/images";
|
||||||
|
// Module webcal
|
||||||
|
$conf->webcal->enabled=defined('MAIN_MODULE_WEBCALENDAR')?MAIN_MODULE_WEBCALENDAR:0;
|
||||||
|
$conf->webcal->db->type=defined('PHPWEBCALENDAR_TYPE')?PHPWEBCALENDAR_TYPE:'mysql';
|
||||||
|
$conf->webcal->db->host=defined('PHPWEBCALENDAR_HOST')?PHPWEBCALENDAR_HOST:'';
|
||||||
|
$conf->webcal->db->user=defined('PHPWEBCALENDAR_USER')?PHPWEBCALENDAR_USER:'';
|
||||||
|
$conf->webcal->db->pass=defined('PHPWEBCALENDAR_PASS')?PHPWEBCALENDAR_PASS:'';
|
||||||
|
$conf->webcal->db->name=defined('PHPWEBCALENDAR_DBNAME')?PHPWEBCALENDAR_DBNAME:'';
|
||||||
|
// Module facture
|
||||||
|
$conf->facture->enabled=defined("MAIN_MODULE_FACTURE")?MAIN_MODULE_FACTURE:0;
|
||||||
|
// \todo Ajouter la ligne
|
||||||
|
// require_once(DOL_DOCUMENT_ROOT ."/includes/modules/facture/modules_facture.php");
|
||||||
|
// dans le fichier facturation-emission.php du module telephonie afin de pouvoir supprimer la suivante
|
||||||
|
if (defined("MAIN_MODULE_TELEPHONIE") && MAIN_MODULE_TELEPHONIE) require_once(DOL_DOCUMENT_ROOT ."/includes/modules/facture/modules_facture.php");
|
||||||
|
$conf->facture->dir_output=DOL_DATA_ROOT."/facture";
|
||||||
|
$conf->facture->dir_images=DOL_DATA_ROOT."/facture/images";
|
||||||
|
if (defined('FAC_OUTPUTDIR') && FAC_OUTPUTDIR) { $conf->facture->dir_output=FAC_OUTPUTDIR; } # Pour passer outre le rep par defaut
|
||||||
|
// Module propal
|
||||||
|
$conf->propal->enabled=defined("MAIN_MODULE_PROPALE")?MAIN_MODULE_PROPALE:0;
|
||||||
|
if (! defined("PROPALE_NEW_FORM_NB_PRODUCT")) define("PROPALE_NEW_FORM_NB_PRODUCT", 4);
|
||||||
|
$conf->propal->dir_output=DOL_DATA_ROOT."/propale";
|
||||||
|
$conf->propal->dir_images=DOL_DATA_ROOT."/propale/images";
|
||||||
|
if (defined('PROPALE_OUTPUTDIR') && PROPALE_OUTPUTDIR) { $conf->propal->dir_output=PROPALE_OUTPUTDIR; } # Pour passer outre le rep par defaut
|
||||||
|
// Module telephonie
|
||||||
|
$conf->telephonie->enabled=defined("MAIN_MODULE_TELEPHONIE")?MAIN_MODULE_TELEPHONIE:0;
|
||||||
|
$conf->telephonie->dir_output=DOL_DATA_ROOT."/telephonie";
|
||||||
|
$conf->telephonie->dir_images=DOL_DATA_ROOT."/telephonie/images";
|
||||||
|
// Module energie
|
||||||
|
$conf->energie->enabled=defined("MAIN_MODULE_ENERGIE")?MAIN_MODULE_ENERGIE:0;
|
||||||
|
// Module domaine
|
||||||
|
$conf->domaine->enabled=0;
|
||||||
|
// Module voyage
|
||||||
|
$conf->voyage->enabled=0;
|
||||||
|
// Module actionscomm
|
||||||
|
$conf->actionscomm->dir_output=DOL_DATA_ROOT."/action";
|
||||||
|
// Module export
|
||||||
|
$conf->export->enabled=defined("MAIN_MODULE_EXPORT")?MAIN_MODULE_EXPORT:0;
|
||||||
|
$conf->export->dir_ouput=DOL_DATA_ROOT."/export";
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Modification de quelques variable de conf en fonction des Constantes
|
||||||
|
*/
|
||||||
|
|
||||||
|
// conf->use_preview_tabs
|
||||||
|
$conf->use_preview_tabs=1;
|
||||||
|
if (isset($conf->global->MAIN_USE_PREVIEW_TABS)) $conf->use_preview_tabs=$conf->global->MAIN_USE_PREVIEW_TABS;
|
||||||
|
|
||||||
|
// conf->use_javascript
|
||||||
|
$conf->use_javascript=1;
|
||||||
|
if (isset($conf->global->MAIN_DISABLE_JAVASCRIPT)) $conf->use_javascript=! $conf->global->MAIN_DISABLE_JAVASCRIPT;
|
||||||
|
|
||||||
|
// conf->monnaie
|
||||||
|
if (! $conf->global->MAIN_MONNAIE) $conf->global->MAIN_MONNAIE='EUR';
|
||||||
|
$conf->monnaie=$conf->global->MAIN_MONNAIE;
|
||||||
|
|
||||||
|
// $conf->compta->mode = Option du module Compta: Defini le mode de calcul des etats comptables (CA,...)
|
||||||
|
$conf->compta->mode = 'RECETTES-DEPENSES'; // Par d?faut
|
||||||
|
if (defined('COMPTA_MODE') && COMPTA_MODE) {
|
||||||
|
// Peut etre 'RECETTES-DEPENSES' ou 'CREANCES-DETTES'
|
||||||
|
$conf->compta->mode = COMPTA_MODE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// $conf->defaulttx
|
||||||
|
if (defined('FACTURE_TVAOPTION') && FACTURE_TVAOPTION == 'franchise') {
|
||||||
|
$conf->defaulttx='0'; // Taux par d?faut des factures clients
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$conf->defaulttx=''; // Pas de taux par d?faut des factures clients, le premier sera pris
|
||||||
|
}
|
||||||
|
|
||||||
|
// $conf->liste_limit = constante de taille maximale des listes
|
||||||
|
if (! $conf->global->SIZE_LISTE_LIMIT) $conf->global->SIZE_LISTE_LIMIT=20;
|
||||||
|
$conf->liste_limit=$conf->global->SIZE_LISTE_LIMIT;
|
||||||
|
|
||||||
|
// $conf->produit->limit_size = constante de taille maximale des select de produit
|
||||||
|
if (! isset($conf->global->PRODUIT_LIMIT_SIZE)) $conf->global->PRODUIT_LIMIT_SIZE=50;
|
||||||
|
$conf->produit->limit_size=$conf->global->PRODUIT_LIMIT_SIZE;
|
||||||
|
|
||||||
|
// $conf->theme et $conf->css
|
||||||
|
if (! $conf->global->MAIN_THEME) $conf->global->MAIN_THEME="eldy";
|
||||||
|
$conf->theme=$conf->global->MAIN_THEME;
|
||||||
|
$conf->css = "theme/".$conf->theme."/".$conf->theme.".css";
|
||||||
|
|
||||||
|
// $conf->email_from = email pour envoi par Dolibarr des mails auto (notifications, ...)
|
||||||
|
// $conf->mailing->email_from = email pour envoi par Dolibarr des mailings
|
||||||
|
$conf->email_from="dolibarr-robot@domain.com";
|
||||||
|
if (defined('MAIN_EMAIL_FROM'))
|
||||||
|
{
|
||||||
|
$conf->email_from=MAIN_EMAIL_FROM;
|
||||||
|
}
|
||||||
|
if (defined('MAILING_EMAIL_FROM'))
|
||||||
|
{
|
||||||
|
$conf->mailing->email_from=MAILING_EMAIL_FROM;
|
||||||
|
}
|
||||||
|
else $conf->mailing->email_from=$conf->email_from;
|
||||||
|
|
||||||
|
// $conf->adherent->email_resil, ...
|
||||||
|
if (defined("MAIN_MAIL_RESIL"))
|
||||||
|
{
|
||||||
|
$conf->adherent->email_resil=MAIN_MAIL_RESIL;
|
||||||
|
}
|
||||||
|
if (defined("MAIN_MAIL_RESIL_SUBJECT"))
|
||||||
|
{
|
||||||
|
$conf->adherent->email_resil_subject=MAIN_MAIL_RESIL_SUBJECT;
|
||||||
|
}
|
||||||
|
if (defined("MAIN_MAIL_VALID"))
|
||||||
|
{
|
||||||
|
$conf->adherent->email_valid=MAIN_MAIL_VALID;
|
||||||
|
}
|
||||||
|
if (defined("MAIN_MAIL_VALID_SUBJECT"))
|
||||||
|
{
|
||||||
|
$conf->adherent->email_valid_subject=MAIN_MAIL_VALID_SUBJECT;
|
||||||
|
}
|
||||||
|
if (defined("MAIN_MAIL_EDIT"))
|
||||||
|
{
|
||||||
|
$conf->adherent->email_edit=MAIN_MAIL_EDIT;
|
||||||
|
}
|
||||||
|
if (defined("MAIN_MAIL_EDIT_SUBJECT"))
|
||||||
|
{
|
||||||
|
$conf->adherent->email_edit_subject=MAIN_MAIL_EDIT_SUBJECT;
|
||||||
|
}
|
||||||
|
if (defined("MAIN_MAIL_NEW"))
|
||||||
|
{
|
||||||
|
$conf->adherent->email_new=MAIN_MAIL_NEW;
|
||||||
|
}
|
||||||
|
if (defined("MAIN_MAIL_NEW_SUBJECT"))
|
||||||
|
{
|
||||||
|
$conf->adherent->email_new_subject=MAIN_MAIL_NEW_SUBJECT;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Format de la date
|
||||||
|
// \todo Mettre format dans fichier langue
|
||||||
|
$conf->format_date_text_short="%d %b %Y";
|
||||||
|
$conf->format_date_short="%d/%m/%Y";
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Creation objet mysoc
|
||||||
|
* Objet Societe qui contient carac de l'institution g<EFBFBD><EFBFBD> par Dolibarr.
|
||||||
|
*/
|
||||||
|
require_once(DOL_DOCUMENT_ROOT ."/societe.class.php");
|
||||||
|
$mysoc=new Societe($db);
|
||||||
|
$mysoc->id=0;
|
||||||
|
$mysoc->nom=$conf->global->MAIN_INFO_SOCIETE_NOM;
|
||||||
|
$mysoc->adresse=$conf->global->MAIN_INFO_SOCIETE_ADRESSE;
|
||||||
|
$mysoc->cp=$conf->global->MAIN_INFO_SOCIETE_CP;
|
||||||
|
$mysoc->ville=$conf->global->MAIN_INFO_SOCIETE_VILLE;
|
||||||
|
$mysoc->pays_code=$conf->global->MAIN_INFO_SOCIETE_PAYS;
|
||||||
|
$mysoc->tel=$conf->global->MAIN_INFO_SOCIETE_TEL;
|
||||||
|
$mysoc->fax=$conf->global->MAIN_INFO_SOCIETE_FAX;
|
||||||
|
$mysoc->url=$conf->global->MAIN_INFO_SOCIETE_WEB;
|
||||||
|
$mysoc->siren=$conf->global->MAIN_INFO_SIREN;
|
||||||
|
$mysoc->siret=$conf->global->MAIN_INFO_SIRET;
|
||||||
|
$mysoc->ape=$conf->global->MAIN_INFO_APE;
|
||||||
|
$mysoc->rcs=$conf->global->MAIN_INFO_RCS;
|
||||||
|
$mysoc->tvaintra=$conf->global->MAIN_INFO_TVAINTRA;
|
||||||
|
$mysoc->capital=$conf->global->MAIN_INFO_CAPITAL;
|
||||||
|
$mysoc->forme_juridique_code=$conf->global->MAIN_INFO_FORME_JURIDIQUE;
|
||||||
|
$mysoc->email=$conf->global->MAIN_INFO_SOCIETE_MAIL;
|
||||||
|
|
||||||
|
|
||||||
|
/* \todo Ajouter une option Gestion de la TVA dans le module compta qui permet de d?sactiver la fonction TVA
|
||||||
|
* (pour particuliers ou lib?raux en franchise)
|
||||||
|
* En attendant, valeur forc?e ? 1
|
||||||
|
*/
|
||||||
|
$conf->compta->tva=1;
|
||||||
|
|
||||||
|
// Delais de tolerance des alertes
|
||||||
|
$conf->actions->warning_delay=$conf->global->MAIN_DELAY_ACTIONS_TODO*24*60*60;
|
||||||
|
$conf->commande->traitement->warning_delay=$conf->global->MAIN_DELAY_ORDERS_TO_PROCESS*24*60*60;
|
||||||
|
$conf->propal->cloture->warning_delay=$conf->global->MAIN_DELAY_PROPALS_TO_CLOSE*24*60*60;
|
||||||
|
$conf->propal->facturation->warning_delay=$conf->global->MAIN_DELAY_PROPALS_TO_BILL*24*60*60;
|
||||||
|
$conf->facture->fournisseur->warning_delay=$conf->global->MAIN_DELAY_SUPPLIER_BILLS_TO_PAY*24*60*60;
|
||||||
|
$conf->facture->client->warning_delay=$conf->global->MAIN_DELAY_CUSTOMER_BILLS_UNPAYED*24*60*60;
|
||||||
|
$conf->contrat->services->inactifs->warning_delay=$conf->global->MAIN_DELAY_NOT_ACTIVATED_SERVICES*24*60*60;
|
||||||
|
$conf->contrat->services->expires->warning_delay=$conf->global->MAIN_DELAY_RUNNING_SERVICES*24*60*60;
|
||||||
|
$conf->adherent->cotisation->warning_delay=$conf->global->MAIN_DELAY_MEMBERS*24*60*60;
|
||||||
|
$conf->bank->rappro->warning_delay=$conf->global->MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE*24*60*60;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
*/
|
||||||
|
$bc[0]="class=\"impair\"";
|
||||||
|
$bc[1]="class=\"pair\"";
|
||||||
|
$yesno[0]="no";
|
||||||
|
$yesno[1]="yes";
|
||||||
|
|
||||||
|
if ( ! defined('MENTION_NPR') ) define('MENTION_NPR','(npr)');
|
||||||
|
?>
|
||||||
|
<?PHP
|
||||||
|
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
|
* Copyright (C) 2003 Xavier Dutoit <doli@sydesy.com>
|
||||||
|
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||||
|
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||||
|
* Copyright (C) 2005 Regis Houssin <regis.houssin@cap-networks.com>
|
||||||
|
* Copyright (C) 2005 Simon Tosser <simon@kornog-computing.com>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
* $Source$
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
\file htdocs/master.inc.php
|
||||||
|
\brief Fichier de preparation de l'environnement Dolibarr
|
||||||
|
\version $Revision$
|
||||||
|
*/
|
||||||
|
|
||||||
|
define('DOL_VERSION','2.1-alpha');
|
||||||
|
|
||||||
|
// La fonction clearstatcache ne doit pas etre appel<65>de mani<6E>e globale car ralenti.
|
||||||
|
// Elle doit etre appel<65> uniquement par les pages qui ont besoin d'un cache fichier vid<69>
|
||||||
|
// comme par exemple document.php
|
||||||
|
//clearstatcache();
|
||||||
|
|
||||||
|
// Forcage du parametrage PHP error_reporting (Dolibarr non utilisable en mode error E_ALL)
|
||||||
|
if (function_exists("define_syslog_variables"))
|
||||||
|
{
|
||||||
|
define_syslog_variables();
|
||||||
|
}
|
||||||
|
//error_reporting(E_ALL);
|
||||||
|
error_reporting(E_ALL ^ E_NOTICE);
|
||||||
|
|
||||||
|
// Test si install ok
|
||||||
|
if (! @include_once("conf/conf.php"))
|
||||||
|
{
|
||||||
|
Header("Location: install/index.php");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (! isset($dolibarr_main_db_host))
|
||||||
|
{
|
||||||
|
Header("Location: install/index.php");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! isset($dolibarr_main_db_type))
|
||||||
|
{
|
||||||
|
$dolibarr_main_db_type='mysql'; // Pour compatibilite avec anciennes configs, si non defini, on prend 'mysql'
|
||||||
|
}
|
||||||
|
if (! $dolibarr_main_data_root) {
|
||||||
|
// Si repertoire documents non defini, on utilise celui par defaut
|
||||||
|
$dolibarr_main_data_root=ereg_replace("/htdocs","",$dolibarr_main_document_root);
|
||||||
|
$dolibarr_main_data_root.="/documents";
|
||||||
|
}
|
||||||
|
define('DOL_DOCUMENT_ROOT', $dolibarr_main_document_root);
|
||||||
|
define('DOL_DATA_ROOT', $dolibarr_main_data_root);
|
||||||
|
|
||||||
|
$uri=eregi_replace('^http(s?)://','',$dolibarr_main_url_root);
|
||||||
|
$pos = strstr ($uri, '/'); // $pos contient alors url sans nom domaine
|
||||||
|
if ($pos == '/') $pos = ''; // si $pos vaut /, on le met a ''
|
||||||
|
define('DOL_URL_ROOT', $pos);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Initialisation de l'objet $conf
|
||||||
|
*/
|
||||||
|
require_once(DOL_DOCUMENT_ROOT."/conf/conf.class.php");
|
||||||
|
$conf = new Conf();
|
||||||
|
$conf->db->host = $dolibarr_main_db_host;
|
||||||
|
$conf->db->name = $dolibarr_main_db_name;
|
||||||
|
$conf->db->user = $dolibarr_main_db_user;
|
||||||
|
$conf->db->pass = $dolibarr_main_db_pass;
|
||||||
|
$conf->db->type = $dolibarr_main_db_type;
|
||||||
|
if (! $conf->db->type) { $conf->db->type = 'mysql'; } // Pour compatibilite avec anciennes configs, si non defini, on prend 'mysql'
|
||||||
|
// Defini prefix
|
||||||
|
if (isset($_SERVER["LLX_DBNAME"])) $dolibarr_main_db_prefix=$_SERVER["LLX_DBNAME"];
|
||||||
|
if (! isset($dolibarr_main_db_prefix) || ! $dolibarr_main_db_prefix) $dolibarr_main_db_prefix='llx_';
|
||||||
|
$conf->db->prefix = $dolibarr_main_db_prefix;
|
||||||
|
define('MAIN_DB_PREFIX',$dolibarr_main_db_prefix);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Chargement des includes principaux
|
||||||
|
*/
|
||||||
|
require_once(DOL_DOCUMENT_ROOT ."/lib/".$conf->db->type.".lib.php");
|
||||||
|
require_once(DOL_DOCUMENT_ROOT ."/lib/functions.inc.php");
|
||||||
|
require_once(DOL_DOCUMENT_ROOT ."/user.class.php");
|
||||||
|
require_once(DOL_DOCUMENT_ROOT ."/menu.class.php");
|
||||||
|
require_once(DOL_DOCUMENT_ROOT ."/html.form.class.php");
|
||||||
|
|
||||||
|
|
||||||
|
$db = new DoliDb($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name);
|
||||||
|
if (! $db->connected) {
|
||||||
|
dolibarr_print_error($db,"host=".$conf->db->host.", user=".$conf->db->user.", databasename=".$conf->db->name.", ".$db->error);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$user = new User($db);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Definition de toutes les Constantes globales d'environnement
|
||||||
|
* - En constante php (\todo a virer)
|
||||||
|
* - En $conf->global->key=value
|
||||||
|
*/
|
||||||
|
$sql = "SELECT name, value FROM ".MAIN_DB_PREFIX."const";
|
||||||
|
$result = $db->query($sql);
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
|
$numr = $db->num_rows($result);
|
||||||
|
$i = 0;
|
||||||
|
|
||||||
|
while ($i < $numr)
|
||||||
|
{
|
||||||
|
$objp = $db->fetch_object($result);
|
||||||
|
$key=$objp->name;
|
||||||
|
$value=$objp->value; // Pas de stripslashes (ne s'applique pas sur lecture base mais apr<70> POST quand get_magic_quotes_gpc()==1)
|
||||||
define ("$key", $value);
|
define ("$key", $value);
|
||||||
$conf->global->$key=$value;
|
$conf->global->$key=$value;
|
||||||
$i++;
|
$i++;
|
||||||
@ -427,7 +909,7 @@ $conf->format_date_short="%d/%m/%Y";
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Creation objet mysoc
|
* Creation objet mysoc
|
||||||
* Objet Societe qui contient carac de l'institution gérée par Dolibarr.
|
* Objet Societe qui contient carac de l'institution g<EFBFBD><EFBFBD> par Dolibarr.
|
||||||
*/
|
*/
|
||||||
require_once(DOL_DOCUMENT_ROOT ."/societe.class.php");
|
require_once(DOL_DOCUMENT_ROOT ."/societe.class.php");
|
||||||
$mysoc=new Societe($db);
|
$mysoc=new Societe($db);
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2005 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
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
@ -42,6 +42,7 @@ class Product
|
|||||||
var $libelle;
|
var $libelle;
|
||||||
var $description;
|
var $description;
|
||||||
var $price;
|
var $price;
|
||||||
|
var $multiprices=array();
|
||||||
var $tva_tx;
|
var $tva_tx;
|
||||||
var $type;
|
var $type;
|
||||||
var $seuil_stock_alerte;
|
var $seuil_stock_alerte;
|
||||||
@ -248,30 +249,89 @@ class Product
|
|||||||
*/
|
*/
|
||||||
function _log_price($user)
|
function _log_price($user)
|
||||||
{
|
{
|
||||||
// On supprimme ligne existante au cas ou
|
// MultiPrix : si activé, on gère tout ici, même le prix standard
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."product_price ";
|
global $conf;
|
||||||
$sql .= "WHERE date_price = now()";
|
if($conf->global->PRODUIT_MULTIPRICES == 1)
|
||||||
$sql .= " and fk_product = ".$this->id;
|
{
|
||||||
$sql .= " and fk_user_author = ".$user->id;
|
$queryError = false;
|
||||||
$sql .= " and price = ".ereg_replace(",",".",$this->price);
|
for($i=2;$i<=$conf->global->PRODUIT_MULTIPRICES_LIMIT;$i++)
|
||||||
$sql .= " and envente = ".$this->envente;
|
{
|
||||||
$sql .= " and tva_tx = ".$this->tva_tx;
|
if($this->multiprices["$i"] != "")
|
||||||
|
{
|
||||||
|
// On supprimme ligne existante au cas ou
|
||||||
|
$sql_multiprix = "DELETE FROM ".MAIN_DB_PREFIX."product_price ";
|
||||||
|
$sql_multiprix .= "WHERE date_price = now()";
|
||||||
|
$sql_multiprix .= " and fk_product = ".$this->id;
|
||||||
|
$sql_multiprix .= " and fk_user_author = ".$user->id;
|
||||||
|
$sql_multiprix .= " and price = ".ereg_replace(",",".",$this->multiprices["$i"]);
|
||||||
|
|
||||||
$this->db->query($sql);
|
$this->db->query($sql_multiprix);
|
||||||
|
|
||||||
|
// On ajoute nouveau tarif
|
||||||
|
$sql_multiprix = "INSERT INTO ".MAIN_DB_PREFIX."product_price(date_price,fk_product,fk_user_author,price_level,price) ";
|
||||||
|
$sql_multiprix .= " VALUES(now(),".$this->id.",".$user->id.",".$i.",".ereg_replace(",",".",$this->multiprices["$i"]);
|
||||||
|
$sql_multiprix .= ")";
|
||||||
|
if (! $this->db->query($sql_multiprix) )
|
||||||
|
$queryError = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (strlen(trim($this->price)) > 0 )
|
||||||
|
{
|
||||||
|
// On supprimme ligne existante au cas ou
|
||||||
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."product_price ";
|
||||||
|
$sql .= "WHERE date_price = now()";
|
||||||
|
$sql .= " and fk_product = ".$this->id;
|
||||||
|
$sql .= " and fk_user_author = ".$user->id;
|
||||||
|
$sql .= " and price = ".ereg_replace(",",".",$this->price);
|
||||||
|
$sql .= " and envente = ".$this->envente;
|
||||||
|
$sql .= " and tva_tx = ".$this->tva_tx;
|
||||||
|
|
||||||
|
$this->db->query($sql);
|
||||||
|
|
||||||
|
// On ajoute nouveau tarif
|
||||||
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."product_price(date_price,fk_product,fk_user_author,price,envente,tva_tx) ";
|
||||||
|
$sql .= " VALUES(now(),".$this->id.",".$user->id.",".ereg_replace(",",".",$this->price).",".$this->envente.",".$this->tva_tx;
|
||||||
|
$sql .= ")";
|
||||||
|
if (! $this->db->query($sql) )
|
||||||
|
$queryError = true;
|
||||||
|
}
|
||||||
|
if($queryError)
|
||||||
|
{
|
||||||
|
dolibarr_print_error($this->db);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// On supprimme ligne existante au cas ou
|
||||||
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."product_price ";
|
||||||
|
$sql .= "WHERE date_price = now()";
|
||||||
|
$sql .= " and fk_product = ".$this->id;
|
||||||
|
$sql .= " and fk_user_author = ".$user->id;
|
||||||
|
$sql .= " and price = ".ereg_replace(",",".",$this->price);
|
||||||
|
$sql .= " and envente = ".$this->envente;
|
||||||
|
$sql .= " and tva_tx = ".$this->tva_tx;
|
||||||
|
|
||||||
|
$this->db->query($sql);
|
||||||
|
|
||||||
|
// On ajoute nouveau tarif
|
||||||
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."product_price(date_price,fk_product,fk_user_author,price,envente,tva_tx) ";
|
||||||
|
$sql .= " VALUES(now(),".$this->id.",".$user->id.",".ereg_replace(",",".",$this->price).",".$this->envente.",".$this->tva_tx;
|
||||||
|
$sql .= ")";
|
||||||
|
|
||||||
|
if ($this->db->query($sql) )
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dolibarr_print_error($this->db);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// On ajoute nouveau tarif
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."product_price(date_price,fk_product,fk_user_author,price,envente,tva_tx) ";
|
|
||||||
$sql .= " VALUES(now(),".$this->id.",".$user->id.",".ereg_replace(",",".",$this->price).",".$this->envente.",".$this->tva_tx;
|
|
||||||
$sql .= ")";
|
|
||||||
if ($this->db->query($sql) )
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dolibarr_print_error($this->db);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -396,29 +456,67 @@ class Product
|
|||||||
*/
|
*/
|
||||||
function update_price($id, $user)
|
function update_price($id, $user)
|
||||||
{
|
{
|
||||||
if (strlen(trim($this->price)) > 0 )
|
//multiprix
|
||||||
{
|
global $conf;
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."product ";
|
if($conf->global->PRODUIT_MULTIPRICES == 1)
|
||||||
$sql .= " SET price = " . ereg_replace(",",".",$this->price);
|
{
|
||||||
$sql .= " WHERE rowid = " . $id;
|
if (strlen(trim($this->price)) > 0 )
|
||||||
|
{
|
||||||
|
$sql = "UPDATE ".MAIN_DB_PREFIX."product ";
|
||||||
|
$sql .= " SET price = " . ereg_replace(",",".",$this->price);
|
||||||
|
$sql .= " WHERE rowid = " . $id;
|
||||||
|
|
||||||
if ( $this->db->query($sql) )
|
if ( $this->db->query($sql) )
|
||||||
{
|
{
|
||||||
$this->_log_price($user);
|
$this->_log_price($user);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dolibarr_print_error($this->db);
|
dolibarr_print_error($this->db);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else if(count($this->multiprices) > 0)
|
||||||
{
|
{
|
||||||
$this->error = "Prix saisi invalide.";
|
$this->_log_price($user);
|
||||||
return -2;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
|
$this->error = "Prix saisi invalide.";
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (strlen(trim($this->price)) > 0 )
|
||||||
|
{
|
||||||
|
$sql = "UPDATE ".MAIN_DB_PREFIX."product ";
|
||||||
|
$sql .= " SET price = " . ereg_replace(",",".",$this->price);
|
||||||
|
$sql .= " WHERE rowid = " . $id;
|
||||||
|
|
||||||
|
if ( $this->db->query($sql) )
|
||||||
|
{
|
||||||
|
$this->_log_price($user);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dolibarr_print_error($this->db);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->error = "Prix saisi invalide.";
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -430,6 +528,7 @@ class Product
|
|||||||
function fetch($id='',$ref='')
|
function fetch($id='',$ref='')
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
global $conf;
|
||||||
|
|
||||||
// Verification parametres
|
// Verification parametres
|
||||||
if (! $id && ! $ref)
|
if (! $id && ! $ref)
|
||||||
@ -479,6 +578,49 @@ class Product
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->db->free();
|
$this->db->free();
|
||||||
|
// multiprix
|
||||||
|
if($conf->global->PRODUIT_MULTIPRICES == 1)
|
||||||
|
{
|
||||||
|
if ($ref)
|
||||||
|
{
|
||||||
|
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."product ";
|
||||||
|
$sql.= "WHERE ref = '".addslashes($ref)."'";
|
||||||
|
$result = $this->db->query($sql) ;
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
|
$result = $this->db->fetch_array();
|
||||||
|
$prodid = $result["rowid"];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dolibarr_print_error($this->db);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for($i=2;$i<=$conf->global->PRODUIT_MULTIPRICES_LIMIT;$i++)
|
||||||
|
{
|
||||||
|
$sql= "SELECT price, tva_tx, envente ";
|
||||||
|
$sql.= "FROM ".MAIN_DB_PREFIX."product_price ";
|
||||||
|
$sql.= "where price_level=".$i." and ";
|
||||||
|
if ($id) $sql.= "fk_product = ".$id." ";
|
||||||
|
if ($ref) $sql.= "fk_product = ".$prodid." ";
|
||||||
|
$sql.= "order by date_price DESC limit 1";
|
||||||
|
$result = $this->db->query($sql) ;
|
||||||
|
if ( $result )
|
||||||
|
{
|
||||||
|
$result = $this->db->fetch_array();
|
||||||
|
if($result["price"] != "")
|
||||||
|
$this -> multiprices[$i]=$result["price"];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dolibarr_print_error($this->db);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$sql = "SELECT reel, fk_entrepot";
|
$sql = "SELECT reel, fk_entrepot";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."product_stock WHERE fk_product = ".$this->id;
|
$sql .= " FROM ".MAIN_DB_PREFIX."product_stock WHERE fk_product = ".$this->id;
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
|
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
|
||||||
* Copyright (C) 2005 Régis Houssin <regis.houssin@cap-networks.com>
|
* Copyright (C) 2005 Régis Houssin <regis.houssin@cap-networks.com>
|
||||||
|
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -74,7 +75,17 @@ if ($_POST["action"] == 'add' && $user->rights->produit->creer)
|
|||||||
$product->duration_value = $_POST["duration_value"];
|
$product->duration_value = $_POST["duration_value"];
|
||||||
$product->duration_unit = $_POST["duration_unit"];
|
$product->duration_unit = $_POST["duration_unit"];
|
||||||
$product->seuil_stock_alerte = $_POST["seuil_stock_alerte"];
|
$product->seuil_stock_alerte = $_POST["seuil_stock_alerte"];
|
||||||
|
// MultiPrix
|
||||||
|
if($conf->global->PRODUIT_MULTIPRICES == 1)
|
||||||
|
{
|
||||||
|
for($i=2;$i<=$conf->global->PRODUIT_MULTIPRICES_LIMIT;$i++)
|
||||||
|
{
|
||||||
|
if($_POST["price_".$i])
|
||||||
|
$product->multiprices["$i"]=ereg_replace(" ","",$_POST["price_".$i]);
|
||||||
|
else
|
||||||
|
$product->multiprices["$i"] = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
$e_product = $product;
|
$e_product = $product;
|
||||||
|
|
||||||
$id = $product->create($user);
|
$id = $product->create($user);
|
||||||
@ -286,8 +297,18 @@ if ($_GET["action"] == 'create' && $user->rights->produit->creer)
|
|||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
print '<tr><td>'.$langs->trans("Label").'</td><td><input name="libelle" size="40" value="'.$product->libelle.'"></td></tr>';
|
print '<tr><td>'.$langs->trans("Label").'</td><td><input name="libelle" size="40" value="'.$product->libelle.'"></td></tr>';
|
||||||
print '<tr><td>'.$langs->trans("SellingPrice").'</td><td><input name="price" size="10" value="'.$product->price.'"></td></tr>';
|
|
||||||
|
|
||||||
|
if($conf->global->PRODUIT_MULTIPRICES == 1)
|
||||||
|
{
|
||||||
|
print '<tr><td>'.$langs->trans("SellingPrice").' 1</td><td><input name="price" size="10" value="'.$product->price.'"></td></tr>';
|
||||||
|
for($i=2;$i<=$conf->global->PRODUIT_MULTIPRICES_LIMIT;$i++)
|
||||||
|
{
|
||||||
|
print '<tr><td>'.$langs->trans("SellingPrice").' '.$i.'</td><td><input name="price_'.$i.'" size="10" value="'.$product->multiprices["$i"].'"></td>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// PRIX
|
||||||
|
else
|
||||||
|
print '<tr><td>'.$langs->trans("SellingPrice").'</td><td><input name="price" size="10" value="'.$product->price.'"></td></tr>';
|
||||||
$langs->load("bills");
|
$langs->load("bills");
|
||||||
print '<tr><td>'.$langs->trans("VATRate").'</td><td>';
|
print '<tr><td>'.$langs->trans("VATRate").'</td><td>';
|
||||||
print $html->select_tva("tva_tx",$conf->defaulttx,$mysoc,'');
|
print $html->select_tva("tva_tx",$conf->defaulttx,$mysoc,'');
|
||||||
@ -461,9 +482,23 @@ if ($_GET["id"] || $_GET["ref"])
|
|||||||
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$product->libelle.'</td>';
|
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$product->libelle.'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Prix
|
// MultiPrix
|
||||||
print '<tr><td>'.$langs->trans("SellingPrice").'</td><td>'.price($product->price).'</td>';
|
if($conf->global->PRODUIT_MULTIPRICES == 1)
|
||||||
print '</tr>';
|
{
|
||||||
|
print '<tr><td>'.$langs->trans("SellingPrice").' 1</td><td>'.price($product->price).'</td>';
|
||||||
|
print '</tr>';
|
||||||
|
for($i=2;$i<=$conf->global->PRODUIT_MULTIPRICES_LIMIT;$i++)
|
||||||
|
{
|
||||||
|
print '<tr><td>'.$langs->trans("SellingPrice").' '.$i.'</td><td>'.price($product->multiprices["$i"]).'</td>';
|
||||||
|
print '</tr>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Prix
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<tr><td>'.$langs->trans("SellingPrice").'</td><td>'.price($product->price).'</td>';
|
||||||
|
print '</tr>';
|
||||||
|
}
|
||||||
|
|
||||||
// Statut
|
// Statut
|
||||||
print '<tr><td>'.$langs->trans("Status").'</td><td>';
|
print '<tr><td>'.$langs->trans("Status").'</td><td>';
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
|
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
|
||||||
* Copyright (C) 2005 Regis Houssin <regis.houssin@cap-networks.com>
|
* Copyright (C) 2005 Regis Houssin <regis.houssin@cap-networks.com>
|
||||||
|
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -57,9 +58,19 @@ if ($_POST["action"] == 'update_price' &&
|
|||||||
$result = $product->fetch($_GET["id"]);
|
$result = $product->fetch($_GET["id"]);
|
||||||
|
|
||||||
$product->price = ereg_replace(" ","",$_POST["price"]);
|
$product->price = ereg_replace(" ","",$_POST["price"]);
|
||||||
|
// MultiPrix
|
||||||
|
if($conf->global->PRODUIT_MULTIPRICES == 1)
|
||||||
|
{
|
||||||
|
for($i=2;$i<=$conf->global->PRODUIT_MULTIPRICES_LIMIT;$i++)
|
||||||
|
{
|
||||||
|
if($_POST["price_".$i])
|
||||||
|
$product->multiprices["$i"]=ereg_replace(" ","",$_POST["price_".$i]);
|
||||||
|
else
|
||||||
|
$product->multiprices["$i"] = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( $product->update_price($product->id, $user) > 0 )
|
if ( $product->update_price($product->id, $user) > 0 )
|
||||||
|
|
||||||
{
|
{
|
||||||
$_GET["action"] = '';
|
$_GET["action"] = '';
|
||||||
$mesg = 'Fiche mise à jour';
|
$mesg = 'Fiche mise à jour';
|
||||||
@ -168,9 +179,20 @@ print '</tr>';
|
|||||||
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="2">'.$product->libelle.'</td>';
|
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="2">'.$product->libelle.'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Prix
|
|
||||||
print '<tr><td>'.$langs->trans("SellingPrice").'</td><td colspan="2">'.price($product->price).'</td></tr>';
|
|
||||||
|
|
||||||
|
// MultiPrix
|
||||||
|
if($conf->global->PRODUIT_MULTIPRICES == 1)
|
||||||
|
{
|
||||||
|
print '<tr><td>'.$langs->trans("SellingPrice").' 1</td><td colspan="2">'.price($product->price).'</td></tr>';
|
||||||
|
for($i=2;$i<=$conf->global->PRODUIT_MULTIPRICES_LIMIT;$i++)
|
||||||
|
{
|
||||||
|
print '<tr><td>'.$langs->trans("SellingPrice").' '.$i.'</td><td>'.price($product->multiprices["$i"]).'</td>';
|
||||||
|
print '</tr>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Prix
|
||||||
|
else
|
||||||
|
print '<tr><td>'.$langs->trans("SellingPrice").'</td><td colspan="2">'.price($product->price).'</td></tr>';
|
||||||
// Statut
|
// Statut
|
||||||
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="2">';
|
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="2">';
|
||||||
if ($product->envente) print $langs->trans("OnSell");
|
if ($product->envente) print $langs->trans("OnSell");
|
||||||
@ -213,20 +235,59 @@ if ($_GET["action"] == 'edit_price' && $user->rights->produit->creer)
|
|||||||
print '<input type="hidden" name="action" value="update_price">';
|
print '<input type="hidden" name="action" value="update_price">';
|
||||||
print '<input type="hidden" name="id" value="'.$product->id.'">';
|
print '<input type="hidden" name="id" value="'.$product->id.'">';
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
if($conf->global->PRODUIT_MULTIPRICES == 1)
|
||||||
|
print '<tr><td width="15%">'.$langs->trans('SellingPrice').' 1</td><td><input name="price" size="10" value="'.price($product->price).'"></td></tr>';
|
||||||
|
else
|
||||||
print '<tr><td width="15%">'.$langs->trans('SellingPrice').'</td><td><input name="price" size="10" value="'.price($product->price).'"></td></tr>';
|
print '<tr><td width="15%">'.$langs->trans('SellingPrice').'</td><td><input name="price" size="10" value="'.price($product->price).'"></td></tr>';
|
||||||
print '<tr><td colspan="2" align="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"> ';
|
print '<tr><td colspan="2" align="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"> ';
|
||||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></td></tr>';
|
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></td></tr>';
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
// MultiPrix
|
||||||
|
if($conf->global->PRODUIT_MULTIPRICES == 1)
|
||||||
|
{
|
||||||
|
for($i=2;$i<=$conf->global->PRODUIT_MULTIPRICES_LIMIT;$i++)
|
||||||
|
{
|
||||||
|
print '<form action="price.php?id='.$product->id.'" method="post">';
|
||||||
|
print '<input type="hidden" name="action" value="update_price">';
|
||||||
|
print '<input type="hidden" name="id" value="'.$product->id.'">';
|
||||||
|
print '<table class="border" width="100%">';
|
||||||
|
print '<tr><td width="15%">'.$langs->trans("SellingPrice").' '.$i.'</td><td><input name="price_'.$i.'" size="10" value="'.price($product->multiprices["$i"]).'"></td>';
|
||||||
|
print '</tr>';
|
||||||
|
print '<tr><td colspan="2" align="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"> ';
|
||||||
|
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></td></tr>';
|
||||||
|
print '</table>';
|
||||||
|
print '</form>';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Liste des evolutions du prix
|
// Liste des evolutions du prix
|
||||||
$sql = "SELECT p.rowid, p.price, ".$db->pdate("p.date_price")." as dp, u.rowid as user_id, u.login";
|
$sql = "SELECT p.rowid, p.price, ";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."product_price as p, llx_user as u";
|
if($conf->global->PRODUIT_MULTIPRICES == 1)
|
||||||
$sql .= " WHERE fk_product = ".$product->id;
|
{
|
||||||
$sql .= " AND p.fk_user_author = u.rowid ";
|
$sql .= "p.price_level, ";
|
||||||
$sql .= " ORDER BY p.date_price DESC ";
|
$sql .= $db->pdate("p.date_price")." as dp, u.rowid as user_id, u.login";
|
||||||
|
$sql .= " FROM ".MAIN_DB_PREFIX."product_price as p, llx_user as u";
|
||||||
|
$sql .= " WHERE fk_product = ".$product->id;
|
||||||
|
$sql .= " AND p.fk_user_author = u.rowid ";
|
||||||
|
$sql .= " ORDER BY p.price_level ASC ";
|
||||||
|
$sql .= ",p.date_price DESC ";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$sql .= $db->pdate("p.date_price")." as dp, u.rowid as user_id, u.login";
|
||||||
|
$sql .= " FROM ".MAIN_DB_PREFIX."product_price as p, llx_user as u";
|
||||||
|
$sql .= " WHERE fk_product = ".$product->id;
|
||||||
|
$sql .= " AND p.fk_user_author = u.rowid ";
|
||||||
|
$sql .= " ORDER BY p.date_price DESC ";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$sql .= $db->plimit();
|
$sql .= $db->plimit();
|
||||||
$result = $db->query($sql) ;
|
$result = $db->query($sql) ;
|
||||||
|
|
||||||
@ -254,6 +315,8 @@ if ($result)
|
|||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans("AppliedPricesFrom").'</td>';
|
print '<td>'.$langs->trans("AppliedPricesFrom").'</td>';
|
||||||
|
if($conf->global->PRODUIT_MULTIPRICES == 1)
|
||||||
|
print '<td>'.$langs->trans("MultiPriceLevelsName").'</td>';
|
||||||
print '<td>'.$langs->trans("Price").'</td>';
|
print '<td>'.$langs->trans("Price").'</td>';
|
||||||
print '<td>'.$langs->trans("ChangedBy").'</td>';
|
print '<td>'.$langs->trans("ChangedBy").'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
@ -269,6 +332,10 @@ if ($result)
|
|||||||
// Date
|
// Date
|
||||||
print "<td>".dolibarr_print_date($objp->dp,"%d %b %Y %H:%M:%S")."</td>";
|
print "<td>".dolibarr_print_date($objp->dp,"%d %b %Y %H:%M:%S")."</td>";
|
||||||
|
|
||||||
|
// catégorie de Prix
|
||||||
|
if($conf->global->PRODUIT_MULTIPRICES == 1)
|
||||||
|
print "<td>".$objp->price_level."</td>";
|
||||||
|
|
||||||
// Prix
|
// Prix
|
||||||
print "<td>".price($objp->price)."</td>";
|
print "<td>".price($objp->price)."</td>";
|
||||||
|
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
* Copyright (C) 2004 Éric Seigne <eric.seigne@ryxeo.com>
|
* Copyright (C) 2004 Éric Seigne <eric.seigne@ryxeo.com>
|
||||||
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||||
|
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -132,7 +133,8 @@ class Propal
|
|||||||
*/
|
*/
|
||||||
function insert_product($idproduct, $qty, $remise_percent=0, $p_desc='')
|
function insert_product($idproduct, $qty, $remise_percent=0, $p_desc='')
|
||||||
{
|
{
|
||||||
dolibarr_syslog("propal.class.php::insert_product $idproduct, $qty, $remise_percent, $p_desc");
|
global $conf;
|
||||||
|
dolibarr_syslog("propal.class.php::insert_product $idproduct, $qty, $remise_percent, $p_desc");
|
||||||
if ($this->statut == 0)
|
if ($this->statut == 0)
|
||||||
{
|
{
|
||||||
// Nettoyage parametres
|
// Nettoyage parametres
|
||||||
@ -141,12 +143,25 @@ class Propal
|
|||||||
|
|
||||||
if ($idproduct)
|
if ($idproduct)
|
||||||
{
|
{
|
||||||
$prod = new Product($this->db, $idproduct);
|
$prod = new Product($this->db, $idproduct);
|
||||||
if ($prod->fetch($idproduct) > 0)
|
if ($prod->fetch($idproduct) > 0)
|
||||||
{
|
{
|
||||||
$txtva = $prod->tva_tx;
|
// multiprix
|
||||||
$price = price2num($prod->price);
|
if($conf->global->PRODUIT_MULTIPRICES == 1)
|
||||||
$subprice = price2num($prod->price);
|
{
|
||||||
|
$this -> fetch_client();
|
||||||
|
$price = price2num($prod->multiprices[$this->client->price_level]);
|
||||||
|
$subprice = price2num($prod->multiprices[$this->client->price_level]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$price = price2num($prod->price);
|
||||||
|
$subprice = price2num($prod->price);
|
||||||
|
}
|
||||||
|
$txtva = $prod->tva_tx;
|
||||||
|
/*
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
// Calcul remise et nouveau prix
|
// Calcul remise et nouveau prix
|
||||||
$remise = 0;
|
$remise = 0;
|
||||||
@ -341,7 +356,6 @@ class Propal
|
|||||||
function create()
|
function create()
|
||||||
{
|
{
|
||||||
global $langs,$conf;
|
global $langs,$conf;
|
||||||
|
|
||||||
// Définition paramètres
|
// Définition paramètres
|
||||||
$this->fin_validite = $this->datep + ($this->duree_validite * 24 * 3600);
|
$this->fin_validite = $this->datep + ($this->duree_validite * 24 * 3600);
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||||
* Copyright (C) 2003 Brian Fraval <brian@fraval.org>
|
* Copyright (C) 2003 Brian Fraval <brian@fraval.org>
|
||||||
*
|
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -79,6 +79,8 @@ class Societe {
|
|||||||
var $stcomm_id;
|
var $stcomm_id;
|
||||||
var $statut_commercial;
|
var $statut_commercial;
|
||||||
|
|
||||||
|
var $price_level;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Constructeur de la classe
|
* \brief Constructeur de la classe
|
||||||
@ -406,7 +408,7 @@ class Societe {
|
|||||||
function fetch($socid, $user=0)
|
function fetch($socid, $user=0)
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
global $conf;
|
||||||
/* Lecture des permissions */
|
/* Lecture des permissions */
|
||||||
if ($user <> 0)
|
if ($user <> 0)
|
||||||
{
|
{
|
||||||
@ -427,6 +429,9 @@ class Societe {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$sql = 'SELECT s.idp, s.nom, s.address,'.$this->db->pdate('s.datec').' as dc, prefix_comm';
|
$sql = 'SELECT s.idp, s.nom, s.address,'.$this->db->pdate('s.datec').' as dc, prefix_comm';
|
||||||
|
// multiprix
|
||||||
|
if($conf->global->PRODUIT_MULTIPRICES == 1)
|
||||||
|
$sql .= ', s.price_level';
|
||||||
$sql .= ','. $this->db->pdate('s.tms').' as date_update';
|
$sql .= ','. $this->db->pdate('s.tms').' as date_update';
|
||||||
$sql .= ', s.tel, s.fax, s.url,s.cp,s.ville, s.note, s.siren, client, fournisseur';
|
$sql .= ', s.tel, s.fax, s.url,s.cp,s.ville, s.note, s.siren, client, fournisseur';
|
||||||
$sql .= ', s.siret, s.capital, s.ape, s.tva_intra, s.rubrique';
|
$sql .= ', s.siret, s.capital, s.ape, s.tva_intra, s.rubrique';
|
||||||
@ -536,6 +541,9 @@ class Societe {
|
|||||||
|
|
||||||
$this->rubrique = $obj->rubrique;
|
$this->rubrique = $obj->rubrique;
|
||||||
$this->note = $obj->note;
|
$this->note = $obj->note;
|
||||||
|
// multiprix
|
||||||
|
if($conf->global->PRODUIT_MULTIPRICES == 1)
|
||||||
|
$this->price_level = $obj->price_level;
|
||||||
|
|
||||||
$result = 1;
|
$result = 1;
|
||||||
}
|
}
|
||||||
@ -849,6 +857,27 @@ class Societe {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function set_price_level($price_level, $user)
|
||||||
|
{
|
||||||
|
if ($this->id)
|
||||||
|
{
|
||||||
|
$sql = "UPDATE ".MAIN_DB_PREFIX."societe ";
|
||||||
|
$sql .= " SET price_level = '".$price_level."'";
|
||||||
|
$sql .= " WHERE idp = " . $this->id .";";
|
||||||
|
|
||||||
|
$this->db->query($sql);
|
||||||
|
|
||||||
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_prices ";
|
||||||
|
$sql .= " ( datec, fk_soc, price_level, fk_user_author )";
|
||||||
|
$sql .= " VALUES (now(),".$this->id.",'".$price_level."',".$user->id.")";
|
||||||
|
|
||||||
|
if (! $this->db->query($sql) )
|
||||||
|
{
|
||||||
|
dolibarr_print_error($this->db);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user