Fix: Bug 17703

This commit is contained in:
Laurent Destailleur 2006-09-11 22:26:58 +00:00
parent 3631e5b405
commit 97f3c176ce
4 changed files with 199 additions and 189 deletions

View File

@ -82,8 +82,8 @@ if ($_GET["action"] == 'create')
$modPropale = new $obj; $modPropale = new $obj;
$numpr = $modPropale->getNextValue($soc); $numpr = $modPropale->getNextValue($soc);
// Si numero deja pris (ne devrait pas arriver) // Fix pour modele numerotation qui deconne
// on incremente par .num+1 // Si numero deja pris (ne devrait pas arriver), on incremente par .num+1
$sql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."propal WHERE ref like '$numpr%'"; $sql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."propal WHERE ref like '$numpr%'";
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)
@ -106,9 +106,9 @@ if ($_GET["action"] == 'create')
print '<tr><td>'.$langs->trans("Ref").'</td><td colspan="2"><input name="ref" value="'.$numpr.'"></td></tr>'; print '<tr><td>'.$langs->trans("Ref").'</td><td colspan="2"><input name="ref" value="'.$numpr.'"></td></tr>';
// Reference client // Reference client
print '<tr><td>'.$langs->trans('RefCustomer').'</td><td>'; print '<tr><td>'.$langs->trans('RefCustomer').'</td><td>';
print '<input type="text" name="ref_client" value=""></td>'; print '<input type="text" name="ref_client" value=""></td>';
print '</tr>'; print '</tr>';
// Societe // Societe
print '<tr><td>'.$langs->trans('Company').'</td><td colspan="2">'.$soc->getNomUrl(1); print '<tr><td>'.$langs->trans('Company').'</td><td colspan="2">'.$soc->getNomUrl(1);
@ -117,8 +117,8 @@ if ($_GET["action"] == 'create')
print '</tr>'; print '</tr>';
/* /*
* Contact de la propale * Contact de la propale
*/ */
print "<tr><td>".$langs->trans("DefaultContact")."</td><td colspan=\"2\">\n"; print "<tr><td>".$langs->trans("DefaultContact")."</td><td colspan=\"2\">\n";
$html->select_contacts($soc->id,$setcontact,'contactidp',1); $html->select_contacts($soc->id,$setcontact,'contactidp',1);
print '</td></tr>'; print '</td></tr>';

View File

@ -165,6 +165,7 @@ if ($_POST['action'] == 'set_ref_client' && $user->rights->propale->creer)
if ($_POST['action'] == 'add') if ($_POST['action'] == 'add')
{ {
$propal = new Propal($db, $_POST['socidp']); $propal = new Propal($db, $_POST['socidp']);
$propal->fetch_client();
$db->begin(); $db->begin();
@ -550,16 +551,17 @@ if ($_REQUEST['action'] == 'builddoc' && $user->rights->propale->creer)
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs"); $outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs->setDefaultLang($_REQUEST['lang_id']);
} }
$result=propale_pdf_create($db, $propal->id, $propal->modelpdf, $outputlangs); $result=propale_pdf_create($db, $propal->id, $propal->modelpdf, $outputlangs);
if ($result <= 0) if ($result <= 0)
{ {
dolibarr_print_error($db,$result); dolibarr_print_error($db,$result);
exit; exit;
} }
else else
{ {
Header ('Location: '.$_SERVER["PHP_SELF"].'?propalid='.$propal->id.'#builddoc'); Header ('Location: '.$_SERVER["PHP_SELF"].'?propalid='.$propal->id.'#builddoc');
} exit;
}
} }
@ -655,8 +657,9 @@ if ($_GET['action'] == 'down' && $user->rights->propale->creer)
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs"); $outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs->setDefaultLang($_REQUEST['lang_id']);
} }
propale_pdf_create($db, $propal->id, $propal->modelpdf, $outputlangs); propale_pdf_create($db, $propal->id, $propal->modelpdf, $outputlangs);
Header ('Location: '.$_SERVER["PHP_SELF"].'?propalid='.$_GET["propalid"].'#'.$_GET['rowid']); Header ('Location: '.$_SERVER["PHP_SELF"].'?propalid='.$_GET["propalid"].'#'.$_GET['rowid']);
exit;
} }

View File

@ -757,9 +757,6 @@ class Product
return -2; return -2;
} }
} }
} }

View File

@ -145,6 +145,16 @@ class Propal extends CommonObject
$prod=new Product($this->db); $prod=new Product($this->db);
$prod->fetch($idproduct); $prod->fetch($idproduct);
// on ajoute la description du produit si l'option est active
if ($conf->global->PRODUIT_CHANGE_PROD_DESC)
{
$productdesc = $prod->description;
}
else
{
$productdesc = '';
}
$tva_tx = get_default_tva($mysoc,$this->client,$prod->tva_tx); $tva_tx = get_default_tva($mysoc,$this->client,$prod->tva_tx);
// multiprix // multiprix
if($conf->global->PRODUIT_MULTIPRICES == 1) if($conf->global->PRODUIT_MULTIPRICES == 1)
@ -159,10 +169,10 @@ class Propal extends CommonObject
$line = new PropaleLigne($this->db); $line = new PropaleLigne($this->db);
$line->fk_product=$idproduct; $line->fk_product=$idproduct;
$line->desc=$prod->description; $line->desc=$productdesc;
$line->qty = $qty; $line->qty=$qty;
$line->subprice=$price; $line->subprice=$price;
$line->remise_percent = $remise_percent; $line->remise_percent=$remise_percent;
$line->tva_tx=$tva_tx; $line->tva_tx=$tva_tx;
$this->products[]=$line; $this->products[]=$line;