From 1be33e1ddaacc718ee7436e01a6cf613c24b8d56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sun, 19 Jul 2015 14:56:52 +0200 Subject: [PATCH 1/6] FIX [ bug 1634 ] Error deleting a project when it had many linked objects Projet::delete was throwing DB error messages directly to the user instead of logging them and showing a proper error message to the user --- ChangeLog | 1 + htdocs/projet/card.php | 2 +- htdocs/projet/class/project.class.php | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0002ce6b3fa..243b350ba85 100644 --- a/ChangeLog +++ b/ChangeLog @@ -13,6 +13,7 @@ FIX [ bug #2855 ] Wrong translation key in localtax report page FIX [ bug #1852 ] JS error when editing a customer order line FIX [ bug #2900 ] Courtesy title is not stored in create thirdparty form FIX [ bug #3055 ] Product image thumbnails were not deleted after deleting the image +FIX [ bug 1634 ] Error deleting a project when it had many linked objects ***** ChangeLog for 3.7.1 compared to 3.7.* ***** FIX Bug in the new photo system diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 1c971ef9e35..00b3f54eab8 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -339,7 +339,7 @@ if (empty($reshook)) else { dol_syslog($object->error,LOG_DEBUG); - setEventMessage($object->error,'errors'); +// setEventMessage($object->error,'errors'); setEventMessage($object->errors,'errors'); } } diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index a52a9f133e9..8d2068b4591 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -533,7 +533,7 @@ class Project extends CommonObject $resql = $this->db->query($sql); if (!$resql) { - $this->errors[] = $this->db->lasterror(); + $this->errors[] = $langs->trans("CantRemoveProject"); $error++; } } From b64adcc065cd140b8697bdd39828942d24ae410d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sun, 19 Jul 2015 15:13:27 +0200 Subject: [PATCH 2/6] FIX [ bug 1925 ] "Link to order" option in supplier invoices is not working properly Patch submitted by Philippe (pheno) at https://doliforge.org/tracker/?func=detail&aid=1925&group_id=144 --- ChangeLog | 1 + htdocs/fourn/facture/card.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 1dd68adceb7..0be06f07923 100644 --- a/ChangeLog +++ b/ChangeLog @@ -13,6 +13,7 @@ FIX [ bug #2855 ] Wrong translation key in localtax report page FIX [ bug #1852 ] JS error when editing a customer order line FIX [ bug #2900 ] Courtesy title is not stored in create thirdparty form FIX [ bug #3055 ] Product image thumbnails were not deleted after deleting the image +FIX [ bug 1925 ] "Link to order" option in supplier invoices is not working properly ***** ChangeLog for 3.7.1 compared to 3.7.* ***** FIX Bug in the new photo system diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 08bffd09a67..1919faadee4 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -824,7 +824,7 @@ elseif ($action == 'reopen' && $user->rights->fournisseur->facture->creer) if (GETPOST('linkedOrder')) { $object->fetch($id); $object->fetch_thirdparty(); - $result = $object->add_object_linked('commande', GETPOST('linkedOrder')); + $result = $object->add_object_linked('order_supplier', GETPOST('linkedOrder')); } // Add file in email form From ad5612158acfbe79881287a2feab521935cb5157 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Jul 2015 15:29:18 +0200 Subject: [PATCH 3/6] Fix report of all error messages --- htdocs/projet/card.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 00b3f54eab8..331eb944604 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -232,7 +232,7 @@ if (empty($reshook)) if ($result < 0) { $error++; - setEventMessage($object->errors,'errors'); + setEventMessages($object->error, $object->errors,'errors'); } } @@ -314,7 +314,7 @@ if (empty($reshook)) $result = $object->setClose($user); if ($result <= 0) { - setEventMessage($object->error, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } @@ -323,7 +323,7 @@ if (empty($reshook)) $result = $object->setValid($user); if ($result <= 0) { - setEventMessage($object->error, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } @@ -339,8 +339,7 @@ if (empty($reshook)) else { dol_syslog($object->error,LOG_DEBUG); -// setEventMessage($object->error,'errors'); - setEventMessage($object->errors,'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } @@ -354,7 +353,7 @@ if (empty($reshook)) $result=$object->createFromClone($object->id,$clone_contacts,$clone_tasks,$clone_project_files,$clone_task_files,$clone_notes); if ($result <= 0) { - setEventMessage($object->error, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } else { From f0ed7dac095a90ede5311fa087557f29303ccc2e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 Jul 2015 12:21:15 +0200 Subject: [PATCH 4/6] Exclude tested module --- build/makepack-dolibarr.pl | 1 + htdocs/.gitignore | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index 8feecdd774e..a4dbb40ae7c 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -463,6 +463,7 @@ if ($nboftargetok) { $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/factory*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/management*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/multicompany*`; + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/ndf*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/nltechno*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/oscim*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/pos*`; diff --git a/htdocs/.gitignore b/htdocs/.gitignore index bf99a2deebe..160eae6f858 100644 --- a/htdocs/.gitignore +++ b/htdocs/.gitignore @@ -1,12 +1,13 @@ -/test.php -/extensions* -/nltechno* /ancot* -/teclib* /bootstrap* +/extensions* /google* /multicompany* +/ndf* /numberingpack* +/nltechno* /ovh* /pos +/teclib* +/test.php /ultimatepdf* From 2bebb869fbd35d612d4c617353e2b70d6243a034 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 Jul 2015 17:19:44 +0200 Subject: [PATCH 5/6] Fix bad signature of fetch. The ref_ext is missing. --- htdocs/comm/action/class/actioncomm.class.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index bda4362bed9..c868cb8569c 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -376,11 +376,12 @@ class ActionComm extends CommonObject /** * Load object from database * - * @param int $id Id of action to get - * @param string $ref Ref of action to get - * @return int <0 if KO, >0 if OK + * @param int $id Id of action to get + * @param string $ref Ref of action to get + * @param string $ref_ext Ref ext to get + * @return int <0 if KO, >0 if OK */ - function fetch($id, $ref='') + function fetch($id, $ref='',$ref_ext='') { global $langs; @@ -404,11 +405,12 @@ class ActionComm extends CommonObject $sql.= " s.nom as socname,"; $sql.= " u.firstname, u.lastname as lastname"; $sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a "; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON a.fk_action=c.id "; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON a.fk_action=c.id "; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_author"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on s.rowid = a.fk_soc"; $sql.= " WHERE "; - if ($ref) $sql.= " a.id=".$ref; // No field ref, we use id + if ($ref) $sql.= " a.id=".$ref; // No field ref, we use id + elseif ($ref_ext) $sql.= " a.ref_ext='".$this->db->escape($ref_ext)."'"; else $sql.= " a.id=".$id; dol_syslog(get_class($this)."::fetch", LOG_DEBUG); From 84be353e136d0c8a3c2263e226df1e690f4ddda3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 Jul 2015 00:13:13 +0200 Subject: [PATCH 6/6] Comments --- htdocs/core/lib/date.lib.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index 072db988dc1..4d83f76b910 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -271,6 +271,7 @@ function convertSecondToTime($iSecond, $format='all', $lengthOfDay=86400, $lengt /** * Convert a string date into a GM Timestamps date + * Warning: YYYY-MM-DDTHH:MM:SS+02:00 (RFC3339) is not supported. If parameter gm is 1, we will use no TZ, if not we will use TZ of server, not the one inside string. * * @param string $string Date in a string * YYYYMMDD @@ -305,8 +306,8 @@ function dol_stringtotime($string, $gm=1) $string=sprintf("%04d%02d%02d%02d%02d%02d",$syear,$smonth,$sday,$shour,$smin,$ssec); } else if ( - preg_match('/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})Z$/i',$string,$reg) // Convert date with format RFC3339 - || preg_match('/^([0-9]{4})-([0-9]{2})-([0-9]{2}) ([0-9]{2}):([0-9]{2}):([0-9]{2})$/i',$string,$reg) // Convert date with format YYYY-MM-DD HH:MM:SS + preg_match('/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})Z$/i',$string,$reg) // Convert date with format YYYY-MM-DDTHH:MM:SSZ (RFC3339) + || preg_match('/^([0-9]{4})-([0-9]{2})-([0-9]{2}) ([0-9]{2}):([0-9]{2}):([0-9]{2})$/i',$string,$reg) // Convert date with format YYYY-MM-DD HH:MM:SS || preg_match('/^([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2})([0-9]{2})([0-9]{2})Z$/i',$string,$reg) // Convert date with format YYYYMMDDTHHMMSSZ ) {