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

This commit is contained in:
Laurent Destailleur 2013-01-23 18:09:05 +01:00
commit a7d41d74e8
7 changed files with 67 additions and 17 deletions

View File

@ -538,8 +538,6 @@ class Adherent extends CommonObject
$luser->office_phone=$this->phone;
$luser->user_mobile=$this->phone_mobile;
$luser->note=$this->note;
$luser->fk_member=$this->id;
$result=$luser->update($user,0,1,1); // Use nosync to 1 to avoid cyclic updates

View File

@ -178,6 +178,8 @@ class HookManager
// TODO. remove this. result must not be a string. we must use $actionclassinstance->resprint to return a string
if (! is_array($result) && ! is_numeric($result)) $this->resPrint.=$result;
}
//print "method=".$method." results=".count($actionclassinstance->results)." resprints=".count($actionclassinstance->resprints)." result=".$result." resaction=".$resaction;
}
}
}

View File

@ -20,6 +20,8 @@ DROP TABLE llx_document;
DROP TABLE llx_dolibarr_modules;
DROP TABLE llx_product_fournisseur;
ALTER TABLE llx_adherent ADD COLUMN canvas varchar(32);
ALTER TABLE llx_societe_rib MODIFY COLUMN bic varchar(20);
ALTER TABLE llx_facture_rec ADD COLUMN usenewprice integer;

View File

@ -60,5 +60,6 @@ create table llx_adherent
fk_user_author integer, -- can be null because member can be create by a guest
fk_user_mod integer,
fk_user_valid integer,
canvas varchar(32), -- type of canvas if used (null by default)
import_key varchar(14) -- Import key
)ENGINE=innodb;

View File

@ -375,9 +375,10 @@ class Societe extends CommonObject
* @param int $allowmodcodeclient Inclut modif code client et code compta
* @param int $allowmodcodefournisseur Inclut modif code fournisseur et code compta fournisseur
* @param string $action 'create' or 'update'
* @param int $nosyncmember Do not synchronize info of linked member
* @return int <0 if KO, >=0 if OK
*/
function update($id, $user='', $call_trigger=1, $allowmodcodeclient=0, $allowmodcodefournisseur=0, $action='update')
function update($id, $user='', $call_trigger=1, $allowmodcodeclient=0, $allowmodcodefournisseur=0, $action='update', $nosyncmember=1)
{
global $langs,$conf;
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
@ -491,7 +492,7 @@ class Societe extends CommonObject
if ($result >= 0)
{
dol_syslog(get_class($this)."::Update verify ok");
dol_syslog(get_class($this)."::update verify ok");
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET ";
$sql .= "nom = '" . $this->db->escape($this->name) ."'"; // Required
@ -564,11 +565,49 @@ class Societe extends CommonObject
$resql=$this->db->query($sql);
if ($resql)
{
unset($this->country_code); // We clean this because it may have been changed after an update of country_id
unset($this->country);
unset($this->state_code);
unset($this->state);
unset($this->country_code); // We clean this because it may have been changed after an update of country_id
unset($this->country);
unset($this->state_code);
unset($this->state);
$nbrowsaffected+=$this->db->affected_rows($resql);
if (! $error && $nbrowsaffected)
{
// Update information on linked member if it is an update
if (! $nosyncmember && ! empty($conf->adherent->enabled))
{
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
dol_syslog(get_class($this)."::update update linked member");
$lmember=new Adherent($this->db);
$result=$lmember->fetch(0, 0, $this->id);
if ($result > 0)
{
$lmember->firstname=$this->firstname;
$lmember->lastname=$this->lastname;
$lmember->address=$this->address;
$lmember->email=$this->email;
$lmember->phone=$this->phone;
$result=$lmember->update($user,0,1,1); // Use nosync to 1 to avoid cyclic updates
if ($result < 0)
{
$this->error=$lmember->error;
dol_syslog(get_class($this)."::update ".$this->error,LOG_ERR);
$error++;
}
}
else if ($result < 0)
{
$this->error=$lmember->error;
$error++;
}
}
}
// Si le fournisseur est classe on l'ajoute
$this->AddFournisseurInCategory($this->fournisseur_categorie);

View File

@ -346,7 +346,7 @@ if (empty($reshook))
if (empty($object->fournisseur)&& empty($object->oldcopy->code_fournisseur)) $object->code_fournisseur='';
//var_dump($object);exit;
$result = $object->update($socid,$user,1,$object->oldcopy->codeclient_modifiable(),$object->oldcopy->codefournisseur_modifiable());
$result = $object->update($socid, $user, 1, $object->oldcopy->codeclient_modifiable(), $object->oldcopy->codefournisseur_modifiable(), 'update', 0);
if ($result <= 0)
{
$error = $object->error; $errors = $object->errors;
@ -397,6 +397,22 @@ if (empty($reshook))
}
// Gestion du logo de la société
// Update linked member
if (! $error && $object->fk_soc > 0)
{
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent";
$sql.= " SET fk_soc = NULL WHERE fk_soc = " . $id;
dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG);
if (! $this->db->query($sql))
{
$error++;
$this->error .= $this->db->lasterror();
dol_syslog(get_class($this)."::delete erreur -1 ".$this->error, LOG_ERR);
}
}
if (! $error && ! count($errors))
{

View File

@ -223,10 +223,6 @@ if ($action == 'add' && $canadduser)
$object->entity = (empty($_POST["entity"]) ? 0 : $_POST["entity"]);
}
}
else if (! empty($_POST["admin"]))
{
$object->entity=0;
}
else
{
$object->entity = (empty($_POST["entity"]) ? 0 : $_POST["entity"]);
@ -372,10 +368,6 @@ if ($action == 'update' && ! $_POST["cancel"])
$object->entity = (empty($_POST["entity"]) ? 0 : $_POST["entity"]);
}
}
else if(! empty($_POST["admin"]))
{
$object->entity=0;
}
else
{
$object->entity = (empty($_POST["entity"]) ? 0 : $_POST["entity"]);