diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 867c0cfbc1d..c1a6769216b 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -715,9 +715,9 @@ class Adherent extends CommonObject $this->error .= $this->db->lasterror(); $errorflag=-1; dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR); - + } - + // Remove cotisation if (! $error) { @@ -732,9 +732,9 @@ class Adherent extends CommonObject dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR); } } - + // Remove linked user - if (! $error) + if (! $error) { $ret=$this->setUserId(0); if ($ret < 0) @@ -745,21 +745,22 @@ class Adherent extends CommonObject dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR); } } - + // Removed extrafields if (! $error) { if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used { - $result=$this->deleteExtraFields($this); - if ($result < 0) { + $result=$this->deleteExtraFields(); + if ($result < 0) + { $error++; $errorflag=-4; dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR); } } } - + // Remove adherent if (! $error) { @@ -774,7 +775,7 @@ class Adherent extends CommonObject dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR); } } - + if (! $error) { // Appel des triggers @@ -784,9 +785,9 @@ class Adherent extends CommonObject if ($result < 0) {$error++; $this->errors=$interface->errors;} // Fin appel triggers } - - - + + + if (! $error) { $this->db->commit(); diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 489c9d2409d..dfc80a04051 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -227,7 +227,7 @@ class ActionComm extends CommonObject } } else if ($reshook < 0) $error++; - + if (! $notrigger) { // Appel des triggers @@ -367,13 +367,17 @@ class ActionComm extends CommonObject $this->error=$this->db->lasterror(); $error++; } - + // Removed extrafields if (! $error) { - $result=$this->deleteExtraFields($this); - if ($result < 0) $error++; + $result=$this->deleteExtraFields(); + if ($result < 0) + { + $error++; + dol_syslog(get_class($this)."::delete error -3 ".$this->error, LOG_ERR); + } } - + if (!$error) { if (! $notrigger) @@ -468,7 +472,7 @@ class ActionComm extends CommonObject dol_syslog(get_class($this)."::update sql=".$sql); if ($this->db->query($sql)) { - + // Actions on extra fields (by external module or standard code) include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; $hookmanager=new HookManager($this->db); @@ -487,7 +491,7 @@ class ActionComm extends CommonObject } } else if ($reshook < 0) $error++; - + if (! $notrigger) { // Appel des triggers diff --git a/htdocs/contact/fiche.php b/htdocs/contact/fiche.php index 2e28c7e2a5c..6a3ee5b2bcd 100644 --- a/htdocs/contact/fiche.php +++ b/htdocs/contact/fiche.php @@ -385,12 +385,13 @@ else }); $("#copyaddressfromsoc").click(function() { - $(\'textarea[name="address"]\').text("'.addslashes($objsoc->address).'"); - $(\'input[name="zipcode"]\').val("'.addslashes($objsoc->zip).'"); - $(\'input[name="town"]\').val("'.addslashes($objsoc->town).'"); - $(\'select[name="country_id"]\').val("'.addslashes($objsoc->country_id).'"); - $(\'select[name="state_id"]\').val("'.addslashes($objsoc->state_id).'"); - }); + $(\'textarea[name="address"]\').text("'.dol_escape_js($objsoc->address).'"); + $(\'input[name="zipcode"]\').val("'.dol_escape_js($objsoc->zip).'"); + $(\'input[name="town"]\').val("'.dol_escape_js($objsoc->town).'"); + $(\'select[name="country_id"]\').val("'.dol_escape_js($objsoc->country_id).'"); + $(\'select[name="state_id"]\').val("'.dol_escape_js($objsoc->state_id).'"); + $(\'input[name="email"]\').val("'.dol_escape_js($objsoc->email).'"); + }); })'."\n"; print ''."\n"; } @@ -482,16 +483,16 @@ else // Phone / Fax if (($objsoc->typent_code == 'TE_PRIVATE' || ! empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->phone_pro)) == 0) $object->phone_pro = $objsoc->tel; // Predefined with third party - print ''.$langs->trans("PhonePro").'phone_pro).'">'; - print ''.$langs->trans("PhonePerso").'phone_perso).'">'; + print ''.$langs->trans("PhonePro").'phone_pro).'">'; + print ''.$langs->trans("PhonePerso").'phone_perso).'">'; if (($objsoc->typent_code == 'TE_PRIVATE' || ! empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->fax)) == 0) $object->fax = $objsoc->fax; // Predefined with third party - print ''.$langs->trans("PhoneMobile").'phone_mobile).'">'; - print ''.$langs->trans("Fax").'fax).'">'; + print ''.$langs->trans("PhoneMobile").'phone_mobile).'">'; + print ''.$langs->trans("Fax").'fax).'">'; // EMail if (($objsoc->typent_code == 'TE_PRIVATE' || ! empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->email)) == 0) $object->email = $objsoc->email; // Predefined with third party - print ''.$langs->trans("Email").'email).'">'; + print ''.$langs->trans("Email").'email).'">'; if (! empty($conf->mailing->enabled)) { print ''.$langs->trans("No_Email").''.$form->selectyesno('no_email',(isset($_POST["no_email"])?$_POST["no_email"]:$object->no_email), 1).''; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 75a5086e711..4147bdf2fb6 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2069,25 +2069,24 @@ abstract class CommonObject /** * Delete all extra fields values for the current object. - * - * @return void + * + * @return int <0 if KO, >0 if OK */ function deleteExtraFields() { global $langs; - + $error=0; - + $this->db->begin(); - + $sql_del = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element."_extrafields WHERE fk_object = ".$this->id; - dol_syslog(get_class($this)."::insertExtraFields delete sql=".$sql_del); - $this->db->query($sql_del); - + dol_syslog(get_class($this)."::deleteExtraFields delete sql=".$sql_del); + $resql=$this->db->query($sql_del); if (! $resql) { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::delete ".$this->error,LOG_ERR); + dol_syslog(get_class($this)."::deleteExtraFields ".$this->error,LOG_ERR); $this->db->rollback(); return -1; } @@ -2256,7 +2255,7 @@ abstract class CommonObject /** * Function that returns the total amount of discounts applied. - * + * * @return false|float False is returned if the discount couldn't be retrieved */ function getTotalDiscount() @@ -2264,7 +2263,7 @@ abstract class CommonObject $sql = 'SELECT (SUM(`subprice`) - SUM(`total_ht`)) as `discount` FROM '.MAIN_DB_PREFIX.$this->table_element.'det WHERE `'.$this->fk_element.'` = '.$this->id; $query = $this->db->query($sql); - + if ($query) { $result = $this->db->fetch_object($query); diff --git a/htdocs/install/mysql/migration/3.2.0-3.3.0.sql b/htdocs/install/mysql/migration/3.2.0-3.3.0.sql index 07e1d00be10..7a57a99a0d3 100755 --- a/htdocs/install/mysql/migration/3.2.0-3.3.0.sql +++ b/htdocs/install/mysql/migration/3.2.0-3.3.0.sql @@ -172,6 +172,7 @@ date_create datetime NOT NULL , description varchar(255) NOT NULL , date_debut date NOT NULL , date_fin date NOT NULL , +halfday integer DEFAULT 0, statut integer NOT NULL DEFAULT '1', fk_validator integer NOT NULL , date_valid datetime DEFAULT NULL , @@ -183,6 +184,8 @@ fk_user_cancel integer DEFAULT NULL, detail_refuse varchar(250) DEFAULT NULL ) ENGINE=innodb; +ALTER TABLE llx_holiday ADD COLUMN halfday integer DEFAULT 0 after date_fin; + ALTER TABLE llx_holiday ADD INDEX idx_holiday_fk_user (fk_user); ALTER TABLE llx_holiday ADD INDEX idx_holiday_date_debut (date_debut); diff --git a/htdocs/install/mysql/tables/llx_holiday.sql b/htdocs/install/mysql/tables/llx_holiday.sql index 08e96799949..1d99405600a 100644 --- a/htdocs/install/mysql/tables/llx_holiday.sql +++ b/htdocs/install/mysql/tables/llx_holiday.sql @@ -24,6 +24,7 @@ date_create DATETIME NOT NULL, description VARCHAR( 255 ) NOT NULL, date_debut DATE NOT NULL, date_fin DATE NOT NULL, +halfday integer DEFAULT 0, statut integer NOT NULL DEFAULT '1', fk_validator integer NOT NULL, date_valid DATETIME DEFAULT NULL, diff --git a/htdocs/langs/fr_FR/companies.lang b/htdocs/langs/fr_FR/companies.lang index f00b80e6aa6..72115f17e5f 100644 --- a/htdocs/langs/fr_FR/companies.lang +++ b/htdocs/langs/fr_FR/companies.lang @@ -70,7 +70,7 @@ Phone=Téléphone PhonePro=Tél pro. PhonePerso=Tél perso. PhoneMobile=Tél portable -No_Email=Ne pas envoyer d'emailing de masse +No_Email=Désactiver l'envoi d'emailing de masse Fax=Fax Zip=Code postal Town=Ville diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 48731cec6cb..2a13c7f19e5 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -791,6 +791,8 @@ if (! function_exists("llxHeader")) */ function llxHeader($head = '', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='') { + global $conf; + top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers if (empty($conf->global->MAIN_HIDE_TOP_MENU)) { diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 38588d12090..daff25aebc1 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -629,8 +629,9 @@ class Product extends CommonObject // Removed extrafields if ((! $error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used { - $result=$this->deleteExtraFields($this); - if ($result < 0) { + $result=$this->deleteExtraFields(); + if ($result < 0) + { $error++; dol_syslog(get_class($this).'::delete error '.$this->error, LOG_ERR); } diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 88ca87d28e8..ee26d047ba6 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1018,7 +1018,7 @@ class Societe extends CommonObject { $error++; $this->error = $this->db->lasterror(); - dol_syslog(get_class($this)."::Delete erreur -2 ".$this->error, LOG_ERR); + dol_syslog(get_class($this)."::delete erreur -2 ".$this->error, LOG_ERR); } } @@ -1040,10 +1040,11 @@ class Societe extends CommonObject // Removed extrafields if ((! $error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used { - $result=$this->deleteExtraFields($this); - if ($result < 0) { + $result=$this->deleteExtraFields(); + if ($result < 0) + { $error++; - dol_syslog(get_class($this)."::delete error -3 ".$this->error, LOG_ERR); + dol_syslog(get_class($this)."::delete error -3 ".$this->error, LOG_ERR); } } diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 35265d42f8d..805090d3956 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -721,8 +721,9 @@ class User extends CommonObject // Remove extrafields if ((! $error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used { - $result=$this->deleteExtraFields($this); - if ($result < 0) { + $result=$this->deleteExtraFields(); + if ($result < 0) + { $error++; dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR); }