Qual: Utilisation de la methode select_projects plutot que code en dur
This commit is contained in:
parent
7583146b73
commit
01d444febd
@ -18,7 +18,6 @@
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -60,10 +59,13 @@ $form=new Form($db);
|
||||
*/
|
||||
if ($_GET["action"] == 'create')
|
||||
{
|
||||
|
||||
$soc = new Societe($db);
|
||||
/* TODO Ajouter un test ici */
|
||||
$soc->fetch($_GET["socidp"]);
|
||||
$result=$soc->fetch($_GET["socidp"]);
|
||||
if ($result < 0)
|
||||
{
|
||||
dolibarr_print_error($db,$soc->error);
|
||||
exit;
|
||||
}
|
||||
|
||||
$obj = PROPALE_ADDON;
|
||||
$modPropale = new $obj;
|
||||
@ -149,45 +151,18 @@ if ($_GET["action"] == 'create')
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr>';
|
||||
if ($conf->projet->enabled) {
|
||||
|
||||
if ($conf->projet->enabled)
|
||||
{
|
||||
/*
|
||||
* Projet associé
|
||||
* Projet associ
|
||||
*/
|
||||
print '<td valign="top">'.$langs->trans("Project").'</td><td>';
|
||||
print '<option value="0"></option>';
|
||||
|
||||
$sql = "SELECT p.rowid, p.title FROM ".MAIN_DB_PREFIX."projet as p WHERE p.fk_soc =".$soc->id;
|
||||
|
||||
if ( $db->query($sql) )
|
||||
{
|
||||
$i = 0 ;
|
||||
$numprojet = $db->num_rows();
|
||||
|
||||
$numprojet=$form->select_projects($soc->id,0,'projetidp');
|
||||
if ($numprojet==0)
|
||||
{
|
||||
print $langs->trans("NoProject").' - ';
|
||||
print '<a href=../projet/fiche.php?socidp='.$soc->id.'&action=create>'.$langs->trans("AddProject").'</a>';
|
||||
print ' <a href=../projet/fiche.php?socidp='.$soc->id.'&action=create>'.$langs->trans("AddProject").'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<select name="projetidp">';
|
||||
|
||||
while ($i < $numprojet)
|
||||
{
|
||||
$projet = $db->fetch_object();
|
||||
print "<option value=\"$projet->rowid\">".$projet->title."</option>";
|
||||
$i++;
|
||||
}
|
||||
print '</select>';
|
||||
}
|
||||
$db->free();
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
print '</td>';
|
||||
}
|
||||
else {
|
||||
@ -233,7 +208,9 @@ if ($_GET["action"] == 'create')
|
||||
if ($numdest > 0)
|
||||
{
|
||||
$langs->load("bills");
|
||||
print '<center>';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("CreateDraft").'">';
|
||||
print '</center>';
|
||||
}
|
||||
print "</form>";
|
||||
}
|
||||
|
||||
@ -123,10 +123,16 @@ if ($_POST['action'] == 'add')
|
||||
/*
|
||||
* Generation
|
||||
*/
|
||||
if ($id)
|
||||
if ($id > 0)
|
||||
{
|
||||
propale_pdf_create($db, $id, $_POST['modelpdf']);
|
||||
Header ('Location: propal.php?propalid='.$id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db,$propal->error);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user