Fix: When a line is defined as option, it was not possible to remove "options" then.

This commit is contained in:
Laurent Destailleur 2011-08-08 01:53:25 +00:00
parent 645dab23a0
commit 02c9c563e0
4 changed files with 29 additions and 24 deletions

View File

@ -26,7 +26,7 @@
* \file htdocs/comm/propal.php
* \ingroup propale
* \brief Page of commercial proposals card and list
* \version $Id: propal.php,v 1.614 2011/08/03 00:46:26 eldy Exp $
* \version $Id: propal.php,v 1.615 2011/08/08 01:53:26 eldy Exp $
*/
require("../main.inc.php");
@ -818,6 +818,10 @@ if ($_POST['action'] == 'updateligne' && $user->rights->propale->creer && $_POST
$localtax2_rate=get_localtax($vat_rate,2,$object->client);
$up_ht=GETPOST('pu')?GETPOST('pu'):GETPOST('subprice');
// Define special_code for special lines
$special_code=0;
if (empty($_POST['qty'])) $special_code=3;
// On verifie que le prix minimum est respecte
$productid = $_POST['productid'] ;
if ($productid)
@ -843,7 +847,7 @@ if ($_POST['action'] == 'updateligne' && $user->rights->propale->creer && $_POST
$_POST['desc'],
'HT',
$info_bits,
'',
$special_code,
$_POST['fk_parent_line']
);
@ -1828,7 +1832,7 @@ else
$soc = new Societe($db);
$soc->fetch($socid);
}
$param='&socid='.$socid.'&viewstatut='.$viewstatut;
if ($month) $param.='&month='.$month;
if ($year) $param.='&year='.$year;
@ -1975,6 +1979,6 @@ else
}
$db->close();
llxFooter('$Date: 2011/08/03 00:46:26 $ - $Revision: 1.614 $');
llxFooter('$Date: 2011/08/08 01:53:26 $ - $Revision: 1.615 $');
?>

View File

@ -29,7 +29,7 @@
* \author Rodolphe Qiedeville
* \author Eric Seigne
* \author Laurent Destailleur
* \version $Id: propal.class.php,v 1.110 2011/08/03 00:46:39 eldy Exp $
* \version $Id: propal.class.php,v 1.111 2011/08/08 01:53:26 eldy Exp $
*/
require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php");
@ -431,18 +431,20 @@ class Propal extends CommonObject
/**
* \brief Mise a jour d'une ligne de produit
* \param rowid Id de la ligne
* \param pu Prix unitaire (HT ou TTC selon price_base_type)
* \param qty Quantity
* \param remise_percent Remise effectuee sur le produit
* \param txtva Taux de TVA
* \param txlocaltax1 Local tax 1 rate
* \param txlocaltax2 Local tax 2 rate
* \param desc Description
* \param price_base_type HT ou TTC
* \param info_bits Miscellanous informations
* \return int 0 en cas de succes
* Update a proposal line
* @param rowid Id de la ligne
* @param pu Prix unitaire (HT ou TTC selon price_base_type)
* @param qty Quantity
* @param remise_percent Remise effectuee sur le produit
* @param txtva Taux de TVA
* @param txlocaltax1 Local tax 1 rate
* @param txlocaltax2 Local tax 2 rate
* @param desc Description
* @param price_base_type HT ou TTC
* @param info_bits Miscellanous informations
* @param special_code Set special code ('' = we don't change it)
* @param fk_parent_line Id of line parent
* @return int 0 en cas de succes
*/
function updateline($rowid, $pu, $qty, $remise_percent=0, $txtva, $txlocaltax1=0, $txlocaltax2=0, $desc='', $price_base_type='HT', $info_bits=0, $special_code=0, $fk_parent_line=0, $skip_update_total=0)
{
@ -458,6 +460,8 @@ class Propal extends CommonObject
$txtva = price2num($txtva);
$txlocaltax1=price2num($txlocaltax1);
$txlocaltax2=price2num($txlocaltax2);
if (empty($qty) && empty($special_code)) $special_code=3; // Set option tag
if (! empty($qty) && $special_code == 3) $special_code=0; // Remove option tag
if ($this->statut == 0)
{
@ -508,8 +512,6 @@ class Propal extends CommonObject
$this->line->fk_parent_line=$fk_parent_line;
$this->line->skip_update_total=$skip_update_total;
if (empty($qty) && empty($special_code)) $this->line->special_code=3;
// TODO deprecated
$this->line->price=$price;
$this->line->remise=$remise;
@ -2671,12 +2673,11 @@ class PropaleLigne
$sql.= " , marge_tx='".$this->marge_tx."'";
$sql.= " , marque_tx='".$this->marque_tx."'";
$sql.= " , info_bits=".$this->info_bits;
if ($this->special_code != '') $sql.= " , special_code=".$this->special_code;
if (strlen($this->special_code)) $sql.= " , special_code=".$this->special_code;
$sql.= " , fk_parent_line=".($this->fk_parent_line>0?$this->fk_parent_line:"null");
$sql.= " WHERE rowid = ".$this->rowid;
dol_syslog("PropaleLigne::update sql=$sql");
$resql=$this->db->query($sql);
if ($resql)
{

View File

@ -16,7 +16,7 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
-- $Id: llx_propaldet.sql,v 1.9 2011/08/03 01:25:41 eldy Exp $
-- $Id: llx_propaldet.sql,v 1.10 2011/08/08 01:53:25 eldy Exp $
-- ===================================================================
create table llx_propaldet
@ -49,7 +49,7 @@ create table llx_propaldet
marge_tx double(6,3) DEFAULT 0, -- taux de marge (marge sur prix d'achat)
marque_tx double(6,3) DEFAULT 0, -- taux de marque (marge sur prix de vente)
special_code integer UNSIGNED DEFAULT 0, -- code pour les lignes speciales
special_code integer DEFAULT 0, -- code pour les lignes speciales
rang integer DEFAULT 0 -- ordre affichage sur la propal
)ENGINE=innodb;

View File

@ -29,7 +29,7 @@ StatusOrderCanceledShort=Annulée
StatusOrderDraftShort=Brouillon
StatusOrderValidatedShort=Validée
StatusOrderOnProcessShort=Réception
StatusOrderSentShort=Expédition en cours
StatusOrderSentShort=Envoi en cours
StatusOrderProcessedShort=Traitée
StatusOrderToBillShort=À facturer
StatusOrderApprovedShort=Approuvée