Merge branch 'develop' of https://github.com/Dolibarr/dolibarr.git into develop

This commit is contained in:
fhenry 2013-01-23 19:46:44 +01:00
commit 848bb5417d
17 changed files with 312 additions and 159 deletions

View File

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

View File

@ -3,7 +3,7 @@
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Marc Barilley <marc@ocebo.com> * Copyright (C) 2005 Marc Barilley <marc@ocebo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr> * Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
@ -301,7 +301,7 @@ class Propal extends CommonObject
* @param int $info_bits Bits de type de lignes * @param int $info_bits Bits de type de lignes
* @param int $type Type of line (product, service) * @param int $type Type of line (product, service)
* @param int $rang Position of line * @param int $rang Position of line
* @param int $special_code Special code * @param int $special_code Special code (also used by externals modules!)
* @param int $fk_parent_line Id of parent line * @param int $fk_parent_line Id of parent line
* @param int $fk_fournprice Id supplier price * @param int $fk_fournprice Id supplier price
* @param int $pa_ht Buying price without tax * @param int $pa_ht Buying price without tax
@ -457,7 +457,7 @@ class Propal extends CommonObject
* @param string $desc Description * @param string $desc Description
* @param double $price_base_type HT ou TTC * @param double $price_base_type HT ou TTC
* @param int $info_bits Miscellanous informations * @param int $info_bits Miscellanous informations
* @param int $special_code Set special code ('' = we don't change it) * @param int $special_code Special code (also used by externals modules!)
* @param int $fk_parent_line Id of parent line (0 in most cases, used by modules adding sublevels into lines). * @param int $fk_parent_line Id of parent line (0 in most cases, used by modules adding sublevels into lines).
* @param int $skip_update_total Keep fields total_xxx to 0 (used for special lines by some modules) * @param int $skip_update_total Keep fields total_xxx to 0 (used for special lines by some modules)
* @param int $fk_fournprice Id of origin supplier price * @param int $fk_fournprice Id of origin supplier price
@ -480,7 +480,7 @@ class Propal extends CommonObject
$txtva = price2num($txtva); $txtva = price2num($txtva);
$txlocaltax1=price2num($txlocaltax1); $txlocaltax1=price2num($txlocaltax1);
$txlocaltax2=price2num($txlocaltax2); $txlocaltax2=price2num($txlocaltax2);
$pa_ht=price2num($pa_ht); $pa_ht=price2num($pa_ht);
if (empty($qty) && empty($special_code)) $special_code=3; // Set option tag if (empty($qty) && empty($special_code)) $special_code=3; // Set option tag
if (! empty($qty) && $special_code == 3) $special_code=0; // Remove option tag if (! empty($qty) && $special_code == 3) $special_code=0; // Remove option tag

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011 Jean Heimburger <jean@tiaris.info> * Copyright (C) 2011 Jean Heimburger <jean@tiaris.info>
@ -995,7 +995,7 @@ class Commande extends CommonOrder
* @param timestamp $date_end End date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html) * @param timestamp $date_end End date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
* @param int $type Type of line (0=product, 1=service) * @param int $type Type of line (0=product, 1=service)
* @param int $rang Position of line * @param int $rang Position of line
* @param int $special_code Special code * @param int $special_code Special code (also used by externals modules!)
* @param int $fk_parent_line Parent line * @param int $fk_parent_line Parent line
* @param int $fk_fournprice Id supplier price * @param int $fk_fournprice Id supplier price
* @param int $pa_ht Buying price (without tax) * @param int $pa_ht Buying price (without tax)
@ -2176,9 +2176,10 @@ class Commande extends CommonOrder
* @param int $fk_fournprice Id of origin supplier price * @param int $fk_fournprice Id of origin supplier price
* @param int $pa_ht Price (without tax) of product when it was bought * @param int $pa_ht Price (without tax) of product when it was bought
* @param string $label Label * @param string $label Label
* @param int $special_code Special code (also used by externals modules!)
* @return int < 0 if KO, > 0 if OK * @return int < 0 if KO, > 0 if OK
*/ */
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0,$txlocaltax2=0, $price_base_type='HT', $info_bits=0, $date_start='', $date_end='', $type=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='') function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0,$txlocaltax2=0, $price_base_type='HT', $info_bits=0, $date_start='', $date_end='', $type=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $special_code=0)
{ {
global $conf; global $conf;
@ -2197,6 +2198,7 @@ class Commande extends CommonOrder
if (empty($txlocaltax2)) $txlocaltax2=0; if (empty($txlocaltax2)) $txlocaltax2=0;
if (empty($remise)) $remise=0; if (empty($remise)) $remise=0;
if (empty($remise_percent)) $remise_percent=0; if (empty($remise_percent)) $remise_percent=0;
if (empty($special_code) || $special_code == 3) $special_code=0;
$remise_percent=price2num($remise_percent); $remise_percent=price2num($remise_percent);
$qty=price2num($qty); $qty=price2num($qty);
$pu = price2num($pu); $pu = price2num($pu);
@ -2251,7 +2253,7 @@ class Commande extends CommonOrder
$this->line->remise_percent=$remise_percent; $this->line->remise_percent=$remise_percent;
$this->line->subprice=$subprice; $this->line->subprice=$subprice;
$this->line->info_bits=$info_bits; $this->line->info_bits=$info_bits;
$this->line->special_code=0; // To remove special_code=3 coming from proposals copy $this->line->special_code=$special_code;
$this->line->total_ht=$total_ht; $this->line->total_ht=$total_ht;
$this->line->total_tva=$total_tva; $this->line->total_tva=$total_tva;
$this->line->total_localtax1=$total_localtax1; $this->line->total_localtax1=$total_localtax1;

View File

@ -4,7 +4,7 @@
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org> * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com> * Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be> * Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
@ -1874,7 +1874,7 @@ class Facture extends CommonInvoice
* @param double $pu_ttc Prix unitaire TTC (> 0 even for credit note) * @param double $pu_ttc Prix unitaire TTC (> 0 even for credit note)
* @param int $type Type of line (0=product, 1=service) * @param int $type Type of line (0=product, 1=service)
* @param int $rang Position of line * @param int $rang Position of line
* @param int $special_code Special code * @param int $special_code Special code (also used by externals modules!)
* @param string $origin 'order', ... * @param string $origin 'order', ...
* @param int $origin_id Id of origin object * @param int $origin_id Id of origin object
* @param int $fk_parent_line Id of parent line * @param int $fk_parent_line Id of parent line
@ -2037,9 +2037,10 @@ class Facture extends CommonInvoice
* @param int $fk_fournprice Id of origin supplier price * @param int $fk_fournprice Id of origin supplier price
* @param int $pa_ht Price (without tax) of product when it was bought * @param int $pa_ht Price (without tax) of product when it was bought
* @param string $label Label of the line * @param string $label Label of the line
* @param int $special_code Special code (also used by externals modules!)
* @return int < 0 if KO, > 0 if OK * @return int < 0 if KO, > 0 if OK
*/ */
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $type=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='') function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $type=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $special_code=0)
{ {
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
@ -2052,11 +2053,12 @@ class Facture extends CommonInvoice
// Clean parameters // Clean parameters
if (empty($qty)) $qty=0; if (empty($qty)) $qty=0;
if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line=0; if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line=0;
if (empty($special_code) || $special_code == 3) $special_code=0;
$remise_percent = price2num($remise_percent); $remise_percent = price2num($remise_percent);
$qty = price2num($qty); $qty = price2num($qty);
$pu = price2num($pu); $pu = price2num($pu);
$pa_ht = price2num($pa_ht); $pa_ht = price2num($pa_ht);
$txtva = price2num($txtva); $txtva = price2num($txtva);
$txlocaltax1 = price2num($txlocaltax1); $txlocaltax1 = price2num($txlocaltax1);
$txlocaltax2 = price2num($txlocaltax2); $txlocaltax2 = price2num($txlocaltax2);
@ -2105,21 +2107,21 @@ class Facture extends CommonInvoice
$this->line->rowid = $rowid; $this->line->rowid = $rowid;
$this->line->label = $label; $this->line->label = $label;
$this->line->desc = $desc; $this->line->desc = $desc;
$this->line->qty= ($this->type==2?abs($qty):$qty); // For credit note, quantity is always positive and unit price negative $this->line->qty = ($this->type==2?abs($qty):$qty); // For credit note, quantity is always positive and unit price negative
$this->line->tva_tx = $txtva; $this->line->tva_tx = $txtva;
$this->line->localtax1_tx = $txlocaltax1; $this->line->localtax1_tx = $txlocaltax1;
$this->line->localtax2_tx = $txlocaltax2; $this->line->localtax2_tx = $txlocaltax2;
$this->line->remise_percent = $remise_percent; $this->line->remise_percent = $remise_percent;
$this->line->subprice= ($this->type==2?-abs($pu_ht):$pu_ht); // For credit note, unit price always negative, always positive otherwise $this->line->subprice = ($this->type==2?-abs($pu_ht):$pu_ht); // For credit note, unit price always negative, always positive otherwise
$this->line->date_start = $date_start; $this->line->date_start = $date_start;
$this->line->date_end = $date_end; $this->line->date_end = $date_end;
$this->line->total_ht= (($this->type==2||$qty<0)?-abs($total_ht):$total_ht); // For credit note and if qty is negative, total is negative $this->line->total_ht = (($this->type==2||$qty<0)?-abs($total_ht):$total_ht); // For credit note and if qty is negative, total is negative
$this->line->total_tva= (($this->type==2||$qty<0)?-abs($total_tva):$total_tva); $this->line->total_tva = (($this->type==2||$qty<0)?-abs($total_tva):$total_tva);
$this->line->total_localtax1=(($this->type==2||$qty<0)?-abs($total_localtax1):$total_localtax1); $this->line->total_localtax1 = (($this->type==2||$qty<0)?-abs($total_localtax1):$total_localtax1);
$this->line->total_localtax2=(($this->type==2||$qty<0)?-abs($total_localtax2):$total_localtax2); $this->line->total_localtax2 = (($this->type==2||$qty<0)?-abs($total_localtax2):$total_localtax2);
$this->line->total_ttc= (($this->type==2||$qty<0)?-abs($total_ttc):$total_ttc); $this->line->total_ttc = (($this->type==2||$qty<0)?-abs($total_ttc):$total_ttc);
$this->line->info_bits = $info_bits; $this->line->info_bits = $info_bits;
$this->line->special_code=0; // To remove special_code=3 coming from proposals copy $this->line->special_code = $special_code;
$this->line->product_type = $type; $this->line->product_type = $type;
$this->line->fk_parent_line = $fk_parent_line; $this->line->fk_parent_line = $fk_parent_line;
$this->line->skip_update_total = $skip_update_total; $this->line->skip_update_total = $skip_update_total;

View File

@ -2135,7 +2135,7 @@ abstract class CommonObject
$this->array_options[$key] = null; $this->array_options[$key] = null;
} }
break; break;
case 'price': case 'price':
$this->array_options[$key] = price2num($this->array_options[$key]); $this->array_options[$key] = price2num($this->array_options[$key]);
break; break;
} }
@ -2282,16 +2282,16 @@ abstract class CommonObject
$qty= $obj->qty; $qty= $obj->qty;
$discount_percent_line = $obj->remise_percent; $discount_percent_line = $obj->remise_percent;
$total_ht = $obj->total_ht; $total_ht = $obj->total_ht;
$total_discount_line = price2num(($pu_ht * $qty) - $total_ht, 'MT'); $total_discount_line = price2num(($pu_ht * $qty) - $total_ht, 'MT');
$total_discount += $total_discount_line; $total_discount += $total_discount_line;
$i++; $i++;
} }
} }
else dol_syslog(get_class($this).'::getTotalDiscount '.$this->db->lasterror(), LOG_ERR); else dol_syslog(get_class($this).'::getTotalDiscount '.$this->db->lasterror(), LOG_ERR);
//print $total_discount; exit; //print $total_discount; exit;
return price2num($total_discount); return price2num($total_discount);
} }
@ -2482,7 +2482,7 @@ abstract class CommonObject
$parameters=array(); $parameters=array();
$reshook=$hookmanager->executeHooks('showLinkedObjectBlock',$parameters,$this,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('showLinkedObjectBlock',$parameters,$this,$action); // Note that $action and $object may have been modified by hook
if (! $reshook) if (empty($reshook))
{ {
$num = count($this->linkedObjects); $num = count($this->linkedObjects);

View File

@ -41,6 +41,8 @@ class HookManager
// Array result // Array result
var $resArray=array(); var $resArray=array();
// Printable result
var $resPrint='';
/** /**
* Constructor * Constructor
@ -176,6 +178,8 @@ class HookManager
// TODO. remove this. result must not be a string. we must use $actionclassinstance->resprint to return a string // 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; 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

@ -134,8 +134,7 @@ class Form
$ret=''; $ret='';
// When option to edit inline is activated // When option to edit inline is activated
// TODO change for compatibility if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE) && ! preg_match('/^select;|datehourpicker/',$typeofdata)) // FIXME add jquery timepicker
if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE) && ! preg_match('/^select;/',$typeofdata))
{ {
$ret.=$this->editInPlace($object, $value, $htmlname, $perm, $typeofdata, $editvalue, $extObject, $success); $ret.=$this->editInPlace($object, $value, $htmlname, $perm, $typeofdata, $editvalue, $extObject, $success);
} }

View File

@ -36,9 +36,10 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
if (! empty($conf->produit->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
if (!empty($conf->produit->enabled))
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
if (! empty($conf->projet->enabled)) if (!empty($conf->projet->enabled))
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
$langs->load('orders'); $langs->load('orders');

View File

@ -3,7 +3,7 @@
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr> * Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
* Copyright (C) 2005 Marc Barilley <marc@ocebo.fr> * Copyright (C) 2005 Marc Barilley <marc@ocebo.fr>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -33,8 +33,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/supplier_invoice/modules_facturefo
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; if (!empty($conf->produit->enabled))
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
if (!empty($conf->projet->enabled))
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
$langs->load('bills'); $langs->load('bills');

View File

@ -20,6 +20,8 @@ DROP TABLE llx_document;
DROP TABLE llx_dolibarr_modules; DROP TABLE llx_dolibarr_modules;
DROP TABLE llx_product_fournisseur; 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_societe_rib MODIFY COLUMN bic varchar(20);
ALTER TABLE llx_facture_rec ADD COLUMN usenewprice integer; 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_author integer, -- can be null because member can be create by a guest
fk_user_mod integer, fk_user_mod integer,
fk_user_valid integer, fk_user_valid integer,
canvas varchar(32), -- type of canvas if used (null by default)
import_key varchar(14) -- Import key import_key varchar(14) -- Import key
)ENGINE=innodb; )ENGINE=innodb;

View File

@ -46,6 +46,7 @@ $setuplang=GETPOST("selectlang",'',3)?GETPOST("selectlang",'',3):'auto';
$langs->setDefaultLang($setuplang); $langs->setDefaultLang($setuplang);
$versionfrom=GETPOST("versionfrom",'',3)?GETPOST("versionfrom",'',3):(empty($argv[1])?'':$argv[1]); $versionfrom=GETPOST("versionfrom",'',3)?GETPOST("versionfrom",'',3):(empty($argv[1])?'':$argv[1]);
$versionto=GETPOST("versionto",'',3)?GETPOST("versionto",'',3):(empty($argv[2])?'':$argv[2]); $versionto=GETPOST("versionto",'',3)?GETPOST("versionto",'',3):(empty($argv[2])?'':$argv[2]);
$versionmodule=GETPOST("versionmodule",'',3)?GETPOST("versionmodule",'',3):(empty($argv[3])?'':$argv[3]);
$langs->load("admin"); $langs->load("admin");
$langs->load("install"); $langs->load("install");
@ -319,8 +320,9 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action')))
if ($ok) if ($ok)
{ {
$dir = "mysql/migration/"; // We use mysql migration scripts whatever is database driver $dir = "mysql/migration/"; // We use mysql migration scripts whatever is database driver
if (! empty($versionmodule)) $dir=dol_buildpath('/'.$versionmodule.'/sql/',0);
// For minor version // For minor version
$newversionfrom=preg_replace('/(\.[0-9]+)$/i','.0',$versionfrom); $newversionfrom=preg_replace('/(\.[0-9]+)$/i','.0',$versionfrom);
$newversionto=preg_replace('/(\.[0-9]+)$/i','.0',$versionto); $newversionto=preg_replace('/(\.[0-9]+)$/i','.0',$versionto);
@ -387,7 +389,7 @@ $ret=0;
if (! $ok && isset($argv[1])) $ret=1; if (! $ok && isset($argv[1])) $ret=1;
dol_syslog("Exit ".$ret); dol_syslog("Exit ".$ret);
pFooter(! $ok && empty($_GET["ignoreerrors"]),$setuplang); pFooter(((! $ok && empty($_GET["ignoreerrors"])) || $versionmodule),$setuplang);
if ($db->connected) $db->close(); if ($db->connected) $db->close();

View File

@ -375,9 +375,10 @@ class Societe extends CommonObject
* @param int $allowmodcodeclient Inclut modif code client et code compta * @param int $allowmodcodeclient Inclut modif code client et code compta
* @param int $allowmodcodefournisseur Inclut modif code fournisseur et code compta fournisseur * @param int $allowmodcodefournisseur Inclut modif code fournisseur et code compta fournisseur
* @param string $action 'create' or 'update' * @param string $action 'create' or 'update'
* @param int $nosyncmember Do not synchronize info of linked member
* @return int <0 if KO, >=0 if OK * @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; global $langs,$conf;
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
@ -491,7 +492,7 @@ class Societe extends CommonObject
if ($result >= 0) 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 = "UPDATE ".MAIN_DB_PREFIX."societe SET ";
$sql .= "nom = '" . $this->db->escape($this->name) ."'"; // Required $sql .= "nom = '" . $this->db->escape($this->name) ."'"; // Required
@ -564,11 +565,49 @@ class Societe extends CommonObject
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
unset($this->country_code); // We clean this because it may have been changed after an update of country_id unset($this->country_code); // We clean this because it may have been changed after an update of country_id
unset($this->country); unset($this->country);
unset($this->state_code); unset($this->state_code);
unset($this->state); 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 // Si le fournisseur est classe on l'ajoute
$this->AddFournisseurInCategory($this->fournisseur_categorie); $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=''; if (empty($object->fournisseur)&& empty($object->oldcopy->code_fournisseur)) $object->code_fournisseur='';
//var_dump($object);exit; //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) if ($result <= 0)
{ {
$error = $object->error; $errors = $object->errors; $error = $object->error; $errors = $object->errors;
@ -397,6 +397,22 @@ if (empty($reshook))
} }
// Gestion du logo de la société // 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)) if (! $error && ! count($errors))
{ {

View File

@ -223,10 +223,6 @@ if ($action == 'add' && $canadduser)
$object->entity = (empty($_POST["entity"]) ? 0 : $_POST["entity"]); $object->entity = (empty($_POST["entity"]) ? 0 : $_POST["entity"]);
} }
} }
else if (! empty($_POST["admin"]))
{
$object->entity=0;
}
else else
{ {
$object->entity = (empty($_POST["entity"]) ? 0 : $_POST["entity"]); $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"]); $object->entity = (empty($_POST["entity"]) ? 0 : $_POST["entity"]);
} }
} }
else if(! empty($_POST["admin"]))
{
$object->entity=0;
}
else else
{ {
$object->entity = (empty($_POST["entity"]) ? 0 : $_POST["entity"]); $object->entity = (empty($_POST["entity"]) ? 0 : $_POST["entity"]);
@ -1368,7 +1360,7 @@ else
print '<div class="tabsAction">'; print '<div class="tabsAction">';
if ($caneditfield && (empty($conf->multicompany->enabled) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->multicompany->transverse_mode && $conf->entity == 1))) if ($caneditfield && ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->multicompany->transverse_mode && $conf->entity == 1)))
{ {
if (! empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)) if (! empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED))
{ {
@ -1376,13 +1368,13 @@ else
} }
else else
{ {
print '<a class="butAction" href="fiche.php?id='.$object->id.'&amp;action=edit">'.$langs->trans("Modify").'</a>'; print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=edit">'.$langs->trans("Modify").'</a>';
} }
} }
elseif ($caneditpassword && ! $object->ldap_sid && elseif ($caneditpassword && ! $object->ldap_sid &&
(empty($conf->multicompany->enabled) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->multicompany->transverse_mode && $conf->entity == 1))) ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->multicompany->transverse_mode && $conf->entity == 1)))
{ {
print '<a class="butAction" href="fiche.php?id='.$object->id.'&amp;action=edit">'.$langs->trans("EditPassword").'</a>'; print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=edit">'.$langs->trans("EditPassword").'</a>';
} }
// Si on a un gestionnaire de generation de mot de passe actif // Si on a un gestionnaire de generation de mot de passe actif
@ -1393,9 +1385,9 @@ else
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("UserDisabled")).'">'.$langs->trans("ReinitPassword").'</a>'; print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("UserDisabled")).'">'.$langs->trans("ReinitPassword").'</a>';
} }
elseif (($user->id != $id && $caneditpassword) && $object->login && !$object->ldap_sid && elseif (($user->id != $id && $caneditpassword) && $object->login && !$object->ldap_sid &&
(empty($conf->multicompany->enabled) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->multicompany->transverse_mode && $conf->entity == 1))) ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->multicompany->transverse_mode && $conf->entity == 1)))
{ {
print '<a class="butAction" href="fiche.php?id='.$object->id.'&amp;action=password">'.$langs->trans("ReinitPassword").'</a>'; print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=password">'.$langs->trans("ReinitPassword").'</a>';
} }
if ($object->statut == 0) if ($object->statut == 0)
@ -1403,32 +1395,32 @@ else
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("UserDisabled")).'">'.$langs->trans("SendNewPassword").'</a>'; print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("UserDisabled")).'">'.$langs->trans("SendNewPassword").'</a>';
} }
else if (($user->id != $id && $caneditpassword) && $object->login && !$object->ldap_sid && else if (($user->id != $id && $caneditpassword) && $object->login && !$object->ldap_sid &&
(empty($conf->multicompany->enabled) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->multicompany->transverse_mode && $conf->entity == 1))) ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->multicompany->transverse_mode && $conf->entity == 1)))
{ {
if ($object->email) print '<a class="butAction" href="fiche.php?id='.$object->id.'&amp;action=passwordsend">'.$langs->trans("SendNewPassword").'</a>'; if ($object->email) print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=passwordsend">'.$langs->trans("SendNewPassword").'</a>';
else print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NoEMail")).'">'.$langs->trans("SendNewPassword").'</a>'; else print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NoEMail")).'">'.$langs->trans("SendNewPassword").'</a>';
} }
} }
// Activer // Activer
if ($user->id <> $id && $candisableuser && $object->statut == 0 && if ($user->id <> $id && $candisableuser && $object->statut == 0 &&
(empty($conf->multicompany->enabled) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->multicompany->transverse_mode && $conf->entity == 1))) ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->multicompany->transverse_mode && $conf->entity == 1)))
{ {
print '<a class="butAction" href="fiche.php?id='.$object->id.'&amp;action=enable">'.$langs->trans("Reactivate").'</a>'; print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=enable">'.$langs->trans("Reactivate").'</a>';
} }
// Desactiver // Desactiver
if ($user->id <> $id && $candisableuser && $object->statut == 1 && if ($user->id <> $id && $candisableuser && $object->statut == 1 &&
(empty($conf->multicompany->enabled) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->multicompany->transverse_mode && $conf->entity == 1))) ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->multicompany->transverse_mode && $conf->entity == 1)))
{ {
print '<a class="butActionDelete" href="fiche.php?action=disable&amp;id='.$object->id.'">'.$langs->trans("DisableUser").'</a>'; print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=disable&amp;id='.$object->id.'">'.$langs->trans("DisableUser").'</a>';
} }
// Delete // Delete
if ($user->id <> $id && $candisableuser && if ($user->id <> $id && $candisableuser &&
(empty($conf->multicompany->enabled) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->multicompany->transverse_mode && $conf->entity == 1))) ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->multicompany->transverse_mode && $conf->entity == 1)))
{ {
if ($user->admin || ! $object->admin) // If user edited is admin, delete is possible on for an admin if ($user->admin || ! $object->admin) // If user edited is admin, delete is possible on for an admin
{ {
print '<a class="butActionDelete" href="fiche.php?action=delete&amp;id='.$object->id.'">'.$langs->trans("DeleteUser").'</a>'; print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=delete&amp;id='.$object->id.'">'.$langs->trans("DeleteUser").'</a>';
} }
else else
{ {
@ -1582,7 +1574,7 @@ else
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'" method="POST" name="updateuser" enctype="multipart/form-data">'; print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'" method="POST" name="updateuser" enctype="multipart/form-data">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="entity" value="'.$conf->entity.'">'; print '<input type="hidden" name="entity" value="'.$object->entity.'">';
print '<table width="100%" class="border">'; print '<table width="100%" class="border">';
$rowspan=13; $rowspan=13;

View File

@ -28,6 +28,7 @@ require_once("../master.inc.php");
require_once(NUSOAP_PATH.'/nusoap.php'); // Include SOAP require_once(NUSOAP_PATH.'/nusoap.php'); // Include SOAP
require_once(DOL_DOCUMENT_ROOT."/core/lib/ws.lib.php"); require_once(DOL_DOCUMENT_ROOT."/core/lib/ws.lib.php");
require_once(DOL_DOCUMENT_ROOT."/contact/class/contact.class.php"); require_once(DOL_DOCUMENT_ROOT."/contact/class/contact.class.php");
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
dol_syslog("Call Contact webservices interfaces"); dol_syslog("Call Contact webservices interfaces");
@ -80,6 +81,58 @@ $server->wsdl->addComplexType(
) )
); );
$contact_fields = array(
'id' => array('name'=>'id','type'=>'xsd:string'),
'lastname' => array('name'=>'lastname','type'=>'xsd:string'),
'firstname' => array('name'=>'firstname','type'=>'xsd:string'),
'address' => array('name'=>'address','type'=>'xsd:string'),
'zip' => array('name'=>'zip','type'=>'xsd:string'),
'town' => array('name'=>'town','type'=>'xsd:string'),
'state_id' => array('name'=>'state_id','type'=>'xsd:string'),
'state_code' => array('name'=>'state_code','type'=>'xsd:string'),
'state' => array('name'=>'state','type'=>'xsd:string'),
'country_id' => array('name'=>'country_id','type'=>'xsd:string'),
'country_code' => array('name'=>'country_code','type'=>'xsd:string'),
'country' => array('name'=>'country','type'=>'xsd:string'),
'socid' => array('name'=>'socid','type'=>'xsd:string'),
'status' => array('name'=>'status','type'=>'xsd:string'),
'phone_pro' => array('name'=>'phone_pro','type'=>'xsd:string'),
'fax' => array('name'=>'fax','type'=>'xsd:string'),
'phone_perso' => array('name'=>'phone_perso','type'=>'xsd:string'),
'phone_mobile' => array('name'=>'phone_mobile','type'=>'xsd:string'),
'code' => array('name'=>'code','type'=>'xsd:string'),
'email' => array('name'=>'email','type'=>'xsd:string'),
'birthday' => array('name'=>'birthday','type'=>'xsd:string'),
'default_lang' => array('name'=>'default_lang','type'=>'xsd:string'),
'note' => array('name'=>'note','type'=>'xsd:string'),
'no_email' => array('name'=>'no_email','type'=>'xsd:string'),
'ref_facturation' => array('name'=>'ref_facturation','type'=>'xsd:string'),
'ref_contrat' => array('name'=>'ref_contrat','type'=>'xsd:string'),
'ref_commande' => array('name'=>'ref_commande','type'=>'xsd:string'),
'ref_propal' => array('name'=>'ref_propal','type'=>'xsd:string'),
'user_id' => array('name'=>'user_id','type'=>'xsd:string'),
'user_login' => array('name'=>'user_login','type'=>'xsd:string'),
'civility_id' => array('name'=>'civility_id','type'=>'xsd:string')
//...
);
//Retreive all extrafield for contact
// fetch optionals attributes and labels
$extrafields=new ExtraFields($db);
$extralabels=$extrafields->fetch_name_optionals_label('contact',true);
if (count($extrafields)>0) {
$extrafield_array = array();
}
foreach($extrafields->attribute_label as $key=>$label)
{
$type =$extrafields->attribute_type[$key];
if ($type=='date' || $type=='datetime') {$type='xsd:dateTime';}
else {$type='xsd:string';}
$extrafield_array['options_'.$key]=array('name'=>'options_'.$key,'type'=>$type);
}
$contact_fields=array_merge($contact_fields,$extrafield_array);
// Define other specific objects // Define other specific objects
$server->wsdl->addComplexType( $server->wsdl->addComplexType(
'contact', 'contact',
@ -87,36 +140,7 @@ $server->wsdl->addComplexType(
'struct', 'struct',
'all', 'all',
'', '',
array( $contact_fields
'id' => array('name'=>'id','type'=>'xsd:string'),
'lastname' => array('name'=>'lastname','type'=>'xsd:string'),
'firstname' => array('name'=>'firstname','type'=>'xsd:string'),
'address' => array('name'=>'address','type'=>'xsd:string'),
'zip' => array('name'=>'zip','type'=>'xsd:string'),
'town' => array('name'=>'town','type'=>'xsd:string'),
'state_id' => array('name'=>'state_id','type'=>'xsd:string'),
'state_code' => array('name'=>'state_code','type'=>'xsd:string'),
'state' => array('name'=>'state','type'=>'xsd:string'),
'country_id' => array('name'=>'country_id','type'=>'xsd:string'),
'country_code' => array('name'=>'country_code','type'=>'xsd:string'),
'country' => array('name'=>'country','type'=>'xsd:string'),
'socid' => array('name'=>'socid','type'=>'xsd:string'),
'status' => array('name'=>'status','type'=>'xsd:string'),
'code' => array('name'=>'code','type'=>'xsd:string'),
'email' => array('name'=>'email','type'=>'xsd:string'),
'birthday' => array('name'=>'birthday','type'=>'xsd:string'),
'default_lang' => array('name'=>'default_lang','type'=>'xsd:string'),
'note' => array('name'=>'note','type'=>'xsd:string'),
'no_email' => array('name'=>'no_email','type'=>'xsd:string'),
'ref_facturation' => array('name'=>'ref_facturation','type'=>'xsd:string'),
'ref_contrat' => array('name'=>'ref_contrat','type'=>'xsd:string'),
'ref_commande' => array('name'=>'ref_commande','type'=>'xsd:string'),
'ref_propal' => array('name'=>'ref_propal','type'=>'xsd:string'),
'user_id' => array('name'=>'user_id','type'=>'xsd:string'),
'user_login' => array('name'=>'user_login','type'=>'xsd:string'),
'civility_id' => array('name'=>'civility_id','type'=>'xsd:string')
//...
)
); );
$server->wsdl->addComplexType( $server->wsdl->addComplexType(
@ -223,44 +247,63 @@ function getContact($authentication,$id,$ref='',$ref_ext='')
{ {
$fuser->getrights(); $fuser->getrights();
if ($fuser->rights->contact->read) if ($fuser->rights->societe->contact->lire )
{ {
$contact=new Contact($db); $contact=new Contact($db);
$result=$contact->fetch($id,$ref,$ref_ext); $result=$contact->fetch($id,$ref,$ref_ext);
if ($result > 0) if ($result > 0)
{ {
$contact_result_fields =array(
'id' => $contact->id,
'lastname' => $contact->lastname,
'firstname' => $contact->firstname,
'address' => $contact->address,
'zip' => $contact->zip,
'town' => $contact->town,
'state_id' => $contact->state_id,
'state_code' => $contact->state_code,
'state' => $contact->state,
'country_id' => $contact->country_id,
'country_code' => $contact->country_code,
'country' => $contact->country,
'socid' => $contact->socid,
'status' => $contact->status,
'phone_pro' => $contact->phone_pro,
'fax' => $contact->fax,
'phone_perso' => $contact->phone_perso,
'phone_mobile' => $contact->phone_mobile,
'code' => $contact->code,
'email' => $contact->email,
'birthday' => $contact->birthday,
'default_lang' => $contact->default_lang,
'note' => $contact->note,
'no_email' => $contact->no_email,
'ref_facturation' => $contact->ref_facturation,
'ref_contrat' => $contact->ref_contrat,
'ref_commande' => $contact->ref_commande,
'ref_propal' => $contact->ref_propal,
'user_id' => $contact->user_id,
'user_login' => $contact->user_login,
'civility_id' => $contact->civility_id
);
//Retreive all extrafield for thirdsparty
// fetch optionals attributes and labels
$extrafields=new ExtraFields($db);
$extralabels=$extrafields->fetch_name_optionals_label('contact',true);
//Get extrafield values
$contact->fetch_optionals($contact->id,$extralabels);
foreach($extrafields->attribute_label as $key=>$label)
{
$contact_result_fields=array_merge($contact_result_fields,array('options_'.$key => $contact->array_options['options_'.$key]));
}
// Create // Create
$objectresp = array( $objectresp = array(
'result'=>array('result_code'=>'OK', 'result_label'=>''), 'result'=>array('result_code'=>'OK', 'result_label'=>''),
'contact'=>array( 'contact'=>$contact_result_fields
'id' => $contact->id,
'lastname' => $contact->lastname,
'firstname' => $contact->firstname,
'address' => $contact->address,
'zip' => $contact->zip,
'town' => $contact->town,
'state_id' => $contact->state_id,
'state_code' => $contact->state_code,
'state' => $contact->state,
'country_id' => $contact->country_id,
'country_code' => $contact->country_code,
'country' => $contact->country,
'socid' => $contact->socid,
'status' => $contact->status,
'code' => $contact->code,
'email' => $contact->email,
'birthday' => $contact->birthday,
'default_lang' => $contact->default_lang,
'note' => $contact->note,
'no_email' => $contact->no_email,
'ref_facturation' => $contact->ref_facturation,
'ref_contrat' => $contact->ref_contrat,
'ref_commande' => $contact->ref_commande,
'ref_propal' => $contact->ref_propal,
'user_id' => $contact->user_id,
'user_login' => $contact->user_login,
'civility_id' => $contact->civility_id
)
); );
} }
else else
@ -334,6 +377,10 @@ function createContact($authentication,$contact)
$newobject->country=$contact['country']; $newobject->country=$contact['country'];
$newobject->socid=$contact['socid']; $newobject->socid=$contact['socid'];
$newobject->status=$contact['status']; $newobject->status=$contact['status'];
$newobject->phone_pro=$contact['phone_pro'];
$newobject->fax=$contact['fax'];
$newobject->phone_perso=$contact['phone_perso'];
$newobject->phone_mobile=$contact['phone_mobile'];
$newobject->code=$contact['code']; $newobject->code=$contact['code'];
$newobject->email=$contact['email']; $newobject->email=$contact['email'];
$newobject->birthday=$contact['birthday']; $newobject->birthday=$contact['birthday'];
@ -346,6 +393,17 @@ function createContact($authentication,$contact)
$newobject->ref_propal=$contact['ref_propal']; $newobject->ref_propal=$contact['ref_propal'];
$newobject->user_id=$contact['user_id']; $newobject->user_id=$contact['user_id'];
$newobject->user_login=$contact['user_login']; $newobject->user_login=$contact['user_login'];
//Retreive all extrafield for thirdsparty
// fetch optionals attributes and labels
$extrafields=new ExtraFields($db);
$extralabels=$extrafields->fetch_name_optionals_label('contact',true);
foreach($extrafields->attribute_label as $key=>$label)
{
$key='options_'.$key;
$newobject->array_options[$key]=$contact[$key];
}
//... //...

View File

@ -30,6 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/ws.lib.php';
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
dol_syslog("Call User webservices interfaces"); dol_syslog("Call User webservices interfaces");
@ -150,6 +151,56 @@ $server->wsdl->addComplexType(
), ),
'tns:group' 'tns:group'
); );
$thirdpartywithuser_fields = array(
// For thirdparty and contact
'name' => array('name'=>'name','type'=>'xsd:string'),
'firstname' => array('name'=>'firstname','type'=>'xsd:string'),
'name_thirdparty' => array('name'=>'name_thirdparty','type'=>'xsd:string'),
'ref_ext' => array('name'=>'ref_ext','type'=>'xsd:string'),
'client' => array('name'=>'client','type'=>'xsd:string'),
'fournisseur' => array('name'=>'fournisseur','type'=>'xsd:string'),
'address' => array('name'=>'address','type'=>'xsd:string'),
'zip' => array('name'=>'zip','type'=>'xsd:string'),
'town' => array('name'=>'town','type'=>'xsd:string'),
'country_id' => array('name'=>'country_id','type'=>'xsd:string'),
'country_code' => array('name'=>'country_code','type'=>'xsd:string'),
'phone' => array('name'=>'phone','type'=>'xsd:string'),
'phone_mobile' => array('name'=>'phone_mobile','type'=>'xsd:string'),
'fax' => array('name'=>'fax','type'=>'xsd:string'),
'email' => array('name'=>'email','type'=>'xsd:string'),
'url' => array('name'=>'url','type'=>'xsd:string'),
'profid1' => array('name'=>'profid1','type'=>'xsd:string'),
'profid2' => array('name'=>'profid2','type'=>'xsd:string'),
'profid3' => array('name'=>'profid3','type'=>'xsd:string'),
'profid4' => array('name'=>'profid4','type'=>'xsd:string'),
'profid5' => array('name'=>'profid5','type'=>'xsd:string'),
'profid6' => array('name'=>'profid6','type'=>'xsd:string'),
'capital' => array('name'=>'capital','type'=>'xsd:string'),
'tva_assuj' => array('name'=>'tva_assuj','type'=>'xsd:string'),
'tva_intra' => array('name'=>'tva_intra','type'=>'xsd:string'),
// For user
'login' => array('name'=>'login','type'=>'xsd:string'),
'password' => array('name'=>'password','type'=>'xsd:string')
);
//Retreive all extrafield for contact
// fetch optionals attributes and labels
$extrafields=new ExtraFields($db);
$extralabels=$extrafields->fetch_name_optionals_label('contact',true);
if (count($extrafields)>0) {
$extrafield_array = array();
}
foreach($extrafields->attribute_label as $key=>$label)
{
$type =$extrafields->attribute_type[$key];
if ($type=='date' || $type=='datetime') {$type='xsd:dateTime';}
else {$type='xsd:string';}
$extrafield_array['contact_options_'.$key]=array('name'=>'contact_options_'.$key,'type'=>$type);
}
$thirdpartywithuser_fields=array_merge($thirdpartywithuser_fields,$extrafield_array);
$server->wsdl->addComplexType( $server->wsdl->addComplexType(
'thirdpartywithuser', 'thirdpartywithuser',
@ -157,36 +208,7 @@ $server->wsdl->addComplexType(
'struct', 'struct',
'all', 'all',
'', '',
array( $thirdpartywithuser_fields
// For thirdparty and contact
'name' => array('name'=>'name','type'=>'xsd:string'),
'firstname' => array('name'=>'firstname','type'=>'xsd:string'),
'name_thirdparty' => array('name'=>'name_thirdparty','type'=>'xsd:string'),
'ref_ext' => array('name'=>'ref_ext','type'=>'xsd:string'),
'client' => array('name'=>'client','type'=>'xsd:string'),
'fournisseur' => array('name'=>'fournisseur','type'=>'xsd:string'),
'address' => array('name'=>'address','type'=>'xsd:string'),
'zip' => array('name'=>'zip','type'=>'xsd:string'),
'town' => array('name'=>'town','type'=>'xsd:string'),
'country_id' => array('name'=>'country_id','type'=>'xsd:string'),
'country_code' => array('name'=>'country_code','type'=>'xsd:string'),
'phone' => array('name'=>'phone','type'=>'xsd:string'),
'fax' => array('name'=>'fax','type'=>'xsd:string'),
'email' => array('name'=>'email','type'=>'xsd:string'),
'url' => array('name'=>'url','type'=>'xsd:string'),
'profid1' => array('name'=>'profid1','type'=>'xsd:string'),
'profid2' => array('name'=>'profid2','type'=>'xsd:string'),
'profid3' => array('name'=>'profid3','type'=>'xsd:string'),
'profid4' => array('name'=>'profid4','type'=>'xsd:string'),
'profid5' => array('name'=>'profid5','type'=>'xsd:string'),
'profid6' => array('name'=>'profid6','type'=>'xsd:string'),
'capital' => array('name'=>'capital','type'=>'xsd:string'),
'tva_assuj' => array('name'=>'tva_assuj','type'=>'xsd:string'),
'tva_intra' => array('name'=>'tva_intra','type'=>'xsd:string'),
// For user
'login' => array('name'=>'login','type'=>'xsd:string'),
'password' => array('name'=>'password','type'=>'xsd:string')
)
); );
@ -521,9 +543,21 @@ function CreateUserFromThirdparty($authentication,$thirdpartywithuser)
$contact->zip = $thirdparty->zip; $contact->zip = $thirdparty->zip;
$contact->town = $thirdparty->town; $contact->town = $thirdparty->town;
$contact->email = $thirdparty->email; $contact->email = $thirdparty->email;
$contact->phone_pro = $thirdparty->tel; $contact->phone_pro = $thirdparty->phone;
$contact->phone_mobile = $thirdparty->phone_mobile; $contact->phone_mobile = $thirdpartywithuser['phone_mobile'];
$contact->fax = $thirdparty->fax; $contact->fax = $thirdparty->fax;
//Retreive all extrafield for thirdsparty
// fetch optionals attributes and labels
$extrafields=new ExtraFields($db);
$extralabels=$extrafields->fetch_name_optionals_label('contact',true);
foreach($extrafields->attribute_label as $key=>$label)
{
$key='contact_options_'.$key;
$contact->array_options[$key]=$thirdpartywithuser[$key];
}
$contact_id = $contact->create($fuser); $contact_id = $contact->create($fuser);