Fix: Pb with supplier orders
This commit is contained in:
parent
f48f2b2df8
commit
214bbdd9a6
@ -86,8 +86,7 @@ if ($_POST["action"] == 'updateMask')
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Affichage page configuration module societe
|
* View
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$form=new Form($db);
|
$form=new Form($db);
|
||||||
@ -132,11 +131,11 @@ if ($handle)
|
|||||||
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/societe/".$file.".php");
|
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/societe/".$file.".php");
|
||||||
|
|
||||||
$modCodeTiers = new $file;
|
$modCodeTiers = new $file;
|
||||||
|
|
||||||
// Show modules according to features level
|
// Show modules according to features level
|
||||||
if ($modCodeTiers->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
|
if ($modCodeTiers->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
|
||||||
if ($modCodeTiers->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
|
if ($modCodeTiers->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
|
||||||
|
|
||||||
$var = !$var;
|
$var = !$var;
|
||||||
print "<tr ".$bc[$var].">\n <td width=\"140\">".$modCodeTiers->nom."</td>\n <td>";
|
print "<tr ".$bc[$var].">\n <td width=\"140\">".$modCodeTiers->nom."</td>\n <td>";
|
||||||
print $modCodeTiers->info($langs);
|
print $modCodeTiers->info($langs);
|
||||||
|
|||||||
@ -99,62 +99,90 @@ if ($_POST['action'] == 'addligne' && $user->rights->fournisseur->commande->cree
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$soc = new Societe($db, $commande->socid);
|
|
||||||
$result=$soc->fetch($commande->socid);
|
|
||||||
//print $result;
|
|
||||||
|
|
||||||
// Ecrase $pu par celui du produit
|
// Ecrase $pu par celui du produit
|
||||||
// Ecrase $desc par celui du produit
|
// Ecrase $desc par celui du produit
|
||||||
// Ecrase $txtva par celui du produit
|
// Ecrase $txtva par celui du produit
|
||||||
if ($_POST["idprodfournprice"] > 0)
|
if ($_POST["idprodfournprice"]) // >0 or -1
|
||||||
{
|
{
|
||||||
$prodfournprice = new ProductFournisseur($db);
|
$prodfournprice = new ProductFournisseur($db);
|
||||||
$prodfournprice->fetch_product_fournisseur_price($_POST["idprodfournprice"]);
|
$idprod=$prodfournprice->get_buyprice($_POST['idprodfournprice'], $_POST['qty']);
|
||||||
|
if ($idprod > 0)
|
||||||
|
{
|
||||||
|
$prodfournprice->fetch($idprod);
|
||||||
|
|
||||||
|
// cas special pour lequel on a les meme reference que le fournisseur
|
||||||
|
// $label = '['.$nv_prod->ref.'] - '. $nv_prod->libelle;
|
||||||
|
$label = $prodfournprice->libelle;
|
||||||
|
|
||||||
|
$societe='';
|
||||||
|
if ($commande->socid)
|
||||||
|
{
|
||||||
|
$societe=new Societe($db);
|
||||||
|
$societe->fetch($commande->socid);
|
||||||
|
}
|
||||||
|
|
||||||
|
$desc = $prodfournprice->description;
|
||||||
|
$desc.= $prodfournprice->description && $_POST['np_desc'] ? "\n" : "";
|
||||||
|
$desc.= $_POST['np_desc'];
|
||||||
|
|
||||||
|
$tva_tx = get_default_tva($societe,$mysoc,$prodfournprice->tva_tx,$prodfournprice->id);
|
||||||
|
|
||||||
$prod = new Product($db, $prodfournprice->product_id);
|
$result=$commande->addline(
|
||||||
$prod->fetch($prodfournprice->product_id);
|
$desc,
|
||||||
|
$pu,
|
||||||
|
$_POST['qty'],
|
||||||
|
$tva_tx,
|
||||||
|
$prodfournprice->id,
|
||||||
|
$_POST['idprodfournprice'],
|
||||||
|
$prodfournprice->fourn_ref,
|
||||||
|
$_POST['remise_percent'],
|
||||||
|
'HT'
|
||||||
|
);
|
||||||
|
|
||||||
$libelle = $prod->libelle;
|
}
|
||||||
|
if ($idprod == -1)
|
||||||
$desc = $prod->description;
|
{
|
||||||
$desc.= $prod->description && $_POST['np_desc'] ? "\n" : "";
|
// Quantity too low
|
||||||
$desc.= $_POST['np_desc'];
|
$mesg='<div class="error">'.$langs->trans("ErrorQtyTooLowForThisSupplier").'</div>';
|
||||||
|
}
|
||||||
$tva_tx = get_default_tva($soc,$mysoc,$prod->tva_tx,$prodfournprice->product_id);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$pu=$_POST['pu'];
|
$tauxtva = price2num($_POST['tva_tx']);
|
||||||
$tva_tx=$_POST['tva_tx'];
|
if (! $_POST['dp_desc'])
|
||||||
$desc=$_POST['dp_desc'];
|
{
|
||||||
|
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Label")).'</div>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!empty($_POST['pu']))
|
||||||
|
{
|
||||||
|
$ht = price2num($_POST['pu']);
|
||||||
|
$result=$commande->addline($_POST['dp_desc'], $ht, $_POST['qty'], $tauxtva);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$ttc = price2num($_POST['amountttc']);
|
||||||
|
$ht = $ttc / (1 + ($tauxtva / 100));
|
||||||
|
$result=$commande->addline($_POST['dp_desc'], $ht, $_POST['qty'], $tauxtva);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//print "xx".$tva_tx; exit;
|
//print "xx".$tva_tx; exit;
|
||||||
|
if ($result > 0)
|
||||||
$result=$commande->addline(
|
{
|
||||||
$desc,
|
if ($_REQUEST['lang_id'])
|
||||||
$pu,
|
{
|
||||||
$_POST['qty'],
|
$outputlangs = new Translate("",$conf);
|
||||||
$tva_tx,
|
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||||
$prodfournprice->product_id,
|
}
|
||||||
$_POST['idprodfournprice'],
|
supplier_order_pdf_create($db, $commande->id, $commande->modelpdf, $outputlangs);
|
||||||
$prodfournprice->fourn_ref,
|
}
|
||||||
$_POST['remise_percent'],
|
else
|
||||||
'HT'
|
{
|
||||||
);
|
$mesg='<div class="error">'.$commande->error.'</div>';
|
||||||
|
}
|
||||||
if ($result > 0)
|
|
||||||
{
|
|
||||||
if ($_REQUEST['lang_id'])
|
|
||||||
{
|
|
||||||
$outputlangs = new Translate("",$conf);
|
|
||||||
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
|
||||||
}
|
|
||||||
supplier_order_pdf_create($db, $commande->id, $commande->modelpdf, $outputlangs);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$mesg='<div class="error">'.$commande->error.'</div>';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -217,7 +245,7 @@ if ($_POST['action'] == 'confirm_deleteproductline' && $_POST['confirm'] == 'yes
|
|||||||
if ($_POST['action'] == 'confirm_valid' && $_POST['confirm'] == 'yes' && $user->rights->fournisseur->commande->valider)
|
if ($_POST['action'] == 'confirm_valid' && $_POST['confirm'] == 'yes' && $user->rights->fournisseur->commande->valider)
|
||||||
{
|
{
|
||||||
$commande = new CommandeFournisseur($db);
|
$commande = new CommandeFournisseur($db);
|
||||||
|
|
||||||
$commande->fetch($id);
|
$commande->fetch($id);
|
||||||
|
|
||||||
$commande->date_commande=time();
|
$commande->date_commande=time();
|
||||||
@ -437,7 +465,7 @@ if ($id > 0)
|
|||||||
{
|
{
|
||||||
//if ($mesg) print $mesg.'<br>';
|
//if ($mesg) print $mesg.'<br>';
|
||||||
$commande = new CommandeFournisseur($db);
|
$commande = new CommandeFournisseur($db);
|
||||||
|
|
||||||
if ($commande->fetch($id) >= 0)
|
if ($commande->fetch($id) >= 0)
|
||||||
{
|
{
|
||||||
$soc = new Societe($db);
|
$soc = new Societe($db);
|
||||||
@ -499,10 +527,10 @@ if ($id > 0)
|
|||||||
$text=$langs->trans('ConfirmValidateOrder',$newref);
|
$text=$langs->trans('ConfirmValidateOrder',$newref);
|
||||||
if ($conf->notification->enabled)
|
if ($conf->notification->enabled)
|
||||||
{
|
{
|
||||||
require_once(DOL_DOCUMENT_ROOT ."/notify.class.php");
|
require_once(DOL_DOCUMENT_ROOT ."/notify.class.php");
|
||||||
$notify=new Notify($db);
|
$notify=new Notify($db);
|
||||||
$text.='<br>';
|
$text.='<br>';
|
||||||
$text.=$notify->confirmMessage(3,$commande->socid);
|
$text.=$notify->confirmMessage(3,$commande->socid);
|
||||||
}
|
}
|
||||||
|
|
||||||
$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('ValidateOrder'), $text, 'confirm_valid');
|
$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('ValidateOrder'), $text, 'confirm_valid');
|
||||||
@ -665,7 +693,7 @@ if ($id > 0)
|
|||||||
if ($num)
|
if ($num)
|
||||||
{
|
{
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans('Description').'</td>';
|
print '<td>'.$langs->trans('Label').'</td>';
|
||||||
print '<td align="right" width="50">'.$langs->trans('VAT').'</td>';
|
print '<td align="right" width="50">'.$langs->trans('VAT').'</td>';
|
||||||
print '<td align="right" width="80">'.$langs->trans('PriceUHT').'</td>';
|
print '<td align="right" width="80">'.$langs->trans('PriceUHT').'</td>';
|
||||||
print '<td align="right" width="50">'.$langs->trans('Qty').'</td>';
|
print '<td align="right" width="50">'.$langs->trans('Qty').'</td>';
|
||||||
@ -800,7 +828,7 @@ if ($id > 0)
|
|||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print '<a name="add"></a>'; // ancre
|
print '<a name="add"></a>'; // ancre
|
||||||
print $langs->trans('Description').'</td>';
|
print $langs->trans('Label').'</td>';
|
||||||
print '<td align="right">'.$langs->trans('VAT').'</td>';
|
print '<td align="right">'.$langs->trans('VAT').'</td>';
|
||||||
print '<td align="right">'.$langs->trans('PriceUHT').'</td>';
|
print '<td align="right">'.$langs->trans('PriceUHT').'</td>';
|
||||||
print '<td align="right">'.$langs->trans('Qty').'</td>';
|
print '<td align="right">'.$langs->trans('Qty').'</td>';
|
||||||
@ -868,7 +896,7 @@ if ($id > 0)
|
|||||||
$var=!$var;
|
$var=!$var;
|
||||||
print '<tr '.$bc[$var].'>';
|
print '<tr '.$bc[$var].'>';
|
||||||
print '<td colspan="3">';
|
print '<td colspan="3">';
|
||||||
$html->select_produits_fournisseurs($commande->fourn_id,'','idprodfournprice');
|
$html->select_produits_fournisseurs($commande->fourn_id,'','idprodfournprice',2,$filtre);
|
||||||
|
|
||||||
if (! $conf->global->PRODUIT_USE_SEARCH_TO_SELECT) print '<br>';
|
if (! $conf->global->PRODUIT_USE_SEARCH_TO_SELECT) print '<br>';
|
||||||
|
|
||||||
|
|||||||
@ -242,24 +242,30 @@ if ($_REQUEST['action'] == 'update_line')
|
|||||||
if ($_GET['action'] == 'add_ligne')
|
if ($_GET['action'] == 'add_ligne')
|
||||||
{
|
{
|
||||||
$facfou = new FactureFournisseur($db, '', $_GET['facid']);
|
$facfou = new FactureFournisseur($db, '', $_GET['facid']);
|
||||||
|
$ret=$facfou->fetch($_GET['facid']);
|
||||||
if ($_POST['prodfournpriceid'])
|
if ($ret < 0)
|
||||||
{
|
{
|
||||||
$nv_prod = new Product($db);
|
dolibarr_print_error($db,$facfou->error);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_POST['prodfournpriceid']) // > 0 or -1
|
||||||
|
{
|
||||||
|
$nv_prod = new ProductFournisseur($db);
|
||||||
$idprod=$nv_prod->get_buyprice($_POST['prodfournpriceid'], $_POST['qty']);
|
$idprod=$nv_prod->get_buyprice($_POST['prodfournpriceid'], $_POST['qty']);
|
||||||
if ($idprod > 0)
|
if ($idprod > 0)
|
||||||
{
|
{
|
||||||
$result=$nv_prod->fetch($idprod);
|
$result=$nv_prod->fetch($idprod);
|
||||||
|
|
||||||
// cas sp<73>cial pour lequel on a les meme r<>f<EFBFBD>rence que le fournisseur
|
// cas special pour lequel on a les meme reference que le fournisseur
|
||||||
// $label = '['.$nv_prod->ref.'] - '. $nv_prod->libelle;
|
// $label = '['.$nv_prod->ref.'] - '. $nv_prod->libelle;
|
||||||
$label = $nv_prod->libelle;
|
$label = $nv_prod->libelle;
|
||||||
|
|
||||||
$societe='';
|
$societe='';
|
||||||
if ($_POST['socid'])
|
if ($facfou->socid)
|
||||||
{
|
{
|
||||||
$societe=new Societe($db);
|
$societe=new Societe($db);
|
||||||
$societe->fetch($_POST['socid']);
|
$societe->fetch($facfou->socid);
|
||||||
}
|
}
|
||||||
|
|
||||||
$tvatx=get_default_tva($societe,$mysoc,$nv_prod->tva_tx);
|
$tvatx=get_default_tva($societe,$mysoc,$nv_prod->tva_tx);
|
||||||
@ -268,7 +274,7 @@ if ($_GET['action'] == 'add_ligne')
|
|||||||
}
|
}
|
||||||
if ($idprod == -1)
|
if ($idprod == -1)
|
||||||
{
|
{
|
||||||
// Quantit<EFBFBD> insuffisante
|
// Quantity too low
|
||||||
$mesg='<div class="error">'.$langs->trans("ErrorQtyTooLowForThisSupplier").'</div>';
|
$mesg='<div class="error">'.$langs->trans("ErrorQtyTooLowForThisSupplier").'</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -854,7 +860,7 @@ else
|
|||||||
print '<td align="center" valign="middle" colspan="2"><input type="submit" class="button" value="'.$langs->trans('Add').'"></td></tr>';
|
print '<td align="center" valign="middle" colspan="2"><input type="submit" class="button" value="'.$langs->trans('Add').'"></td></tr>';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
// Ajout de produits/services pr<EFBFBD>d<EFBFBD>finis
|
// Ajout de produits/services predefinis
|
||||||
if ($conf->produit->enabled)
|
if ($conf->produit->enabled)
|
||||||
{
|
{
|
||||||
print '<form name="addligne_predef" action="fiche.php?facid='.$fac->id.'&action=add_ligne" method="post">';
|
print '<form name="addligne_predef" action="fiche.php?facid='.$fac->id.'&action=add_ligne" method="post">';
|
||||||
@ -864,7 +870,7 @@ else
|
|||||||
$var=! $var;
|
$var=! $var;
|
||||||
print '<tr '.$bc[$var].'>';
|
print '<tr '.$bc[$var].'>';
|
||||||
print '<td colspan="4">';
|
print '<td colspan="4">';
|
||||||
$html->select_produits_fournisseurs($fac->socid,'','prodfournpriceid',$filtre);
|
$html->select_produits_fournisseurs($fac->socid,'','prodfournpriceid',2,$filtre);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td align="right"><input type="text" name="qty" value="1" size="1"></td>';
|
print '<td align="right"><input type="text" name="qty" value="1" size="1"></td>';
|
||||||
print '<td> </td>';
|
print '<td> </td>';
|
||||||
|
|||||||
@ -673,13 +673,13 @@ class CommandeFournisseur extends Commande
|
|||||||
* \param fk_product Id produit
|
* \param fk_product Id produit
|
||||||
* \param remise_percent Remise
|
* \param remise_percent Remise
|
||||||
* \param price_base_type HT or TTC
|
* \param price_base_type HT or TTC
|
||||||
* \param int <0 si ko, >0 si ok
|
* \param int <=0 si ko, >0 si ok
|
||||||
*/
|
*/
|
||||||
function addline($desc, $pu_ht, $qty, $txtva, $fk_product=0, $fk_prod_fourn_price=0, $fourn_ref='', $remise_percent=0, $price_base_type='HT', $pu_ttc=0)
|
function addline($desc, $pu_ht, $qty, $txtva, $fk_product=0, $fk_prod_fourn_price=0, $fourn_ref='', $remise_percent=0, $price_base_type='HT', $pu_ttc=0)
|
||||||
{
|
{
|
||||||
global $langs,$mysoc;
|
global $langs,$mysoc;
|
||||||
|
|
||||||
dolibarr_syslog("Fournisseur.Commande::addline $desc, $pu, $qty, $txtva, $fk_product, $remise_percent");
|
dolibarr_syslog("FournisseurCommande::addline $desc, $pu_ht, $qty, $txtva, $fk_product, $fk_prod_fourn_price, $fourn_ref, $remise_percent, $price_base_type, $pu_ttc");
|
||||||
include_once(DOL_DOCUMENT_ROOT.'/lib/price.lib.php');
|
include_once(DOL_DOCUMENT_ROOT.'/lib/price.lib.php');
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
@ -726,14 +726,14 @@ class CommandeFournisseur extends Commande
|
|||||||
{
|
{
|
||||||
$this->error="Aucun tarif trouvé pour cette quantité. Quantité saisie insuffisante ?";
|
$this->error="Aucun tarif trouvé pour cette quantité. Quantité saisie insuffisante ?";
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
dolibarr_syslog("Fournisseur.commande::addline result=".$result." - ".$this->error);
|
dolibarr_syslog("FournisseurCommande::addline result=".$result." - ".$this->error, LOG_DEBUG);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if ($result < -1)
|
if ($result < -1)
|
||||||
{
|
{
|
||||||
$this->error=$prod->error;
|
$this->error=$prod->error;
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
dolibarr_syslog("Fournisseur.commande::addline result=".$result." - ".$this->error);
|
dolibarr_syslog("Fournisseur.commande::addline result=".$result." - ".$this->error, LOG_ERR);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -754,7 +754,7 @@ class CommandeFournisseur extends Commande
|
|||||||
$total_ttc = $tabprice[2];
|
$total_ttc = $tabprice[2];
|
||||||
|
|
||||||
$subprice = price2num($pu,'MU');
|
$subprice = price2num($pu,'MU');
|
||||||
|
|
||||||
// \TODO A virer
|
// \TODO A virer
|
||||||
// Anciens indicateurs: $price, $remise (a ne plus utiliser)
|
// Anciens indicateurs: $price, $remise (a ne plus utiliser)
|
||||||
$remise = 0;
|
$remise = 0;
|
||||||
@ -777,7 +777,8 @@ class CommandeFournisseur extends Commande
|
|||||||
$sql.= "'".price2num($total_tva)."',";
|
$sql.= "'".price2num($total_tva)."',";
|
||||||
$sql.= "'".price2num($total_ttc)."'";
|
$sql.= "'".price2num($total_ttc)."'";
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
dolibarr_syslog('Fournisseur.commande::addline sql='.$sql);
|
|
||||||
|
dolibarr_syslog('FournisseurCommande::addline sql='.$sql);
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
//print $sql;
|
//print $sql;
|
||||||
if ($resql)
|
if ($resql)
|
||||||
@ -791,6 +792,7 @@ class CommandeFournisseur extends Commande
|
|||||||
{
|
{
|
||||||
$this->error=$this->db->error();
|
$this->error=$this->db->error();
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
|
dolibarr_syslog('FournisseurCommande::addline '.$this->error, LOG_ERR);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -295,7 +295,7 @@ class ProductFournisseur extends Product
|
|||||||
/**
|
/**
|
||||||
* \brief Charge les informations relatives à un prix de fournisseur
|
* \brief Charge les informations relatives à un prix de fournisseur
|
||||||
* \param rowid id ligne
|
* \param rowid id ligne
|
||||||
* \return int < 0 si erreur, > 0 si ok
|
* \return int < 0 if KO, 0 if OK but not found, > 0 if OK
|
||||||
*/
|
*/
|
||||||
function fetch_product_fournisseur_price($rowid)
|
function fetch_product_fournisseur_price($rowid)
|
||||||
{
|
{
|
||||||
@ -304,24 +304,32 @@ class ProductFournisseur extends Product
|
|||||||
$sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp, ".MAIN_DB_PREFIX."product_fournisseur as pf";
|
$sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp, ".MAIN_DB_PREFIX."product_fournisseur as pf";
|
||||||
$sql.= " WHERE pfp.rowid = ".$rowid." AND pf.rowid = pfp.fk_product_fournisseur";
|
$sql.= " WHERE pfp.rowid = ".$rowid." AND pf.rowid = pfp.fk_product_fournisseur";
|
||||||
|
|
||||||
dolibarr_syslog("Product::fetch_product_fournisseur_price sql=".$sql);
|
dolibarr_syslog("Product::fetch_product_fournisseur_price sql=".$sql, LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql) ;
|
$resql = $this->db->query($sql) ;
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$obj = $this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
$this->product_fourn_price_id = $rowid;
|
if ($obj)
|
||||||
$this->product_fourn_id = $obj->product_fourn_id;
|
{
|
||||||
$this->fourn_ref = $obj->ref_fourn;
|
$this->product_fourn_price_id = $rowid;
|
||||||
$this->fourn_price = $obj->price;
|
$this->product_fourn_id = $obj->product_fourn_id;
|
||||||
$this->fourn_qty = $obj->quantity;
|
$this->fourn_ref = $obj->ref_fourn;
|
||||||
$this->fourn_unitprice = $obj->unitprice;
|
$this->fourn_price = $obj->price;
|
||||||
$this->product_id = $obj->fk_product;
|
$this->fourn_qty = $obj->quantity;
|
||||||
return 1;
|
$this->fourn_unitprice = $obj->unitprice;
|
||||||
|
$this->product_id = $obj->fk_product; // deprecated
|
||||||
|
$this->fk_product = $obj->fk_product;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error();
|
$this->error=$this->db->error();
|
||||||
dolibarr_syslog("Product::fetch_product_fournisseur_price error=".$this->error);
|
dolibarr_syslog("Product::fetch_product_fournisseur_price error=".$this->error, LOG_ERR);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1127,13 +1127,14 @@ class Form
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Retourne la liste des produits fournisseurs en Ajax si ajax activé ou renvoie à select_produits_fournisseurs_do
|
\brief Retourne la liste des produits fournisseurs en Ajax si ajax activé ou renvoie à select_produits_fournisseurs_do
|
||||||
\param selected Produit pré-sélectionné
|
\param socid Id third party
|
||||||
\param htmlname Nom de la zone select
|
\param selected Produit pré-sélectionné
|
||||||
\param filtretype Pour filtre sur type de produit
|
\param htmlname Nom de la zone select
|
||||||
\param filtre Pour filtre sql
|
\param filtretype Filter on product type (1=customer, 2=supplier)
|
||||||
|
\param filtre Pour filtre sql
|
||||||
*/
|
*/
|
||||||
function select_produits_fournisseurs($socid,$selected='',$htmlname='productid',$filtretype='',$filtre='')
|
function select_produits_fournisseurs($socid,$selected='',$htmlname='productid',$filtretype=2,$filtre)
|
||||||
{
|
{
|
||||||
global $langs,$conf;
|
global $langs,$conf;
|
||||||
if ($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)
|
if ($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)
|
||||||
@ -1143,7 +1144,7 @@ class Form
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->select_produits_fournisseurs_do($socid,$selected,$htmlname,$filtretype,$filtre);
|
$this->select_produits_fournisseurs_do($socid,$selected,$htmlname,$filtretype,$filtre,'');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1226,7 +1227,7 @@ class Form
|
|||||||
{
|
{
|
||||||
$opt.= strtolower($langs->trans("Units"));
|
$opt.= strtolower($langs->trans("Units"));
|
||||||
}
|
}
|
||||||
if ($objp->quantity > 1)
|
if ($objp->quantity >= 1)
|
||||||
{
|
{
|
||||||
$opt.=" (";
|
$opt.=" (";
|
||||||
$opt.= price($objp->unitprice).$langs->trans("Currency".$conf->monnaie)."/".strtolower($langs->trans("Unit"));
|
$opt.= price($objp->unitprice).$langs->trans("Currency".$conf->monnaie)."/".strtolower($langs->trans("Unit"));
|
||||||
@ -1255,8 +1256,8 @@ class Form
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Retourne la liste des tarifs fournisseurs pour un produit
|
\brief Retourne la liste des tarifs fournisseurs pour un produit
|
||||||
\param productid Id du produit
|
\param productid Id product
|
||||||
*/
|
*/
|
||||||
function select_product_fourn_price($productid,$htmlname='productfournpriceid')
|
function select_product_fourn_price($productid,$htmlname='productfournpriceid')
|
||||||
{
|
{
|
||||||
|
|||||||
@ -13,7 +13,7 @@ OrderDate=Order date
|
|||||||
BuyingPrice=Buying price
|
BuyingPrice=Buying price
|
||||||
AddSupplierPrice=Add supplier price
|
AddSupplierPrice=Add supplier price
|
||||||
ChangeSupplierPrice=Change supplier price
|
ChangeSupplierPrice=Change supplier price
|
||||||
ErrorQtyTooLowForThisSupplier=Quantity too low for this supplier
|
ErrorQtyTooLowForThisSupplier=Quantity too low for this supplier or no price defined on this product for this supplier
|
||||||
ErrorSupplierCountryIsNotDefined=Country for this supplier is not defined. Correct this first.
|
ErrorSupplierCountryIsNotDefined=Country for this supplier is not defined. Correct this first.
|
||||||
ProductHasAlreadyReferenceInThisSupplier=This product has already a reference in this supplier
|
ProductHasAlreadyReferenceInThisSupplier=This product has already a reference in this supplier
|
||||||
NoRecordedSuppliers=No suppliers recorded
|
NoRecordedSuppliers=No suppliers recorded
|
||||||
|
|||||||
@ -13,6 +13,6 @@ OrderDate=Date commande
|
|||||||
BuyingPrice=Prix d'achat
|
BuyingPrice=Prix d'achat
|
||||||
AddSupplierPrice=Ajouter prix fournisseur
|
AddSupplierPrice=Ajouter prix fournisseur
|
||||||
ChangeSupplierPrice=Modifier prix fournisseur
|
ChangeSupplierPrice=Modifier prix fournisseur
|
||||||
ErrorQtyTooLowForThisSupplier=Quantité insuffisante pour ce fournisseur
|
ErrorQtyTooLowForThisSupplier=Quantité insuffisante pour ce fournisseur ou aucun tarif défini sur ce produit pour ce fournisseur
|
||||||
ErrorSupplierCountryIsNotDefined=Le pays de ce fournisseur n'est pas défini. Corriger sur sa fiche.
|
ErrorSupplierCountryIsNotDefined=Le pays de ce fournisseur n'est pas défini. Corriger sur sa fiche.
|
||||||
ProductHasAlreadyReferenceInThisSupplier=Ce produit a déjà une référence chez ce fournisseur
|
ProductHasAlreadyReferenceInThisSupplier=Ce produit a déjà une référence chez ce fournisseur
|
||||||
|
|||||||
@ -13,7 +13,7 @@ OrderDate=Date commande
|
|||||||
BuyingPrice=Prix d'achat
|
BuyingPrice=Prix d'achat
|
||||||
AddSupplierPrice=Ajouter prix fournisseur
|
AddSupplierPrice=Ajouter prix fournisseur
|
||||||
ChangeSupplierPrice=Modifier prix fournisseur
|
ChangeSupplierPrice=Modifier prix fournisseur
|
||||||
ErrorQtyTooLowForThisSupplier=Quantité insuffisante pour ce fournisseur
|
ErrorQtyTooLowForThisSupplier=Quantité insuffisante pour ce fournisseur ou aucun tarif défini sur ce produit pour ce fournisseur
|
||||||
ErrorSupplierCountryIsNotDefined=Le pays de ce fournisseur n'est pas défini. Corriger sur sa fiche.
|
ErrorSupplierCountryIsNotDefined=Le pays de ce fournisseur n'est pas défini. Corriger sur sa fiche.
|
||||||
ProductHasAlreadyReferenceInThisSupplier=Ce produit a déjà une référence chez ce fournisseur
|
ProductHasAlreadyReferenceInThisSupplier=Ce produit a déjà une référence chez ce fournisseur
|
||||||
NoRecordedSuppliers=Pas de fournisseurs enregistrés
|
NoRecordedSuppliers=Pas de fournisseurs enregistrés
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user