New: not reload page with dialog confirm

Fix: problem with external module constraint
This commit is contained in:
Regis Houssin 2011-05-14 14:35:04 +00:00
parent b08844f915
commit 781fe52b39
3 changed files with 6 additions and 7 deletions

View File

@ -579,6 +579,7 @@ class Product extends CommonObject
$prod_use = $this->verif_prod_use($id); $prod_use = $this->verif_prod_use($id);
if ($prod_use == 0) if ($prod_use == 0)
{ {
// TODO possibility to add external module constraint
$elements = array('product_price','product_price_min','product_lang','categorie_product'); $elements = array('product_price','product_price_min','product_lang','categorie_product');
foreach($elements as $table) foreach($elements as $table)
@ -588,13 +589,14 @@ class Product extends CommonObject
$result = $this->db->query($sql); $result = $this->db->query($sql);
} }
$sqlz = "DELETE from ".MAIN_DB_PREFIX."product"; $sqlz = "DELETE FROM ".MAIN_DB_PREFIX."product";
$sqlz.= " WHERE rowid = ".$id; $sqlz.= " WHERE rowid = ".$id;
$resultz = $this->db->query($sqlz); $resultz = $this->db->query($sqlz);
if ( !$resultz ) if ( ! $resultz )
{ {
dol_syslog('Product::delete error sqlz='.$sqlz, LOG_ERR); dol_syslog('Product::delete error sqlz='.$sqlz, LOG_ERR);
$error++;
} }
// Appel des triggers // Appel des triggers

View File

@ -1028,7 +1028,7 @@ if ($id || $ref)
$picto=($product->type==1?'service':'product'); $picto=($product->type==1?'service':'product');
dol_fiche_head($head, 'card', $titre, 0, $picto); dol_fiche_head($head, 'card', $titre, 0, $picto);
// Confirmation de la suppression de la facture // Confirm delete product
if ($action == 'delete' || ($conf->use_javascript_ajax && $conf->global->MAIN_CONFIRM_AJAX)) if ($action == 'delete' || ($conf->use_javascript_ajax && $conf->global->MAIN_CONFIRM_AJAX))
{ {
$ret=$html->form_confirm("fiche.php?id=".$product->id,$langs->trans("DeleteProduct"),$langs->trans("ConfirmDeleteProduct"),"confirm_delete",'',0,"action-delete"); $ret=$html->form_confirm("fiche.php?id=".$product->id,$langs->trans("DeleteProduct"),$langs->trans("ConfirmDeleteProduct"),"confirm_delete",'',0,"action-delete");

View File

@ -234,10 +234,7 @@ if ($resql)
llxHeader('',$title,$helpurl,''); llxHeader('',$title,$helpurl,'');
// Displays product removal confirmation // Displays product removal confirmation
if (!empty($_GET['delprod'])) if (GETPOST('delprod')) dol_htmloutput_mesg($langs->trans("ProductDeleted",GETPOST('delprod')));
{
print '<div class="warning">'.$langs->trans("ProductDeleted",$_GET['delprod']).'</div><br>';
}
$param="&amp;sref=".$sref.($sbarcode?"&amp;sbarcode=".$sbarcode:"")."&amp;snom=".$snom."&amp;sall=".$sall."&amp;tosell=".$tosell."&amp;tobuy=".$tobuy; $param="&amp;sref=".$sref.($sbarcode?"&amp;sbarcode=".$sbarcode:"")."&amp;snom=".$snom."&amp;sall=".$sall."&amp;tosell=".$tosell."&amp;tobuy=".$tobuy;
$param.=($fourn_id?"&amp;fourn_id=".$fourn_id:""); $param.=($fourn_id?"&amp;fourn_id=".$fourn_id:"");