forked from Wavyzz/dolibarr
Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
@@ -1870,6 +1870,8 @@ class Form
|
||||
$outlabel=$objp->label;
|
||||
$outdesc=$objp->description;
|
||||
$outtype=$objp->fk_product_type;
|
||||
$outdurationvalue=$outtype == Product::TYPE_SERVICE?substr($objp->duration,0,dol_strlen($objp->duration)-1):'';
|
||||
$outdurationunit=$outtype == Product::TYPE_SERVICE?substr($objp->duration,-1):'';
|
||||
|
||||
$opt = '<option value="'.$objp->rowid.'"';
|
||||
$opt.= ($objp->rowid == $selected)?' selected':'';
|
||||
@@ -2014,24 +2016,19 @@ class Form
|
||||
$outval.=' - '.$langs->transnoentities("Stock").':'.$objp->stock;
|
||||
}
|
||||
|
||||
if ($objp->duration)
|
||||
if ($outdurationvalue && $outdurationunit)
|
||||
{
|
||||
$duration_value = substr($objp->duration,0,dol_strlen($objp->duration)-1);
|
||||
$duration_unit = substr($objp->duration,-1);
|
||||
if ($duration_value > 1)
|
||||
$da=array("h"=>$langs->trans("Hour"),"d"=>$langs->trans("Day"),"w"=>$langs->trans("Week"),"m"=>$langs->trans("Month"),"y"=>$langs->trans("Year"));
|
||||
if (isset($da[$outdurationunit]))
|
||||
{
|
||||
$dur=array("h"=>$langs->trans("Hours"),"d"=>$langs->trans("Days"),"w"=>$langs->trans("Weeks"),"m"=>$langs->trans("Months"),"y"=>$langs->trans("Years"));
|
||||
$key = $da[$outdurationunit].($outdurationvalue > 1?'s':'');
|
||||
$opt.= ' - '.$outdurationvalue.' '.$langs->trans($key);
|
||||
$outval.=' - '.$outdurationvalue.' '.$langs->transnoentities($key);
|
||||
}
|
||||
else
|
||||
{
|
||||
$dur=array("h"=>$langs->trans("Hour"),"d"=>$langs->trans("Day"),"w"=>$langs->trans("Week"),"m"=>$langs->trans("Month"),"y"=>$langs->trans("Year"));
|
||||
}
|
||||
$opt.= ' - '.$duration_value.' '.($dur[$duration_unit]?$langs->trans($dur[$duration_unit]):'');
|
||||
$outval.=' - '.$duration_value.' '.($dur[$duration_unit]?$langs->transnoentities($dur[$duration_unit]):'');
|
||||
}
|
||||
|
||||
$opt.= "</option>\n";
|
||||
$optJson = array('key'=>$outkey, 'value'=>$outref, 'label'=>$outval, 'label2'=>$outlabel, 'desc'=>$outdesc, 'type'=>$outtype, 'price_ht'=>$outprice_ht, 'price_ttc'=>$outprice_ttc, 'pricebasetype'=>$outpricebasetype, 'tva_tx'=>$outtva_tx, 'qty'=>$outqty, 'discount'=>$outdiscount);
|
||||
$optJson = array('key'=>$outkey, 'value'=>$outref, 'label'=>$outval, 'label2'=>$outlabel, 'desc'=>$outdesc, 'type'=>$outtype, 'price_ht'=>$outprice_ht, 'price_ttc'=>$outprice_ttc, 'pricebasetype'=>$outpricebasetype, 'tva_tx'=>$outtva_tx, 'qty'=>$outqty, 'discount'=>$outdiscount, 'duration_value'=>$outdurationvalue, 'duration_unit'=>$outdurationunit);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2087,7 +2084,7 @@ class Form
|
||||
|
||||
$langs->load('stocks');
|
||||
|
||||
$sql = "SELECT p.rowid, p.label, p.ref, p.price, p.duration,";
|
||||
$sql = "SELECT p.rowid, p.label, p.ref, p.price, p.duration, p.fk_product_type,";
|
||||
$sql.= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.quantity, pfp.remise_percent, pfp.remise, pfp.unitprice,";
|
||||
$sql.= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, pfp.fk_soc, s.nom as name";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||
@@ -2145,6 +2142,9 @@ class Form
|
||||
$outval='';
|
||||
$outqty=1;
|
||||
$outdiscount=0;
|
||||
$outtype=$objp->fk_product_type;
|
||||
$outdurationvalue=$outtype == Product::TYPE_SERVICE?substr($objp->duration,0,dol_strlen($objp->duration)-1):'';
|
||||
$outdurationunit=$outtype == Product::TYPE_SERVICE?substr($objp->duration,-1):'';
|
||||
|
||||
$opt = '<option value="'.$objp->idprodfournprice.'"';
|
||||
if ($selected && $selected == $objp->idprodfournprice) $opt.= ' selected';
|
||||
@@ -2238,7 +2238,7 @@ class Form
|
||||
// "key" value of json key array is used by jQuery automatically as selected value
|
||||
// "label" value of json key array is used by jQuery automatically as text for combo box
|
||||
$out.=$opt;
|
||||
array_push($outarray, array('key'=>$outkey, 'value'=>$outref, 'label'=>$outval, 'qty'=>$outqty, 'discount'=>$outdiscount, 'disabled'=>(empty($objp->idprodfournprice)?true:false)));
|
||||
array_push($outarray, array('key'=>$outkey, 'value'=>$outref, 'label'=>$outval, 'qty'=>$outqty, 'discount'=>$outdiscount, 'type'=>$outtype, 'duration_value'=>$outdurationvalue, 'duration_unit'=>$outdurationunit, 'disabled'=>(empty($objp->idprodfournprice)?true:false)));
|
||||
// Exemple of var_dump $outarray
|
||||
// array(1) {[0]=>array(6) {[key"]=>string(1) "2" ["value"]=>string(3) "ppp"
|
||||
// ["label"]=>string(76) "ppp (<strong>f</strong>ff2) - ppp - 20,00 Euros/1unité (20,00 Euros/unité)"
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
<?php
|
||||
/* Copyright (C) 2002-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2005-2015 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2005 Lionel Cousteix <etm_ltd@tiscali.co.uk>
|
||||
* Copyright (C) 2011 Herve Prot <herve.prot@symeos.com>
|
||||
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2015 Charlie Benke <charlie@patas-monkey.com>
|
||||
/* Copyright (C) 2002-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2005-2015 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2005 Lionel Cousteix <etm_ltd@tiscali.co.uk>
|
||||
* Copyright (C) 2011 Herve Prot <herve.prot@symeos.com>
|
||||
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2015 Charlie Benke <charlie@patas-monkey.com>
|
||||
* Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
*
|
||||
* 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
|
||||
@@ -324,7 +325,7 @@ if (empty($reshook)) {
|
||||
if (!$error) {
|
||||
$db->begin();
|
||||
|
||||
$object->oldcopy = dol_clone($object);
|
||||
$object->oldcopy = clone $object;
|
||||
|
||||
$object->lastname = GETPOST("lastname", 'alpha');
|
||||
$object->firstname = GETPOST("firstname", 'alpha');
|
||||
@@ -506,7 +507,7 @@ if (empty($reshook)) {
|
||||
{
|
||||
$object->fetch($id);
|
||||
|
||||
$object->oldcopy = dol_clone($object);
|
||||
$object->oldcopy = clone $object;
|
||||
|
||||
$ret = $object->setPassword($user, $_POST["password"]);
|
||||
if ($ret < 0)
|
||||
|
||||
Reference in New Issue
Block a user