Qual: uniformize code
This commit is contained in:
parent
39e8ff606e
commit
156a1e6b29
@ -150,7 +150,7 @@ if ($_REQUEST['action'] == 'confirm_deleteline' && $_REQUEST['confirm'] == 'yes'
|
||||
{
|
||||
$propal->fetch($_GET["id"]);
|
||||
$propal->fetch_thirdparty();
|
||||
$result = $propal->delete_product($_GET['lineid']);
|
||||
$result = $propal->deleteline($_GET['lineid']);
|
||||
// reorder lines
|
||||
if ($result) $propal->line_order(true);
|
||||
|
||||
|
||||
@ -527,11 +527,11 @@ class Propal extends CommonObject
|
||||
* \param idligne Id de la ligne detail a supprimer
|
||||
* \return int >0 si ok, <0 si ko
|
||||
*/
|
||||
function delete_product($idligne)
|
||||
function deleteline($lineid)
|
||||
{
|
||||
if ($this->statut == 0)
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."propaldet WHERE rowid = ".$idligne;
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."propaldet WHERE rowid = ".$lineid;
|
||||
|
||||
if ($this->db->query($sql) )
|
||||
{
|
||||
|
||||
@ -1403,7 +1403,7 @@ class Commande extends CommonObject
|
||||
* \param idligne Id de la ligne a supprimer
|
||||
* \return int >0 si ok, 0 si rien a supprimer, <0 si ko
|
||||
*/
|
||||
function delete_line($idligne)
|
||||
function deleteline($lineid)
|
||||
{
|
||||
global $user;
|
||||
|
||||
@ -1413,7 +1413,7 @@ class Commande extends CommonObject
|
||||
|
||||
$sql = "SELECT fk_product, qty";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."commandedet";
|
||||
$sql.= " WHERE rowid = ".$idligne;
|
||||
$sql.= " WHERE rowid = ".$lineid;
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
@ -1428,7 +1428,7 @@ class Commande extends CommonObject
|
||||
// Supprime ligne
|
||||
$line = new OrderLine($this->db);
|
||||
|
||||
$line->id = $idligne;
|
||||
$line->id = $lineid;
|
||||
$line->fk_commande = $this->id; // On en a besoin dans les triggers
|
||||
|
||||
$result=$line->delete($user);
|
||||
|
||||
@ -154,7 +154,7 @@ if ($_REQUEST['action'] == 'confirm_deleteline' && $_REQUEST['confirm'] == 'yes'
|
||||
$commande->fetch($comid);
|
||||
$commande->fetch_thirdparty();
|
||||
|
||||
$result = $commande->delete_line($_GET['lineid']);
|
||||
$result = $commande->deleteline($_GET['lineid']);
|
||||
if ($result > 0)
|
||||
{
|
||||
// Define output language
|
||||
@ -1352,6 +1352,15 @@ else
|
||||
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$commande->id.'&lineid='.$_GET["lineid"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 0, 1);
|
||||
if ($ret == 'html') print '<br>';
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO ajout temporaire pour test en attendant la migration en template
|
||||
*/
|
||||
if ($_GET['action'] == 'ask_deletemilestone')
|
||||
{
|
||||
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$commande->id.'&lineid='.$_GET["lineid"], $langs->trans('DeleteMilestone'), $langs->trans('ConfirmDeleteMilestone'), 'confirm_deletemilestone','',0,1);
|
||||
if ($ret == 'html') print '<br>';
|
||||
}
|
||||
|
||||
// Clone confirmation
|
||||
if ($_GET["action"] == 'clone')
|
||||
|
||||
@ -150,14 +150,14 @@ if ($_REQUEST['action'] == 'confirm_delete' && $_REQUEST['confirm'] == 'yes' &&
|
||||
/*
|
||||
* Supprime une ligne produit AVEC ou SANS confirmation
|
||||
*/
|
||||
if ($_REQUEST['action'] == 'confirm_deleteproductline' && $_REQUEST['confirm'] == 'yes')
|
||||
if ($_REQUEST['action'] == 'confirm_deleteline' && $_REQUEST['confirm'] == 'yes')
|
||||
{
|
||||
if ($user->rights->facture->creer)
|
||||
{
|
||||
$object->fetch($facid);
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$result = $object->deleteline($_GET['rowid'], $user);
|
||||
$result = $object->deleteline($_GET['lineid'], $user);
|
||||
if ($result > 0)
|
||||
{
|
||||
// Define output language
|
||||
@ -2083,9 +2083,18 @@ else
|
||||
}
|
||||
|
||||
// Confirmation de la suppression d'une ligne produit
|
||||
if ($_GET['action'] == 'delete_product_line')
|
||||
if ($_GET['action'] == 'ask_deleteline')
|
||||
{
|
||||
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$object->id.'&rowid='.$_GET["rowid"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteproductline', '', 'no', 1);
|
||||
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$object->id.'&lineid='.$_GET["lineid"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 'no', 1);
|
||||
if ($ret == 'html') print '<br>';
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO ajout temporaire pour test en attendant la migration en template
|
||||
*/
|
||||
if ($_GET['action'] == 'ask_deletemilestone')
|
||||
{
|
||||
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$object->id.'&lineid='.$_GET["lineid"], $langs->trans('DeleteMilestone'), $langs->trans('ConfirmDeleteMilestone'), 'confirm_deletemilestone','',0,1);
|
||||
if ($ret == 'html') print '<br>';
|
||||
}
|
||||
|
||||
|
||||
@ -102,6 +102,7 @@ class Facture extends CommonObject
|
||||
var $lignes=array(); // TODO deprecated
|
||||
var $lines=array();
|
||||
var $line;
|
||||
var $clone_fromid;
|
||||
//! Pour board
|
||||
var $nbtodo;
|
||||
var $nbtodolate;
|
||||
@ -452,6 +453,7 @@ class Facture extends CommonObject
|
||||
$object->fetch($fromid);
|
||||
$object->id=0;
|
||||
$object->statut=0;
|
||||
$object->clone_fromid=$fromid;
|
||||
|
||||
// Clear fields
|
||||
$object->user_author = $user->id;
|
||||
|
||||
@ -964,7 +964,7 @@ class Contrat extends CommonObject
|
||||
* \param user User that delete
|
||||
* \return int >0 if OK, <0 if KO
|
||||
*/
|
||||
function delete_line($idline,$user)
|
||||
function deleteline($idline,$user)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
|
||||
@ -365,7 +365,7 @@ if ($_REQUEST["action"] == 'confirm_deleteline' && $_REQUEST["confirm"] == 'yes'
|
||||
{
|
||||
$contrat = new Contrat($db);
|
||||
$contrat->fetch($_GET["id"]);
|
||||
$result = $contrat->delete_line($_GET["lineid"],$user);
|
||||
$result = $contrat->deleteline($_GET["lineid"],$user);
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
|
||||
@ -543,12 +543,12 @@ class Expedition extends CommonObject
|
||||
*
|
||||
*
|
||||
*/
|
||||
function delete_line($id)
|
||||
function deleteline($lineid)
|
||||
{
|
||||
if ($this->statut == 0)
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."commandedet";
|
||||
$sql.= " WHERE rowid = ".$id;
|
||||
$sql.= " WHERE rowid = ".$lineid;
|
||||
|
||||
if ($this->db->query($sql) )
|
||||
{
|
||||
|
||||
@ -1024,16 +1024,16 @@ class FichinterLigne
|
||||
* \brief Supprime une ligne d'intervention
|
||||
* \return int >0 si ok, <0 si ko
|
||||
*/
|
||||
function delete_line()
|
||||
function deleteline()
|
||||
{
|
||||
if ($this->statut == 0)
|
||||
{
|
||||
dol_syslog("FichinterLigne::delete_line lineid=".$this->rowid);
|
||||
dol_syslog("FichinterLigne::deleteline lineid=".$this->rowid);
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."fichinterdet WHERE rowid = ".$this->rowid;
|
||||
$resql = $this->db->query($sql);
|
||||
dol_syslog("FichinterLigne::delete_line sql=".$sql);
|
||||
dol_syslog("FichinterLigne::deleteline sql=".$sql);
|
||||
|
||||
if ($resql)
|
||||
{
|
||||
@ -1052,7 +1052,7 @@ class FichinterLigne
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error()." sql=".$sql;
|
||||
dol_syslog("FichinterLigne::delete_line Error ".$this->error, LOG_ERR);
|
||||
dol_syslog("FichinterLigne::deleteline Error ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -358,7 +358,7 @@ if ($_REQUEST['action'] == 'confirm_deleteline' && $_REQUEST['confirm'] == 'yes'
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
$result=$fichinterline->delete_line();
|
||||
$result=$fichinterline->deleteline();
|
||||
$fichinter = new Fichinter($db);
|
||||
if ($fichinter->fetch($fichinterline->fk_fichinter) <= 0)
|
||||
{
|
||||
|
||||
@ -1000,14 +1000,14 @@ class CommandeFournisseur extends Commande
|
||||
* Delete line
|
||||
* @param idligne
|
||||
*/
|
||||
function delete_line($idligne)
|
||||
function deleteline($idligne)
|
||||
{
|
||||
if ($this->statut == 0)
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."commande_fournisseurdet WHERE rowid = ".$idligne;
|
||||
$resql=$this->db->query($sql);
|
||||
|
||||
dol_syslog("Fournisseur.commande.class::delete_line sql=".$sql);
|
||||
dol_syslog("Fournisseur.commande.class::deleteline sql=".$sql);
|
||||
if ($resql)
|
||||
{
|
||||
$result=$this->update_price();
|
||||
|
||||
@ -275,7 +275,7 @@ if ($_REQUEST['action'] == 'confirm_deleteproductline' && $_REQUEST['confirm'] =
|
||||
{
|
||||
$commande = new CommandeFournisseur($db);
|
||||
$commande->fetch($id);
|
||||
$result = $commande->delete_line($_GET['lineid']);
|
||||
$result = $commande->deleteline($_GET['lineid']);
|
||||
|
||||
$outputlangs = $langs;
|
||||
if (! empty($_REQUEST['lang_id']))
|
||||
|
||||
@ -537,12 +537,12 @@ class Livraison extends CommonObject
|
||||
*
|
||||
*
|
||||
*/
|
||||
function delete_line($idligne)
|
||||
function deleteline($lineid)
|
||||
{
|
||||
if ($this->statut == 0)
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."commandedet";
|
||||
$sql.= " WHERE rowid = ".$idligne;
|
||||
$sql.= " WHERE rowid = ".$lineid;
|
||||
|
||||
if ($this->db->query($sql) )
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user