From 156a1e6b29a4363065eb1b7fd7817aa416310744 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 10 Sep 2010 14:35:07 +0000 Subject: [PATCH] Qual: uniformize code --- htdocs/comm/propal.php | 2 +- htdocs/comm/propal/class/propal.class.php | 4 ++-- htdocs/commande/class/commande.class.php | 6 +++--- htdocs/commande/fiche.php | 11 ++++++++++- htdocs/compta/facture.php | 17 +++++++++++++---- htdocs/compta/facture/class/facture.class.php | 2 ++ htdocs/contrat/class/contrat.class.php | 2 +- htdocs/contrat/fiche.php | 2 +- htdocs/expedition/class/expedition.class.php | 4 ++-- htdocs/fichinter/class/fichinter.class.php | 8 ++++---- htdocs/fichinter/fiche.php | 2 +- .../fourn/class/fournisseur.commande.class.php | 4 ++-- htdocs/fourn/commande/fiche.php | 2 +- htdocs/livraison/class/livraison.class.php | 4 ++-- 14 files changed, 45 insertions(+), 25 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index da1fb65fd76..4f043a1dcc5 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -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); diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 94800573174..c4f63024293 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -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) ) { diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 9a673ee2e1c..32e1970a2f3 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -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); diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 3c4d0481b28..b0259ea3349 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -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 '
'; } + + /* + * 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 '
'; + } // Clone confirmation if ($_GET["action"] == 'clone') diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index a9d57685d9d..f5b6fec1023 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -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 '
'; + } + + /* + * 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 '
'; } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 55bd253d6d2..da45c447480 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -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; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 2d58d6b65f6..e41f138904d 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -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; diff --git a/htdocs/contrat/fiche.php b/htdocs/contrat/fiche.php index 50948548323..e4a979ac5b4 100644 --- a/htdocs/contrat/fiche.php +++ b/htdocs/contrat/fiche.php @@ -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) { diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index dc27944b01b..68268db861a 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -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) ) { diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 57b126b49ae..72fce9857c9 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -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; } diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php index 2000e89f7e9..89d86cb0176 100644 --- a/htdocs/fichinter/fiche.php +++ b/htdocs/fichinter/fiche.php @@ -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) { diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index b78918f5411..5783ca1bb01 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -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(); diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php index 0b2ae6e2c2e..0406926fdc5 100644 --- a/htdocs/fourn/commande/fiche.php +++ b/htdocs/fourn/commande/fiche.php @@ -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'])) diff --git a/htdocs/livraison/class/livraison.class.php b/htdocs/livraison/class/livraison.class.php index 3484b0a371b..f83b33081ba 100644 --- a/htdocs/livraison/class/livraison.class.php +++ b/htdocs/livraison/class/livraison.class.php @@ -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) ) {