From 2c6aeac64f53b8eb88aaf8797975500c01692897 Mon Sep 17 00:00:00 2001 From: Gauthier Date: Thu, 15 Oct 2015 16:48:52 +0200 Subject: [PATCH 01/10] FIX : Societe::set_parent() function needs societe object to be fetched to update parent --- htdocs/societe/class/societe.class.php | 1 + htdocs/societe/soc.php | 1 + 2 files changed, 2 insertions(+) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 7bf8d6c45cf..cd68317c709 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2468,6 +2468,7 @@ class Societe extends CommonObject $resql=$this->db->query($sql); if ($resql) { + $this->parent = $id; return 1; } else diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index be879efecf5..b376a8c2765 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -649,6 +649,7 @@ if (empty($reshook)) // Set parent company if ($action == 'set_thirdparty' && $user->rights->societe->creer) { + $object->fetch($socid); $result = $object->set_parent(GETPOST('editparentcompany','int')); } From 6bd13b8071b87a8251b0b0c6aaa941b853011740 Mon Sep 17 00:00:00 2001 From: arnaud Date: Thu, 15 Oct 2015 16:53:28 +0200 Subject: [PATCH 02/10] FIX bug invoice classified in propale next update commonobject class in 3.8 --- htdocs/comm/propal/class/propal.class.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 69f36c83136..71295e94f70 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -2124,26 +2124,26 @@ class Propal extends CommonObject $this->fetchObjectLinked($id,$this->element); foreach($this->linkedObjectsIds as $objecttype => $objectid) { - $numi=count($objectid); - for ($i=0;$i<$numi;$i++) + // Nouveau système du comon object renvoi des rowid et non un id linéaire de 1 à n + // On parcourt donc une liste d'objets en tant qu'objet unique + foreach($objectid as $key => $object) { // Cas des factures liees directement if ($objecttype == 'facture') { - $linkedInvoices[] = $objectid[$i]; + $linkedInvoices[] = $object; } // Cas des factures liees par un autre objet (ex: commande) else { - $this->fetchObjectLinked($objectid[$i],$objecttype); + $this->fetchObjectLinked($object,$objecttype); foreach($this->linkedObjectsIds as $subobjecttype => $subobjectid) { - $numj=count($subobjectid); - for ($j=0;$j<$numj;$j++) + foreach($subobjectid as $subkey => $subobject) { if ($subobjecttype == 'facture') { - $linkedInvoices[] = $subobjectid[$j]; + $linkedInvoices[] = $subobject; } } } From b3e3cc14a7ebcc0c01fbbf31081414c62b83b656 Mon Sep 17 00:00:00 2001 From: Gauthier Date: Thu, 15 Oct 2015 17:26:16 +0200 Subject: [PATCH 03/10] FIX : 1/ update_extra() function musn't be in "if(!empty(MAIN_DISABLE_CONTACTS_TAB)" test. 2/ Reindented code --- htdocs/compta/facture.php | 78 +++++++++++++++++++-------------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index b96edc31b2c..de0a591cf98 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1737,40 +1737,41 @@ if (empty($reshook)) $result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]); } - if ($result >= 0) { - header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $object->id); - exit(); - } else { - if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { - $langs->load("errors"); - setEventMessage($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), 'errors'); + if ($result >= 0) { + header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $object->id); + exit(); } else { - setEventMessage($object->error, 'errors'); + if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { + $langs->load("errors"); + setEventMessage($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), 'errors'); + } else { + setEventMessage($object->error, 'errors'); + } } } - } - - // bascule du statut d'un contact - else if ($action == 'swapstatut') - { - if ($object->fetch($id)) { - $result = $object->swapContactStatus(GETPOST('ligne')); - } else { - dol_print_error($db); + + // bascule du statut d'un contact + else if ($action == 'swapstatut') + { + if ($object->fetch($id)) { + $result = $object->swapContactStatus(GETPOST('ligne')); + } else { + dol_print_error($db); + } + } + + // Efface un contact + else if ($action == 'deletecontact') + { + $object->fetch($id); + $result = $object->delete_contact($lineid); + + if ($result >= 0) { + header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $object->id); + exit(); + } else { + dol_print_error($db); } - } - - // Efface un contact - else if ($action == 'deletecontact') - { - $object->fetch($id); - $result = $object->delete_contact($lineid); - - if ($result >= 0) { - header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $object->id); - exit(); - } else { - dol_print_error($db); } } @@ -1790,17 +1791,16 @@ if (empty($reshook)) $reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by // some hooks if (empty($reshook)) { - $result = $object->insertExtraFields(); - if ($result < 0) { - $error ++; - } - } else if ($reshook < 0) + $result = $object->insertExtraFields(); + if ($result < 0) { $error ++; - } - - if ($error) - $action = 'edit_extras'; + } + } else if ($reshook < 0) + $error ++; } + + if ($error) + $action = 'edit_extras'; } } From d68db2a844231880780b75901abd9b74f6b77d72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 17 Oct 2015 08:48:53 +0200 Subject: [PATCH 04/10] Update fournisseur.commande.class.php --- htdocs/fourn/class/fournisseur.commande.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 54022429fb3..492663295b8 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -460,6 +460,7 @@ class CommandeFournisseur extends CommonOrder { $result = 1; $this->log($user, 1, time()); // Statut 1 + $this->statut = 1; $this->ref = $num; } From 0211ad64eed4de33aec6bf0e966cbf449aca96eb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 17 Oct 2015 12:28:47 +0200 Subject: [PATCH 05/10] FIX Total in summary was not same than into detail on the referrer page. Conflicts: htdocs/product/stats/facture.php --- htdocs/product/stats/commande.php | 4 ++-- htdocs/product/stats/commande_fournisseur.php | 4 ++-- htdocs/product/stats/facture.php | 24 +++++++++++-------- htdocs/product/stats/facture_fournisseur.php | 2 +- htdocs/product/stats/propal.php | 2 +- 5 files changed, 20 insertions(+), 16 deletions(-) diff --git a/htdocs/product/stats/commande.php b/htdocs/product/stats/commande.php index 9491b18da1e..42925a704ec 100644 --- a/htdocs/product/stats/commande.php +++ b/htdocs/product/stats/commande.php @@ -128,9 +128,9 @@ if ($id > 0 || ! empty($ref)) if ($user->rights->commande->lire) { - $sql = "SELECT distinct s.nom as name, s.rowid as socid, s.code_client, c.rowid, d.total_ht as total_ht, c.ref,"; + $sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, s.code_client, c.rowid, d.total_ht as total_ht, c.ref,"; $sql .= " c.ref_client,"; - $sql.= " c.date_commande, c.fk_statut as statut, c.facture, c.rowid as commandeid, d.qty"; + $sql.= " c.date_commande, c.fk_statut as statut, c.facture, c.rowid as commandeid, d.rowid, d.qty"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user "; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."commande as c"; diff --git a/htdocs/product/stats/commande_fournisseur.php b/htdocs/product/stats/commande_fournisseur.php index e7a803c299c..0516163b2a1 100644 --- a/htdocs/product/stats/commande_fournisseur.php +++ b/htdocs/product/stats/commande_fournisseur.php @@ -135,9 +135,9 @@ if ($id > 0 || ! empty($ref)) { print ''; if ($user->rights->fournisseur->commande->lire) { - $sql = "SELECT distinct s.nom as name, s.rowid as socid, s.code_client,"; + $sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, s.code_client,"; $sql .= " c.rowid, d.total_ht as total_ht, c.ref,"; - $sql .= " c.date_commande, c.fk_statut as statut, c.rowid as commandeid, d.qty"; + $sql .= " c.date_commande, c.fk_statut as statut, c.rowid as commandeid, d.rowid, d.qty"; if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user "; $sql .= " FROM " . MAIN_DB_PREFIX . "societe as s"; diff --git a/htdocs/product/stats/facture.php b/htdocs/product/stats/facture.php index 2a79b97e399..9c400dcdeaa 100644 --- a/htdocs/product/stats/facture.php +++ b/htdocs/product/stats/facture.php @@ -128,10 +128,11 @@ if ($id > 0 || ! empty($ref)) print ''; - if ($user->rights->facture->lire) { - $sql = "SELECT distinct s.nom as name, s.rowid as socid, s.code_client,"; - $sql.= " f.facnumber, d.total_ht as total_ht,"; - $sql.= " f.datef, f.paye, f.fk_statut as statut, f.rowid as facid, d.qty"; + if ($user->rights->facture->lire) + { + $sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, s.code_client,"; + $sql.= " f.facnumber, f.datef, f.paye, f.fk_statut as statut, f.rowid as facid,"; + $sql.= " d.rowid, d.total_ht as total_ht, d.qty"; // We must keep the d.rowid here to not loose record because of the distinct used to ignore duplicate line when link on societe_commerciaux is used if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user "; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."facture as f"; @@ -147,24 +148,27 @@ if ($id > 0 || ! empty($ref)) $sql.= ' AND YEAR(f.datef) IN (' . $search_year . ')'; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($socid) $sql.= " AND f.fk_soc = ".$socid; - $sql.= " ORDER BY $sortfield $sortorder "; + $sql.= $db->order($sortfield, $sortorder); //Calcul total qty and amount for global if full scan list $total_ht=0; $total_qty=0; $totalrecords=0; - if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { + if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) + { $result = $db->query($sql); - if ($result) { + if ($result) + { $totalrecords = $db->num_rows($result); - while ($objp = $db->fetch_object($result)) { + while ($objp = $db->fetch_object($result)) + { $total_ht+=$objp->total_ht; $total_qty+=$objp->qty; } } } - $sql.= $db->plimit($conf->liste_limit +1, $offset); + $sql.= $db->plimit($conf->liste_limit + 1, $offset); $result = $db->query($sql); if ($result) @@ -214,7 +218,7 @@ if ($id > 0 || ! empty($ref)) if ($num > 0) { $var=True; - while ($i < $num && $i < $conf->liste_limit) + while ($i < min($num,$conf->liste_limit)) { $objp = $db->fetch_object($result); $var=!$var; diff --git a/htdocs/product/stats/facture_fournisseur.php b/htdocs/product/stats/facture_fournisseur.php index 9b56cee7552..5ce40658d0d 100644 --- a/htdocs/product/stats/facture_fournisseur.php +++ b/htdocs/product/stats/facture_fournisseur.php @@ -130,7 +130,7 @@ if ($id > 0 || ! empty($ref)) if ($user->rights->fournisseur->facture->lire) { - $sql = "SELECT distinct s.nom as name, s.rowid as socid, s.code_client, f.ref, d.total_ht as total_ht,"; + $sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, s.code_client, f.ref, d.rowid, d.total_ht as total_ht,"; $sql .= " f.datef, f.paye, f.fk_statut as statut, f.rowid as facid, d.qty"; if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user "; diff --git a/htdocs/product/stats/propal.php b/htdocs/product/stats/propal.php index 690f9c8c421..84d1ba72a80 100644 --- a/htdocs/product/stats/propal.php +++ b/htdocs/product/stats/propal.php @@ -129,7 +129,7 @@ if ($id > 0 || ! empty($ref)) if ($user->rights->propale->lire) { $sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, p.rowid as propalid, p.ref, d.total_ht as amount,"; $sql .= " p.ref_client,"; - $sql .= "p.datep, p.fk_statut as statut, d.qty"; + $sql .= "p.datep, p.fk_statut as statut, d.rowid, d.qty"; if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user "; $sql .= " FROM " . MAIN_DB_PREFIX . "societe as s"; From 334c14d088c0f22805247917770dbcc5f6a8e3f8 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Sun, 18 Oct 2015 11:56:42 +0200 Subject: [PATCH 06/10] Fix: Last page total is 0 --- htdocs/compta/bank/account.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php index 10e9674ec8d..32284874797 100644 --- a/htdocs/compta/bank/account.php +++ b/htdocs/compta/bank/account.php @@ -952,7 +952,7 @@ if ($id > 0 || ! empty($ref)) if ($sep > 0) print ' '; // If we had at least one line in future else print $langs->trans("CurrentBalance"); print ' '.$object->currency_code.''; - print ''.price($solde, 0, $langs, 0, 0, -1, $object->currency_code).''; + print ''.price($total, 0, $langs, 0, 0, -1, $object->currency_code).''; print ' '; print ''; } else { From c51bc09e3974b940dd5aaaaebddf28f142776a52 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Oct 2015 18:54:54 +0200 Subject: [PATCH 07/10] FIX The preview of PDF was never refreshed if PDF document was changed --- htdocs/comm/propal/apercu.php | 2 +- htdocs/commande/apercu.php | 2 +- htdocs/compta/facture/apercu.php | 2 +- htdocs/fichinter/apercu.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/comm/propal/apercu.php b/htdocs/comm/propal/apercu.php index 87281e7ea63..837dc48c670 100644 --- a/htdocs/comm/propal/apercu.php +++ b/htdocs/comm/propal/apercu.php @@ -144,7 +144,7 @@ if ($id > 0 || ! empty($ref)) print "\n"; // Conversion du PDF en image png si fichier png non existant - if (! file_exists($fileimage) && ! file_exists($fileimagebis)) + if ((! file_exists($fileimage) && ! file_exists($fileimagebis)) || (filemtime($fileimage) < filemtime($file))) { if (class_exists("Imagick")) { diff --git a/htdocs/commande/apercu.php b/htdocs/commande/apercu.php index f3d83b837dd..5d65ba1a493 100644 --- a/htdocs/commande/apercu.php +++ b/htdocs/commande/apercu.php @@ -142,7 +142,7 @@ if ($id > 0 || ! empty($ref)) print "\n"; // Conversion du PDF en image png si fichier png non existant - if (! file_exists($fileimage) && ! file_exists($fileimagebis)) + if ((! file_exists($fileimage) && ! file_exists($fileimagebis)) || (filemtime($fileimage) < filemtime($file))) { if (class_exists("Imagick")) { diff --git a/htdocs/compta/facture/apercu.php b/htdocs/compta/facture/apercu.php index 340df8172dc..b649dd43c43 100644 --- a/htdocs/compta/facture/apercu.php +++ b/htdocs/compta/facture/apercu.php @@ -280,7 +280,7 @@ if ($id > 0 || ! empty($ref)) print "\n"; // Conversion du PDF en image png si fichier png non existant - if (! file_exists($fileimage) && ! file_exists($fileimagebis)) + if ((! file_exists($fileimage) && ! file_exists($fileimagebis)) || (filemtime($fileimage) < filemtime($file))) { if (class_exists("Imagick")) { diff --git a/htdocs/fichinter/apercu.php b/htdocs/fichinter/apercu.php index 0d4d3421538..9e08fae27ab 100644 --- a/htdocs/fichinter/apercu.php +++ b/htdocs/fichinter/apercu.php @@ -124,7 +124,7 @@ if ($id > 0 || ! empty($ref)) print "\n"; // Conversion du PDF en image png si fichier png non existant - if (! file_exists($fileimage) && ! file_exists($fileimagebis)) + if ((! file_exists($fileimage) && ! file_exists($fileimagebis)) || (filemtime($fileimage) < filemtime($file))) { if (class_exists("Imagick")) { From 420bfd8301ba8f9b7950338a26014b844e073d2b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Oct 2015 19:09:35 +0200 Subject: [PATCH 08/10] FIX Preview pages was not using correct style for ref --- htdocs/comm/propal/apercu.php | 13 ++++++++----- htdocs/commande/apercu.php | 11 ++++++++--- htdocs/compta/facture/apercu.php | 20 ++++++++++++++++---- htdocs/fichinter/apercu.php | 29 +++++++++++++++-------------- 4 files changed, 47 insertions(+), 26 deletions(-) diff --git a/htdocs/comm/propal/apercu.php b/htdocs/comm/propal/apercu.php index 837dc48c670..cdeacefafe1 100644 --- a/htdocs/comm/propal/apercu.php +++ b/htdocs/comm/propal/apercu.php @@ -47,8 +47,9 @@ $result = restrictedArea($user, 'propal', $id); * View Mode */ -llxHeader(); +$form = new Form($db); +llxHeader(); if ($id > 0 || ! empty($ref)) { @@ -68,10 +69,12 @@ if ($id > 0 || ! empty($ref)) */ print ''; - // Ref - print ''; - print ''; - print ''; + $linkback = '' . $langs->trans("BackToList") . ''; + + // Ref + print ''; // Ref client print ''; diff --git a/htdocs/commande/apercu.php b/htdocs/commande/apercu.php index 5d65ba1a493..1ec3a0533cc 100644 --- a/htdocs/commande/apercu.php +++ b/htdocs/commande/apercu.php @@ -47,6 +47,8 @@ $result=restrictedArea($user,'commande',$id,''); * View Mode */ +$form = new Form($db); + llxHeader('',$langs->trans('Order'),'EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes'); if ($id > 0 || ! empty($ref)) @@ -64,9 +66,12 @@ if ($id > 0 || ! empty($ref)) print '
'.$langs->trans('Ref').''.$object->ref.'
' . $langs->trans('Ref') . ''; + print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', ''); + print '
'.$langs->trans('RefCustomer').'
'; - // Ref - print '"; - print ''; + //$linkback = '' . $langs->trans("BackToList") . ''; + + // Ref + print ''; // Ref cde client print ''; diff --git a/htdocs/compta/facture/apercu.php b/htdocs/compta/facture/apercu.php index b649dd43c43..1172769e95a 100644 --- a/htdocs/compta/facture/apercu.php +++ b/htdocs/compta/facture/apercu.php @@ -29,6 +29,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; @@ -79,10 +80,21 @@ if ($id > 0 || ! empty($ref)) */ print '
'.$langs->trans("Ref")."'.$object->ref.'
' . $langs->trans('Ref') . ''; + print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', ''); + print '
'.$langs->trans('RefCustomer').'
'; - // Ref - print ''; - print ''; - print ''; + $linkback = '' . $langs->trans("BackToList") . ''; + + // Ref + print ''; // Ref customer print ''; diff --git a/htdocs/fichinter/apercu.php b/htdocs/fichinter/apercu.php index 9e08fae27ab..04ed6b71e19 100644 --- a/htdocs/fichinter/apercu.php +++ b/htdocs/fichinter/apercu.php @@ -72,13 +72,21 @@ if ($id > 0 || ! empty($ref)) */ print '
'.$langs->trans('Ref').''.$object->ref.'
' . $langs->trans('Ref') . ''; + $morehtmlref = ''; + $discount = new DiscountAbsolute($db); + $result = $discount->fetch(0, $object->id); + if ($result > 0) { + $morehtmlref = ' (' . $langs->trans("CreditNoteConvertedIntoDiscount", $discount->getNomUrl(1, 'discount')) . ')'; + } + if ($result < 0) { + dol_print_error('', $discount->error); + } + print $form->showrefnav($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref); + print '
'.$langs->trans('RefCustomer').'
'; - // Ref - print '"; - print ''; + $linkback = ''.$langs->trans("BackToList").''; + + // Ref + print ''; - $nbrow=4; + $nbrow=3; + // Client + print ""; + print ''; print '"; - // Client - print ""; - print ''; - print ''; - // Statut print ''; - print "\n"; + print "\n"; print ''; // Date print ''; - print "\n"; + print "\n"; print ''; print '
'.$langs->trans("Ref")."'.$object->ref.'
'.$langs->trans("Ref").''; + print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref'); + print '
".$langs->trans("Customer")."'; + print ''.$soc->name.''; + print ''; - + /* * Documents */ @@ -141,21 +149,14 @@ if ($id > 0 || ! empty($ref)) print "
".$langs->trans("Customer")."'; - print ''.$soc->name.''; - print '
'.$langs->trans("Status").'".$object->getLibStatut(4)."".$object->getLibStatut(4)."
'.$langs->trans("Date").'".dol_print_date($object->datec,"daytext")."".dol_print_date($object->datec,"daytext")."
'; From c64c1a0201f00e6b7d83f36e3ffa996c911b9fcf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Oct 2015 20:11:26 +0200 Subject: [PATCH 09/10] FIX If no end date is set on survey, we should be able to vote. --- htdocs/public/opensurvey/studs.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/public/opensurvey/studs.php b/htdocs/public/opensurvey/studs.php index 1d2d6d2d1e6..f522bc0ac14 100644 --- a/htdocs/public/opensurvey/studs.php +++ b/htdocs/public/opensurvey/studs.php @@ -1,6 +1,6 @@ - * Copyright (C) 2014 Marcos García +/* Copyright (C) 2013-2015 Laurent Destailleur + * Copyright (C) 2014 Marcos García * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -46,7 +46,7 @@ if ($result <= 0) dol_print_error('','Failed to get survey id '.$numsondage); $nblignes=$object->fetch_lines(); //If the survey has not yet finished, then it can be modified -$canbemodified = ($object->date_fin > dol_now()); +$canbemodified = (empty($object->date_fin) || $object->date_fin > dol_now()); /* From afe4057a976abd8d834a2cf698c249ff40ed83f7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Oct 2015 21:17:19 +0200 Subject: [PATCH 10/10] FIX #3757 Can't set amount in a social contribution with some languages --- htdocs/compta/sociales/charges.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/sociales/charges.php b/htdocs/compta/sociales/charges.php index 7be1360287c..74e4d3f8aff 100644 --- a/htdocs/compta/sociales/charges.php +++ b/htdocs/compta/sociales/charges.php @@ -79,7 +79,7 @@ if ($action == 'add' && $user->rights->tax->charges->creer) { $dateech=@dol_mktime(GETPOST('echhour'),GETPOST('echmin'),GETPOST('echsec'),GETPOST('echmonth'),GETPOST('echday'),GETPOST('echyear')); $dateperiod=@dol_mktime(GETPOST('periodhour'),GETPOST('periodmin'),GETPOST('periodsec'),GETPOST('periodmonth'),GETPOST('periodday'),GETPOST('periodyear')); - $amount=GETPOST('amount'); + $amount=price2num(GETPOST('amount')); $actioncode=GETPOST('actioncode'); if (! $dateech) { @@ -114,7 +114,7 @@ if ($action == 'add' && $user->rights->tax->charges->creer) $chargesociales->lib=GETPOST('label'); $chargesociales->date_ech=$dateech; $chargesociales->periode=$dateperiod; - $chargesociales->amount=price2num($amount); + $chargesociales->amount=$amount; $id=$chargesociales->create($user); if ($id <= 0) @@ -130,7 +130,7 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->tax->charges->cr { $dateech=dol_mktime(GETPOST('echhour'),GETPOST('echmin'),GETPOST('echsec'),GETPOST('echmonth'),GETPOST('echday'),GETPOST('echyear')); $dateperiod=dol_mktime(GETPOST('periodhour'),GETPOST('periodmin'),GETPOST('periodsec'),GETPOST('periodmonth'),GETPOST('periodday'),GETPOST('periodyear')); - $amount=GETPOST('amount'); + $amount=price2num(GETPOST('amount')); if (! $dateech) { setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("DateDue")), 'errors'); @@ -146,7 +146,12 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->tax->charges->cr setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Amount")), 'errors'); $action = 'edit'; } - else + elseif (! is_numeric($amount)) + { + setEventMessage($langs->trans("ErrorFieldMustBeANumeric",$langs->transnoentities("Amount")), 'errors'); + $action = 'create'; + } + else { $chargesociales=new ChargeSociales($db); $result=$chargesociales->fetch($id);