From 4a4da9ebbfe51e253071932aa537e61a2b6296ce Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 20 Feb 2012 21:03:59 +0100 Subject: [PATCH 1/4] Fix: compatibility with edit in place --- htdocs/fourn/paiement/fiche.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/paiement/fiche.php b/htdocs/fourn/paiement/fiche.php index 4c2b40f9f04..95e77f47068 100644 --- a/htdocs/fourn/paiement/fiche.php +++ b/htdocs/fourn/paiement/fiche.php @@ -183,7 +183,7 @@ if ($result > 0) // Date payment print ''.$form->editfieldkey("Date",'date',$object->date,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer).''; - print $form->editfieldval("Date",'date',$object->date,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer,'day'); + print $form->editfieldval("Date",'date',$object->date,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer,'datepicker'); print ''; // Payment mode From 47eaaf5905db4cf85d44016c770abb7a293fcd19 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 20 Feb 2012 21:10:51 +0100 Subject: [PATCH 2/4] Fix: compatibility with edit in place --- htdocs/fourn/paiement/fiche.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/fourn/paiement/fiche.php b/htdocs/fourn/paiement/fiche.php index 95e77f47068..469aa1c1a1a 100644 --- a/htdocs/fourn/paiement/fiche.php +++ b/htdocs/fourn/paiement/fiche.php @@ -101,10 +101,10 @@ if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->fournisse } } -if ($action == 'setnum' && ! empty($_POST['num'])) +if ($action == 'setnum' && ! empty($_POST['num_paiement'])) { $object->fetch($id); - $res = $object->update_num($_POST['num']); + $res = $object->update_num($_POST['num_paiement']); if ($res === 0) { $mesg = '
'.$langs->trans('PaymentNumberUpdateSucceeded').'
'; @@ -115,10 +115,10 @@ if ($action == 'setnum' && ! empty($_POST['num'])) } } -if ($action == 'setdate' && ! empty($_POST['dateday'])) +if ($action == 'setdate' && ! empty($_POST['datepday'])) { $object->fetch($id); - $datepaye = dol_mktime(12, 0, 0, $_POST['datemonth'], $_POST['dateday'], $_POST['dateyear']); + $datepaye = dol_mktime(12, 0, 0, $_POST['datepmonth'], $_POST['datepday'], $_POST['datepyear']); $res = $object->update_date($datepaye); if ($res === 0) { @@ -182,16 +182,16 @@ if ($result > 0) print ''; // Date payment - print ''.$form->editfieldkey("Date",'date',$object->date,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer).''; - print $form->editfieldval("Date",'date',$object->date,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer,'datepicker'); + print ''.$form->editfieldkey("Date",'datep',$object->date,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer).''; + print $form->editfieldval("Date",'datep',$object->date,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer,'datepicker','',null,$langs->trans('PaymentDateUpdateSucceeded')); print ''; // Payment mode print ''.$langs->trans('PaymentMode').''.$object->type_libelle.''; // Payment numero - print ''.$form->editfieldkey("Numero",'num',$object->numero,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer).''; - print $form->editfieldval("Numero",'num',$object->numero,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer,'string'); + print ''.$form->editfieldkey("Numero",'num_paiement',$object->numero,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer).''; + print $form->editfieldval("Numero",'num_paiement',$object->numero,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer,'string','',null,$langs->trans('PaymentNumberUpdateSucceeded')); print ''; // Amount @@ -204,7 +204,7 @@ if ($result > 0) // Note print ''.$form->editfieldkey("Note",'note',$object->note,$object,$user->rights->fournisseur->facture->creer).''; - print $form->editfieldval("Note",'note',$object->note,$object,$user->rights->fournisseur->facture->creer,'text'); + print $form->editfieldval("Note",'note',$object->note,$object,$user->rights->fournisseur->facture->creer,'textarea'); print ''; // Bank account From cd23f8a04019488fff2c95115d3f567f5946e955 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 20 Feb 2012 21:17:05 +0100 Subject: [PATCH 3/4] Fix: bad rights --- htdocs/core/ajax/loadinplace.php | 7 ++++--- htdocs/core/ajax/saveinplace.php | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/htdocs/core/ajax/loadinplace.php b/htdocs/core/ajax/loadinplace.php index 48fd654b3e4..5a1865223e9 100644 --- a/htdocs/core/ajax/loadinplace.php +++ b/htdocs/core/ajax/loadinplace.php @@ -63,9 +63,10 @@ if((isset($_GET['field']) && ! empty($_GET['field'])) if ($element == 'propal') $element = 'propale'; else if ($element == 'fichinter') $element = 'ficheinter'; - if (($element == 'payment' && $user->rights->facture->paiement) - || $user->rights->$element->lire || $user->rights->$element->read - || $user->rights->$element->$subelement->lire || $user->rights->$element->$subelement->read) + if ($user->rights->$element->lire || $user->rights->$element->read + || $user->rights->$element->$subelement->lire || $user->rights->$element->$subelement->read + || ($element == 'payment' && $user->rights->facture->lire) + || ($element == 'payment_supplier' && $user->rights->fournisseur->facture->lire)) { if ($type == 'select') { diff --git a/htdocs/core/ajax/saveinplace.php b/htdocs/core/ajax/saveinplace.php index e88eda87e9f..ae6313012fd 100644 --- a/htdocs/core/ajax/saveinplace.php +++ b/htdocs/core/ajax/saveinplace.php @@ -69,9 +69,10 @@ if((isset($_POST['field']) && ! empty($_POST['field'])) if ($element == 'propal') $element = 'propale'; else if ($element == 'fichinter') $element = 'ficheinter'; - if (($element == 'payment' && $user->rights->facture->paiement) - || $user->rights->$element->creer || $user->rights->$element->write - || $user->rights->$element->$subelement->creer || $user->rights->$element->$subelement->write) + if ($user->rights->$element->creer || $user->rights->$element->write + || $user->rights->$element->$subelement->creer || $user->rights->$element->$subelement->write + || ($element == 'payment' && $user->rights->facture->paiement) + || ($element == 'payment_supplier' && $user->rights->fournisseur->facture->creer)) { // Clean parameters $newvalue = trim($value); From a5969db28b09ba203c927687b31d57173cbdea4a Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 20 Feb 2012 21:19:08 +0100 Subject: [PATCH 4/4] Fix: uniformize code --- htdocs/fourn/paiement/fiche.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/fourn/paiement/fiche.php b/htdocs/fourn/paiement/fiche.php index 469aa1c1a1a..dfb40716ce8 100644 --- a/htdocs/fourn/paiement/fiche.php +++ b/htdocs/fourn/paiement/fiche.php @@ -36,9 +36,9 @@ $langs->load("suppliers"); $mesg=''; -$id = GETPOST('id'); -$action = GETPOST('action'); -$confirm = GETPOST('confirm'); +$id = GETPOST('id','int'); +$action = GETPOST('action','alpha'); +$confirm = GETPOST('confirm','alpha'); $object = new PaiementFourn($db); @@ -141,7 +141,7 @@ $form = new Form($db); $h=0; -$head[$h][0] = DOL_URL_ROOT.'/fourn/paiement/fiche.php?id='.$id; +$head[$h][0] = $_SERVER['PHP_SELF'].'?id='.$id; $head[$h][1] = $langs->trans('Card'); $hselected = $h; $h++; @@ -338,7 +338,7 @@ else dol_fiche_end(); -$db->close(); - llxFooter(); -?> + +$db->close(); +?> \ No newline at end of file