Merge remote-tracking branch 'origin/develop' into develop

This commit is contained in:
Grand Philippe 2012-12-11 19:04:54 +01:00
commit dc0558989b
11 changed files with 64 additions and 50 deletions

View File

@ -715,9 +715,9 @@ class Adherent extends CommonObject
$this->error .= $this->db->lasterror(); $this->error .= $this->db->lasterror();
$errorflag=-1; $errorflag=-1;
dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR); dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR);
} }
// Remove cotisation // Remove cotisation
if (! $error) if (! $error)
{ {
@ -732,9 +732,9 @@ class Adherent extends CommonObject
dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR); dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR);
} }
} }
// Remove linked user // Remove linked user
if (! $error) if (! $error)
{ {
$ret=$this->setUserId(0); $ret=$this->setUserId(0);
if ($ret < 0) if ($ret < 0)
@ -745,21 +745,22 @@ class Adherent extends CommonObject
dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR); dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR);
} }
} }
// Removed extrafields // Removed extrafields
if (! $error) if (! $error)
{ {
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{ {
$result=$this->deleteExtraFields($this); $result=$this->deleteExtraFields();
if ($result < 0) { if ($result < 0)
{
$error++; $error++;
$errorflag=-4; $errorflag=-4;
dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR); dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR);
} }
} }
} }
// Remove adherent // Remove adherent
if (! $error) if (! $error)
{ {
@ -774,7 +775,7 @@ class Adherent extends CommonObject
dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR); dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR);
} }
} }
if (! $error) if (! $error)
{ {
// Appel des triggers // Appel des triggers
@ -784,9 +785,9 @@ class Adherent extends CommonObject
if ($result < 0) {$error++; $this->errors=$interface->errors;} if ($result < 0) {$error++; $this->errors=$interface->errors;}
// Fin appel triggers // Fin appel triggers
} }
if (! $error) if (! $error)
{ {
$this->db->commit(); $this->db->commit();

View File

@ -227,7 +227,7 @@ class ActionComm extends CommonObject
} }
} }
else if ($reshook < 0) $error++; else if ($reshook < 0) $error++;
if (! $notrigger) if (! $notrigger)
{ {
// Appel des triggers // Appel des triggers
@ -367,13 +367,17 @@ class ActionComm extends CommonObject
$this->error=$this->db->lasterror(); $this->error=$this->db->lasterror();
$error++; $error++;
} }
// Removed extrafields // Removed extrafields
if (! $error) { if (! $error) {
$result=$this->deleteExtraFields($this); $result=$this->deleteExtraFields();
if ($result < 0) $error++; if ($result < 0)
{
$error++;
dol_syslog(get_class($this)."::delete error -3 ".$this->error, LOG_ERR);
}
} }
if (!$error) if (!$error)
{ {
if (! $notrigger) if (! $notrigger)
@ -468,7 +472,7 @@ class ActionComm extends CommonObject
dol_syslog(get_class($this)."::update sql=".$sql); dol_syslog(get_class($this)."::update sql=".$sql);
if ($this->db->query($sql)) if ($this->db->query($sql))
{ {
// Actions on extra fields (by external module or standard code) // Actions on extra fields (by external module or standard code)
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db); $hookmanager=new HookManager($this->db);
@ -487,7 +491,7 @@ class ActionComm extends CommonObject
} }
} }
else if ($reshook < 0) $error++; else if ($reshook < 0) $error++;
if (! $notrigger) if (! $notrigger)
{ {
// Appel des triggers // Appel des triggers

View File

@ -385,12 +385,13 @@ else
}); });
$("#copyaddressfromsoc").click(function() { $("#copyaddressfromsoc").click(function() {
$(\'textarea[name="address"]\').text("'.addslashes($objsoc->address).'"); $(\'textarea[name="address"]\').text("'.dol_escape_js($objsoc->address).'");
$(\'input[name="zipcode"]\').val("'.addslashes($objsoc->zip).'"); $(\'input[name="zipcode"]\').val("'.dol_escape_js($objsoc->zip).'");
$(\'input[name="town"]\').val("'.addslashes($objsoc->town).'"); $(\'input[name="town"]\').val("'.dol_escape_js($objsoc->town).'");
$(\'select[name="country_id"]\').val("'.addslashes($objsoc->country_id).'"); $(\'select[name="country_id"]\').val("'.dol_escape_js($objsoc->country_id).'");
$(\'select[name="state_id"]\').val("'.addslashes($objsoc->state_id).'"); $(\'select[name="state_id"]\').val("'.dol_escape_js($objsoc->state_id).'");
}); $(\'input[name="email"]\').val("'.dol_escape_js($objsoc->email).'");
});
})'."\n"; })'."\n";
print '</script>'."\n"; print '</script>'."\n";
} }
@ -482,16 +483,16 @@ else
// Phone / Fax // 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 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 '<tr><td>'.$langs->trans("PhonePro").'</td><td><input name="phone_pro" type="text" size="18" maxlength="80" value="'.(isset($_POST["phone_pro"])?$_POST["phone_pro"]:$object->phone_pro).'"></td>'; print '<tr><td>'.$langs->trans("PhonePro").'</td><td><input name="phone_pro" id="phone_pro" type="text" size="18" maxlength="80" value="'.(isset($_POST["phone_pro"])?$_POST["phone_pro"]:$object->phone_pro).'"></td>';
print '<td>'.$langs->trans("PhonePerso").'</td><td><input name="phone_perso" type="text" size="18" maxlength="80" value="'.(isset($_POST["phone_perso"])?$_POST["phone_perso"]:$object->phone_perso).'"></td></tr>'; print '<td>'.$langs->trans("PhonePerso").'</td><td><input name="phone_perso" id="phone_perso" type="text" size="18" maxlength="80" value="'.(isset($_POST["phone_perso"])?$_POST["phone_perso"]:$object->phone_perso).'"></td></tr>';
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 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 '<tr><td>'.$langs->trans("PhoneMobile").'</td><td><input name="phone_mobile" type="text" size="18" maxlength="80" value="'.(isset($_POST["phone_mobile"])?$_POST["phone_mobile"]:$object->phone_mobile).'"></td>'; print '<tr><td>'.$langs->trans("PhoneMobile").'</td><td><input name="phone_mobile" id="phone_mobile" type="text" size="18" maxlength="80" value="'.(isset($_POST["phone_mobile"])?$_POST["phone_mobile"]:$object->phone_mobile).'"></td>';
print '<td>'.$langs->trans("Fax").'</td><td><input name="fax" type="text" size="18" maxlength="80" value="'.(isset($_POST["fax"])?$_POST["fax"]:$object->fax).'"></td></tr>'; print '<td>'.$langs->trans("Fax").'</td><td><input name="fax" id="fax" type="text" size="18" maxlength="80" value="'.(isset($_POST["fax"])?$_POST["fax"]:$object->fax).'"></td></tr>';
// EMail // 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 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 '<tr><td>'.$langs->trans("Email").'</td><td><input name="email" type="text" size="50" maxlength="80" value="'.(isset($_POST["email"])?$_POST["email"]:$object->email).'"></td>'; print '<tr><td>'.$langs->trans("Email").'</td><td><input name="email" id="email" type="text" size="50" maxlength="80" value="'.(isset($_POST["email"])?$_POST["email"]:$object->email).'"></td>';
if (! empty($conf->mailing->enabled)) if (! empty($conf->mailing->enabled))
{ {
print '<td>'.$langs->trans("No_Email").'</td><td>'.$form->selectyesno('no_email',(isset($_POST["no_email"])?$_POST["no_email"]:$object->no_email), 1).'</td>'; print '<td>'.$langs->trans("No_Email").'</td><td>'.$form->selectyesno('no_email',(isset($_POST["no_email"])?$_POST["no_email"]:$object->no_email), 1).'</td>';

View File

@ -2069,25 +2069,24 @@ abstract class CommonObject
/** /**
* Delete all extra fields values for the current object. * Delete all extra fields values for the current object.
* *
* @return void * @return int <0 if KO, >0 if OK
*/ */
function deleteExtraFields() function deleteExtraFields()
{ {
global $langs; global $langs;
$error=0; $error=0;
$this->db->begin(); $this->db->begin();
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element."_extrafields WHERE fk_object = ".$this->id; $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); dol_syslog(get_class($this)."::deleteExtraFields delete sql=".$sql_del);
$this->db->query($sql_del); $resql=$this->db->query($sql_del);
if (! $resql) if (! $resql)
{ {
$this->error=$this->db->lasterror(); $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(); $this->db->rollback();
return -1; return -1;
} }
@ -2256,7 +2255,7 @@ abstract class CommonObject
/** /**
* Function that returns the total amount of discounts applied. * Function that returns the total amount of discounts applied.
* *
* @return false|float False is returned if the discount couldn't be retrieved * @return false|float False is returned if the discount couldn't be retrieved
*/ */
function getTotalDiscount() 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; $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); $query = $this->db->query($sql);
if ($query) if ($query)
{ {
$result = $this->db->fetch_object($query); $result = $this->db->fetch_object($query);

View File

@ -172,6 +172,7 @@ date_create datetime NOT NULL ,
description varchar(255) NOT NULL , description varchar(255) NOT NULL ,
date_debut date NOT NULL , date_debut date NOT NULL ,
date_fin date NOT NULL , date_fin date NOT NULL ,
halfday integer DEFAULT 0,
statut integer NOT NULL DEFAULT '1', statut integer NOT NULL DEFAULT '1',
fk_validator integer NOT NULL , fk_validator integer NOT NULL ,
date_valid datetime DEFAULT NULL , date_valid datetime DEFAULT NULL ,
@ -183,6 +184,8 @@ fk_user_cancel integer DEFAULT NULL,
detail_refuse varchar(250) DEFAULT NULL detail_refuse varchar(250) DEFAULT NULL
) )
ENGINE=innodb; 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_fk_user (fk_user);
ALTER TABLE llx_holiday ADD INDEX idx_holiday_date_debut (date_debut); ALTER TABLE llx_holiday ADD INDEX idx_holiday_date_debut (date_debut);

View File

@ -24,6 +24,7 @@ date_create DATETIME NOT NULL,
description VARCHAR( 255 ) NOT NULL, description VARCHAR( 255 ) NOT NULL,
date_debut DATE NOT NULL, date_debut DATE NOT NULL,
date_fin DATE NOT NULL, date_fin DATE NOT NULL,
halfday integer DEFAULT 0,
statut integer NOT NULL DEFAULT '1', statut integer NOT NULL DEFAULT '1',
fk_validator integer NOT NULL, fk_validator integer NOT NULL,
date_valid DATETIME DEFAULT NULL, date_valid DATETIME DEFAULT NULL,

View File

@ -70,7 +70,7 @@ Phone=Téléphone
PhonePro=Tél pro. PhonePro=Tél pro.
PhonePerso=Tél perso. PhonePerso=Tél perso.
PhoneMobile=Tél portable 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 Fax=Fax
Zip=Code postal Zip=Code postal
Town=Ville Town=Ville

View File

@ -791,6 +791,8 @@ if (! function_exists("llxHeader"))
*/ */
function llxHeader($head = '', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='') 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 top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers
if (empty($conf->global->MAIN_HIDE_TOP_MENU)) if (empty($conf->global->MAIN_HIDE_TOP_MENU))
{ {

View File

@ -629,8 +629,9 @@ class Product extends CommonObject
// Removed extrafields // Removed extrafields
if ((! $error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used if ((! $error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used
{ {
$result=$this->deleteExtraFields($this); $result=$this->deleteExtraFields();
if ($result < 0) { if ($result < 0)
{
$error++; $error++;
dol_syslog(get_class($this).'::delete error '.$this->error, LOG_ERR); dol_syslog(get_class($this).'::delete error '.$this->error, LOG_ERR);
} }

View File

@ -1018,7 +1018,7 @@ class Societe extends CommonObject
{ {
$error++; $error++;
$this->error = $this->db->lasterror(); $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 // Removed extrafields
if ((! $error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used if ((! $error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used
{ {
$result=$this->deleteExtraFields($this); $result=$this->deleteExtraFields();
if ($result < 0) { if ($result < 0)
{
$error++; $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);
} }
} }

View File

@ -721,8 +721,9 @@ class User extends CommonObject
// Remove extrafields // Remove extrafields
if ((! $error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used if ((! $error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used
{ {
$result=$this->deleteExtraFields($this); $result=$this->deleteExtraFields();
if ($result < 0) { if ($result < 0)
{
$error++; $error++;
dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR); dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR);
} }