Qual: Use a so much simpler way to have ajax confirmation boxes

This commit is contained in:
Laurent Destailleur 2009-05-06 16:27:45 +00:00
parent 64db204c29
commit 3ccecb4e7f
10 changed files with 233 additions and 224 deletions

View File

@ -224,7 +224,7 @@ if ($_POST['action'] == 'updateligne' && $user->rights->fournisseur->commande->c
}
}
if ($_REQUEST['action'] == 'confirm_deleteproductline' && ($_POST['confirm'] == 'yes' || empty($conf->global->PRODUIT_CONFIRM_DELETE_LINE)))
if ($_REQUEST['action'] == 'confirm_deleteproductline' && ($_REQUEST['confirm'] == 'yes' || empty($conf->global->PRODUIT_CONFIRM_DELETE_LINE)))
{
if ($user->rights->fournisseur->commande->creer)
{
@ -262,21 +262,21 @@ if ($_REQUEST['action'] == 'confirm_valid' && $_REQUEST['confirm'] == 'yes' && $
}
}
if ($_POST['action'] == 'confirm_approve' && $_POST["confirm"] == 'yes' && $user->rights->fournisseur->commande->approuver)
if ($_REQUEST['action'] == 'confirm_approve' && $_REQUEST["confirm"] == 'yes' && $user->rights->fournisseur->commande->approuver)
{
$commande = new CommandeFournisseur($db);
$commande->fetch($id);
$result = $commande->approve($user);
}
if ($_POST['action'] == 'confirm_refuse' && $_POST['confirm'] == 'yes' && $user->rights->fournisseur->commande->approuver)
if ($_REQUEST['action'] == 'confirm_refuse' && $_REQUEST['confirm'] == 'yes' && $user->rights->fournisseur->commande->approuver)
{
$commande = new CommandeFournisseur($db);
$commande->fetch($id);
$result = $commande->refuse($user);
}
if ($_POST['action'] == 'confirm_commande' && $_POST['confirm'] == 'yes' && $user->rights->fournisseur->commande->commander)
if ($_REQUEST['action'] == 'confirm_commande' && $_REQUEST['confirm'] == 'yes' && $user->rights->fournisseur->commande->commander)
{
$commande = new CommandeFournisseur($db);
$commande->fetch($id);
@ -284,7 +284,7 @@ if ($_POST['action'] == 'confirm_commande' && $_POST['confirm'] == 'yes' && $use
}
if ($_POST['action'] == 'confirm_delete' && $_POST['confirm'] == 'yes' && $user->rights->fournisseur->commande->creer)
if ($_REQUEST['action'] == 'confirm_delete' && $_REQUEST['confirm'] == 'yes' && $user->rights->fournisseur->commande->creer)
{
$commande = new CommandeFournisseur($db);
$commande->id = $id;
@ -320,13 +320,20 @@ if ($_POST["action"] == 'livraison' && $user->rights->fournisseur->commande->rec
}
}
if ($_POST["action"] == 'confirm_cancel' && $_POST["confirm"] == yes && $user->rights->fournisseur->commande->annuler)
if ($_REQUEST["action"] == 'confirm_cancel' && $_REQUEST["confirm"] == 'yes' && $user->rights->fournisseur->commande->annuler)
{
$commande = new CommandeFournisseur($db);
$commande->fetch($id);
$result = $commande->cancel($user);
Header("Location: fiche.php?id=".$id);
exit;
if ($result > 0)
{
Header("Location: fiche.php?id=".$id);
exit;
}
else
{
$mesg=$commande->error;
}
}
/*
@ -501,7 +508,7 @@ if ($id > 0 || ! empty($ref))
*/
if ($_GET['action'] == 'delete')
{
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('DeleteOrder'), $langs->trans('ConfirmDeleteOrder'), 'confirm_delete');
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('DeleteOrder'), $langs->trans('ConfirmDeleteOrder'), 'confirm_delete', '', 0, 2);
if ($ret == 'html') print '<br>';
}
@ -525,7 +532,7 @@ if ($id > 0 || ! empty($ref))
$text.=$notify->confirmMessage(3,$commande->socid);
}
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('ValidateOrder'), $text, 'confirm_valid');
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('ValidateOrder'), $text, 'confirm_valid', '', 0, ($conf->notification->enabled?0:1));
if ($ret == 'html') print '<br>';
}
/*
@ -534,7 +541,7 @@ if ($id > 0 || ! empty($ref))
*/
if ($_GET['action'] == 'approve')
{
$ret=$html->form_confirm("fiche.php?id=$commande->id",$langs->trans("ApproveThisOrder"),$langs->trans("ConfirmApproveThisOrder"),"confirm_approve");
$ret=$html->form_confirm("fiche.php?id=$commande->id",$langs->trans("ApproveThisOrder"),$langs->trans("ConfirmApproveThisOrder"),"confirm_approve", '', 1, 1);
if ($ret == 'html') print '<br>';
}
/*
@ -543,7 +550,7 @@ if ($id > 0 || ! empty($ref))
*/
if ($_GET['action'] == 'refuse')
{
$ret=$html->form_confirm("fiche.php?id=$commande->id",$langs->trans("DenyingThisOrder"),$langs->trans("ConfirmDenyingThisOrder"),"confirm_refuse");
$ret=$html->form_confirm("fiche.php?id=$commande->id",$langs->trans("DenyingThisOrder"),$langs->trans("ConfirmDenyingThisOrder"),"confirm_refuse", '', 0, 1);
if ($ret == 'html') print '<br>';
}
/*
@ -551,7 +558,7 @@ if ($id > 0 || ! empty($ref))
*/
if ($_GET['action'] == 'cancel')
{
$ret=$html->form_confirm("fiche.php?id=$commande->id",$langs->trans("Cancel"),$langs->trans("ConfirmCancelThisOrder"),"confirm_cancel");
$ret=$html->form_confirm("fiche.php?id=$commande->id",$langs->trans("Cancel"),$langs->trans("ConfirmCancelThisOrder"),"confirm_cancel", '', 0, 1);
if ($ret == 'html') print '<br>';
}
@ -571,7 +578,7 @@ if ($id > 0 || ! empty($ref))
*/
if ($_GET['action'] == 'delete_product_line' && ! empty($conf->global->PRODUIT_CONFIRM_DELETE_LINE))
{
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$commande->id.'&amp;lineid='.$_GET["lineid"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteproductline');
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$commande->id.'&amp;lineid='.$_GET["lineid"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteproductline','',0,2);
if ($ret == 'html') print '<br>';
}

View File

@ -55,7 +55,7 @@ $action=isset($_GET['action'])?$_GET['action']:$_POST['action'];
*/
// Action clone object
if ($_POST["action"] == 'confirm_clone' && $_POST['confirm'] == 'yes')
if ($_REQUEST["action"] == 'confirm_clone' && $_REQUEST['confirm'] == 'yes')
{
if (1==0 && empty($_REQUEST["clone_content"]) && empty($_REQUEST["clone_receivers"]))
{
@ -87,7 +87,7 @@ if ($_REQUEST['action'] == 'confirm_valid' && $_REQUEST['confirm'] == 'yes' && $
$result = $facturefourn->set_valid($user);
}
if ($_POST['action'] == 'confirm_delete' && $_POST['confirm'] == 'yes')
if ($_REQUEST['action'] == 'confirm_delete' && $_REQUEST['confirm'] == 'yes')
{
if ($user->rights->fournisseur->facture->supprimer )
{
@ -577,7 +577,7 @@ else
// Confirmation de la suppression d'une ligne produit
if ($_GET['action'] == 'confirm_delete_line')
{
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$fac->id.'&amp;ligne_id='.$_GET["ligne_id"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteproductline');
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$fac->id.'&amp;ligne_id='.$_GET["ligne_id"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteproductline', '', 0, 0);
if ($ret == 'html') print '<br>';
}
@ -590,21 +590,21 @@ else
//array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1)
);
// Paiement incomplet. On demande si motif = escompte ou autre
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$fac->id,$langs->trans('CloneInvoice'),$langs->trans('ConfirmCloneInvoice',$fac->ref),'confirm_clone',$formquestion,'yes');
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$fac->id,$langs->trans('CloneInvoice'),$langs->trans('ConfirmCloneInvoice',$fac->ref),'confirm_clone',$formquestion,'yes', 1);
if ($ret == 'html') print '<br>';
}
// Confirmation de la validation
if ($_GET['action'] == 'valid')
{
$ret=$html->form_confirm('fiche.php?facid='.$fac->id, $langs->trans('ValidateBill'), $langs->trans('ConfirmValidateBill', $fac->ref), 'confirm_valid');
$ret=$html->form_confirm('fiche.php?facid='.$fac->id, $langs->trans('ValidateBill'), $langs->trans('ConfirmValidateBill', $fac->ref), 'confirm_valid', '', 0, 1);
if ($ret == 'html') print '<br>';
}
// Confirmation de la validation
// Confirmation set payed
if ($_GET['action'] == 'payed')
{
$ret=$html->form_confirm('fiche.php?facid='.$fac->id, $langs->trans('ClassifyPayed'), $langs->trans('ConfirmClassifyPayedBill', $fac->ref), 'confirm_payed');
$ret=$html->form_confirm('fiche.php?facid='.$fac->id, $langs->trans('ClassifyPayed'), $langs->trans('ConfirmClassifyPayedBill', $fac->ref), 'confirm_payed', '', 0, 1);
if ($ret == 'html') print '<br>';
}
@ -613,7 +613,7 @@ else
*/
if ($_GET['action'] == 'delete')
{
$ret=$html->form_confirm('fiche.php?facid='.$fac->id, $langs->trans('DeleteBill'), $langs->trans('ConfirmDeleteBill'), 'confirm_delete');
$ret=$html->form_confirm('fiche.php?facid='.$fac->id, $langs->trans('DeleteBill'), $langs->trans('ConfirmDeleteBill'), 'confirm_delete', '', 0, 1);
if ($ret == 'html') print '<br>';
}

View File

@ -88,8 +88,8 @@ if ($action == 'add_paiement')
// d'un paiement
if (! $_POST['accountid'])
{
$mesg = '<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('AccountToCredit')).'</div>';
$error++;
$mesg = '<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('AccountToCredit')).'</div>';
$error++;
}
}
@ -191,10 +191,7 @@ llxHeader();
$html=new Form($db);
if ($mesg)
{
print '<tr><td colspan="3" align="center">'.$mesg.'</td></tr>';
}
if ($mesg) print $mesg;
if ($action == 'create' || $action == 'add_paiement')
{
@ -222,6 +219,7 @@ if ($action == 'create' || $action == 'add_paiement')
$total = $obj->total;
print_fiche_titre($langs->trans('DoPayment'));
print '<form name="addpaiement" action="paiement.php" method="post">';
print '<input type="hidden" name="action" value="add_paiement">';
print '<input type="hidden" name="facid" value="'.$facid.'">';

View File

@ -80,7 +80,7 @@ class CommandeFournisseur extends Commande
function fetch($id,$ref='')
{
global $conf;
$sql = "SELECT c.rowid, c.ref, c.date_creation, c.fk_soc, c.fk_user_author, c.fk_statut, c.amount_ht, c.total_ht, c.total_ttc, c.tva,";
$sql.= " ".$this->db->pdate("c.date_commande")." as date_commande, c.fk_projet as fk_project, c.remise_percent, c.source, c.fk_methode_commande,";
$sql.= " c.note, c.note_public, c.model_pdf,";
@ -119,7 +119,7 @@ class CommandeFournisseur extends Commande
$this->note = $obj->note;
$this->note_public = $obj->note_public;
$this->modelpdf = $obj->model_pdf;
$this->next_prev_filter = 'fk_soc = s.rowid AND s.entity = '.$conf->entity;
$this->db->free();
@ -322,8 +322,8 @@ class CommandeFournisseur extends Commande
$this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur SET fk_statut = ".$statut;
$sql .= " WHERE rowid = ".$this->id." AND fk_statut = 1";
$sql .= " WHERE rowid = ".$this->id;
dol_syslog("CommandeFournisseur::Cancel sql=".$sql);
if ($this->db->query($sql))
{
$result = 0;
@ -350,9 +350,9 @@ class CommandeFournisseur extends Commande
}
else
{
dol_syslog("CommandeFournisseur::Cancel Error -1");
$this->db->rollback();
$this->error=$this->db->lasterror();
dol_syslog("CommandeFournisseur::Cancel ".$this->error);
return -1;
}
}
@ -1240,7 +1240,7 @@ class CommandeFournisseur extends Commande
function ReadApprobators()
{
global $conf;
$this->approbs = array();
$sql = "SELECT u.name, u.firstname, u.email";
@ -1379,13 +1379,13 @@ class CommandeFournisseur extends Commande
// Charge tableau des id de societe socids
$socids = array();
$sql = "SELECT rowid";
$sql.= " FROM ".MAIN_DB_PREFIX."societe";
$sql.= " WHERE fournisseur=1";
$sql.= " AND entity = ".$conf->entity;
$sql.= " LIMIT 10";
$resql = $this->db->query($sql);
if ($resql)
{
@ -1402,12 +1402,12 @@ class CommandeFournisseur extends Commande
// Charge tableau des produits prodids
$prodids = array();
$sql = "SELECT rowid";
$sql.= " FROM ".MAIN_DB_PREFIX."product";
$sql.= " WHERE envente = 1";
$sql.= " AND entity = ".$conf->entity;
$resql = $this->db->query($sql);
if ($resql)
{

View File

@ -273,7 +273,7 @@ if ($_GET["action"] == 'clone' && $user->rights->produit->creer)
/*
* Suppression d'un produit/service pas encore affect
*/
if ($_POST['action'] == 'confirm_delete' && $_POST['confirm'] == 'yes' && $user->rights->produit->supprimer)
if ($_REQUEST['action'] == 'confirm_delete' && $_REQUEST['confirm'] == 'yes' && $user->rights->produit->supprimer)
{
$product = new Product($db);
$product->fetch($_GET['id']);
@ -806,7 +806,7 @@ if ($_GET["id"] || $_GET["ref"])
// Confirmation de la suppression de la facture
if ($_GET["action"] == 'delete')
{
$ret=$html->form_confirm("fiche.php?id=".$product->id,$langs->trans("DeleteProduct"),$langs->trans("ConfirmDeleteProduct"),"confirm_delete");
$ret=$html->form_confirm("fiche.php?id=".$product->id,$langs->trans("DeleteProduct"),$langs->trans("ConfirmDeleteProduct"),"confirm_delete",'',0,2);
if ($ret == 'html') print '<br>';
}

View File

@ -20,11 +20,11 @@
*/
/**
\file htdocs/product/photos.php
\ingroup product
\brief Onglet photos de la fiche produit
\version $Id$
*/
\file htdocs/product/photos.php
\ingroup product
\brief Onglet photos de la fiche produit
\version $Id$
*/
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/product.lib.php");
@ -52,32 +52,29 @@ $mesg = '';
if ($_FILES['userfile']['size'] > 0 && $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
{
if ($_GET["id"])
{
$product = new Product($db);
$result = $product->fetch($_GET["id"]);
if ($_GET["id"])
{
$product = new Product($db);
$result = $product->fetch($_GET["id"]);
// if (dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name'],1) > 0)
// if (dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name'],1) > 0)
// var_dump($_FILES);
// var_dump($_FILES);
$product->add_photo($conf->produit->dir_output, $_FILES['userfile']);
}
$product->add_photo($conf->produit->dir_output, $_FILES['userfile']);
}
}
if ($_REQUEST["action"] == 'confirm_delete' && $_GET["file"] && $_REQUEST['confirm'] == 'yes')
if ($_REQUEST["action"] == 'confirm_delete' && $_GET["file"] && $_REQUEST['confirm'] == 'yes' && $user->rights->produit->creer)
{
if ($user->rights->produit->creer)
{
$product = new Product($db);
$product->delete_photo($conf->produit->dir_output."/".$_GET["file"]);
}
$product = new Product($db);
$product->delete_photo($conf->produit->dir_output."/".$_GET["file"]);
}
if ($_GET["action"] == 'addthumb' && $_GET["file"])
{
$product = new Product($db);
$product->add_thumb($conf->produit->dir_output."/".$_GET["file"]);
$product->add_thumb($conf->produit->dir_output."/".$_GET["file"]);
}
@ -90,187 +87,187 @@ $html = new Form($db);
if ($_GET["id"] || $_GET["ref"])
{
$product = new Product($db);
if ($_GET["ref"]) $result = $product->fetch('',$_GET["ref"]);
if ($_GET["id"]) $result = $product->fetch($_GET["id"]);
$product = new Product($db);
if ($_GET["ref"]) $result = $product->fetch('',$_GET["ref"]);
if ($_GET["id"]) $result = $product->fetch($_GET["id"]);
llxHeader("","",$langs->trans("CardProduct".$product->type));
llxHeader("","",$langs->trans("CardProduct".$product->type));
if ($result)
{
/*
* En mode visu
*/
$head=product_prepare_head($product, $user);
$titre=$langs->trans("CardProduct".$product->type);
dol_fiche_head($head, 'photos', $titre);
if ($result)
{
/*
* En mode visu
*/
$head=product_prepare_head($product, $user);
$titre=$langs->trans("CardProduct".$product->type);
dol_fiche_head($head, 'photos', $titre);
/*
* Confirmation de la suppression de photo
*/
if ($_GET['action'] == 'delete')
{
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$product->id.'&amp;file='.$_GET["file"], $langs->trans('DeletePicture'), $langs->trans('ConfirmDeletePicture'), 'confirm_delete');
if ($ret == 'html') print '<br>';
}
/*
* Confirmation de la suppression de photo
*/
if ($_GET['action'] == 'delete')
{
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$product->id.'&file='.$_GET["file"], $langs->trans('DeletePicture'), $langs->trans('ConfirmDeletePicture'), 'confirm_delete', '', 0, 1);
if ($ret == 'html') print '<br>';
}
print($mesg);
print($mesg);
print '<table class="border" width="100%">';
print '<table class="border" width="100%">';
// Reference
print '<tr>';
print '<td width="15%">'.$langs->trans("Ref").'</td><td colspan="2">';
print $html->showrefnav($product,'ref','',1,'ref');
print '</td>';
print '</tr>';
// Reference
print '<tr>';
print '<td width="15%">'.$langs->trans("Ref").'</td><td colspan="2">';
print $html->showrefnav($product,'ref','',1,'ref');
print '</td>';
print '</tr>';
// Libelle
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="2">'.$product->libelle.'</td>';
print '</tr>';
// Libelle
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="2">'.$product->libelle.'</td>';
print '</tr>';
// Prix
print '<tr><td>'.$langs->trans("SellingPrice").'</td><td colspan="2">';
if ($product->price_base_type == 'TTC')
{
print price($product->price_ttc).' '.$langs->trans($product->price_base_type);
}
else
{
print price($product->price).' '.$langs->trans($product->price_base_type);
}
print '</td></tr>';
// Prix
print '<tr><td>'.$langs->trans("SellingPrice").'</td><td colspan="2">';
if ($product->price_base_type == 'TTC')
{
print price($product->price_ttc).' '.$langs->trans($product->price_base_type);
}
else
{
print price($product->price).' '.$langs->trans($product->price_base_type);
}
print '</td></tr>';
// Statut
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="2">';
print $product->getLibStatut(2);
print '</td></tr>';
// Statut
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="2">';
print $product->getLibStatut(2);
print '</td></tr>';
print "</table>\n";
print "</table>\n";
print "</div>\n";
print "</div>\n";
/* ************************************************************************** */
/* */
/* Barre d'action */
/* */
/* ************************************************************************** */
/* ************************************************************************** */
/* */
/* Barre d'action */
/* */
/* ************************************************************************** */
print "\n<div class=\"tabsAction\">\n";
print "\n<div class=\"tabsAction\">\n";
if ($_GET["action"] != 'ajout_photo' && $user->rights->produit->creer)
{
if (! empty($conf->global->MAIN_UPLOAD_DOC))
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/product/photos.php?action=ajout_photo&amp;id='.$product->id.'">';
print $langs->trans("AddPhoto").'</a>';
}
else
{
print '<a class="butActionRefused" href="#">e';
print $langs->trans("AddPhoto").'</a>';
}
}
if ($_GET["action"] != 'ajout_photo' && $user->rights->produit->creer)
{
if (! empty($conf->global->MAIN_UPLOAD_DOC))
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/product/photos.php?action=ajout_photo&amp;id='.$product->id.'">';
print $langs->trans("AddPhoto").'</a>';
}
else
{
print '<a class="butActionRefused" href="#">e';
print $langs->trans("AddPhoto").'</a>';
}
}
print "\n</div>\n";
print "\n</div>\n";
/*
* Ajouter une photo
*/
if ($_GET["action"] == 'ajout_photo' && $user->rights->produit->creer && ! empty($conf->global->MAIN_UPLOAD_DOC))
{
// Affiche formulaire upload
$formfile=new FormFile($db);
$formfile->form_attach_new_file(DOL_URL_ROOT.'/product/photos.php?id='.$product->id,$langs->trans("AddPhoto"),1);
}
/*
* Ajouter une photo
*/
if ($_GET["action"] == 'ajout_photo' && $user->rights->produit->creer && ! empty($conf->global->MAIN_UPLOAD_DOC))
{
// Affiche formulaire upload
$formfile=new FormFile($db);
$formfile->form_attach_new_file(DOL_URL_ROOT.'/product/photos.php?id='.$product->id,$langs->trans("AddPhoto"),1);
}
// Affiche photos
if ($_GET["action"] != 'ajout_photo')
{
$nbphoto=0;
$nbbyrow=5;
// Affiche photos
if ($_GET["action"] != 'ajout_photo')
{
$nbphoto=0;
$nbbyrow=5;
$maxWidth = 160;
$maxHeight = 120;
$maxWidth = 160;
$maxHeight = 120;
$pdir = get_exdir($product->id,2) . $product->id ."/photos/";
$dir = $conf->produit->dir_output . '/'. $pdir;
$pdir = get_exdir($product->id,2) . $product->id ."/photos/";
$dir = $conf->produit->dir_output . '/'. $pdir;
print '<br>';
print '<table width="100%" valign="top" align="center" border="0" cellpadding="2" cellspacing="2">';
print '<br>';
print '<table width="100%" valign="top" align="center" border="0" cellpadding="2" cellspacing="2">';
foreach ($product->liste_photos($dir) as $key => $obj)
{
$nbphoto++;
foreach ($product->liste_photos($dir) as $key => $obj)
{
$nbphoto++;
// if ($nbbyrow && $nbphoto == 1) print '<table width="100%" valign="top" align="center" border="0" cellpadding="2" cellspacing="2">';
// if ($nbbyrow && $nbphoto == 1) print '<table width="100%" valign="top" align="center" border="0" cellpadding="2" cellspacing="2">';
if ($nbbyrow && ($nbphoto % $nbbyrow == 1)) print '<tr align=center valign=middle border=1>';
if ($nbbyrow) print '<td width="'.ceil(100/$nbbyrow).'%" class="photo">';
if ($nbbyrow && ($nbphoto % $nbbyrow == 1)) print '<tr align=center valign=middle border=1>';
if ($nbbyrow) print '<td width="'.ceil(100/$nbbyrow).'%" class="photo">';
print '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&file='.urlencode($pdir.$obj['photo']).'" alt="Taille origine" target="_blank">';
print '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&file='.urlencode($pdir.$obj['photo']).'" alt="Taille origine" target="_blank">';
// Si fichier vignette disponible, on l'utilise, sinon on utilise photo origine
if ($obj['photo_vignette'])
{
$filename='thumbs/'.$obj['photo_vignette'];
}
else
{
$filename=$obj['photo'];
}
// Si fichier vignette disponible, on l'utilise, sinon on utilise photo origine
if ($obj['photo_vignette'])
{
$filename='thumbs/'.$obj['photo_vignette'];
}
else
{
$filename=$obj['photo'];
}
// Nom affiché
$viewfilename=$obj['photo'];
// Nom affiché
$viewfilename=$obj['photo'];
// Taille de l'image
$product->get_image_size($dir.$filename);
$imgWidth = ($product->imgWidth < $maxWidth) ? $product->imgWidth : $maxWidth;
$imgHeight = ($product->imgHeight < $maxHeight) ? $product->imgHeight : $maxHeight;
// Taille de l'image
$product->get_image_size($dir.$filename);
$imgWidth = ($product->imgWidth < $maxWidth) ? $product->imgWidth : $maxWidth;
$imgHeight = ($product->imgHeight < $maxHeight) ? $product->imgHeight : $maxHeight;
print '<img border="0" width="'.$imgWidth.'" height="'.$imgHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&file='.urlencode($pdir.$filename).'">';
print '<img border="0" width="'.$imgWidth.'" height="'.$imgHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&file='.urlencode($pdir.$filename).'">';
print '</a>';
print '<br>'.$viewfilename;
print '<br>';
print '</a>';
print '<br>'.$viewfilename;
print '<br>';
// On propose la génération de la vignette si elle n'existe pas et si la taille est supérieure aux limites
if (!$obj['photo_vignette'] && eregi('(\.bmp|\.gif|\.jpg|\.jpeg|\.png)$',$obj['photo']) && ($product->imgWidth > $maxWidth || $product->imgHeight > $maxHeight))
{
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'&amp;action=addthumb&amp;file='.urlencode($pdir.$viewfilename).'">'.img_refresh($langs->trans('GenerateThumb')).'&nbsp;&nbsp;</a>';
}
if ($user->rights->produit->creer)
{
// On propose la génération de la vignette si elle n'existe pas et si la taille est supérieure aux limites
if (!$obj['photo_vignette'] && eregi('(\.bmp|\.gif|\.jpg|\.jpeg|\.png)$',$obj['photo']) && ($product->imgWidth > $maxWidth || $product->imgHeight > $maxHeight))
{
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'&amp;action=addthumb&amp;file='.urlencode($pdir.$viewfilename).'">'.img_refresh($langs->trans('GenerateThumb')).'&nbsp;&nbsp;</a>';
}
if ($user->rights->produit->creer)
{
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'&amp;action=delete&amp;file='.urlencode($pdir.$viewfilename).'">';
print img_delete().'</a>';
}
if ($nbbyrow) print '</td>';
if ($nbbyrow && ($nbphoto % $nbbyrow == 0)) print '</tr>';
}
}
if ($nbbyrow) print '</td>';
if ($nbbyrow && ($nbphoto % $nbbyrow == 0)) print '</tr>';
}
// Ferme tableau
while ($nbphoto % $nbbyrow)
{
print '<td width="'.ceil(100/$nbbyrow).'%">&nbsp;</td>';
$nbphoto++;
}
// Ferme tableau
while ($nbphoto % $nbbyrow)
{
print '<td width="'.ceil(100/$nbbyrow).'%">&nbsp;</td>';
$nbphoto++;
}
if ($nbphoto < 1)
{
print '<tr align=center valign=middle border=1><td class="photo">';
print "<br>".$langs->trans("NoPhotoYet")."<br><br>";
print '</td></tr>';
}
if ($nbphoto < 1)
{
print '<tr align=center valign=middle border=1><td class="photo">';
print "<br>".$langs->trans("NoPhotoYet")."<br><br>";
print '</td></tr>';
}
print '</table>';
}
}
print '</table>';
}
}
}
else
{
print $langs->trans("ErrorUnknown");
print $langs->trans("ErrorUnknown");
}

View File

@ -955,7 +955,7 @@ else
dol_fiche_head($head, 'company', $langs->trans("ThirdParty"));
// Confirmation de la suppression de la facture
// Confirm delete third party
if ($_GET["action"] == 'delete')
{
$html = new Form($db);
@ -981,7 +981,8 @@ else
print '<tr><td>'.$langs->trans('Prefix').'</td><td colspan="3">'.$soc->prefix_comm.'</td></tr>';
if ($soc->client) {
if ($soc->client)
{
print '<tr><td>';
print $langs->trans('CustomerCode').'</td><td colspan="3">';
print $soc->code_client;

View File

@ -98,7 +98,7 @@ if ( $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
}
// Suppression fichier
if ($_POST['action'] == 'confirm_deletefile' && $_POST['confirm'] == 'yes')
if ($_REQUEST['action'] == 'confirm_deletefile' && $_REQUEST['confirm'] == 'yes')
{
$file = $upload_dir . "/" . urldecode($_GET["urlfile"]);
dol_delete_file($file);
@ -157,11 +157,11 @@ if ($socid > 0)
if ($mesg) { print "$mesg<br>"; }
/*
* Confirmation de la suppression d'une ligne produit
* Confirmation suppression fichier
*/
if ($_GET['action'] == 'delete')
{
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?socid='.$_GET["id"].'&amp;urlfile='.urldecode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile');
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?socid='.$_GET["id"].'&urlfile='.urldecode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1);
if ($ret == 'html') print '<br>';
}

View File

@ -80,7 +80,7 @@ if ($_GET["subaction"] == 'delrights' && $caneditperms)
$edituser->delrights($_GET["rights"]);
}
if ($_POST["action"] == 'confirm_disable' && $_POST["confirm"] == "yes")
if ($_REQUEST["action"] == 'confirm_disable' && $_REQUEST["confirm"] == "yes")
{
if ($_GET["id"] <> $user->id)
{
@ -92,7 +92,7 @@ if ($_POST["action"] == 'confirm_disable' && $_POST["confirm"] == "yes")
exit;
}
}
if ($_POST["action"] == 'confirm_enable' && $_POST["confirm"] == "yes")
if ($_REQUEST["action"] == 'confirm_enable' && $_REQUEST["confirm"] == "yes")
{
if ($_GET["id"] <> $user->id)
{
@ -105,7 +105,7 @@ if ($_POST["action"] == 'confirm_enable' && $_POST["confirm"] == "yes")
}
}
if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == "yes")
if ($_REQUEST["action"] == 'confirm_delete' && $_REQUEST["confirm"] == "yes")
{
if ($_GET["id"] <> $user->id)
{
@ -299,8 +299,8 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"] && $caneditfield)
}
// Action modif mot de passe
if ((($_POST["action"] == 'confirm_password' && $_POST["confirm"] == 'yes')
|| $_POST["action"] == 'confirm_passwordsend') && $caneditpassword)
if ((($_REQUEST["action"] == 'confirm_password' && $_REQUEST["confirm"] == 'yes')
|| ($_REQUEST["action"] == 'confirm_passwordsend' && $_REQUEST["confirm"] == 'yes')) && $caneditpassword)
{
$edituser = new User($db, $_GET["id"]);
$edituser->fetch();
@ -314,7 +314,7 @@ if ((($_POST["action"] == 'confirm_password' && $_POST["confirm"] == 'yes')
else
{
// Succes
if ($_POST["action"] == 'confirm_passwordsend')
if ($_REQUEST["action"] == 'confirm_passwordsend' && $_REQUEST["confirm"] == 'yes')
{
if ($edituser->send_password($user,$newpassword) > 0)
{
@ -764,7 +764,7 @@ else
*/
if ($action == 'password')
{
$ret=$html->form_confirm("fiche.php?id=$fuser->id",$langs->trans("ReinitPassword"),$langs->trans("ConfirmReinitPassword",$fuser->login),"confirm_password");
$ret=$html->form_confirm("fiche.php?id=$fuser->id",$langs->trans("ReinitPassword"),$langs->trans("ConfirmReinitPassword",$fuser->login),"confirm_password", '', 0, 1);
if ($ret == 'html') print '<br>';
}
@ -773,7 +773,7 @@ else
*/
if ($action == 'passwordsend')
{
$ret=$html->form_confirm("fiche.php?id=$fuser->id",$langs->trans("SendNewPassword"),$langs->trans("ConfirmSendNewPassword",$fuser->login),"confirm_passwordsend");
$ret=$html->form_confirm("fiche.php?id=$fuser->id",$langs->trans("SendNewPassword"),$langs->trans("ConfirmSendNewPassword",$fuser->login),"confirm_passwordsend", '', 0, 1);
if ($ret == 'html') print '<br>';
}
@ -782,7 +782,7 @@ else
*/
if ($action == 'disable')
{
$ret=$html->form_confirm("fiche.php?id=$fuser->id",$langs->trans("DisableAUser"),$langs->trans("ConfirmDisableUser",$fuser->login),"confirm_disable");
$ret=$html->form_confirm("fiche.php?id=$fuser->id",$langs->trans("DisableAUser"),$langs->trans("ConfirmDisableUser",$fuser->login),"confirm_disable", '', 0, 1);
if ($ret == 'html') print '<br>';
}
@ -791,7 +791,7 @@ else
*/
if ($action == 'enable')
{
$ret=$html->form_confirm("fiche.php?id=$fuser->id",$langs->trans("EnableAUser"),$langs->trans("ConfirmEnableUser",$fuser->login),"confirm_enable");
$ret=$html->form_confirm("fiche.php?id=$fuser->id",$langs->trans("EnableAUser"),$langs->trans("ConfirmEnableUser",$fuser->login),"confirm_enable", '', 0, 1);
if ($ret == 'html') print '<br>';
}
@ -800,7 +800,7 @@ else
*/
if ($action == 'delete')
{
$ret=$html->form_confirm("fiche.php?id=$fuser->id",$langs->trans("DeleteAUser"),$langs->trans("ConfirmDeleteUser",$fuser->login),"confirm_delete");
$ret=$html->form_confirm("fiche.php?id=$fuser->id",$langs->trans("DeleteAUser"),$langs->trans("ConfirmDeleteUser",$fuser->login),"confirm_delete", '', 0, 1);
if ($ret == 'html') print '<br>';
}

View File

@ -45,14 +45,17 @@ $action=isset($_GET["action"])?$_GET["action"]:$_POST["action"];
/**
* Action suppression groupe
*/
if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == "yes")
if ($_REQUEST["action"] == 'confirm_delete' && $_REQUEST["confirm"] == "yes")
{
if($caneditperms){
if ($caneditperms)
{
$editgroup = new Usergroup($db, $_GET["id"]);
$editgroup->fetch($_GET["id"]);
$editgroup->delete();
Header("Location: index.php");
}else{
}
else
{
$message = '<div class="error">'.$langs->trans('ErrorForbidden').'</div>';
}
}
@ -62,14 +65,17 @@ if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == "yes")
*/
if ($_POST["action"] == 'add')
{
if($caneditperms){
if($caneditperms)
{
$message="";
if (! $_POST["nom"]) {
if (! $_POST["nom"])
{
$message='<div class="error">'.$langs->trans("NameNotDefined").'</div>';
$action="create"; // Go back to create page
}
if (! $message) {
if (! $message)
{
$editgroup = new UserGroup($db,0);
$editgroup->nom = trim($_POST["nom"]);
@ -226,7 +232,7 @@ else
*/
if ($action == 'delete')
{
$ret=$html->form_confirm("fiche.php?id=$group->id",$langs->trans("DeleteAGroup"),$langs->trans("ConfirmDeleteGroup",$group->name),"confirm_delete");
$ret=$html->form_confirm("fiche.php?id=".$group->id,$langs->trans("DeleteAGroup"),$langs->trans("ConfirmDeleteGroup",$group->name),"confirm_delete", '',0,1);
if ($ret == 'html') print '<br>';
}