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;
$numpr = $modPropale->getNextValue($soc);
// Si numero deja pris (ne devrait pas arriver)
// on incremente par .num+1
// Fix pour modele numerotation qui deconne
// 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%'";
$resql=$db->query($sql);
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>';
// Reference client
print '<tr><td>'.$langs->trans('RefCustomer').'</td><td>';
print '<input type="text" name="ref_client" value=""></td>';
print '</tr>';
print '<tr><td>'.$langs->trans('RefCustomer').'</td><td>';
print '<input type="text" name="ref_client" value=""></td>';
print '</tr>';
// Societe
print '<tr><td>'.$langs->trans('Company').'</td><td colspan="2">'.$soc->getNomUrl(1);
@ -117,8 +117,8 @@ if ($_GET["action"] == 'create')
print '</tr>';
/*
* Contact de la propale
*/
* Contact de la propale
*/
print "<tr><td>".$langs->trans("DefaultContact")."</td><td colspan=\"2\">\n";
$html->select_contacts($soc->id,$setcontact,'contactidp',1);
print '</td></tr>';

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -145,6 +145,16 @@ class Propal extends CommonObject
$prod=new Product($this->db);
$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);
// multiprix
if($conf->global->PRODUIT_MULTIPRICES == 1)
@ -159,10 +169,10 @@ class Propal extends CommonObject
$line = new PropaleLigne($this->db);
$line->fk_product=$idproduct;
$line->desc=$prod->description;
$line->qty = $qty;
$line->desc=$productdesc;
$line->qty=$qty;
$line->subprice=$price;
$line->remise_percent = $remise_percent;
$line->remise_percent=$remise_percent;
$line->tva_tx=$tva_tx;
$this->products[]=$line;