Fix: uniformize code
This commit is contained in:
parent
ad6999de3b
commit
424a157ecf
@ -72,11 +72,12 @@ $result = restrictedArea($user, $module, $objectid, $dbtable);
|
||||
// Nombre de ligne pour choix de produit/service predefinis
|
||||
$NBLINES=4;
|
||||
|
||||
$propal = new Propal($db);
|
||||
|
||||
// Instantiate hooks of thirdparty module
|
||||
if (is_array($conf->hooks_modules) && !empty($conf->hooks_modules))
|
||||
{
|
||||
$hooks = new Propal($db);
|
||||
$hooks->callHooks('objectcard');
|
||||
$propal->callHooks('objectcard');
|
||||
}
|
||||
|
||||
|
||||
@ -85,11 +86,11 @@ if (is_array($conf->hooks_modules) && !empty($conf->hooks_modules))
|
||||
/******************************************************************************/
|
||||
|
||||
// Hook of thirdparty module
|
||||
if (! empty($hooks->objModules))
|
||||
if (! empty($propal->objModules))
|
||||
{
|
||||
foreach($hooks->objModules as $module)
|
||||
foreach($propal->objModules as $module)
|
||||
{
|
||||
$module->getObjectActions($hooks);
|
||||
$module->doActions($propal);
|
||||
$mesg = $module->error;
|
||||
}
|
||||
}
|
||||
@ -103,8 +104,7 @@ if ($_REQUEST["action"] == 'confirm_clone' && $_REQUEST['confirm'] == 'yes')
|
||||
}
|
||||
else
|
||||
{
|
||||
$object=new Propal($db);
|
||||
$result=$object->createFromClone($_REQUEST["id"]);
|
||||
$result=$propal->createFromClone($_REQUEST["id"]);
|
||||
if ($result > 0)
|
||||
{
|
||||
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);
|
||||
@ -112,7 +112,7 @@ if ($_REQUEST["action"] == 'confirm_clone' && $_REQUEST['confirm'] == 'yes')
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg=$object->error;
|
||||
$mesg=$propal->error;
|
||||
$_GET['action']='';
|
||||
$_GET['id']=$_REQUEST['id'];
|
||||
}
|
||||
@ -124,7 +124,6 @@ if ($_REQUEST['action'] == 'confirm_delete' && $_REQUEST['confirm'] == 'yes')
|
||||
{
|
||||
if ($user->rights->propale->supprimer)
|
||||
{
|
||||
$propal = new Propal($db, 0, $_GET["id"]);
|
||||
$propal->fetch($_GET["id"]);
|
||||
$result=$propal->delete($user);
|
||||
$id = 0;
|
||||
@ -149,7 +148,6 @@ if ($_REQUEST['action'] == 'confirm_deleteline' && $_REQUEST['confirm'] == 'yes'
|
||||
{
|
||||
if ($user->rights->propale->creer)
|
||||
{
|
||||
$propal = new Propal($db);
|
||||
$propal->fetch($_GET["id"]);
|
||||
$propal->fetch_thirdparty();
|
||||
$result = $propal->delete_product($_GET['lineid']);
|
||||
@ -177,7 +175,6 @@ if ($_REQUEST['action'] == 'confirm_deleteline' && $_REQUEST['confirm'] == 'yes'
|
||||
// Validation
|
||||
if ($_REQUEST['action'] == 'confirm_validate' && $_REQUEST['confirm'] == 'yes' && $user->rights->propale->valider)
|
||||
{
|
||||
$propal = new Propal($db);
|
||||
$propal->fetch($_GET["id"]);
|
||||
$propal->fetch_thirdparty();
|
||||
|
||||
@ -204,21 +201,18 @@ if ($_REQUEST['action'] == 'confirm_validate' && $_REQUEST['confirm'] == 'yes' &
|
||||
|
||||
if ($_POST['action'] == 'setdate')
|
||||
{
|
||||
$propal = new Propal($db);
|
||||
$propal->fetch($_GET["id"]);
|
||||
$result=$propal->set_date($user,dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']));
|
||||
if ($result < 0) dol_print_error($db,$propal->error);
|
||||
}
|
||||
if ($_POST['action'] == 'setecheance')
|
||||
{
|
||||
$propal = new Propal($db);
|
||||
$propal->fetch($_GET["id"]);
|
||||
$result=$propal->set_echeance($user,dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear']));
|
||||
if ($result < 0) dol_print_error($db,$propal->error);
|
||||
}
|
||||
if ($_POST['action'] == 'setdate_livraison')
|
||||
{
|
||||
$propal = new Propal($db);
|
||||
$propal->fetch($_GET["id"]);
|
||||
$result=$propal->set_date_livraison($user,dol_mktime(12, 0, 0, $_POST['liv_month'], $_POST['liv_day'], $_POST['liv_year']));
|
||||
if ($result < 0) dol_print_error($db,$propal->error);
|
||||
@ -226,7 +220,6 @@ if ($_POST['action'] == 'setdate_livraison')
|
||||
|
||||
if ($_POST['action'] == 'setaddress' && $user->rights->propale->creer)
|
||||
{
|
||||
$propal = new Propal($db);
|
||||
$propal->fetch($_GET["id"]);
|
||||
$result=$propal->set_adresse_livraison($user,$_POST['fk_address']);
|
||||
if ($result < 0) dol_print_error($db,$propal->error);
|
||||
@ -235,7 +228,6 @@ if ($_POST['action'] == 'setaddress' && $user->rights->propale->creer)
|
||||
// Positionne ref client
|
||||
if ($_POST['action'] == 'set_ref_client' && $user->rights->propale->creer)
|
||||
{
|
||||
$propal = new Propal($db);
|
||||
$propal->fetch($_GET["id"]);
|
||||
$propal->set_ref_client($user, $_POST['ref_client']);
|
||||
}
|
||||
@ -245,7 +237,6 @@ if ($_POST['action'] == 'set_ref_client' && $user->rights->propale->creer)
|
||||
*/
|
||||
if ($_POST['action'] == 'add' && $user->rights->propale->creer)
|
||||
{
|
||||
$propal = new Propal($db);
|
||||
$propal->socid=$_POST['socid'];
|
||||
$propal->fetch_thirdparty();
|
||||
|
||||
@ -381,7 +372,6 @@ if ($_REQUEST['action'] == 'setstatut' && $user->rights->propale->cloturer)
|
||||
}
|
||||
else
|
||||
{
|
||||
$propal = new Propal($db);
|
||||
$propal->fetch($_GET["id"]);
|
||||
// prevent browser refresh from closing proposal several times
|
||||
if ($propal->statut==1)
|
||||
@ -434,7 +424,6 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile']
|
||||
{
|
||||
$langs->load('mails');
|
||||
|
||||
$propal= new Propal($db);
|
||||
$result=$propal->fetch($_POST["id"]);
|
||||
$result=$propal->fetch_thirdparty();
|
||||
|
||||
@ -586,7 +575,6 @@ if ($_GET['action'] == 'commande')
|
||||
/*
|
||||
* Cloture de la propale
|
||||
*/
|
||||
$propal = new Propal($db);
|
||||
$propal->fetch($id);
|
||||
$propal->create_commande($user);
|
||||
}
|
||||
@ -596,7 +584,6 @@ if ($_GET['action'] == 'modif' && $user->rights->propale->creer)
|
||||
/*
|
||||
* Repasse la propale en mode brouillon
|
||||
*/
|
||||
$propal = new Propal($db);
|
||||
$propal->fetch($_GET["id"]);
|
||||
$propal->fetch_thirdparty();
|
||||
$propal->set_draft($user);
|
||||
@ -619,20 +606,19 @@ if ($_POST['action'] == "setabsolutediscount" && $user->rights->propale->creer)
|
||||
{
|
||||
if ($_POST["remise_id"])
|
||||
{
|
||||
$prop = new Propal($db);
|
||||
$prop->id=$_GET["id"];
|
||||
$ret=$prop->fetch($_GET["id"]);
|
||||
$propal->id=$_GET["id"];
|
||||
$ret=$propal->fetch($_GET["id"]);
|
||||
if ($ret > 0)
|
||||
{
|
||||
$result=$prop->insert_discount($_POST["remise_id"]);
|
||||
$result=$propal->insert_discount($_POST["remise_id"]);
|
||||
if ($result < 0)
|
||||
{
|
||||
$mesg='<div class="error">'.$prop->error.'</div>';
|
||||
$mesg='<div class="error">'.$propal->error.'</div>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db,$prop->error);
|
||||
dol_print_error($db,$propal->error);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -642,7 +628,6 @@ if ($_POST['action'] == "setabsolutediscount" && $user->rights->propale->creer)
|
||||
*/
|
||||
if ($_POST['action'] == "addline" && $user->rights->propale->creer)
|
||||
{
|
||||
$propal = new Propal($db);
|
||||
$result=0;
|
||||
|
||||
if (empty($_POST['idprod']) && $_POST["type"] < 0)
|
||||
@ -784,7 +769,6 @@ if ($_POST['action'] == "addline" && $user->rights->propale->creer)
|
||||
*/
|
||||
if ($_POST['action'] == 'updateligne' && $user->rights->propale->creer && $_POST["save"] == $langs->trans("Save"))
|
||||
{
|
||||
$propal = new Propal($db);
|
||||
if (! $propal->fetch($_POST["id"]) > 0)
|
||||
{
|
||||
dol_print_error($db,$propal->error);
|
||||
@ -845,7 +829,6 @@ if ($_POST['action'] == 'updateligne' && $user->rights->propale->creer && $_POST
|
||||
*/
|
||||
if ($_REQUEST['action'] == 'builddoc' && $user->rights->propale->creer)
|
||||
{
|
||||
$propal = new Propal($db);
|
||||
$propal->fetch($_GET["id"]);
|
||||
$propal->fetch_thirdparty();
|
||||
|
||||
@ -880,7 +863,6 @@ if ($_REQUEST['action'] == 'builddoc' && $user->rights->propale->creer)
|
||||
// Set project
|
||||
if ($_POST['action'] == 'classin')
|
||||
{
|
||||
$propal = new Propal($db);
|
||||
$propal->fetch($_GET['id']);
|
||||
$propal->setProject($_POST['projectid']);
|
||||
}
|
||||
@ -888,7 +870,6 @@ if ($_POST['action'] == 'classin')
|
||||
// Conditions de reglement
|
||||
if ($_POST["action"] == 'setconditions')
|
||||
{
|
||||
$propal = new Propal($db);
|
||||
$propal->fetch($_REQUEST['id']);
|
||||
$result = $propal->cond_reglement($_POST['cond_reglement_id']);
|
||||
$_GET['id']=$_REQUEST['id'];
|
||||
@ -896,7 +877,6 @@ if ($_POST["action"] == 'setconditions')
|
||||
|
||||
if ($_REQUEST['action'] == 'setremisepercent' && $user->rights->propale->creer)
|
||||
{
|
||||
$propal = new Propal($db);
|
||||
$propal->fetch($_REQUEST["id"]);
|
||||
$result = $propal->set_remise_percent($user, $_POST['remise_percent']);
|
||||
$_GET["id"]=$_REQUEST["id"];
|
||||
@ -904,7 +884,6 @@ if ($_REQUEST['action'] == 'setremisepercent' && $user->rights->propale->creer)
|
||||
|
||||
if ($_REQUEST['action'] == 'setremiseabsolue' && $user->rights->propale->creer)
|
||||
{
|
||||
$propal = new Propal($db);
|
||||
$propal->fetch($_REQUEST["id"]);
|
||||
$result = $propal->set_remise_absolue($user, $_POST['remise_absolue']);
|
||||
$_GET["id"]=$_REQUEST["id"];
|
||||
@ -913,7 +892,6 @@ if ($_REQUEST['action'] == 'setremiseabsolue' && $user->rights->propale->creer)
|
||||
// Mode de reglement
|
||||
if ($_POST["action"] == 'setmode')
|
||||
{
|
||||
$propal = new Propal($db);
|
||||
$propal->fetch($_REQUEST["id"]);
|
||||
$result = $propal->mode_reglement($_POST['mode_reglement_id']);
|
||||
$_GET["id"]=$_REQUEST["id"];
|
||||
@ -925,7 +903,6 @@ if ($_POST["action"] == 'setmode')
|
||||
|
||||
if ($_GET['action'] == 'up' && $user->rights->propale->creer)
|
||||
{
|
||||
$propal = new Propal($db, '', $_GET["id"]);
|
||||
$propal->fetch($_GET["id"]);
|
||||
$propal->fetch_thirdparty();
|
||||
$propal->line_up($_GET['rowid']);
|
||||
@ -948,7 +925,6 @@ if ($_GET['action'] == 'up' && $user->rights->propale->creer)
|
||||
|
||||
if ($_GET['action'] == 'down' && $user->rights->propale->creer)
|
||||
{
|
||||
$propal = new Propal($db, '', $_GET["id"]);
|
||||
$propal->fetch($_GET['id']);
|
||||
$propal->fetch_thirdparty();
|
||||
$propal->line_down($_GET['rowid']);
|
||||
@ -993,7 +969,6 @@ if ($id > 0 || ! empty($ref))
|
||||
|
||||
if ($mesg) print $mesg."<br>";
|
||||
|
||||
$propal = new Propal($db);
|
||||
$propal->fetch($id,$ref);
|
||||
|
||||
$soc = new Societe($db);
|
||||
@ -1385,22 +1360,8 @@ if ($id > 0 || ! empty($ref))
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
$result = $propal->getLinesArray();
|
||||
//var_dump($propal->lines);
|
||||
|
||||
if (! empty($propal->lines))
|
||||
{
|
||||
if (! empty($hooks->objModules))
|
||||
{
|
||||
// TODO traitement des hooks
|
||||
$propal->print_title_list();
|
||||
$propal->printLinesList();
|
||||
}
|
||||
else
|
||||
{
|
||||
$propal->print_title_list();
|
||||
$propal->printLinesList();
|
||||
}
|
||||
}
|
||||
$propal->print_title_list();
|
||||
$propal->printLinesList();
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -405,7 +405,7 @@ class Propal extends CommonObject
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->ligne->error;
|
||||
$this->error=$this->line->error;
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
}
|
||||
|
||||
@ -62,11 +62,12 @@ $usehm=$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE;
|
||||
|
||||
$mesg=isset($_GET['mesg'])?$_GET['mesg']:'';
|
||||
|
||||
$commande = new Commande($db);
|
||||
|
||||
// Instantiate hooks of thirdparty module
|
||||
if (is_array($conf->hooks_modules) && !empty($conf->hooks_modules))
|
||||
{
|
||||
$hooks = new Commande($db);
|
||||
$hooks->callHooks('objectcard');
|
||||
$commande->callHooks('objectcard');
|
||||
}
|
||||
|
||||
|
||||
@ -75,11 +76,11 @@ if (is_array($conf->hooks_modules) && !empty($conf->hooks_modules))
|
||||
/******************************************************************************/
|
||||
|
||||
// Hook of thirdparty module
|
||||
if (! empty($hooks->objModules))
|
||||
if (! empty($commande->objModules))
|
||||
{
|
||||
foreach($hooks->objModules as $module)
|
||||
foreach($commande->objModules as $module)
|
||||
{
|
||||
$module->getObjectActions($hooks);
|
||||
$module->doActions($commande);
|
||||
$mesg = $module->error;
|
||||
}
|
||||
}
|
||||
@ -93,8 +94,7 @@ if ($_REQUEST["action"] == 'confirm_clone' && $_REQUEST['confirm'] == 'yes')
|
||||
}
|
||||
else
|
||||
{
|
||||
$object=new Commande($db);
|
||||
$result=$object->createFromClone($comid);
|
||||
$result=$commande->createFromClone($comid);
|
||||
if ($result > 0)
|
||||
{
|
||||
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);
|
||||
@ -111,7 +111,6 @@ if ($_REQUEST["action"] == 'confirm_clone' && $_REQUEST['confirm'] == 'yes')
|
||||
// Reopen a closed order
|
||||
if ($_GET['action'] == 'reopen' && $user->rights->commande->creer)
|
||||
{
|
||||
$commande = new Commande($db);
|
||||
$commande->fetch($comid);
|
||||
if ($commande->statut == 3)
|
||||
{
|
||||
@ -133,7 +132,6 @@ if ($_REQUEST['action'] == 'confirm_delete' && $_REQUEST['confirm'] == 'yes')
|
||||
{
|
||||
if ($user->rights->commande->supprimer)
|
||||
{
|
||||
$commande = new Commande($db);
|
||||
$commande->fetch($comid);
|
||||
$result=$commande->delete($user);
|
||||
if ($result > 0)
|
||||
@ -153,7 +151,6 @@ if ($_REQUEST['action'] == 'confirm_deleteline' && $_REQUEST['confirm'] == 'yes'
|
||||
{
|
||||
if ($user->rights->commande->creer)
|
||||
{
|
||||
$commande = new Commande($db);
|
||||
$commande->fetch($comid);
|
||||
$commande->fetch_thirdparty();
|
||||
|
||||
@ -184,7 +181,6 @@ if ($_REQUEST['action'] == 'confirm_deleteline' && $_REQUEST['confirm'] == 'yes'
|
||||
// Categorisation dans projet
|
||||
if ($_POST['action'] == 'classin')
|
||||
{
|
||||
$commande = new Commande($db);
|
||||
$commande->fetch($comid);
|
||||
$commande->setProject($_POST['projectid']);
|
||||
}
|
||||
@ -196,7 +192,6 @@ if ($_POST['action'] == 'add' && $user->rights->commande->creer)
|
||||
$datecommande = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
|
||||
$datelivraison = dol_mktime(12, 0, 0, $_POST['liv_month'],$_POST['liv_day'],$_POST['liv_year']);
|
||||
|
||||
$commande = new Commande($db);
|
||||
$commande->socid=$_POST['socid'];
|
||||
$commande->fetch_thirdparty();
|
||||
|
||||
@ -269,14 +264,12 @@ if ($_POST['action'] == 'add' && $user->rights->commande->creer)
|
||||
// Positionne ref commande client
|
||||
if ($_POST['action'] == 'set_ref_client' && $user->rights->commande->creer)
|
||||
{
|
||||
$commande = new Commande($db);
|
||||
$commande->fetch($comid);
|
||||
$commande->set_ref_client($user, $_POST['ref_client']);
|
||||
}
|
||||
|
||||
if ($_POST['action'] == 'setremise' && $user->rights->commande->creer)
|
||||
{
|
||||
$commande = new Commande($db);
|
||||
$commande->fetch($comid);
|
||||
$commande->set_remise($user, $_POST['remise']);
|
||||
}
|
||||
@ -285,15 +278,14 @@ if ($_POST['action'] == "setabsolutediscount" && $user->rights->commande->creer)
|
||||
{
|
||||
if ($_POST["remise_id"])
|
||||
{
|
||||
$com = new Commande($db);
|
||||
$ret=$com->fetch($comid);
|
||||
$ret=$commande->fetch($comid);
|
||||
if ($ret > 0)
|
||||
{
|
||||
$com->insert_discount($_POST["remise_id"]);
|
||||
$commande->insert_discount($_POST["remise_id"]);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db,$com->error);
|
||||
dol_print_error($db,$commande->error);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -303,7 +295,6 @@ if ($_POST['action'] == 'setdate' && $user->rights->commande->creer)
|
||||
//print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year'];
|
||||
$date=dol_mktime(0, 0, 0, $_POST['order_month'], $_POST['order_day'], $_POST['order_year']);
|
||||
|
||||
$commande = new Commande($db);
|
||||
$commande->fetch($comid);
|
||||
$result=$commande->set_date($user,$date);
|
||||
if ($result < 0)
|
||||
@ -317,7 +308,6 @@ if ($_POST['action'] == 'setdate_livraison' && $user->rights->commande->creer)
|
||||
//print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year'];
|
||||
$datelivraison=dol_mktime(0, 0, 0, $_POST['liv_month'], $_POST['liv_day'], $_POST['liv_year']);
|
||||
|
||||
$commande = new Commande($db);
|
||||
$commande->fetch($comid);
|
||||
$result=$commande->set_date_livraison($user,$datelivraison);
|
||||
if ($result < 0)
|
||||
@ -328,14 +318,12 @@ if ($_POST['action'] == 'setdate_livraison' && $user->rights->commande->creer)
|
||||
|
||||
if ($_POST['action'] == 'setaddress' && $user->rights->commande->creer)
|
||||
{
|
||||
$commande = new Commande($db);
|
||||
$commande->fetch($comid);
|
||||
$commande->set_adresse_livraison($user,$_POST['fk_address']);
|
||||
}
|
||||
|
||||
if ($_POST['action'] == 'setmode' && $user->rights->commande->creer)
|
||||
{
|
||||
$commande = new Commande($db);
|
||||
$commande->fetch($comid);
|
||||
$result=$commande->mode_reglement($_POST['mode_reglement_id']);
|
||||
if ($result < 0) dol_print_error($db,$commande->error);
|
||||
@ -343,7 +331,6 @@ if ($_POST['action'] == 'setmode' && $user->rights->commande->creer)
|
||||
|
||||
if ($_POST['action'] == 'setconditions' && $user->rights->commande->creer)
|
||||
{
|
||||
$commande = new Commande($db);
|
||||
$commande->fetch($comid);
|
||||
$result=$commande->cond_reglement($_POST['cond_reglement_id']);
|
||||
if ($result < 0) dol_print_error($db,$commande->error);
|
||||
@ -351,14 +338,12 @@ if ($_POST['action'] == 'setconditions' && $user->rights->commande->creer)
|
||||
|
||||
if ($_REQUEST['action'] == 'setremisepercent' && $user->rights->facture->creer)
|
||||
{
|
||||
$commande = new Commande($db);
|
||||
$commande->fetch($comid);
|
||||
$result = $commande->set_remise($user, $_POST['remise_percent']);
|
||||
}
|
||||
|
||||
if ($_REQUEST['action'] == 'setremiseabsolue' && $user->rights->facture->creer)
|
||||
{
|
||||
$commande = new Commande($db);
|
||||
$commande->fetch($comid);
|
||||
$result = $commande->set_remise_absolue($user, $_POST['remise_absolue']);
|
||||
}
|
||||
@ -368,7 +353,6 @@ if ($_REQUEST['action'] == 'setremiseabsolue' && $user->rights->facture->creer)
|
||||
*/
|
||||
if ($_POST['action'] == 'addline' && $user->rights->commande->creer)
|
||||
{
|
||||
$commande = new Commande($db);
|
||||
$result=0;
|
||||
|
||||
if (empty($_POST['idprod']) && $_POST["type"] < 0)
|
||||
@ -525,7 +509,6 @@ if ($_POST['action'] == 'addline' && $user->rights->commande->creer)
|
||||
*/
|
||||
if ($_POST['action'] == 'updateligne' && $user->rights->commande->creer && $_POST['save'] == $langs->trans('Save'))
|
||||
{
|
||||
$commande = new Commande($db);
|
||||
if (! $commande->fetch($comid) > 0) dol_print_error($db);
|
||||
$commande->fetch_thirdparty();
|
||||
|
||||
@ -623,7 +606,6 @@ if ($_POST['action'] == 'updateligne' && $user->rights->commande->creer && $_POS
|
||||
|
||||
if ($_REQUEST['action'] == 'confirm_validate' && $_REQUEST['confirm'] == 'yes' && $user->rights->commande->valider)
|
||||
{
|
||||
$commande = new Commande($db);
|
||||
$commande->fetch($comid); // Load order and lines
|
||||
$commande->fetch_thirdparty();
|
||||
|
||||
@ -646,7 +628,6 @@ if ($_REQUEST['action'] == 'confirm_validate' && $_REQUEST['confirm'] == 'yes' &
|
||||
|
||||
if ($_REQUEST['action'] == 'confirm_close' && $_REQUEST['confirm'] == 'yes' && $user->rights->commande->cloturer)
|
||||
{
|
||||
$commande = new Commande($db);
|
||||
$commande->fetch($comid); // Load order and lines
|
||||
|
||||
$result = $commande->cloture($user);
|
||||
@ -654,7 +635,6 @@ if ($_REQUEST['action'] == 'confirm_close' && $_REQUEST['confirm'] == 'yes' && $
|
||||
|
||||
if ($_REQUEST['action'] == 'confirm_cancel' && $_REQUEST['confirm'] == 'yes' && $user->rights->commande->valider)
|
||||
{
|
||||
$commande = new Commande($db);
|
||||
$commande->fetch($comid); // Load order and lines
|
||||
|
||||
$result = $commande->cancel($user);
|
||||
@ -665,7 +645,6 @@ if ($_GET['action'] == 'modif' && $user->rights->commande->creer)
|
||||
/*
|
||||
* Repasse la commande en mode brouillon
|
||||
*/
|
||||
$commande = new Commande($db);
|
||||
$commande->fetch($comid); // Load order and lines
|
||||
$commande->fetch_thirdparty();
|
||||
|
||||
@ -692,7 +671,6 @@ if ($_GET['action'] == 'modif' && $user->rights->commande->creer)
|
||||
|
||||
if ($_GET['action'] == 'up' && $user->rights->commande->creer)
|
||||
{
|
||||
$commande = new Commande($db);
|
||||
$commande->fetch($comid);
|
||||
$commande->fetch_thirdparty();
|
||||
$commande->line_up($_GET['rowid']);
|
||||
@ -716,7 +694,6 @@ if ($_GET['action'] == 'up' && $user->rights->commande->creer)
|
||||
|
||||
if ($_GET['action'] == 'down' && $user->rights->commande->creer)
|
||||
{
|
||||
$commande = new Commande($db);
|
||||
$commande->fetch($comid);
|
||||
$commande->fetch_thirdparty();
|
||||
$commande->line_down($_GET['rowid']);
|
||||
@ -745,7 +722,6 @@ if ($_REQUEST['action'] == 'builddoc') // In get or post
|
||||
*/
|
||||
|
||||
// Sauvegarde le dernier modele choisi pour generer un document
|
||||
$commande = new Commande($db);
|
||||
$result=$commande->fetch($comid);
|
||||
$commande->fetch_thirdparty();
|
||||
|
||||
@ -780,9 +756,7 @@ if ($_REQUEST['action'] == 'builddoc') // In get or post
|
||||
// Remove file in doc form
|
||||
if ($_REQUEST['action'] == 'remove_file')
|
||||
{
|
||||
$com = new Commande($db);
|
||||
|
||||
if ($com->fetch($id))
|
||||
if ($commande->fetch($id))
|
||||
{
|
||||
$upload_dir = $conf->commande->dir_output . "/";
|
||||
$file = $upload_dir . '/' . $_GET['file'];
|
||||
@ -832,7 +806,6 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile']
|
||||
{
|
||||
$langs->load('mails');
|
||||
|
||||
$commande= new Commande($db);
|
||||
$result=$commande->fetch($_POST['orderid']);
|
||||
$result=$commande->fetch_thirdparty();
|
||||
|
||||
@ -1003,8 +976,6 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer)
|
||||
|
||||
if ($mesg) print $mesg.'<br>';
|
||||
|
||||
$new_commande = new Commande($db);
|
||||
|
||||
if ($propalid)
|
||||
{
|
||||
$sql = 'SELECT s.nom, s.prefix_comm, s.rowid';
|
||||
@ -1306,7 +1277,6 @@ else
|
||||
|
||||
$product_static=new Product($db);
|
||||
|
||||
$commande = new Commande($db);
|
||||
$result=$commande->fetch($comid,$ref);
|
||||
if ($result > 0)
|
||||
{
|
||||
@ -1674,22 +1644,8 @@ else
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
$result = $commande->getLinesArray();
|
||||
//var_dump($commande->lines);
|
||||
|
||||
if (! empty($commande->lines))
|
||||
{
|
||||
if (! empty($hooks->objModules))
|
||||
{
|
||||
// TODO traitement des hooks
|
||||
$commande->print_title_list();
|
||||
$commande->printLinesList();
|
||||
}
|
||||
else
|
||||
{
|
||||
$commande->print_title_list();
|
||||
$commande->printLinesList();
|
||||
}
|
||||
}
|
||||
$commande->print_title_list();
|
||||
$commande->printLinesList();
|
||||
|
||||
$numlines=sizeof($commande->lines);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user