From 84729a6aa3837bad0794ddbe91be8ef14862495a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Nov 2014 22:59:48 +0100 Subject: [PATCH 1/7] Fix: Bad vars --- htdocs/admin/security_other.php | 7 +++---- htdocs/langs/en_US/admin.lang | 1 + 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/admin/security_other.php b/htdocs/admin/security_other.php index 8c65d1f3359..6cbbe9185a0 100644 --- a/htdocs/admin/security_other.php +++ b/htdocs/admin/security_other.php @@ -107,7 +107,7 @@ else if ($action == 'MAIN_ANTIVIRUS_PARAM') } else if ($action == 'MAIN_APPLICATION_TITLE') { - if (! dolibarr_set_const($db, "MAIN_APPLICATION_TITLE", $_POST["MAIN_SESSION_TIMEOUT"],'chaine',0,'',$conf->entity)) dol_print_error($db); + if (! dolibarr_set_const($db, "MAIN_APPLICATION_TITLE", $_POST["MAIN_APPLICATION_TITLE"],'chaine',0,'',$conf->entity)) dol_print_error($db); else setEventMessage($langs->trans("RecordModifiedSuccessfully")); } @@ -176,11 +176,10 @@ if (empty($conf->global->MAIN_APPLICATION_TITLE)) $conf->global->MAIN_APPLICATIO print '
'; print ''; print ''; -print ''.$langs->trans("HiddeNumVersion").''; -print $form->textwithpicto('',$langs->trans("HiddeNumVersionExample",ini_get("session.gc_probability"),ini_get("session.gc_divisor"))); +print ''.$langs->trans("MAIN_APPLICATION_TITLE").''; print ''; print ''; -print ' '; +print ' '; print ''; print ''; print ''; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 00f7ae43737..a075f99cd06 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1539,6 +1539,7 @@ ConfirmDeleteFiscalYear=Are you sure to delete this fiscal year ? Opened=Opened Closed=Closed AlwaysEditable=Can always be edited +MAIN_APPLICATION_TITLE=Force visible name of application Format=Format TypePaymentDesc=0:Customer payment type, 1:Supplier payment type, 2:Both customers and suppliers payment type From 9e28452379b09a8ce26b2344180b053b2ce0ddbe Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Wed, 19 Nov 2014 10:02:01 +0100 Subject: [PATCH 2/7] Fix: remove duplicate code --- htdocs/core/class/commonobject.class.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 12fee9deb8b..98bee3e052c 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3,7 +3,7 @@ * Copyright (C) 2005-2013 Regis Houssin * Copyright (C) 2010-2013 Juanjo Menent * Copyright (C) 2012 Christophe Battarel - * Copyright (C) 2010-2011 Juanjo Menent + * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2012-2013 Christophe Battarel * Copyright (C) 2011-2014 Philippe Grand * Copyright (C) 2012 Marcos GarcĂ­a @@ -611,8 +611,6 @@ abstract class CommonObject require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; - require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; - $thirdparty = new Societe($this->db); $result=$thirdparty->fetch(isset($this->socid)?$this->socid:(isset($this->fk_soc)?$this->fk_soc:$this->fk_thirdparty)); $this->client = $thirdparty; // deprecated From f7206c2a52509115cce007befc9bd85603439b72 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Nov 2014 23:10:30 +0100 Subject: [PATCH 3/7] Fixed: [ bug #1578 ] Cannot create proposal by copy of another one --- htdocs/comm/propal/class/propal.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 16d2edd0e96..12dbbe7d1c1 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -651,7 +651,7 @@ class Propal extends CommonObject * @param int $notrigger 1=Does not execute triggers, 0= execuete triggers * @return int <0 if KO, >=0 if OK */ - function create($user='', $notrigger=0) + function create($user, $notrigger=0) { global $langs,$conf,$mysoc,$hookmanager; $error=0; @@ -919,7 +919,7 @@ class Propal extends CommonObject { $this->products=$this->lines; - return $this->create(); + return $this->create($user); } /** From 358ddb0abc1f9f55a4a751775ad8d8d4683e1757 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Nov 2014 10:15:24 +0100 Subject: [PATCH 4/7] Fix: W3C. form into table is forbidden. This makes some browsers crazy. --- htdocs/admin/events.php | 19 ++-- htdocs/admin/proxy.php | 22 +++-- htdocs/admin/security_other.php | 159 ++++++++++++-------------------- 3 files changed, 82 insertions(+), 118 deletions(-) diff --git a/htdocs/admin/events.php b/htdocs/admin/events.php index 59205dcdbab..d5562248c55 100644 --- a/htdocs/admin/events.php +++ b/htdocs/admin/events.php @@ -78,15 +78,16 @@ print_fiche_titre($langs->trans("SecuritySetup"),'','setup'); print $langs->trans("LogEventDesc")."
\n"; print "
\n"; -$head=security_prepare_head(); - -dol_fiche_head($head, 'audit', $langs->trans("Security")); - print ''; print ''; print ''; +$head=security_prepare_head(); + +dol_fiche_head($head, 'audit', $langs->trans("Security")); + + $var=true; print ""; print ""; @@ -109,14 +110,14 @@ foreach ($eventstolog as $key => $arr) } print '
'; -print '
'; +dol_fiche_end(); + +print '
'; print "trans("Save")."\">"; -print "
"; +print ""; print "\n"; -print ''; - -$db->close(); llxFooter(); +$db->close(); diff --git a/htdocs/admin/proxy.php b/htdocs/admin/proxy.php index 050c92fd188..2e9d1f49169 100644 --- a/htdocs/admin/proxy.php +++ b/htdocs/admin/proxy.php @@ -86,6 +86,13 @@ print_fiche_titre($langs->trans("SecuritySetup"),'','setup'); print $langs->trans("ProxyDesc")."
\n"; print "
\n"; + + +print '
'; +print ''; +print ''; + + $head=security_prepare_head(); dol_fiche_head($head, 'proxy', $langs->trans("Security")); @@ -118,10 +125,6 @@ if ($conf->use_javascript_ajax) // Timeout $var=true; -print ''; -print ''; -print ''; - print ''; print ''; @@ -196,14 +199,13 @@ print ''; print '
'; -print '
'; -print ''; -print '
'; - -print '
'; - dol_fiche_end(); +print '
'; +print ''; +print '
'; + +print ''; $db->close(); diff --git a/htdocs/admin/security_other.php b/htdocs/admin/security_other.php index 6cbbe9185a0..c7ad04c322c 100644 --- a/htdocs/admin/security_other.php +++ b/htdocs/admin/security_other.php @@ -80,35 +80,15 @@ else if (preg_match('/del_(.*)/',$action,$reg)) } } -else if ($action == 'MAIN_SESSION_TIMEOUT') +else if ($action == 'updateform') { - if (! dolibarr_set_const($db, "MAIN_SESSION_TIMEOUT", $_POST["MAIN_SESSION_TIMEOUT"],'chaine',0,'',$conf->entity)) dol_print_error($db); - else setEventMessage($langs->trans("RecordModifiedSuccessfully")); -} -else if ($action == 'MAIN_UPLOAD_DOC') -{ - if (! dolibarr_set_const($db, 'MAIN_UPLOAD_DOC',$_POST["MAIN_UPLOAD_DOC"],'chaine',0,'',$conf->entity)) dol_print_error($db); - else setEventMessage($langs->trans("RecordModifiedSuccessfully")); -} -else if ($action == 'MAIN_UMASK') -{ - if (! dolibarr_set_const($db, "MAIN_UMASK", $_POST["MAIN_UMASK"],'chaine',0,'',$conf->entity)) dol_print_error($db); - else setEventMessage($langs->trans("RecordModifiedSuccessfully")); -} -else if ($action == 'MAIN_ANTIVIRUS_COMMAND') -{ - if (! dolibarr_set_const($db, "MAIN_ANTIVIRUS_COMMAND", $_POST["MAIN_ANTIVIRUS_COMMAND"],'chaine',0,'',$conf->entity)) dol_print_error($db); - else setEventMessage($langs->trans("RecordModifiedSuccessfully")); -} -else if ($action == 'MAIN_ANTIVIRUS_PARAM') -{ - if (! dolibarr_set_const($db, "MAIN_ANTIVIRUS_PARAM", $_POST["MAIN_ANTIVIRUS_PARAM"],'chaine',0,'',$conf->entity)) dol_print_error($db); - else setEventMessage($langs->trans("RecordModifiedSuccessfully")); -} -else if ($action == 'MAIN_APPLICATION_TITLE') -{ - if (! dolibarr_set_const($db, "MAIN_APPLICATION_TITLE", $_POST["MAIN_APPLICATION_TITLE"],'chaine',0,'',$conf->entity)) dol_print_error($db); - else setEventMessage($langs->trans("RecordModifiedSuccessfully")); + $res1=dolibarr_set_const($db, "MAIN_APPLICATION_TITLE", $_POST["MAIN_APPLICATION_TITLE"],'chaine',0,'',$conf->entity); + $res2=dolibarr_set_const($db, "MAIN_SESSION_TIMEOUT", $_POST["MAIN_SESSION_TIMEOUT"],'chaine',0,'',$conf->entity); + $res3=dolibarr_set_const($db, 'MAIN_UPLOAD_DOC',$_POST["MAIN_UPLOAD_DOC"],'chaine',0,'',$conf->entity); + $res4=dolibarr_set_const($db, "MAIN_UMASK", $_POST["MAIN_UMASK"],'chaine',0,'',$conf->entity); + $res5=dolibarr_set_const($db, "MAIN_ANTIVIRUS_COMMAND", $_POST["MAIN_ANTIVIRUS_COMMAND"],'chaine',0,'',$conf->entity); + $res6=dolibarr_set_const($db, "MAIN_ANTIVIRUS_PARAM", $_POST["MAIN_ANTIVIRUS_PARAM"],'chaine',0,'',$conf->entity); + if ($res1 && $res2 && $res3 && $res4 && $res5 && $res6) setEventMessage($langs->trans("RecordModifiedSuccessfully")); } @@ -138,57 +118,17 @@ print_fiche_titre($langs->trans("SecuritySetup"),'','setup'); print $langs->trans("MiscellaneousDesc")."
\n"; print "
\n"; + + +print '
'; +print ''; +print ''; + $head=security_prepare_head(); dol_fiche_head($head, 'misc', $langs->trans("Security")); -// Timeout -$var=true; - -print ''; -print ''; -print ''; -print ''; -print ''; -print "\n"; - -$var=!$var; -$sessiontimeout=ini_get("session.gc_maxlifetime"); -if (empty($conf->global->MAIN_SESSION_TIMEOUT)) $conf->global->MAIN_SESSION_TIMEOUT=$sessiontimeout; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; - -$var=!$var; -$sessiontimeout=ini_get("session.gc_maxlifetime"); -if (empty($conf->global->MAIN_APPLICATION_TITLE)) $conf->global->MAIN_APPLICATION_TITLE=""; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; - -print '
'.$langs->trans("Parameters").''.$langs->trans("Value").' 
'.$langs->trans("SessionTimeOut").''; -print $form->textwithpicto('',$langs->trans("SessionExplanation",ini_get("session.gc_probability"),ini_get("session.gc_divisor"))); -print ''; -print ' '.strtolower($langs->trans("Seconds")); -print ''; -print ''; -print '
'.$langs->trans("MAIN_APPLICATION_TITLE").''; -print ''; -print ' '; -print ''; -print ''; -print '
'; -print '
'; - // Other Options $var=true; @@ -253,6 +193,44 @@ print ""; print ''; + +print '
'; + + +// Timeout +$var=true; + +print ''; +print ''; +print ''; +print ''; +print "\n"; + +$var=!$var; +$sessiontimeout=ini_get("session.gc_maxlifetime"); +if (empty($conf->global->MAIN_SESSION_TIMEOUT)) $conf->global->MAIN_SESSION_TIMEOUT=$sessiontimeout; +print ''; +print ''; +print ''; +print ''; + +$var=!$var; +$sessiontimeout=ini_get("session.gc_maxlifetime"); +if (empty($conf->global->MAIN_APPLICATION_TITLE)) $conf->global->MAIN_APPLICATION_TITLE=""; +print ''; +print ''; +print ''; +print ''; + +print '
'.$langs->trans("Parameters").''.$langs->trans("Value").'
'.$langs->trans("SessionTimeOut").''; +print $form->textwithpicto('',$langs->trans("SessionExplanation",ini_get("session.gc_probability"),ini_get("session.gc_divisor"))); +print ''; +print ' '.strtolower($langs->trans("Seconds")); +print '
'.$langs->trans("MAIN_APPLICATION_TITLE").''; +print ''; +print ' '; +print '
'; + print '
'; // Upload options @@ -262,11 +240,8 @@ print ''; print ''; print ''; print ''; -print ''; print ''; -print ''; -print ''; print ''; print ''; print ''; -print ''; -print ''; +print ''; $var=!$var; -print ''; -print ''; print ''; print ''; print ''; -print ''; -print ''; +print ''; // Use anti virus $var=!$var; -print ''; -print ''; print ""; print '"; -print ''; print ''; -print ''; // Use anti virus $var=!$var; -print ''; -print ''; print ""; print ''; print '"; -print ''; print ''; -print ''; print '
'.$langs->trans("Parameters").''.$langs->trans("Value").' 
'.$langs->trans("MaxSizeForUploadedFiles").'.'; $max=@ini_get('upload_max_filesize'); @@ -276,14 +251,9 @@ print ''; print ' '.$langs->trans("Kb"); print ''; -print ''; -print '
'.$langs->trans("UMask").''; print $form->textwithpicto('',$langs->trans("UMaskExplanation")); @@ -291,15 +261,10 @@ print ''; print ''; print ''; -print ''; -print '
'.$langs->trans("AntiVirusCommand").'
'; print $langs->trans("AntiVirusCommandExample"); @@ -319,16 +284,10 @@ if (ini_get('safe_mode') && ! empty($conf->global->MAIN_ANTIVIRUS_COMMAND)) } print ''; print "
'; -print ''; -print '
'.$langs->trans("AntiVirusParam").'
'; print $langs->trans("AntiVirusParamExample"); @@ -336,16 +295,18 @@ print '
'; print ''; print "'; -print ''; -print '
'; dol_fiche_end(); +print '
'; + +print ''; + + + // Form to test upload print '
'; $formfile=new FormFile($db); From d94d7f683b4f1a354ec4a65434cd714d1d92ef8b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Nov 2014 10:31:59 +0100 Subject: [PATCH 5/7] Try to solve warning. --- .../class/opensurveysondage.class.php | 31 ++++++++++++------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php index 48119a7f16f..fa506285cc8 100644 --- a/htdocs/opensurvey/class/opensurveysondage.class.php +++ b/htdocs/opensurvey/class/opensurveysondage.class.php @@ -392,6 +392,7 @@ class Opensurveysondage extends CommonObject function fetch_lines() { $ret=array(); + $sql = "SELECT id_users, nom as name, reponses FROM ".MAIN_DB_PREFIX."opensurvey_user_studs"; $sql.= " WHERE id_sondage = '".$this->db->escape($this->id_sondage)."'"; $resql=$this->db->query($sql); @@ -441,7 +442,9 @@ class Opensurveysondage extends CommonObject * * @return Object[] */ - public function getComments() { + public function getComments() + { + $comments = array(); $sql = 'SELECT id_comment, usercomment, comment'; $sql.= ' FROM '.MAIN_DB_PREFIX.'opensurvey_comments'; @@ -449,13 +452,16 @@ class Opensurveysondage extends CommonObject $sql.= " ORDER BY id_comment"; $resql = $this->db->query($sql); - $num_rows=$this->db->num_rows($resql); + if ($resql) + { + $num_rows=$this->db->num_rows($resql); - $comments = array(); - - if ($num_rows > 0) { - while ($obj = $this->db->fetch_object($resql)) { - $comments[] = $obj; + if ($num_rows > 0) + { + while ($obj = $this->db->fetch_object($resql)) + { + $comments[] = $obj; + } } } @@ -469,8 +475,8 @@ class Opensurveysondage extends CommonObject * @param string $comment_user Comment author * @return boolean False in case of the query fails, true if it was successful */ - public function addComment($comment, $comment_user) { - + public function addComment($comment, $comment_user) + { $sql = "INSERT INTO ".MAIN_DB_PREFIX."opensurvey_comments (id_sondage, comment, usercomment)"; $sql.= " VALUES ('".$this->db->escape($this->id_sondage)."','".$this->db->escape($comment)."','".$this->db->escape($comment_user)."')"; $resql = $this->db->query($sql); @@ -488,7 +494,8 @@ class Opensurveysondage extends CommonObject * @param int $id_comment Id of the comment * @return boolean False in case of the query fails, true if it was successful */ - public function deleteComment($id_comment) { + public function deleteComment($id_comment) + { $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'opensurvey_comments WHERE id_comment = '.$id_comment.' AND id_sondage = '.$this->id_sondage; $resql = $this->db->query($sql); @@ -504,8 +511,8 @@ class Opensurveysondage extends CommonObject * * @return void */ - private function cleanParameters() { - + private function cleanParameters() + { $this->id_sondage = trim($this->id_sondage); $this->commentaires = trim($this->commentaires); $this->mail_admin = trim($this->mail_admin); From c8cd36f3e66c446cc905ac0edf1bcc91663f13f0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Nov 2014 10:48:55 +0100 Subject: [PATCH 6/7] Fixed: ref supplier was visible with label Ref customer. --- htdocs/contrat/card.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 3502736fca6..20fd6939f5d 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -935,8 +935,8 @@ if ($action == 'create') } print ''.$langs->trans('Ref').''.$tmpcode.''; - // Ref Int - print ''.$langs->trans('RefCustomer').''; + // Ref supplier + print ''.$langs->trans('RefSupplier').''; print ''; // Customer @@ -1134,9 +1134,9 @@ else print ''; print ''; - print $form->editfieldkey("RefCustomer",'ref_supplier',$object->ref_supplier,$object,$user->rights->contrat->creer); + print $form->editfieldkey("RefSupplier",'ref_supplier',$object->ref_supplier,$object,$user->rights->contrat->creer); print ''; - print $form->editfieldval("RefCustomer",'ref_supplier',$object->ref_supplier,$object,$user->rights->contrat->creer); + print $form->editfieldval("RefSupplier",'ref_supplier',$object->ref_supplier,$object,$user->rights->contrat->creer); print ''; print ''; @@ -1290,7 +1290,7 @@ else $productstatic->ref=$objp->label; print $productstatic->getNomUrl(0,'',16); } - if (! empty($conf->global->PRODUIT_DESC_IN_FORM) and $objp->description) + if (! empty($conf->global->PRODUIT_DESC_IN_FORM) and $objp->description) print '
'.dol_nl2br($objp->description); print ''; } From 9f6a6d1300c4aa1e1087127029ca5d687ab3b9c3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Nov 2014 10:55:38 +0100 Subject: [PATCH 7/7] Fix: Missing translation --- htdocs/langs/en_US/admin.lang | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index a075f99cd06..720da83ccfd 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1540,6 +1540,12 @@ Opened=Opened Closed=Closed AlwaysEditable=Can always be edited MAIN_APPLICATION_TITLE=Force visible name of application +NbMajMin=Minimum number of uppercase characters +NbNumMin=Minimum number of numeric characters +NbSpeMin=Minimum number of special characters +NbSpeMin=Minimum number of special characters +NbIteConsecutive=Maximum number of repeating same characters +NoAmbiCaracAutoGeneration=Do not use ambiguous characters ("1","l","i","|","0","O") for automatic generation Format=Format TypePaymentDesc=0:Customer payment type, 1:Supplier payment type, 2:Both customers and suppliers payment type