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

This commit is contained in:
Laurent Destailleur 2011-12-07 10:50:04 +01:00
commit 9df57875ce
118 changed files with 803 additions and 366 deletions

View File

@ -336,11 +336,9 @@ if ($nboftargetok) {
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/license.txt`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/license.txt`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/PHPExcel/Shared/PDF`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/PHPExcel/Shared/PDF`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/PHPExcel/Shared/PCLZip`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/PHPExcel/Shared/PCLZip`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/dejavu-fonts-ttf-2.33`; #$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/dejavu-fonts-ttf-2.33`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/freefont-20100919`; #$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/freefont-20100919`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/utils`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/utils`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/free*.ctg.z`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/free*.z`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/LICENSE.TXT`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/LICENSE.TXT`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/jstree`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/jstree`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/langs/*/html`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/langs/*/html`;
@ -652,7 +650,6 @@ if ($nboftargetok) {
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/rpm`; $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/rpm`;
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/zip`; $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/zip`;
# We remove embedded libraries or fonts # We remove embedded libraries or fonts
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/htdocs/includes/artichow/font`,
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/htdocs/includes/fonts`, $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/htdocs/includes/fonts`,
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/htdocs/includes/geoip`; $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/htdocs/includes/geoip`;
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/htdocs/includes/odtphp/zip/pclzip`; $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/htdocs/includes/odtphp/zip/pclzip`;
@ -767,7 +764,8 @@ if ($nboftargetok) {
next; next;
} }
if ($target eq 'APS') { if ($target eq 'APS')
{
$NEWDESTI=$DESTI; $NEWDESTI=$DESTI;
if (-d $DESTI.'/package_aps') { $NEWDESTI=$DESTI.'/package_aps'; } if (-d $DESTI.'/package_aps') { $NEWDESTI=$DESTI.'/package_aps'; }

View File

@ -105,6 +105,7 @@ cui hai bisogno ed essere facile da usare.
%{__cp} -pr scripts $RPM_BUILD_ROOT%{_datadir}/%{name} %{__cp} -pr scripts $RPM_BUILD_ROOT%{_datadir}/%{name}
%{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs/includes/adodbtime %{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs/includes/adodbtime
%{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs/includes/nusoap %{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs/includes/nusoap
%{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs/includes/fonts
# Lang # Lang
for i in $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs/langs/*_* for i in $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs/langs/*_*

View File

@ -102,6 +102,7 @@ cui hai bisogno ed essere facile da usare.
%{__cp} -pr build/tgz/* $RPM_BUILD_ROOT%{_datadir}/%{name}/build/tgz %{__cp} -pr build/tgz/* $RPM_BUILD_ROOT%{_datadir}/%{name}/build/tgz
%{__cp} -pr htdocs $RPM_BUILD_ROOT%{_datadir}/%{name} %{__cp} -pr htdocs $RPM_BUILD_ROOT%{_datadir}/%{name}
%{__cp} -pr scripts $RPM_BUILD_ROOT%{_datadir}/%{name} %{__cp} -pr scripts $RPM_BUILD_ROOT%{_datadir}/%{name}
%{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs/includes/fonts
# Lang # Lang
for i in $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs/langs/*_* for i in $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs/langs/*_*

View File

@ -101,6 +101,7 @@ cui hai bisogno ed essere facile da usare.
%{__cp} -pr build/tgz/* $RPM_BUILD_ROOT%{_datadir}/%{name}/build/tgz %{__cp} -pr build/tgz/* $RPM_BUILD_ROOT%{_datadir}/%{name}/build/tgz
%{__cp} -pr htdocs $RPM_BUILD_ROOT%{_datadir}/%{name} %{__cp} -pr htdocs $RPM_BUILD_ROOT%{_datadir}/%{name}
%{__cp} -pr scripts $RPM_BUILD_ROOT%{_datadir}/%{name} %{__cp} -pr scripts $RPM_BUILD_ROOT%{_datadir}/%{name}
%{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs/includes/fonts
# Lang # Lang
for i in $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs/langs/*_* for i in $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs/langs/*_*

View File

@ -41,12 +41,11 @@ class BoutiqueCommande
/** /**
* Constructor * Constructor
* *
* @param DoliDB $DB Database handler * @param DoliDB $db Database handler
*/ */
function BoutiqueCommande($DB) function BoutiqueCommande($db)
{ {
$this->db = $DB; $this->db = $db;
$this->id = $id;
$this->billing_adr = new Address(); $this->billing_adr = new Address();
$this->delivry_adr = new Address(); $this->delivry_adr = new Address();
@ -108,6 +107,7 @@ class BoutiqueCommande
{ {
$num = $this->db->num_rows($result); $num = $this->db->num_rows($result);
$i=0;
while ($i < $num) while ($i < $num)
{ {
$array = $this->db->fetch_array($result); $array = $this->db->fetch_array($result);

View File

@ -41,12 +41,11 @@ class Promotion
/** /**
* Constructor * Constructor
* *
* @param DoliDB $DB Database handler * @param DoliDB $db Database handler
*/ */
function Promotion($DB) function Promotion($db)
{ {
$this->db = $DB; $this->db = $db;
$this->id = $id;
} }
/** /**

View File

@ -121,15 +121,18 @@ class Categorie
/** /**
* Add category into database * Add category into database
* *
* @param User $user Object user
* @return int -1 : erreur SQL * @return int -1 : erreur SQL
* -2 : nouvel ID inconnu * -2 : nouvel ID inconnu
* -3 : categorie invalide * -3 : categorie invalide
*/ */
function create() function create($user='')
{ {
global $conf,$langs; global $conf,$langs;
$langs->load('categories'); $langs->load('categories');
$error=0;
// Clean parameters // Clean parameters
if (empty($this->visible)) $this->visible=0; if (empty($this->visible)) $this->visible=0;
$this->parentId = ($this->id_mere) != "" ? intval($this->id_mere) : 0; $this->parentId = ($this->id_mere) != "" ? intval($this->id_mere) : 0;
@ -201,14 +204,17 @@ class Categorie
/** /**
* Update category * Update category
* *
* @param User $user Object user
* @return int 1 : OK * @return int 1 : OK
* -1 : SQL error * -1 : SQL error
* -2 : invalid category * -2 : invalid category
*/ */
function update() function update($user='')
{ {
global $conf, $langs; global $conf, $langs;
$error=0;
// Clean parameters // Clean parameters
$this->label=trim($this->label); $this->label=trim($this->label);
$this->description=trim($this->description); $this->description=trim($this->description);
@ -879,12 +885,12 @@ class Categorie
$sql.= " AND c.label='".$this->db->escape($this->label)."'"; $sql.= " AND c.label='".$this->db->escape($this->label)."'";
} }
dol_syslog("Categorie::already_exists sql=".$sql); dol_syslog("Categorie::already_exists sql=".$sql);
$res = $this->db->query($sql); $resql = $this->db->query($sql);
if ($res) if ($resql)
{ {
if($this->db->num_rows($resql) > 0) // Checking for empty resql if ($this->db->num_rows($resql) > 0) // Checking for empty resql
{ {
$obj = $this->db->fetch_array($res); $obj = $this->db->fetch_array($resql);
/* If object called create, obj cannot have is id. /* If object called create, obj cannot have is id.
* If object called update, he mustn't have the same label as an other category for this mother. * If object called update, he mustn't have the same label as an other category for this mother.
* So if the result have the same id, update is not for label, and if result have an other one, * So if the result have the same id, update is not for label, and if result have an other one,

View File

@ -381,7 +381,6 @@ class Propal extends CommonObject
$this->line->subprice=$pu_ht; $this->line->subprice=$pu_ht;
$this->line->rang=$rangtouse; $this->line->rang=$rangtouse;
$this->line->info_bits=$info_bits; $this->line->info_bits=$info_bits;
$this->line->fk_remise_except=$fk_remise_except;
$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;
@ -1149,6 +1148,7 @@ class Propal extends CommonObject
{ {
global $conf,$langs; global $conf,$langs;
$error=0;
$now=dol_now(); $now=dol_now();
if ($user->rights->propale->valider) if ($user->rights->propale->valider)
@ -1477,6 +1477,7 @@ class Propal extends CommonObject
global $langs,$conf; global $langs,$conf;
$this->statut = $statut; $this->statut = $statut;
$error=0;
$this->db->begin(); $this->db->begin();
@ -2536,13 +2537,17 @@ class PropaleLigne
} }
/** /**
* \brief Insert object line propal in database * Insert object line propal in database
* \return int <0 if KO, >0 if OK *
* @param int $notrigger 1=no trigger ran
* @return int <0 if KO, >0 if OK
*/ */
function insert($notrigger=0) function insert($notrigger=0)
{ {
global $conf,$langs,$user; global $conf,$langs,$user;
$error=0;
dol_syslog("PropaleLigne::insert rang=".$this->rang); dol_syslog("PropaleLigne::insert rang=".$this->rang);
// Clean parameters // Clean parameters
@ -2599,8 +2604,6 @@ class PropaleLigne
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
$this->rang=$rangmax;
$this->rowid=$this->db->last_insert_id(MAIN_DB_PREFIX.'propaldet'); $this->rowid=$this->db->last_insert_id(MAIN_DB_PREFIX.'propaldet');
if (! $notrigger) if (! $notrigger)
{ {
@ -2632,6 +2635,7 @@ class PropaleLigne
{ {
global $conf,$langs,$user; global $conf,$langs,$user;
$error=0;
$this->db->begin(); $this->db->begin();
$sql = "DELETE FROM ".MAIN_DB_PREFIX."propaldet WHERE rowid = ".$this->rowid; $sql = "DELETE FROM ".MAIN_DB_PREFIX."propaldet WHERE rowid = ".$this->rowid;
@ -2667,6 +2671,8 @@ class PropaleLigne
{ {
global $conf,$langs,$user; global $conf,$langs,$user;
$error=0;
// Clean parameters // Clean parameters
if (empty($this->tva_tx)) $this->tva_tx=0; if (empty($this->tva_tx)) $this->tva_tx=0;
if (empty($this->localtax1_tx)) $this->localtax1_tx=0; if (empty($this->localtax1_tx)) $this->localtax1_tx=0;

View File

@ -99,15 +99,13 @@ class Commande extends CommonObject
/** /**
* Constructor * Constructor
* *
* @param DoliDB $DB Database handler * @param DoliDB $db Database handler
*/ */
function Commande($DB) function Commande($db)
{ {
global $langs; global $langs;
$langs->load('orders'); $langs->load('orders');
$this->db = $DB; $this->db = $db;
$this->socid = $socid;
$this->id = $commandeid;
$this->remise = 0; $this->remise = 0;
$this->remise_percent = 0; $this->remise_percent = 0;
@ -448,6 +446,7 @@ class Commande extends CommonObject
/** /**
* Close order * Close order
*
* @param user Objet user that close * @param user Objet user that close
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
@ -501,13 +500,15 @@ class Commande extends CommonObject
} }
/** /**
* \brief Cancel an order * Cancel an order
* \return int <0 if KO, >0 if OK * If stock is decremented on order validation, we must reincrement it
* \remarks If stock is decremented on order validation, we must reincrement it *
* @param int $idwarehouse Id warehouse to use for stock change.
* @return int <0 if KO, >0 if OK
*/ */
function cancel($user) function cancel($user, $idwarehouse=-1)
{ {
global $conf; global $conf,$langs;
$error=0; $error=0;
@ -529,15 +530,18 @@ class Commande extends CommonObject
require_once(DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php"); require_once(DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php");
$langs->load("agenda"); $langs->load("agenda");
$num=count($this->lines);
for ($i = 0; $i < $num; $i++)
{
if ($this->lines[$i]->fk_product > 0) if ($this->lines[$i]->fk_product > 0)
{ {
$mouvP = new MouvementStock($this->db); $mouvP = new MouvementStock($this->db);
// We increment stock of product (and sub-products) // We increment stock of product (and sub-products)
$entrepot_id = "1"; //Todo: ajouter possibilite de choisir l'entrepot $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("OrderCanceledInDolibarr",$this->ref));
$result=$mouvP->reception($user, $this->lines[$i]->fk_product, $entrepot_id, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("OrderCanceledInDolibarr",$this->ref));
if ($result < 0) { $error++; } if ($result < 0) { $error++; }
} }
} }
}
if (! $error) if (! $error)
{ {
@ -604,7 +608,6 @@ class Commande extends CommonObject
dol_syslog("Commande::create ".$this->error, LOG_ERR); dol_syslog("Commande::create ".$this->error, LOG_ERR);
return -1; return -1;
} }
if (! $remise) $remise=0;
if (! $this->fk_project) $this->fk_project = 0; if (! $this->fk_project) $this->fk_project = 0;
// $date_commande is deprecated // $date_commande is deprecated
@ -1299,14 +1302,14 @@ class Commande extends CommonObject
} }
else else
{ {
dol_syslog('Commande::Fetch Error rowid='.$rowid.' numrows=0 sql='.$sql); dol_syslog('Commande::Fetch Error rowid='.$id.' numrows=0 sql='.$sql);
$this->error='Order with id '.$rowid.' not found sql='.$sql; $this->error='Order with id '.$id.' not found sql='.$sql;
return -2; return -2;
} }
} }
else else
{ {
dol_syslog('Commande::Fetch Error rowid='.$rowid.' Erreur dans fetch de la commande'); dol_syslog('Commande::Fetch Error rowid='.$id.' Erreur dans fetch de la commande');
$this->error=$this->db->error(); $this->error=$this->db->error();
return -1; return -1;
} }
@ -2194,8 +2197,8 @@ class Commande extends CommonObject
$qty=price2num($qty); $qty=price2num($qty);
$pu = price2num($pu); $pu = price2num($pu);
$txtva=price2num($txtva); $txtva=price2num($txtva);
$txlocaltax1=price2num($txtlocaltax1); $txlocaltax1=price2num($txlocaltax1);
$txlocaltax2=price2num($txtlocaltax2); $txlocaltax2=price2num($txlocaltax2);
// Calcul du total TTC et de la TVA pour la ligne a partir de // Calcul du total TTC et de la TVA pour la ligne a partir de
// qty, pu, remise_percent et txtva // qty, pu, remise_percent et txtva
@ -2287,7 +2290,8 @@ class Commande extends CommonObject
/** /**
* Delete the customer order * Delete the customer order
* @param user User object *
* @param User $user User object
* @return int <=0 if KO, >0 if OK * @return int <=0 if KO, >0 if OK
*/ */
function delete($user) function delete($user)
@ -2295,7 +2299,7 @@ class Commande extends CommonObject
global $conf, $langs; global $conf, $langs;
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"); require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
$err = 0; $error = 0;
$this->db->begin(); $this->db->begin();
@ -2305,7 +2309,7 @@ class Commande extends CommonObject
if (! $this->db->query($sql) ) if (! $this->db->query($sql) )
{ {
dol_syslog("CustomerOrder::delete error", LOG_ERR); dol_syslog("CustomerOrder::delete error", LOG_ERR);
$err++; $error++;
} }
// Delete order // Delete order
@ -2314,7 +2318,7 @@ class Commande extends CommonObject
if (! $this->db->query($sql) ) if (! $this->db->query($sql) )
{ {
dol_syslog("CustomerOrder::delete error", LOG_ERR); dol_syslog("CustomerOrder::delete error", LOG_ERR);
$err++; $error++;
} }
// Delete linked object // Delete linked object
@ -2326,7 +2330,7 @@ class Commande extends CommonObject
if (! $this->db->query($sql) ) if (! $this->db->query($sql) )
{ {
dol_syslog("CustomerOrder::delete error", LOG_ERR); dol_syslog("CustomerOrder::delete error", LOG_ERR);
$err++; $error++;
} }
// Delete linked contacts // Delete linked contacts
@ -2334,7 +2338,7 @@ class Commande extends CommonObject
if ($res < 0) if ($res < 0)
{ {
dol_syslog("CustomerOrder::delete error", LOG_ERR); dol_syslog("CustomerOrder::delete error", LOG_ERR);
$err++; $error++;
} }
// On efface le repertoire de pdf provisoire // On efface le repertoire de pdf provisoire
@ -2365,7 +2369,7 @@ class Commande extends CommonObject
} }
} }
if ($err == 0) if ($error == 0)
{ {
// Appel des triggers // Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
@ -2387,6 +2391,7 @@ class Commande extends CommonObject
/** /**
* Load indicators for dashboard (this->nbtodo and this->nbtodolate) * Load indicators for dashboard (this->nbtodo and this->nbtodolate)
*
* @param user Objet user * @param user Objet user
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
@ -2935,6 +2940,8 @@ class OrderLine
{ {
global $conf, $user, $langs; global $conf, $user, $langs;
$error=0;
$sql = 'DELETE FROM '.MAIN_DB_PREFIX."commandedet WHERE rowid='".$this->rowid."';"; $sql = 'DELETE FROM '.MAIN_DB_PREFIX."commandedet WHERE rowid='".$this->rowid."';";
dol_syslog("OrderLine::delete sql=".$sql); dol_syslog("OrderLine::delete sql=".$sql);
@ -2968,6 +2975,8 @@ class OrderLine
{ {
global $langs, $conf, $user; global $langs, $conf, $user;
$error=0;
dol_syslog("OrderLine::insert rang=".$this->rang); dol_syslog("OrderLine::insert rang=".$this->rang);
// Clean parameters // Clean parameters
@ -3065,6 +3074,8 @@ class OrderLine
{ {
global $conf,$langs,$user; global $conf,$langs,$user;
$error=0;
// Clean parameters // Clean parameters
if (empty($this->tva_tx)) $this->tva_tx=0; if (empty($this->tva_tx)) $this->tva_tx=0;
if (empty($this->localtax1_tx)) $this->localtax1_tx=0; if (empty($this->localtax1_tx)) $this->localtax1_tx=0;

View File

@ -864,7 +864,6 @@ class Account extends CommonObject
{ {
$this->nbtodo++; $this->nbtodo++;
if ($this->db->jdate($obj->datefin) < ($now - $conf->bank->rappro->warning_delay)) $this->nbtodolate++; if ($this->db->jdate($obj->datefin) < ($now - $conf->bank->rappro->warning_delay)) $this->nbtodolate++;
if ($obj->rappro) $foundaccounttoconciliate++;
} }
return $num; return $num;
} }

View File

@ -182,8 +182,8 @@ class Don extends CommonObject
$this->specimen=1; $this->specimen=1;
$this->nom = 'Doe'; $this->nom = 'Doe';
$this->prenom = 'John'; $this->prenom = 'John';
$this->socid = $socids[$socid]; $this->socid = 1;
$this->date = time(); $this->date = dol_now();
$this->amount = 100; $this->amount = 100;
$this->public = 1; $this->public = 1;
$this->societe = 'The Company'; $this->societe = 'The Company';

View File

@ -190,9 +190,10 @@ class FactureRec extends Facture
/** /**
* \brief Recupere l'objet facture et ses lignes de factures * Recupere l'objet facture et ses lignes de factures
* \param rowid id de la facture a recuperer *
* \return int >0 si ok, <0 si ko * @param int $rowid Id de la facture a recuperer
* @return int >0 si ok, <0 si ko
*/ */
function fetch($rowid) function fetch($rowid)
{ {
@ -209,7 +210,7 @@ class FactureRec extends Facture
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = f.rowid AND el.targettype = 'facture'"; // TODO remplacer par une fonction $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = f.rowid AND el.targettype = 'facture'"; // TODO remplacer par une fonction
$sql.= ' WHERE f.rowid='.$rowid; $sql.= ' WHERE f.rowid='.$rowid;
dol_syslog("FactureRec::Fetch rowid=".$rowid.", societe_id=".$socid." sql=".$sql, LOG_DEBUG); dol_syslog("FactureRec::Fetch rowid=".$rowid." sql=".$sql, LOG_DEBUG);
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) if ($result)
{ {
@ -404,7 +405,9 @@ class FactureRec extends Facture
/** /**
* \brief Add a line to invoice * Add a line to invoice
*
* @return int <0 if KO, >0 if OK
*/ */
function addline($facid, $desc, $pu_ht, $qty, $txtva, $fk_product=0, $remise_percent=0, $price_base_type='HT', $info_bits=0, $fk_remise_except='', $pu_ttc=0, $type=0, $rang=-1, $special_code=0) function addline($facid, $desc, $pu_ht, $qty, $txtva, $fk_product=0, $remise_percent=0, $price_base_type='HT', $info_bits=0, $fk_remise_except='', $pu_ttc=0, $type=0, $rang=-1, $special_code=0)
{ {
@ -420,7 +423,6 @@ class FactureRec extends Facture
$remise_percent=price2num($remise_percent); $remise_percent=price2num($remise_percent);
$qty=price2num($qty); $qty=price2num($qty);
if (! $qty) $qty=1; if (! $qty) $qty=1;
if (! $ventil) $ventil=0;
if (! $info_bits) $info_bits=0; if (! $info_bits) $info_bits=0;
$pu_ht=price2num($pu_ht); $pu_ht=price2num($pu_ht);
$pu_ttc=price2num($pu_ttc); $pu_ttc=price2num($pu_ttc);

View File

@ -1395,6 +1395,8 @@ class Facture extends CommonObject
{ {
global $conf,$langs; global $conf,$langs;
$error=0;
dol_syslog(get_class($this)."::set_canceled rowid=".$this->id, LOG_DEBUG); dol_syslog(get_class($this)."::set_canceled rowid=".$this->id, LOG_DEBUG);
$this->db->begin(); $this->db->begin();
@ -1515,7 +1517,7 @@ class Facture extends CommonObject
$result=$facreplaced->set_canceled($user,'replaced',''); $result=$facreplaced->set_canceled($user,'replaced','');
if ($result < 0) if ($result < 0)
{ {
$this->error=$facreplaced->error." sql=".$sql; $this->error=$facreplaced->error;
$this->db->rollback(); $this->db->rollback();
return -13; return -13;
} }
@ -3420,6 +3422,8 @@ class FactureLigne
{ {
global $langs,$user,$conf; global $langs,$user,$conf;
$error=0;
dol_syslog(get_class($this)."::Insert rang=".$this->rang, LOG_DEBUG); dol_syslog(get_class($this)."::Insert rang=".$this->rang, LOG_DEBUG);
// Clean parameters // Clean parameters
@ -3562,12 +3566,16 @@ class FactureLigne
/** /**
* Update line into database * Update line into database
* *
* @param User $user User object
* @param int $notrigger Disable triggers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function update() function update($user='',$notrigger=0)
{ {
global $user,$langs,$conf; global $user,$langs,$conf;
$error=0;
// Clean parameters // Clean parameters
$this->desc=trim($this->desc); $this->desc=trim($this->desc);
if (empty($this->tva_tx)) $this->tva_tx=0; if (empty($this->tva_tx)) $this->tva_tx=0;
@ -3651,6 +3659,8 @@ class FactureLigne
{ {
global $conf,$langs,$user; global $conf,$langs,$user;
$error=0;
$this->db->begin(); $this->db->begin();
$sql = "DELETE FROM ".MAIN_DB_PREFIX."facturedet WHERE rowid = ".$this->rowid; $sql = "DELETE FROM ".MAIN_DB_PREFIX."facturedet WHERE rowid = ".$this->rowid;

View File

@ -63,6 +63,8 @@ class localtax extends CommonObject
{ {
global $conf, $langs; global $conf, $langs;
$error=0;
// Clean parameters // Clean parameters
$this->amount=trim($this->amount); $this->amount=trim($this->amount);
$this->label=trim($this->label); $this->label=trim($this->label);
@ -128,6 +130,8 @@ class localtax extends CommonObject
{ {
global $conf, $langs; global $conf, $langs;
$error=0;
// Clean parameters // Clean parameters
$this->amount=trim($this->amount); $this->amount=trim($this->amount);
$this->label=trim($this->label); $this->label=trim($this->label);
@ -245,6 +249,8 @@ class localtax extends CommonObject
{ {
global $conf, $langs; global $conf, $langs;
$error=0;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."localtax"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."localtax";
$sql.= " WHERE rowid=".$this->id; $sql.= " WHERE rowid=".$this->id;
@ -493,7 +499,7 @@ class localtax extends CommonObject
$acc = new Account($this->db); $acc = new Account($this->db);
$result=$acc->fetch($this->accountid); $result=$acc->fetch($this->accountid);
if ($result <= 0) dol_print_error($db); if ($result <= 0) dol_print_error($this->db);
$bank_line_id = $acc->addline($this->datep, $this->paymenttype, $this->label, -abs($this->amount), '', '', $user); $bank_line_id = $acc->addline($this->datep, $this->paymenttype, $this->label, -abs($this->amount), '', '', $user);

View File

@ -471,6 +471,7 @@ class RemiseCheque extends CommonObject
/** /**
* Build document * Build document
*
* @param model Model name * @param model Model name
* @param outputlangs Object langs * @param outputlangs Object langs
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
@ -493,7 +494,7 @@ class RemiseCheque extends CommonObject
require_once($dir.$file); require_once($dir.$file);
$classname='BordereauCheque'.ucfirst($model); $classname='BordereauCheque'.ucfirst($model);
$docmodel = new $classname($db); $docmodel = new $classname($this->db);
$sql = "SELECT b.banque, b.emetteur, b.amount, b.num_chq"; $sql = "SELECT b.banque, b.emetteur, b.amount, b.num_chq";
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b"; $sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
@ -535,14 +536,14 @@ class RemiseCheque extends CommonObject
$result=$docmodel->write_file($conf->banque->dir_output.'/bordereau', $this->number, $outputlangs); $result=$docmodel->write_file($conf->banque->dir_output.'/bordereau', $this->number, $outputlangs);
if ($result > 0) if ($result > 0)
{ {
$outputlangs->charset_output=$sav_charset_output; //$outputlangs->charset_output=$sav_charset_output;
return 1; return 1;
} }
else else
{ {
$outputlangs->charset_output=$sav_charset_output; //$outputlangs->charset_output=$sav_charset_output;
dol_syslog("Error"); dol_syslog("Error");
dol_print_error($db,$docmodel->error); dol_print_error($this->db,$docmodel->error);
return 0; return 0;
} }
} }

View File

@ -320,7 +320,7 @@ class BonPrelevement extends CommonObject
{ {
global $user,$conf; global $user,$conf;
$error == 0; $error = 0;
if ($this->db->begin()) if ($this->db->begin())
{ {
@ -401,7 +401,7 @@ class BonPrelevement extends CommonObject
{ {
global $conf,$langs; global $conf,$langs;
$error == 0; $error = 0;
if ($this->_fetched == 1) if ($this->_fetched == 1)
{ {
@ -525,7 +525,8 @@ class BonPrelevement extends CommonObject
{ {
global $conf,$langs; global $conf,$langs;
$error == 0; $error = 0;
dol_syslog("bon-prelevement::set_infotrans Start",LOG_INFO); dol_syslog("bon-prelevement::set_infotrans Start",LOG_INFO);
if ($this->db->begin()) if ($this->db->begin())
{ {

View File

@ -74,8 +74,9 @@ class Tva extends CommonObject
{ {
global $conf, $langs; global $conf, $langs;
// Clean parameters $error=0;
// Clean parameters
$this->amount=trim($this->amount); $this->amount=trim($this->amount);
$this->label=trim($this->label); $this->label=trim($this->label);
$this->note=trim($this->note); $this->note=trim($this->note);
@ -83,14 +84,11 @@ class Tva extends CommonObject
$this->fk_user_creat=trim($this->fk_user_creat); $this->fk_user_creat=trim($this->fk_user_creat);
$this->fk_user_modif=trim($this->fk_user_modif); $this->fk_user_modif=trim($this->fk_user_modif);
// Check parameters // Check parameters
// Put here code to add control on parameters values // Put here code to add control on parameters values
// Insert request // Insert request
$sql = "INSERT INTO ".MAIN_DB_PREFIX."tva("; $sql = "INSERT INTO ".MAIN_DB_PREFIX."tva(";
$sql.= "tms,"; $sql.= "tms,";
$sql.= "datep,"; $sql.= "datep,";
$sql.= "datev,"; $sql.= "datev,";
@ -148,8 +146,9 @@ class Tva extends CommonObject
{ {
global $conf, $langs; global $conf, $langs;
// Clean parameters $error=0;
// Clean parameters
$this->amount=trim($this->amount); $this->amount=trim($this->amount);
$this->label=trim($this->label); $this->label=trim($this->label);
$this->note=trim($this->note); $this->note=trim($this->note);
@ -157,8 +156,6 @@ class Tva extends CommonObject
$this->fk_user_creat=trim($this->fk_user_creat); $this->fk_user_creat=trim($this->fk_user_creat);
$this->fk_user_modif=trim($this->fk_user_modif); $this->fk_user_modif=trim($this->fk_user_modif);
// Check parameters // Check parameters
// Put here code to add control on parameters values // Put here code to add control on parameters values
@ -275,6 +272,8 @@ class Tva extends CommonObject
{ {
global $conf, $langs; global $conf, $langs;
$error=0;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."tva"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."tva";
$sql.= " WHERE rowid=".$this->id; $sql.= " WHERE rowid=".$this->id;
@ -522,7 +521,7 @@ class Tva extends CommonObject
$acc = new Account($this->db); $acc = new Account($this->db);
$result=$acc->fetch($this->accountid); $result=$acc->fetch($this->accountid);
if ($result <= 0) dol_print_error($db); if ($result <= 0) dol_print_error($this->db);
$bank_line_id = $acc->addline($this->datep, $this->paymenttype, $this->label, -abs($this->amount), '', '', $user); $bank_line_id = $acc->addline($this->datep, $this->paymenttype, $this->label, -abs($this->amount), '', '', $user);

View File

@ -2,8 +2,9 @@
# Dolibarr example for conf.php file # Dolibarr example for conf.php file
# #
# Do not edit this file without changing its name. # Do not edit this file without changing its name.
# This file is used by Dolibarr setup process to create true Dolibarr # This file is an example of empty config file for Dolibarr than can be used to create "conf.php".
# config file called "conf.php". #
# Warning: Be sure to not add line feed or spaces after closing php tag.
# #

View File

@ -92,10 +92,11 @@ abstract class ActionsContactCardCommon
/** /**
* Load data control * Load data control
* *
* @param string &$action Type of action
* @param int $id Id of object * @param int $id Id of object
* @return void * @return void
*/ */
function doActions(&$action) function doActions(&$action, $id)
{ {
global $conf, $user, $langs; global $conf, $user, $langs;
@ -397,11 +398,7 @@ abstract class ActionsContactCardCommon
include_once(DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'); include_once(DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php');
$login=dol_buildlogin($this->object->nom, $this->object->prenom); $login=dol_buildlogin($this->object->nom, $this->object->prenom);
$generated_password='';
if (! $ldap_sid)
{
$generated_password=getRandomPassword(''); $generated_password=getRandomPassword('');
}
$password=$generated_password; $password=$generated_password;
// Create a form array // Create a form array

View File

@ -867,13 +867,13 @@ class Contact extends CommonObject
$code=$this->civilite_id; $code=$this->civilite_id;
return $langs->trans("Civility".$code)!="Civility".$code ? $langs->trans("Civility".$code) : ''; return $langs->trans("Civility".$code)!="Civility".$code ? $langs->trans("Civility".$code) : '';
if (empty($ret)) /*if (empty($ret))
{ {
$ret=$code; $ret=$code;
$langs->getLabelFromKey($db,$reg[1],'c_civilite','code','civilite'); $langs->getLabelFromKey($this->db,$reg[1],'c_civilite','code','civilite');
//$ret=dol_getIdFromCode($this->db,$code,'c_civilite', //$ret=dol_getIdFromCode($this->db,$code,'c_civilite',
} }
return $ret; return $ret;*/
} }

View File

@ -145,6 +145,8 @@ class Contrat extends CommonObject
{ {
global $langs,$conf; global $langs,$conf;
$error=0;
$this->db->begin(); $this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."contratdet SET statut = 4,"; $sql = "UPDATE ".MAIN_DB_PREFIX."contratdet SET statut = 4,";
@ -191,6 +193,8 @@ class Contrat extends CommonObject
{ {
global $langs,$conf; global $langs,$conf;
$error=0;
// statut actif : 4 // statut actif : 4
$this->db->begin(); $this->db->begin();
@ -225,11 +229,12 @@ class Contrat extends CommonObject
/** /**
* \brief Close all lines of a contract * Close all lines of a contract
* \param user Object User making action
* \param langs Object Lang
* \param conf Object Conf
* *
* @param user Object User making action
* @param langs Object Lang
* @param conf Object Conf
* @return void
*/ */
function cloture($user,$langs='',$conf='') function cloture($user,$langs='',$conf='')
{ {
@ -268,7 +273,7 @@ class Contrat extends CommonObject
} }
else else
{ {
dol_print_error($db,'Error in cloture function'); dol_print_error($this->db,'Error in cloture function');
$this->db->rollback(); $this->db->rollback();
} }
} }
@ -282,6 +287,8 @@ class Contrat extends CommonObject
*/ */
function validate($user,$langs,$conf) function validate($user,$langs,$conf)
{ {
$error=0;
$sql = "UPDATE ".MAIN_DB_PREFIX."contrat SET statut = 1"; $sql = "UPDATE ".MAIN_DB_PREFIX."contrat SET statut = 1";
$sql .= " WHERE rowid = ".$this->id . " AND statut = 0"; $sql .= " WHERE rowid = ".$this->id . " AND statut = 0";
@ -835,7 +842,6 @@ class Contrat extends CommonObject
$remise_percent=price2num($remise_percent); $remise_percent=price2num($remise_percent);
$qty=price2num($qty); $qty=price2num($qty);
if (! $qty) $qty=1; if (! $qty) $qty=1;
if (! $ventil) $ventil=0;
if (! $info_bits) $info_bits=0; if (! $info_bits) $info_bits=0;
if (! $pu_ht) $pu_ht=0; if (! $pu_ht) $pu_ht=0;
if (! $pu_ttc) $pu_ttc=0; if (! $pu_ttc) $pu_ttc=0;
@ -883,7 +889,7 @@ class Contrat extends CommonObject
$sql.= " price_ht, remise"; // TODO A virer $sql.= " price_ht, remise"; // TODO A virer
if ($date_start > 0) { $sql.= ",date_ouverture_prevue"; } if ($date_start > 0) { $sql.= ",date_ouverture_prevue"; }
if ($date_end > 0) { $sql.= ",date_fin_validite"; } if ($date_end > 0) { $sql.= ",date_fin_validite"; }
$sql.= ") VALUES ($this->id, '" . $this->db->escape($label) . "','" . $this->db->escape($desc) . "',"; $sql.= ") VALUES ($this->id, '', '" . $this->db->escape($desc) . "',";
$sql.= ($fk_product>0 ? $fk_product : "null").","; $sql.= ($fk_product>0 ? $fk_product : "null").",";
$sql.= " '".$qty."',"; $sql.= " '".$qty."',";
$sql.= " '".$txtva."',"; $sql.= " '".$txtva."',";
@ -1031,6 +1037,8 @@ class Contrat extends CommonObject
{ {
global $conf, $langs; global $conf, $langs;
$error=0;
if ($this->statut >= 0) if ($this->statut >= 0)
{ {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."contratdet"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."contratdet";
@ -1105,9 +1113,9 @@ class Contrat extends CommonObject
$langs->load("contracts"); $langs->load("contracts");
if ($mode == 0) if ($mode == 0)
{ {
if ($statut == 0) { return $langs->trans("ContractStatusDraft").$text; } if ($statut == 0) { return $langs->trans("ContractStatusDraft"); }
if ($statut == 1) { return $langs->trans("ContractStatusValidated").$text; } if ($statut == 1) { return $langs->trans("ContractStatusValidated"); }
if ($statut == 2) { return $langs->trans("ContractStatusClosed").$text; } if ($statut == 2) { return $langs->trans("ContractStatusClosed"); }
} }
if ($mode == 1) if ($mode == 1)
{ {
@ -1762,6 +1770,8 @@ class ContratLigne
{ {
global $conf, $langs; global $conf, $langs;
$error=0;
// Clean parameters // Clean parameters
$this->fk_contrat=trim($this->fk_contrat); $this->fk_contrat=trim($this->fk_contrat);
$this->fk_product=trim($this->fk_product); $this->fk_product=trim($this->fk_product);

View File

@ -43,13 +43,15 @@ class box_external_rss extends ModeleBoxes {
/** /**
* Constructor * Constructor
*
* @param DoliDB $db Database handler
*/ */
function box_external_rss($DB,$param) function box_external_rss($db,$param)
{ {
global $langs; global $langs;
$langs->load("boxes"); $langs->load("boxes");
$this->db=$DB; $this->db=$db;
$this->param=$param; $this->param=$param;
$this->boxlabel=$langs->trans("BoxLastRssInfos"); $this->boxlabel=$langs->trans("BoxLastRssInfos");
@ -80,7 +82,7 @@ class box_external_rss extends ModeleBoxes {
// Get RSS feed // Get RSS feed
$url=@constant("EXTERNAL_RSS_URLRSS_".$site); $url=@constant("EXTERNAL_RSS_URLRSS_".$site);
$rssparser=new RssParser($db); $rssparser=new RssParser($this->db);
$result = $rssparser->parser($url, $this->max, $cachedelay, $conf->externalrss->dir_temp); $result = $rssparser->parser($url, $this->max, $cachedelay, $conf->externalrss->dir_temp);
// INFO on channel // INFO on channel

View File

@ -500,7 +500,8 @@ class CMailFile
if (@is_writeable($dolibarr_main_data_root)) // Avoid fatal error on fopen with open_basedir if (@is_writeable($dolibarr_main_data_root)) // Avoid fatal error on fopen with open_basedir
{ {
$fp = fopen($dolibarr_main_data_root."/dolibarr_mail.log","w"); $outputfile=$dolibarr_main_data_root."/dolibarr_mail.log";
$fp = fopen($outputfile,"w");
if ($conf->global->MAIN_MAIL_SENDMODE == 'mail') if ($conf->global->MAIN_MAIL_SENDMODE == 'mail')
{ {

View File

@ -198,7 +198,8 @@ class CSMSFile
if (@is_writeable($dolibarr_main_data_root)) // Avoid fatal error on fopen with open_basedir if (@is_writeable($dolibarr_main_data_root)) // Avoid fatal error on fopen with open_basedir
{ {
$fp = fopen($dolibarr_main_data_root."/dolibarr_sms.log","w"); $outputfile=$dolibarr_main_data_root."/dolibarr_sms.log";
$fp = fopen($outputfile,"w");
fputs($fp, $this->message); fputs($fp, $this->message);
@ -218,7 +219,8 @@ class CSMSFile
if (@is_writeable($dolibarr_main_data_root)) // Avoid fatal error on fopen with open_basedir if (@is_writeable($dolibarr_main_data_root)) // Avoid fatal error on fopen with open_basedir
{ {
$fp = fopen($dolibarr_main_data_root."/dolibarr_sms.log","a+"); $outputfile=$dolibarr_main_data_root."/dolibarr_sms.log";
$fp = fopen($outputfile,"a+");
fputs($fp, "\nResult id=".$result); fputs($fp, "\nResult id=".$result);

View File

@ -68,7 +68,7 @@ class AntiVir
$return_var=0; $return_var=0;
$safemode=ini_get("safe_mode"); $safemode=ini_get("safe_mode");
// Create a clean fullcommand // Create a clean fullcommand
dol_syslog("AntiVir::dol_avscan_file Run command=".$fullcommand." with safe_mode ".($safe_mode?"on":"off")); dol_syslog("AntiVir::dol_avscan_file Run command=".$fullcommand." with safe_mode ".($safemode?"on":"off"));
// Run CLI command. If run of Windows, you can get return with echo %ERRORLEVEL% // Run CLI command. If run of Windows, you can get return with echo %ERRORLEVEL%
$lastline=exec($fullcommand, $output, $return_var); $lastline=exec($fullcommand, $output, $return_var);

View File

@ -81,6 +81,8 @@ abstract class CommonObject
{ {
global $user,$conf,$langs; global $user,$conf,$langs;
$error=0;
dol_syslog(get_class($this)."::add_contact $fk_socpeople, $type_contact, $source"); dol_syslog(get_class($this)."::add_contact $fk_socpeople, $type_contact, $source");
// Check parameters // Check parameters
@ -200,6 +202,8 @@ abstract class CommonObject
{ {
global $user,$langs,$conf; global $user,$langs,$conf;
$error=0;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."element_contact"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."element_contact";
$sql.= " WHERE rowid =".$rowid; $sql.= " WHERE rowid =".$rowid;
@ -348,7 +352,7 @@ abstract class CommonObject
$sql.= " AND ec.fk_c_type_contact=tc.rowid"; $sql.= " AND ec.fk_c_type_contact=tc.rowid";
$sql.= " AND tc.element = '".$this->element."'"; $sql.= " AND tc.element = '".$this->element."'";
dol_syslog(get_class($object)."::swapContactStatus sql=".$sql); dol_syslog(get_class($this)."::swapContactStatus sql=".$sql);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
@ -2055,7 +2059,7 @@ abstract class CommonObject
// Produit // Produit
if ($line->fk_product > 0) if ($line->fk_product > 0)
{ {
$product_static = new Product($db); $product_static = new Product($this->db);
$product_static->type=$line->fk_product_type; $product_static->type=$line->fk_product_type;
$product_static->id=$line->fk_product; $product_static->id=$line->fk_product;
@ -2164,7 +2168,7 @@ abstract class CommonObject
if (($line->info_bits & 2) == 2) // TODO Not sure this is used for source object if (($line->info_bits & 2) == 2) // TODO Not sure this is used for source object
{ {
$discount=new DiscountAbsolute($db); $discount=new DiscountAbsolute($this->db);
$discount->fk_soc = $this->socid; $discount->fk_soc = $this->socid;
$this->tpl['label'].= $discount->getNomUrl(0,'discount'); $this->tpl['label'].= $discount->getNomUrl(0,'discount');
} }

View File

@ -208,7 +208,7 @@ class DiscountAbsolute
} }
else else
{ {
dol_print_error($db); dol_print_error($this->db);
return -1; return -1;
} }
} }

View File

@ -1036,7 +1036,7 @@ class Form
if ($num) if ($num)
{ {
$out.= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'"'.($disabled?' disabled="disabled"':'').'>'; $out.= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'"'.($disabled?' disabled="disabled"':'').'>';
if ($show_empty) $out.= '<option value="-1"'.($id==-1?' selected="selected"':'').'>&nbsp;</option>'."\n"; if ($show_empty) $out.= '<option value="-1"'.($selected==-1?' selected="selected"':'').'>&nbsp;</option>'."\n";
$userstatic=new User($this->db); $userstatic=new User($this->db);
@ -1364,6 +1364,8 @@ class Form
function select_produits_fournisseurs($socid,$selected='',$htmlname='productid',$filtertype='',$filtre) function select_produits_fournisseurs($socid,$selected='',$htmlname='productid',$filtertype='',$filtre)
{ {
global $langs,$conf; global $langs,$conf;
global $price_level, $status, $finished;
if ($conf->global->PRODUIT_USE_SEARCH_TO_SELECT) if ($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)
{ {
// mode=2 means suppliers products // mode=2 means suppliers products
@ -1521,7 +1523,7 @@ class Form
} }
else else
{ {
dol_print_error($db); dol_print_error($this->db);
} }
} }
@ -1610,7 +1612,7 @@ class Form
} }
else else
{ {
dol_print_error($db); dol_print_error($this->db);
} }
} }
@ -3806,7 +3808,7 @@ class Form
if ($num) if ($num)
{ {
$out.= '<select class="flat" name="'.$htmlname.'"'.($disabled?' disabled="disabled"':'').'>'; $out.= '<select class="flat" name="'.$htmlname.'"'.($disabled?' disabled="disabled"':'').'>';
if ($show_empty) $out.= '<option value="-1"'.($id==-1?' selected="selected"':'').'>&nbsp;</option>'."\n"; if ($show_empty) $out.= '<option value="-1"'.($selected==-1?' selected="selected"':'').'>&nbsp;</option>'."\n";
while ($i < $num) while ($i < $num)
{ {

View File

@ -358,7 +358,7 @@ class FormFile
$headershown=1; $headershown=1;
$form = new Form($db); $form = new Form($this->db);
$buttonlabeltoshow=$buttonlabel; $buttonlabeltoshow=$buttonlabel;
if (empty($buttonlabel)) $buttonlabel=$langs->trans('Generate'); if (empty($buttonlabel)) $buttonlabel=$langs->trans('Generate');
@ -537,7 +537,7 @@ class FormFile
{ {
global $user, $conf, $langs; global $user, $conf, $langs;
global $bc; global $bc;
global $sortfield, $sortorder; global $sortfield, $sortorder, $maxheightmini;
// Show list of existing files // Show list of existing files
if (empty($useinecm)) print_titre($langs->trans("AttachedFiles")); if (empty($useinecm)) print_titre($langs->trans("AttachedFiles"));

View File

@ -223,7 +223,7 @@ class FormMail
if (! empty($_SESSION["listofmimes"])) $listofmimes=explode(';',$_SESSION["listofmimes"]); if (! empty($_SESSION["listofmimes"])) $listofmimes=explode(';',$_SESSION["listofmimes"]);
$form=new Form($DB); $form=new Form($this->db);
$out.= "\n<!-- Debut form mail -->\n"; $out.= "\n<!-- Debut form mail -->\n";
if ($this->withform) if ($this->withform)

View File

@ -47,16 +47,17 @@ class FormOrder
/** /**
* \brief Renvoie la liste des sources de commandes * Renvoie la liste des sources de commandes
* \param selected Id de la source pre-selectionnee *
* \param htmlname Nom de la liste deroulante * @param selected Id de la source pre-selectionnee
* \param addempty 0=liste sans valeur nulle, 1=ajoute valeur inconnue * @param htmlname Nom de la liste deroulante
* \return array Tableau des sources de commandes * @param addempty 0=liste sans valeur nulle, 1=ajoute valeur inconnue
* @return array Tableau des sources de commandes
*/ */
function selectSourcesCommande($selected='',$htmlname='source_id',$addempty=0) function selectSourcesCommande($selected='',$htmlname='source_id',$addempty=0)
{ {
global $conf,$langs; global $conf,$langs;
print '<select class="flat" name="'.$htmlname.'" '.$htmloption.'>'; print '<select class="flat" name="'.$htmlname.'">';
if ($addempty) print '<option value="-1" selected="selected">&nbsp;</option>'; if ($addempty) print '<option value="-1" selected="selected">&nbsp;</option>';
// TODO Use a table called llx_c_input_reason // TODO Use a table called llx_c_input_reason

View File

@ -311,7 +311,6 @@ class FormOther
$moreforfilter.='>'; $moreforfilter.='>';
$moreforfilter.=$obj_usr->firstname." ".$obj_usr->name." (".$obj_usr->login.')'; $moreforfilter.=$obj_usr->firstname." ".$obj_usr->name." (".$obj_usr->login.')';
$moreforfilter.='</option>'; $moreforfilter.='</option>';
$i++;
} }
$this->db->free($resql_usr); $this->db->free($resql_usr);
} }

View File

@ -633,8 +633,8 @@ class Ldap
//Create file //Create file
$result=create_exdir($conf->ldap->dir_temp); $result=create_exdir($conf->ldap->dir_temp);
$file=$conf->ldap->dir_temp.'/ldapinput.in'; $outputfile=$conf->ldap->dir_temp.'/ldapinput.in';
$fp=fopen($file,"w"); $fp=fopen($outputfile,"w");
if ($fp) if ($fp)
{ {
fputs($fp, $content); fputs($fp, $content);

View File

@ -395,7 +395,7 @@ class Menubase
//print 'name='.$tab[$x][3].' pere='.$pere." ".$tab[$x][6]; //print 'name='.$tab[$x][3].' pere='.$pere." ".$tab[$x][6];
$this->newmenu->add((! preg_match("/^(http:\/\/|https:\/\/)/i",$tab[$x][2])) ? $tab[$x][2] : $tab[$x][2], $tab[$x][3], $rang -1, $tab[$x][4], $tab[$x][5], $tab[$x][8]); $this->newmenu->add((! preg_match("/^(http:\/\/|https:\/\/)/i",$tab[$x][2])) ? $tab[$x][2] : $tab[$x][2], $tab[$x][3], $rang -1, $tab[$x][4], $tab[$x][5], $tab[$x][8]);
$this->recur($tab, $tab[$x][0], $rang +1, $lelfmenu); $this->recur($tab, $tab[$x][0], $rang +1, $leftmenu);
} }
} }
} }

View File

@ -184,7 +184,7 @@ class vCard
$key = "ADR"; $key = "ADR";
if ($type!="") $key.= ";$type"; if ($type!="") $key.= ";$type";
$key.= ";CHARSET=".$this->encoding; $key.= ";CHARSET=".$this->encoding;
$this->properties[$key] = encode($name).";".encode($extended).";".encode($street).";".encode($city).";".encode($region).";".encode($zip).";".encode($country); $this->properties[$key] = ";".encode($extended).";".encode($street).";".encode($city).";".encode($region).";".encode($zip).";".encode($country);
if ($this->properties["LABEL;$type;CHARSET=".$this->encoding] == "") if ($this->properties["LABEL;$type;CHARSET=".$this->encoding] == "")
{ {

View File

@ -374,6 +374,7 @@ function actions_prepare_head($action)
/** /**
* Define head array for tabs of agenda setup pages * Define head array for tabs of agenda setup pages
*
* @return Array of head * @return Array of head
*/ */
function calendars_prepare_head($param) function calendars_prepare_head($param)
@ -388,6 +389,8 @@ function calendars_prepare_head($param)
$head[$h][2] = 'card'; $head[$h][2] = 'card';
$h++; $h++;
$object=(object) array();
// Show more tabs from modules // Show more tabs from modules
// Entries must be declared in modules descriptor with line // Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab

View File

@ -495,6 +495,8 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable
global $conf, $user, $langs, $db; global $conf, $user, $langs, $db;
global $object; global $object;
$error=0;
$file_name = $dest_file; $file_name = $dest_file;
// If an upload error has been reported // If an upload error has been reported
if ($uploaderrorcode) if ($uploaderrorcode)
@ -606,8 +608,6 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable
dol_syslog("Functions.lib::dol_move_uploaded_file Failed to move ".$src_file." to ".$file_name, LOG_ERR); dol_syslog("Functions.lib::dol_move_uploaded_file Failed to move ".$src_file." to ".$file_name, LOG_ERR);
return -3; // Unknown error return -3; // Unknown error
} }
return 1;
} }
/** /**
@ -624,6 +624,8 @@ function dol_delete_file($file,$disableglob=0,$nophperrors=0,$notrigger=0,$objec
{ {
global $db, $conf, $user, $langs; global $db, $conf, $user, $langs;
$error=0;
//print "x".$file." ".$disableglob; //print "x".$file." ".$disableglob;
$ok=true; $ok=true;
$file_osencoded=dol_osencode($file); // New filename encoded in OS filesystem encoding charset $file_osencoded=dol_osencode($file); // New filename encoded in OS filesystem encoding charset
@ -1003,8 +1005,6 @@ function dol_convert_file($file,$ext='png')
{ {
return -1; return -1;
} }
return 1;
} }

View File

@ -3977,7 +3977,7 @@ function get_htmloutput_mesg($mesgstring='',$mesgarray='', $style='ok', $keepemb
} }
// If inline message with no format, we add it. // If inline message with no format, we add it.
if ((! empty($conf->global->MAIN_DISABLE_JQUERY_JNOTIFY) || $keepembedded) && ! preg_match('/<div class=".*">/i',$out)) if ((empty($conf->use_javascript_ajax) || ! empty($conf->global->MAIN_DISABLE_JQUERY_JNOTIFY) || $keepembedded) && ! preg_match('/<div class=".*">/i',$out))
{ {
$divstart='<div class="'.$style.'">'; $divstart='<div class="'.$style.'">';
$divend='</div>'; $divend='</div>';
@ -4007,7 +4007,7 @@ function get_htmloutput_mesg($mesgstring='',$mesgarray='', $style='ok', $keepemb
if ($out) if ($out)
{ {
if (empty($conf->global->MAIN_DISABLE_JQUERY_JNOTIFY) && empty($keepembedded)) if ($conf->use_javascript_ajax && empty($conf->global->MAIN_DISABLE_JQUERY_JNOTIFY) && empty($keepembedded))
{ {
$return = '<script type="text/javascript"> $return = '<script type="text/javascript">
jQuery(document).ready(function() { jQuery(document).ready(function() {
@ -4417,6 +4417,7 @@ function complete_head_from_modules($conf,$langs,$object,&$head,&$h,$type,$mode=
function printCommonFooter($zone='private') function printCommonFooter($zone='private')
{ {
global $conf; global $conf;
global $micro_start_time;
if ($zone == 'private') print "\n".'<!-- Common footer for private page -->'."\n"; if ($zone == 'private') print "\n".'<!-- Common footer for private page -->'."\n";
else print "\n".'<!-- Common footer for public page -->'."\n"; else print "\n".'<!-- Common footer for public page -->'."\n";

View File

@ -675,7 +675,7 @@ function check_value($mask,$value)
$maskrefclient_maskclientcode=$regClientRef[1]; $maskrefclient_maskclientcode=$regClientRef[1];
$maskrefclient_maskcounter=$regClientRef[2]; $maskrefclient_maskcounter=$regClientRef[2];
$maskrefclient_maskoffset=0; //default value of maskrefclient_counter offset $maskrefclient_maskoffset=0; //default value of maskrefclient_counter offset
$maskrefclient_clientcode=substr($valueforccc,0,dol_strlen($maskrefclient_maskclientcode));//get n first characters of client code to form maskrefclient_clientcode $maskrefclient_clientcode=substr('',0,dol_strlen($maskrefclient_maskclientcode));//get n first characters of client code to form maskrefclient_clientcode
$maskrefclient_clientcode=str_pad($maskrefclient_clientcode,dol_strlen($maskrefclient_maskclientcode),"#",STR_PAD_RIGHT);//padding maskrefclient_clientcode for having exactly n characters in maskrefclient_clientcode $maskrefclient_clientcode=str_pad($maskrefclient_clientcode,dol_strlen($maskrefclient_maskclientcode),"#",STR_PAD_RIGHT);//padding maskrefclient_clientcode for having exactly n characters in maskrefclient_clientcode
$maskrefclient_clientcode=dol_string_nospecial($maskrefclient_clientcode);//sanitize maskrefclient_clientcode for sql insert and sql select like $maskrefclient_clientcode=dol_string_nospecial($maskrefclient_clientcode);//sanitize maskrefclient_clientcode for sql insert and sql select like
if (dol_strlen($maskrefclient_maskcounter) > 0 && dol_strlen($maskrefclient_maskcounter) < 3) return 'CounterMustHaveMoreThan3Digits'; if (dol_strlen($maskrefclient_maskcounter) > 0 && dol_strlen($maskrefclient_maskcounter) < 3) return 'CounterMustHaveMoreThan3Digits';
@ -936,7 +936,7 @@ function dol_set_user_param($db, $conf, &$user, $tab)
foreach ($tab as $key => $value) foreach ($tab as $key => $value)
{ {
// Set new parameters // Set new parameters
if ($value && (! $url || in_array($key,array('sortfield','sortorder','begin','page')))) if ($value)
{ {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."user_param(fk_user,entity,param,value)"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."user_param(fk_user,entity,param,value)";
$sql.= " VALUES (".$user->id.",".$conf->entity.","; $sql.= " VALUES (".$user->id.",".$conf->entity.",";

View File

@ -23,6 +23,7 @@
/** /**
* Return array head with list of tabs to view object informations * Return array head with list of tabs to view object informations
*
* @param object Member * @param object Member
* @return array head * @return array head
*/ */

View File

@ -809,6 +809,7 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl
if ($object->lines[$i]->date_start || $object->lines[$i]->date_end) if ($object->lines[$i]->date_start || $object->lines[$i]->date_end)
{ {
$format='day';
// Show duration if exists // Show duration if exists
if ($object->lines[$i]->date_start && $object->lines[$i]->date_end) if ($object->lines[$i]->date_start && $object->lines[$i]->date_end)
{ {
@ -1272,14 +1273,344 @@ function pdf_getTotalQty($object,$type='',$outputlangs,$hookmanager=false)
function pdf_getCurrencySymbol(&$pdf, $currency_code) function pdf_getCurrencySymbol(&$pdf, $currency_code)
{ {
switch ($currency_code) { switch ($currency_code) {
case "ALL":
$currency_sign = " ".$pdf->unichr(76).$pdf->unichr(101).$pdf->unichr(107);
break;
case "AFN":
$currency_sign = " ".$pdf->unichr(1547);
break;
case "ARS":
$currency_sign = " ".$pdf->unichr(36);
break;
case "AWG":
$currency_sign = " ".$pdf->unichr(402);
break;
case "AUD":
$currency_sign = " ".$pdf->unichr(36);
break;
case "AZN":
$currency_sign = " ".$pdf->unichr(1084).$pdf->unichr(1072).$pdf->unichr(1085);
break;
case "BSD":
$currency_sign = " ".$pdf->unichr(36);
break;
case "BBD":
$currency_sign = " ".$pdf->unichr(36);
break;
case "BYR":
$currency_sign = " ".$pdf->unichr(112).$pdf->unichr(46);
break;
case "BZD":
$currency_sign = " ".$pdf->unichr(66).$pdf->unichr(90).$pdf->unichr(36);
break;
case "BMD":
$currency_sign = " ".$pdf->unichr(36);
break;
case "BOB":
$currency_sign = " ".$pdf->unichr(36).$pdf->unichr(98);
break;
case "BAM":
$currency_sign = " ".$pdf->unichr(75).$pdf->unichr(77);
break;
case "BWP":
$currency_sign = " ".$pdf->unichr(80);
break;
case "BGN":
$currency_sign = " ".$pdf->unichr(1083).$pdf->unichr(1074);
break;
case "BRL":
$currency_sign = " ".$pdf->unichr(82).$pdf->unichr(36);
break;
case "BND":
$currency_sign = " ".$pdf->unichr(36);
break;
case "KHR":
$currency_sign = " ".$pdf->unichr(6107);
break;
case "CAD":
$currency_sign = " ".$pdf->unichr(36);
break;
case "KYD":
$currency_sign = " ".$pdf->unichr(36);
break;
case "CLP":
$currency_sign = " ".$pdf->unichr(36);
break;
case "CNY":
$currency_sign = " ".$pdf->unichr(165);
break;
case "COP":
$currency_sign = " ".$pdf->unichr(36);
break;
case "CRC":
$currency_sign = " ".$pdf->unichr(8353);
break;
case "HRK":
$currency_sign = " ".$pdf->unichr(107).$pdf->unichr(110);
break;
case "CUP":
$currency_sign = " ".$pdf->unichr(8369);
break;
case "CZK":
$currency_sign = " ".$pdf->unichr(75).$pdf->unichr(269);
break;
case "DKK":
$currency_sign = " ".$pdf->unichr(107).$pdf->unichr(114);
break;
case "DOP":
$currency_sign = " ".$pdf->unichr(82).$pdf->unichr(68).$pdf->unichr(36);
break;
case "XCD":
$currency_sign = " ".$pdf->unichr(36);
break;
case "EGP":
$currency_sign = " ".$pdf->unichr(163);
break;
case "SVC":
$currency_sign = " ".$pdf->unichr(36);
break;
case "EEK":
$currency_sign = " ".$pdf->unichr(107).$pdf->unichr(114);
break;
case "EUR": case "EUR":
$currency_sign = " ".$pdf->unichr(8364); $currency_sign = " ".$pdf->unichr(8364);
break; break;
case "USD": case "FKP":
$currency_sign = " ".utf8_encode('$'); $currency_sign = " ".$pdf->unichr(163);
break;
case "FJD":
$currency_sign = " ".$pdf->unichr(36);
break;
case "GHC":
$currency_sign = " ".$pdf->unichr(162);
break;
case "GIP":
$currency_sign = " ".$pdf->unichr(163);
break;
case "GTQ":
$currency_sign = " ".$pdf->unichr(81);
break;
case "GGP":
$currency_sign = " ".$pdf->unichr(163);
break;
case "GYD":
$currency_sign = " ".$pdf->unichr(36);
break;
case "HNL":
$currency_sign = " ".$pdf->unichr(76);
break;
case "HKD":
$currency_sign = " ".$pdf->unichr(36);
break;
case "HUF":
$currency_sign = " ".$pdf->unichr(70).$pdf->unichr(116);
break;
case "ISK":
$currency_sign = " ".$pdf->unichr(107).$pdf->unichr(114);
break;
case "INR":
$currency_sign = " ".$pdf->unichr(8377);
break;
case "IDR":
$currency_sign = " ".$pdf->unichr(82).$pdf->unichr(112);
break;
case "IRR":
$currency_sign = " ".$pdf->unichr(65020);
break;
case "IMP":
$currency_sign = " ".$pdf->unichr(163);
break;
case "ILS":
$currency_sign = " ".$pdf->unichr(8362);
break;
case "JMD":
$currency_sign = " ".$pdf->unichr(74).$pdf->unichr(36);
break;
case "JPY":
$currency_sign = " ".$pdf->unichr(165);
break;
case "JEP":
$currency_sign = " ".$pdf->unichr(163);
break;
case "KZT":
$currency_sign = " ".$pdf->unichr(1083).$pdf->unichr(1074);
break;
case "KPW":
$currency_sign = " ".$pdf->unichr(8361);
break;
case "KRW":
$currency_sign = " ".$pdf->unichr(8361);
break;
case "KGS":
$currency_sign = " ".$pdf->unichr(1083).$pdf->unichr(1074);
break;
case "LAK":
$currency_sign = " ".$pdf->unichr(8365);
break;
case "LVL":
$currency_sign = " ".$pdf->unichr(76).$pdf->unichr(115);
break;
case "LBP":
$currency_sign = " ".$pdf->unichr(163);
break;
case "LRD":
$currency_sign = " ".$pdf->unichr(36);
break;
case "LTL":
$currency_sign = " ".$pdf->unichr(76).$pdf->unichr(116);
break;
case "MKD":
$currency_sign = " ".$pdf->unichr(1076).$pdf->unichr(1077).$pdf->unichr(1085);
break;
case "MYR":
$currency_sign = " ".$pdf->unichr(82).$pdf->unichr(77);
break;
case "MUR":
$currency_sign = " ".$pdf->unichr(8360);
break;
case "MXN":
$currency_sign = " ".$pdf->unichr(36);
break;
case "MNT":
$currency_sign = " ".$pdf->unichr(8366);
break;
case "MZN":
$currency_sign = " ".$pdf->unichr(77).$pdf->unichr(84);
break;
case "NAD":
$currency_sign = " ".$pdf->unichr(36);
break;
case "NPR":
$currency_sign = " ".$pdf->unichr(8360);
break;
case "ANG":
$currency_sign = " ".$pdf->unichr(402);
break;
case "NZD":
$currency_sign = " ".$pdf->unichr(36);
break;
case "NIO":
$currency_sign = " ".$pdf->unichr(67).$pdf->unichr(36);
break;
case "NGN":
$currency_sign = " ".$pdf->unichr(8358);
break;
case "NOK":
$currency_sign = " ".$pdf->unichr(107).$pdf->unichr(114);
break;
case "OMR":
$currency_sign = " ".$pdf->unichr(65020);
break;
case "PKR":
$currency_sign = " ".$pdf->unichr(8360);
break;
case "PAB":
$currency_sign = " ".$pdf->unichr(66).$pdf->unichr(47).$pdf->unichr(46);
break;
case "PYG":
$currency_sign = " ".$pdf->unichr(71).$pdf->unichr(115);
break;
case "PEN":
$currency_sign = " ".$pdf->unichr(83).$pdf->unichr(47).$pdf->unichr(46);
break;
case "PHP":
$currency_sign = " ".$pdf->unichr(8369);
break;
case "PLN":
$currency_sign = " ".$pdf->unichr(122).$pdf->unichr(322);
break;
case "QAR":
$currency_sign = " ".$pdf->unichr(65020);
break;
case "RON":
$currency_sign = " ".$pdf->unichr(108).$pdf->unichr(101).$pdf->unichr(105);
break;
case "RUB":
$currency_sign = " ".$pdf->unichr(1088).$pdf->unichr(1091).$pdf->unichr(1073);
break;
case "SHP":
$currency_sign = " ".$pdf->unichr(163);
break;
case "SAR":
$currency_sign = " ".$pdf->unichr(65020);
break;
case "RSD":
$currency_sign = " ".$pdf->unichr(1044).$pdf->unichr(1080).$pdf->unichr(1085).$pdf->unichr(46);
break;
case "SCR":
$currency_sign = " ".$pdf->unichr(8360);
break;
case "SGD":
$currency_sign = " ".$pdf->unichr(36);
break;
case "SBD":
$currency_sign = " ".$pdf->unichr(36);
break;
case "SOS":
$currency_sign = " ".$pdf->unichr(83);
break;
case "ZAR":
$currency_sign = " ".$pdf->unichr(82);
break;
case "LKR":
$currency_sign = " ".$pdf->unichr(8360);
break;
case "SEK":
$currency_sign = " ".$pdf->unichr(107).$pdf->unichr(114);
break;
case "CHF":
$currency_sign = " ".$pdf->unichr(67).$pdf->unichr(72).$pdf->unichr(70);
break;
case "SRD":
$currency_sign = " ".$pdf->unichr(36);
break;
case "SYP":
$currency_sign = " ".$pdf->unichr(163);
break;
case "TWD":
$currency_sign = " ".$pdf->unichr(78).$pdf->unichr(84).$pdf->unichr(36);
break;
case "THB":
$currency_sign = " ".$pdf->unichr(3647);
break;
case "TTD":
$currency_sign = " ".$pdf->unichr(84).$pdf->unichr(84).$pdf->unichr(36);
break;
case "TRY":
$currency_sign = " ".$pdf->unichr(84).$pdf->unichr(76);
break;
case "TRL":
$currency_sign = " ".$pdf->unichr(8356);
break;
case "TVD":
$currency_sign = " ".$pdf->unichr(36);
break;
case "UAH":
$currency_sign = " ".$pdf->unichr(8372);
break; break;
case "GBP": case "GBP":
$currency_sign = " ".utf8_encode('£'); $currency_sign = " ".$pdf->unichr(163);
break;
case "USD":
$currency_sign = " ".$pdf->unichr(36);
break;
case "UYU":
$currency_sign = " ".$pdf->unichr(36).$pdf->unichr(85);
break;
case "UZS":
$currency_sign = " ".$pdf->unichr(1083).$pdf->unichr(1074);
break;
case "VEF":
$currency_sign = " ".$pdf->unichr(66).$pdf->unichr(115);
break;
case "VND":
$currency_sign = " ".$pdf->unichr(8363);
break;
case "YER":
$currency_sign = " ".$pdf->unichr(65020);
break;
case "ZWD":
$currency_sign = " ".$pdf->unichr(90).$pdf->unichr(36);
break; break;
default: default:
$currency_sign = " ".$currency_code; $currency_sign = " ".$currency_code;

View File

@ -265,13 +265,10 @@ function select_projects($socid=-1, $selected='', $htmlname='projectid')
function PLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mytask=0) function PLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mytask=0)
{ {
global $user, $bc, $langs; global $user, $bc, $langs;
global $form; global $form, $projectstatic, $taskstatic;
$lastprojectid=0; $lastprojectid=0;
$projectstatic = new Project($db);
$taskstatic = new Task($db);
$var=true; $var=true;
$numlines=count($lines); $numlines=count($lines);
@ -380,12 +377,10 @@ function PLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $
function PLines(&$inc, $parent, &$lines, &$level, $var, $showproject, &$taskrole, $projectsListId='') function PLines(&$inc, $parent, &$lines, &$level, $var, $showproject, &$taskrole, $projectsListId='')
{ {
global $user, $bc, $langs; global $user, $bc, $langs;
global $projectstatic, $taskstatic;
$lastprojectid=0; $lastprojectid=0;
$projectstatic = new Project($db);
$taskstatic = new Task($db);
$projectsArrayId=explode(',',$projectsListId); $projectsArrayId=explode(',',$projectsListId);
$numlines=count($lines); $numlines=count($lines);

View File

@ -36,7 +36,7 @@
*/ */
function report_header($nom,$variante='',$period,$periodlink,$description,$builddate,$exportlink='',$moreparam=array()) function report_header($nom,$variante='',$period,$periodlink,$description,$builddate,$exportlink='',$moreparam=array())
{ {
global $langs; global $langs, $hselected;
print "\n\n<!-- debut cartouche rapport -->\n"; print "\n\n<!-- debut cartouche rapport -->\n";

View File

@ -131,8 +131,6 @@ function show_list_sending_receive($origin='commande',$origin_id,$filter='')
if ($num) if ($num)
{ {
if ($somethingshown) print '<br>';
if ($filter) print_titre($langs->trans("OtherSendingsForSameOrder")); if ($filter) print_titre($langs->trans("OtherSendingsForSameOrder"));
else print_titre($langs->trans("SendingsAndReceivingForSameOrder")); else print_titre($langs->trans("SendingsAndReceivingForSameOrder"));
@ -191,7 +189,7 @@ function show_list_sending_receive($origin='commande',$origin_id,$filter='')
else else
{ {
print "<td>"; print "<td>";
if ($type==1) $text = img_object($langs->trans('Service'),'service'); if ($objp->fk_product_type==1) $text = img_object($langs->trans('Service'),'service');
else $text = img_object($langs->trans('Product'),'product'); else $text = img_object($langs->trans('Product'),'product');
print $text.' '.nl2br($objp->description); print $text.' '.nl2br($objp->description);

View File

@ -84,9 +84,9 @@ function check_user_password_ldap($usertotest,$passwordtotest,$entitytotest)
if ($ldapdebug) if ($ldapdebug)
{ {
dol_syslog("functions_ldap::check_user_password_ldap Server:".join(',',$ldap->server).", Port:".$ldap->serverPort.", Protocol:".$ldap->ldapProtocolVersion.", Type:".$ldap->serverType); dol_syslog("functions_ldap::check_user_password_ldap Server:".join(',',$ldap->server).", Port:".$ldap->serverPort.", Protocol:".$ldap->ldapProtocolVersion.", Type:".$ldap->serverType);
dol_syslog("functions_ldap::check_user_password_ldap uid/samacountname=".$ldapuserattr.", dn=".$ladpdn.", Admin:".$ldap->searchUser.", Pass:".$ldap->searchPassword); dol_syslog("functions_ldap::check_user_password_ldap uid/samacountname=".$ldapuserattr.", dn=".$ldapdn.", Admin:".$ldap->searchUser.", Pass:".$ldap->searchPassword);
print "DEBUG: Server:".join(',',$ldap->server).", Port:".$ldap->serverPort.", Protocol:".$ldap->ldapProtocolVersion.", Type:".$ldap->serverType."\n"; print "DEBUG: Server:".join(',',$ldap->server).", Port:".$ldap->serverPort.", Protocol:".$ldap->ldapProtocolVersion.", Type:".$ldap->serverType."\n";
print "DEBUG: uid/samacountname=".$ldapuserattr.", dn=".$ladpdn.", Admin:".$ldap->searchUser.", Pass:".$ldap->searchPassword."\n"; print "DEBUG: uid/samacountname=".$ldapuserattr.", dn=".$ldapdn.", Admin:".$ldap->searchUser.", Pass:".$ldap->searchPassword."\n";
} }
$resultFetchLdapUser=0; $resultFetchLdapUser=0;

View File

@ -204,7 +204,7 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after)
print '<div class="menu_titre" id="menu_titre_logo"></div>'; print '<div class="menu_titre" id="menu_titre_logo"></div>';
print '<div class="menu_top" id="menu_top_logo"></div>'; print '<div class="menu_top" id="menu_top_logo"></div>';
print '<div class="menu_contenu" id="menu_contenu_logo">'; print '<div class="menu_contenu" id="menu_contenu_logo">';
print '<center><img title="'.$title.'" src="'.$urllogo.'"></center>'."\n"; print '<center><img title="" src="'.$urllogo.'"></center>'."\n";
print '</div>'; print '</div>';
print '<div class="menu_end" id="menu_end_logo"></div>'; print '<div class="menu_end" id="menu_end_logo"></div>';
print '</div>'."\n"; print '</div>'."\n";

View File

@ -601,7 +601,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after)
print '<div class="menu_titre" id="menu_titre_logo"></div>'; print '<div class="menu_titre" id="menu_titre_logo"></div>';
print '<div class="menu_top" id="menu_top_logo"></div>'; print '<div class="menu_top" id="menu_top_logo"></div>';
print '<div class="menu_contenu" id="menu_contenu_logo">'; print '<div class="menu_contenu" id="menu_contenu_logo">';
print '<center><img title="'.$title.'" src="'.$urllogo.'"></center>'."\n"; print '<center><img title="" src="'.$urllogo.'"></center>'."\n";
print '</div>'; print '</div>';
print '<div class="menu_end" id="menu_end_logo"></div>'; print '<div class="menu_end" id="menu_end_logo"></div>';
print '</div>'."\n"; print '</div>'."\n";

View File

@ -167,7 +167,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
$pdf->Output($_file,'F'); $pdf->Output($_file,'F');
if (! empty($conf->global->MAIN_UMASK)) if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK)); @chmod($_file, octdec($conf->global->MAIN_UMASK));
$outputlangs->charset_output=$sav_charset_output; $outputlangs->charset_output=$sav_charset_output;
return 1; // Pas d'erreur return 1; // Pas d'erreur
@ -359,7 +359,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
// On positionne le debut du bas de page selon nbre de lignes de ce bas de page // On positionne le debut du bas de page selon nbre de lignes de ce bas de page
$nbofline=dol_nboflines_bis($line,0,$outputlangs->charset_output); $nbofline=dol_nboflines_bis($line,0,$outputlangs->charset_output);
//print 'e'.$line.'t'.dol_nboflines($line);exit; //print 'e'.$line.'t'.dol_nboflines($line);exit;
$posy=$marge_basse + ($nbofline*3) + ($line1?3:0) + ($line2?3:0); $posy=$marge_basse + ($nbofline*3);
if ($line) // Free text if ($line) // Free text
{ {
@ -372,7 +372,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
$pdf->line($marge_gauche, $page_hauteur-$posy, 200, $page_hauteur-$posy); $pdf->line($marge_gauche, $page_hauteur-$posy, 200, $page_hauteur-$posy);
$posy--; $posy--;
if ($line1) /*if ($line1)
{ {
$pdf->SetXY($marge_gauche,-$posy); $pdf->SetXY($marge_gauche,-$posy);
$pdf->MultiCell(200, 2, $line1, 0, 'C', 0); $pdf->MultiCell(200, 2, $line1, 0, 'C', 0);
@ -383,7 +383,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
$posy-=3; $posy-=3;
$pdf->SetXY($marge_gauche,-$posy); $pdf->SetXY($marge_gauche,-$posy);
$pdf->MultiCell(200, 2, $line2, 0, 'C', 0); $pdf->MultiCell(200, 2, $line2, 0, 'C', 0);
} }*/
// Show page nb only on iso languages (so default Helvetica font) // Show page nb only on iso languages (so default Helvetica font)
if (pdf_getPDFFont($outputlangs) == 'Helvetica') if (pdf_getPDFFont($outputlangs) == 'Helvetica')

View File

@ -48,7 +48,7 @@ class mod_commande_saphir extends ModeleNumRefCommandes
$langs->load("bills"); $langs->load("bills");
$form = new Form($db); $form = new Form($this->db);
$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n"; $texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; $texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';

View File

@ -155,6 +155,8 @@ function commande_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0
global $conf,$user,$langs; global $conf,$user,$langs;
$langs->load("orders"); $langs->load("orders");
$error=0;
$dir = "/core/modules/commande/"; $dir = "/core/modules/commande/";
$srctemplatepath=''; $srctemplatepath='';
$modelisok=0; $modelisok=0;

View File

@ -43,7 +43,7 @@ class mod_contract_magre extends ModelNumRefContracts
$langs->load("bills"); $langs->load("bills");
$form = new Form($db); $form = new Form($this->db);
$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n"; $texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; $texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';

View File

@ -177,7 +177,7 @@ function don_create($db, $id, $message, $modele, $outputlangs)
// we delete preview files // we delete preview files
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"); require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
dol_delete_preview($object); dol_delete_preview($obj);
return 1; return 1;
} }
else else

View File

@ -43,7 +43,7 @@ class mod_expedition_ribera extends ModelNumRefExpedition
$langs->load("bills"); $langs->load("bills");
$form = new Form($db); $form = new Form($this->db);
$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n"; $texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; $texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';

View File

@ -166,7 +166,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures
$langs->load("companies"); $langs->load("companies");
$langs->load("errors"); $langs->load("errors");
$form = new Form($db); $form = new Form($this->db);
$texte = $this->description.".<br>\n"; $texte = $this->description.".<br>\n";
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; $texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
@ -266,11 +266,10 @@ class doc_generic_invoice_odt extends ModelePDFFactures
{ {
$id = $object; $id = $object;
$object = new Facture($this->db); $object = new Facture($this->db);
$object->fetch($id); $result=$object->fetch($id);
if ($result < 0) if ($result < 0)
{ {
dol_print_error($db,$object->error); dol_print_error($this->db,$object->error);
return -1; return -1;
} }
} }

View File

@ -46,7 +46,7 @@ class mod_facture_mercure extends ModeleNumRefFactures
$langs->load("bills"); $langs->load("bills");
$form = new Form($db); $form = new Form($this->db);
$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n"; $texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; $texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';

View File

@ -149,6 +149,8 @@ function facture_pdf_create($db, $object, $message, $modele, $outputlangs, $hide
$langs->load("bills"); $langs->load("bills");
$error=0;
// Increase limit for PDF build // Increase limit for PDF build
$err=error_reporting(); $err=error_reporting();
error_reporting(0); error_reporting(0);

View File

@ -52,7 +52,7 @@ class mod_arctic extends ModeleNumRefFicheinter
$langs->load("bills"); $langs->load("bills");
$form = new Form($db); $form = new Form($this->db);
$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n"; $texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; $texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';

View File

@ -45,7 +45,7 @@ class mod_livraison_saphir extends ModeleNumRefDeliveryOrder
$langs->load("bills"); $langs->load("bills");
$form = new Form($db); $form = new Form($this->db);
$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n"; $texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; $texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';

View File

@ -234,7 +234,7 @@ class pdf_sirocco extends ModelePDFDeliveryOrder
$tab_height_in_current_page=$tab_height_newpage; $tab_height_in_current_page=$tab_height_newpage;
} }
if (($nexY+$nblineFollowDesc) > ($tab_top_in_current_page+$tab_height_in_current_page) && $i < ($nblignes - 1)) if (($nexY+$nblineFollowDesc) > ($tab_top_in_current_page+$tab_height_in_current_page) && $i < ($nblines - 1))
{ {
if ($pagenb == 1) if ($pagenb == 1)
{ {

View File

@ -298,7 +298,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
$tab_top_in_current_page=$tab_top_newpage; $tab_top_in_current_page=$tab_top_newpage;
$tab_height_in_current_page=$tab_height_newpage; $tab_height_in_current_page=$tab_height_newpage;
} }
if (($nexY+$nblineFollowDesc) > ($tab_top_in_current_page+$tab_height_in_current_page) && $i < ($nblignes - 1)) if (($nexY+$nblineFollowDesc) > ($tab_top_in_current_page+$tab_height_in_current_page) && $i < ($nblines - 1))
{ {
if ($pagenb == 1) if ($pagenb == 1)
{ {
@ -344,6 +344,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
// Check product remaining to be delivered // Check product remaining to be delivered
// TODO doit etre modifie // TODO doit etre modifie
//$waitingDelivery = $object->getRemainingDelivered(); //$waitingDelivery = $object->getRemainingDelivered();
$waitingDelivery='';
if (is_array($waitingDelivery) & !empty($waitingDelivery)) if (is_array($waitingDelivery) & !empty($waitingDelivery))
{ {

View File

@ -202,7 +202,7 @@ class mailing_framboise extends MailingTargets
} }
else else
{ {
dol_print_error($db); dol_print_error($this->db);
} }
$s.='</select>'; $s.='</select>';

View File

@ -218,7 +218,7 @@ class mailing_thirdparties extends MailingTargets
} }
else else
{ {
dol_print_error($db); dol_print_error($this->db);
} }
$s.='</select>'; $s.='</select>';

View File

@ -357,10 +357,11 @@ class pdf_standard {
/** /**
* \brief Function to build PDF on disk, then output on HTTP strem. * Function to build PDF on disk, then output on HTTP strem.
* \param arrayofmembers Array of members informations *
* \param outputlangs Lang object for output language * @param arrayofmembers Array of members informations
* \return int 1=ok, 0=ko * @param outputlangs Lang object for output language
* @return int 1=ok, 0=ko
*/ */
function write_file($arrayofmembers,$outputlangs) function write_file($arrayofmembers,$outputlangs)
{ {
@ -457,7 +458,7 @@ class pdf_standard {
$filename='tmpcards.pdf'; $filename='tmpcards.pdf';
$type=dol_mimetype($filename); $type=dol_mimetype($filename);
if ($encoding) header('Content-Encoding: '.$encoding); //if ($encoding) header('Content-Encoding: '.$encoding);
if ($type) header('Content-Type: '.$type); if ($type) header('Content-Type: '.$type);
if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"'); if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"');
else header('Content-Disposition: inline; filename="'.$filename.'"'); else header('Content-Disposition: inline; filename="'.$filename.'"');

View File

@ -144,6 +144,8 @@ class pdf_standardlabel {
$logo=$conf->mycompany->dir_output.'/logos/'.$mysoc->logo; $logo=$conf->mycompany->dir_output.'/logos/'.$mysoc->logo;
} }
} }
// Define photo
$photo='';
// Print lines // Print lines
if ($this->code == "CARD") if ($this->code == "CARD")
@ -436,7 +438,7 @@ class pdf_standardlabel {
$filename='tmplabels.pdf'; $filename='tmplabels.pdf';
$type=dol_mimetype($filename); $type=dol_mimetype($filename);
if ($encoding) header('Content-Encoding: '.$encoding); //if ($encoding) header('Content-Encoding: '.$encoding);
if ($type) header('Content-Type: '.$type); if ($type) header('Content-Type: '.$type);
if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"'); if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"');
else header('Content-Disposition: inline; filename="'.$filename.'"'); else header('Content-Disposition: inline; filename="'.$filename.'"');

View File

@ -132,6 +132,8 @@ class modComptabilite extends DolibarrModules
// Nettoyage avant activation // Nettoyage avant activation
$this->remove(); $this->remove();
$sql = array();
return $this->_init($sql); return $this->_init($sql);
} }

View File

@ -129,6 +129,8 @@ class modContrat extends DolibarrModules
// Nettoyage avant activation // Nettoyage avant activation
$this->remove(); $this->remove();
$sql = array();
return $this->_init($sql); return $this->_init($sql);
} }

View File

@ -111,6 +111,8 @@ class modMailing extends DolibarrModules
// Permissions // Permissions
$this->remove(); $this->remove();
$sql = array();
return $this->_init($sql); return $this->_init($sql);
} }

View File

@ -84,6 +84,8 @@ class modNotification extends DolibarrModules
// Permissions // Permissions
$this->remove(); $this->remove();
$sql = array();
return $this->_init($sql); return $this->_init($sql);
} }

View File

@ -149,6 +149,8 @@ class modTax extends DolibarrModules
// Nettoyage avant activation // Nettoyage avant activation
$this->remove(); $this->remove();
$sql = array();
return $this->_init($sql); return $this->_init($sql);
} }

View File

@ -147,7 +147,10 @@ class modWorkflow extends DolibarrModules
*/ */
function init() function init()
{ {
//$result=$this->load_tables(); // Permissions
$this->remove();
$sql = array();
return $this->_init($sql); return $this->_init($sql);
} }

View File

@ -47,7 +47,7 @@ class mod_project_universal extends ModeleNumRefProjects
$langs->load("projects"); $langs->load("projects");
$langs->load("admin"); $langs->load("admin");
$form = new Form($db); $form = new Form($this->db);
$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n"; $texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; $texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';

View File

@ -48,7 +48,7 @@ class mod_propale_saphir extends ModeleNumRefPropales
$langs->load("bills"); $langs->load("bills");
$form = new Form($db); $form = new Form($this->db);
$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n"; $texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; $texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';

View File

@ -128,7 +128,7 @@ abstract class ModeleNumRefPropales
/** /**
* Create a document onto disk accordign to template module. * Create a document onto disk according to template module.
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
* @param Object $object Object proposal * @param Object $object Object proposal
@ -145,6 +145,8 @@ function propale_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0,
global $conf,$user,$langs; global $conf,$user,$langs;
$langs->load("propale"); $langs->load("propale");
$error=0;
$dir = "/core/modules/propale/"; $dir = "/core/modules/propale/";
$srctemplatepath=''; $srctemplatepath='';
$modelisok=0; $modelisok=0;
@ -181,7 +183,7 @@ function propale_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0,
} }
// Si model pas encore bon // Si model pas encore bon
if (! $modelisok && is_array($liste)) if (! $modelisok)
{ {
$liste=ModelePDFPropales::liste_modeles($db); $liste=ModelePDFPropales::liste_modeles($db);
$modele=key($liste); // Renvoie premiere valeur de cle trouve dans le tableau $modele=key($liste); // Renvoie premiere valeur de cle trouve dans le tableau

View File

@ -654,9 +654,9 @@ class pdf_propale_azur extends ModelePDFPropales
{ {
$index++; $index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT1".$mysoc->pays_code), $useborder, 'L', 1); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT1".$mysoc->pays_code), 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax1), $useborder, 'R', 1); $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax1), 0, 'R', 1);
} }
// Total LocalTax2 // Total LocalTax2
@ -664,9 +664,9 @@ class pdf_propale_azur extends ModelePDFPropales
{ {
$index++; $index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT2".$mysoc->pays_code), $useborder, 'L', 1); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT2".$mysoc->pays_code), 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax2), $useborder, 'R', 1); $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax2), 0, 'R', 1);
} }
} }
else else

View File

@ -654,9 +654,9 @@ class pdf_propale_jaune extends ModelePDFPropales
{ {
$index++; $index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT1".$mysoc->pays_code), $useborder, 'L', 1); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT1".$mysoc->pays_code), 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax1), $useborder, 'R', 1); $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax1), 0, 'R', 1);
} }
// Total LocalTax2 // Total LocalTax2
@ -664,9 +664,9 @@ class pdf_propale_jaune extends ModelePDFPropales
{ {
$index++; $index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT2".$mysoc->pays_code), $useborder, 'L', 1); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT2".$mysoc->pays_code), 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax2), $useborder, 'R', 1); $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax2), 0, 'R', 1);
} }
} }
else else

View File

@ -88,7 +88,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc
$langs->load("companies"); $langs->load("companies");
$langs->load("errors"); $langs->load("errors");
$form = new Form($db); $form = new Form($this->db);
$texte = $this->description.".<br>\n"; $texte = $this->description.".<br>\n";
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; $texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
@ -187,11 +187,10 @@ class doc_generic_odt extends ModeleThirdPartyDoc
{ {
$id = $object; $id = $object;
$object = new Societe($this->db); $object = new Societe($this->db);
$object->fetch($id); $result=$object->fetch($id);
if ($result < 0) if ($result < 0)
{ {
dol_print_error($db,$object->error); dol_print_error($this->db,$object->error);
return -1; return -1;
} }
} }

View File

@ -72,7 +72,7 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode
$langs->load("companies"); $langs->load("companies");
$form = new Form($db); $form = new Form($this->db);
$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n"; $texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; $texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';

View File

@ -61,7 +61,7 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode
$langs->load("companies"); $langs->load("companies");
$form = new Form($db); $form = new Form($this->db);
$tooltip=''; $tooltip='';
$texte = '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; $texte = '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';

View File

@ -355,6 +355,9 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
// Affiche zone totaux // Affiche zone totaux
$posy=$this->_tableau_tot($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs); $posy=$this->_tableau_tot($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs);
$amount_credit_notes_included=0;
$amount_deposits_included=0;
if ($deja_regle || $amount_credit_notes_included || $amount_deposits_included) if ($deja_regle || $amount_credit_notes_included || $amount_deposits_included)
{ {
$posy=$this->_tableau_versements($pdf, $object, $posy, $outputlangs); $posy=$this->_tableau_versements($pdf, $object, $posy, $outputlangs);
@ -423,6 +426,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
// Affichage des totaux de TVA par taux (conformement a reglementation) // Affichage des totaux de TVA par taux (conformement a reglementation)
$pdf->SetFillColor(248,248,248); $pdf->SetFillColor(248,248,248);
$index=0;
foreach( $this->tva as $tvakey => $tvaval ) foreach( $this->tva as $tvakey => $tvaval )
{ {
if ($tvakey > 0) // On affiche pas taux 0 if ($tvakey > 0) // On affiche pas taux 0
@ -461,9 +465,9 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
{ {
$index++; $index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT1".$mysoc->pays_code), $useborder, 'L', 1); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT1".$mysoc->pays_code), 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax1), $useborder, 'R', 1); $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax1), 0, 'R', 1);
} }
// Total LocalTax2 // Total LocalTax2
@ -471,9 +475,9 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
{ {
$index++; $index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT2".$mysoc->pays_code), $useborder, 'L', 1); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT2".$mysoc->pays_code), 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax2), $useborder, 'R', 1); $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax2), 0, 'R', 1);
} }
} }
else else

View File

@ -48,7 +48,7 @@ class mod_commande_fournisseur_orchidee extends ModeleNumRefSuppliersOrders
$langs->load("bills"); $langs->load("bills");
$langs->load("admin"); $langs->load("admin");
$form = new Form($db); $form = new Form($this->db);
$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n"; $texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; $texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';

View File

@ -356,6 +356,8 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
// Affiche zone totaux // Affiche zone totaux
$posy=$this->_tableau_tot($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs); $posy=$this->_tableau_tot($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs);
$amount_credit_notes_included=0;
$amount_deposits_included=0;
if ($deja_regle || $amount_credit_notes_included || $amount_deposits_included) if ($deja_regle || $amount_credit_notes_included || $amount_deposits_included)
{ {
$this->_tableau_versements($pdf, $object, $posy); $this->_tableau_versements($pdf, $object, $posy);
@ -426,6 +428,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
// Affichage des totaux de TVA par taux (conformement a reglementation) // Affichage des totaux de TVA par taux (conformement a reglementation)
$pdf->SetFillColor(248,248,248); $pdf->SetFillColor(248,248,248);
$index=0;
foreach( $this->tva as $tvakey => $tvaval ) foreach( $this->tva as $tvakey => $tvaval )
{ {
if ($tvakey > 0) // On affiche pas taux 0 if ($tvakey > 0) // On affiche pas taux 0
@ -465,9 +468,9 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
{ {
$index++; $index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT1".$mysoc->pays_code), $useborder, 'L', 1); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT1".$mysoc->pays_code), 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax1), $useborder, 'R', 1); $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax1), 0, 'R', 1);
} }
// Total LocalTax2 // Total LocalTax2
@ -475,9 +478,9 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
{ {
$index++; $index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT2".$mysoc->pays_code), $useborder, 'L', 1); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT2".$mysoc->pays_code), 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax2), $useborder, 'R', 1); $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax2), 0, 'R', 1);
} }
} }
else else

View File

@ -70,6 +70,7 @@ class EcmDirectory // extends CommonObject
{ {
global $conf, $langs; global $conf, $langs;
$error=0;
$now=dol_now(); $now=dol_now();
// Clean parameters // Clean parameters
@ -328,6 +329,8 @@ class EcmDirectory // extends CommonObject
global $conf, $langs; global $conf, $langs;
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"); require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
$error=0;
$relativepath=$this->getRelativePath(1); // Ex: dir1/dir2/dir3 $relativepath=$this->getRelativePath(1); // Ex: dir1/dir2/dir3
dol_syslog("EcmDirectories::delete remove directory ".$relativepath); dol_syslog("EcmDirectories::delete remove directory ".$relativepath);

View File

@ -398,14 +398,14 @@ class Expedition extends CommonObject
} }
else else
{ {
dol_syslog('Expedition::Fetch Error rowid='.$rowid.' numrows=0 sql='.$sql); dol_syslog('Expedition::Fetch Error -2');
$this->error='Delivery with id '.$rowid.' not found sql='.$sql; $this->error='Delivery with id '.$id.' not found sql='.$sql;
return -2; return -2;
} }
} }
else else
{ {
dol_syslog('Expedition::Fetch Error rowid='.$rowid.' Erreur dans fetch de l\'expedition'); dol_syslog('Expedition::Fetch Error -1');
$this->error=$this->db->error(); $this->error=$this->db->error();
return -1; return -1;
} }
@ -768,8 +768,10 @@ class Expedition extends CommonObject
function delete() function delete()
{ {
global $conf, $langs, $user; global $conf, $langs, $user;
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"); require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
$error=0;
$this->db->begin(); $this->db->begin();
$sql = "DELETE FROM ".MAIN_DB_PREFIX."expeditiondet"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."expeditiondet";

View File

@ -267,7 +267,7 @@ class Export
$file = "export_".$model.".modules.php"; $file = "export_".$model.".modules.php";
$classname = "Export".$model; $classname = "Export".$model;
require_once($dir.$file); require_once($dir.$file);
$objmodel = new $classname($db); $objmodel = new $classname($this->db);
if ($sqlquery) $sql = $sqlquery; if ($sqlquery) $sql = $sqlquery;
else $sql=$this->build_sql($indice,$array_selected); else $sql=$this->build_sql($indice,$array_selected);

View File

@ -310,6 +310,8 @@ class Fichinter extends CommonObject
{ {
global $langs, $conf; global $langs, $conf;
$error=0;
if ($this->statut != 1) if ($this->statut != 1)
{ {
$this->db->begin(); $this->db->begin();
@ -578,6 +580,7 @@ class Fichinter extends CommonObject
if (! $this->db->query($sql) ) if (! $this->db->query($sql) )
{ {
dol_syslog("Fichinter::delete error", LOG_ERR); dol_syslog("Fichinter::delete error", LOG_ERR);
$this->error=$this->db->lasterror();
$error++; $error++;
} }
@ -589,7 +592,7 @@ class Fichinter extends CommonObject
$error++; $error++;
} }
if ($err > 0) if ($error)
{ {
$this->db->rollback(); $this->db->rollback();
return -1; return -1;

View File

@ -706,6 +706,8 @@ class CommandeFournisseur extends Commande
{ {
global $conf, $langs; global $conf, $langs;
$error=0;
dol_syslog("CommandeFournisseur::Refuse"); dol_syslog("CommandeFournisseur::Refuse");
$result = 0; $result = 0;
if ($user->rights->fournisseur->commande->approuver) if ($user->rights->fournisseur->commande->approuver)
@ -750,6 +752,8 @@ class CommandeFournisseur extends Commande
{ {
global $langs,$conf; global $langs,$conf;
$error=0;
//dol_syslog("CommandeFournisseur::Cancel"); //dol_syslog("CommandeFournisseur::Cancel");
$result = 0; $result = 0;
if ($user->rights->fournisseur->commande->commander) if ($user->rights->fournisseur->commande->commander)
@ -848,6 +852,7 @@ class CommandeFournisseur extends Commande
$this->db->begin(); $this->db->begin();
$error=0;
$now=dol_now(); $now=dol_now();
/* On positionne en mode brouillon la commande */ /* On positionne en mode brouillon la commande */
@ -919,6 +924,7 @@ class CommandeFournisseur extends Commande
/** /**
* Add order line * Add order line
*
* @param desc Description * @param desc Description
* @param pu_ht Unit price * @param pu_ht Unit price
* @param qty Quantity * @param qty Quantity
@ -934,7 +940,7 @@ class CommandeFournisseur extends Commande
* @param type Type of line (0=product, 1=service) * @param type Type of line (0=product, 1=service)
* @return int <=0 if KO, >0 if OK * @return int <=0 if KO, >0 if OK
*/ */
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $fk_prod_fourn_price=0, $fourn_ref='', $remise_percent=0, $price_base_type='HT', $pu_ttc=0, $type=0) function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $fk_prod_fourn_price=0, $fourn_ref='', $remise_percent=0, $price_base_type='HT', $pu_ttc=0, $type=0, $info_bits=0)
{ {
global $langs,$mysoc; global $langs,$mysoc;
@ -1134,7 +1140,6 @@ class CommandeFournisseur extends Commande
$error++; $error++;
} }
} }
$i++;
} }
if ($error == 0) if ($error == 0)
@ -1188,13 +1193,14 @@ class CommandeFournisseur extends Commande
/** /**
* Delete an order * Delete an order
* *
* @param User $user Object user
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function delete() function delete($user='')
{ {
global $langs,$conf; global $langs,$conf;
$err = 0; $error = 0;
$this->db->begin(); $this->db->begin();
@ -1202,7 +1208,7 @@ class CommandeFournisseur extends Commande
dol_syslog("FournisseurCommande::delete sql=".$sql, LOG_DEBUG); dol_syslog("FournisseurCommande::delete sql=".$sql, LOG_DEBUG);
if (! $this->db->query($sql) ) if (! $this->db->query($sql) )
{ {
$err++; $error++;
} }
$sql = "DELETE FROM ".MAIN_DB_PREFIX."commande_fournisseur WHERE rowid =".$this->id; $sql = "DELETE FROM ".MAIN_DB_PREFIX."commande_fournisseur WHERE rowid =".$this->id;
@ -1211,15 +1217,15 @@ class CommandeFournisseur extends Commande
{ {
if ($this->db->affected_rows($resql) < 1) if ($this->db->affected_rows($resql) < 1)
{ {
$err++; $error++;
} }
} }
else else
{ {
$err++; $error++;
} }
if ($err == 0) if ($error == 0)
{ {
// Appel des triggers // Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
@ -1630,10 +1636,10 @@ class CommandeFournisseur extends Commande
$sql.= ",localtax1_tx='".price2num($txlocaltax1)."'"; $sql.= ",localtax1_tx='".price2num($txlocaltax1)."'";
$sql.= ",localtax2_tx='".price2num($txlocaltax2)."'"; $sql.= ",localtax2_tx='".price2num($txlocaltax2)."'";
$sql.= ",qty='".price2num($qty)."'"; $sql.= ",qty='".price2num($qty)."'";
if ($date_end) { $sql.= ",date_start='$date_end'"; } /*if ($date_end) { $sql.= ",date_start='$date_end'"; }
else { $sql.=',date_start=null'; } else { $sql.=',date_start=null'; }
if ($date_end) { $sql.= ",date_end='$date_end'"; } if ($date_end) { $sql.= ",date_end='$date_end'"; }
else { $sql.=',date_end=null'; } else { $sql.=',date_end=null'; }*/
$sql.= ",info_bits='".$info_bits."'"; $sql.= ",info_bits='".$info_bits."'";
$sql.= ",total_ht='".price2num($total_ht)."'"; $sql.= ",total_ht='".price2num($total_ht)."'";
$sql.= ",total_tva='".price2num($total_tva)."'"; $sql.= ",total_tva='".price2num($total_tva)."'";

View File

@ -82,14 +82,11 @@ class FactureFournisseur extends Facture
/** /**
* Constructor * Constructor
* *
* @param DoliDB $DB Database handler * @param DoliDB $db Database handler
*/ */
function FactureFournisseur($DB) function FactureFournisseur($db)
{ {
$this->db = $DB ; $this->db = $db;
$this->id = $facid;
$this->socid = $socid;
$this->amount = 0; $this->amount = 0;
$this->remise = 0; $this->remise = 0;
@ -115,6 +112,7 @@ class FactureFournisseur extends Facture
{ {
global $langs,$conf; global $langs,$conf;
$error=0;
$now=dol_now(); $now=dol_now();
// Clear parameters // Clear parameters
@ -255,6 +253,7 @@ class FactureFournisseur extends Facture
function fetch($id='',$ref='') function fetch($id='',$ref='')
{ {
global $langs; global $langs;
$sql = "SELECT"; $sql = "SELECT";
$sql.= " t.rowid,"; $sql.= " t.rowid,";
$sql.= " t.facnumber,"; $sql.= " t.facnumber,";
@ -356,8 +355,8 @@ class FactureFournisseur extends Facture
} }
else else
{ {
$this->error='Bill with id '.$rowid.' not found sql='.$sql; $this->error='Bill with id '.$id.' not found sql='.$sql;
dol_syslog(get_class($this).'::Fetch rowid='.$rowid.' numrows=0 sql='.$sql); dol_syslog(get_class($this).'::Fetch rowid='.$id.' numrows=0 sql='.$sql);
return -2; return -2;
} }

View File

@ -1231,7 +1231,7 @@ else
array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse'),'idwarehouse','',1))); array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse'),'idwarehouse','',1)));
} }
$ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateBill'), $langs->trans('ConfirmValidateBill', $object->ref), 'confirm_valid', $formquestion, 0, 1, 240); $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateBill'), $langs->trans('ConfirmValidateBill', $object->ref), 'confirm_valid', $formquestion, 1, 1, 240);
if ($ret == 'html') print '<br>'; if ($ret == 'html') print '<br>';
} }

View File

@ -34,8 +34,9 @@ $langs->load('companies');
$langs->load('bills'); $langs->load('bills');
$langs->load('banks'); $langs->load('banks');
$facid=isset($_GET['facid'])?$_GET['facid']:$_POST['facid']; $facid=GETPOST('facid');
$action=isset($_GET['action'])?$_GET['action']:$_POST['action']; $action=GETPOST('action');
$socid=GETPOST('socid','int');
$sortfield = GETPOST("sortfield",'alpha'); $sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha'); $sortorder = GETPOST("sortorder",'alpha');
@ -51,7 +52,6 @@ if (! $sortfield) $sortfield="p.rowid";
$amounts = array(); $amounts = array();
// Security check // Security check
$socid=0;
if ($user->societe_id > 0) if ($user->societe_id > 0)
{ {
$socid = $user->societe_id; $socid = $user->societe_id;
@ -159,7 +159,7 @@ if ($action == 'add_paiement')
} }
} }
if ($invoiceid > 0) $loc = DOL_URL_ROOT.'/fourn/facture/fiche.php?facid='.$invoiceid; if ($invoiceid > 0) $loc = DOL_URL_ROOT.'/fourn/facture/fiche.php?facid='.$invoiceid;
else $loc = DOL_URL_ROOT.'/compta/paiement/fiche.php?id='.$paiement_id; else $loc = DOL_URL_ROOT.'/fourn/paiement/fiche.php?id='.$paiement_id;
Header('Location: '.$loc); Header('Location: '.$loc);
exit; exit;
} }
@ -170,6 +170,7 @@ if ($action == 'add_paiement')
} }
} }
/* /*
* View * View
*/ */
@ -344,7 +345,7 @@ if ($action == 'create' || $action == 'add_paiement')
} }
/* /*
* Affichage liste * Show list
*/ */
if (! $_GET['action'] && ! $_POST['action']) if (! $_GET['action'] && ! $_POST['action'])
{ {
@ -355,16 +356,16 @@ if (! $_GET['action'] && ! $_POST['action'])
if (! $sortorder) $sortorder='DESC'; if (! $sortorder) $sortorder='DESC';
if (! $sortfield) $sortfield='p.datep'; if (! $sortfield) $sortfield='p.datep';
$sql = 'SELECT p.rowid, p.rowid as pid, p.datep as dp, p.amount as pamount,'; $sql = 'SELECT p.rowid as pid, p.datep as dp, p.amount as pamount, p.num_paiement,';
$sql.= ' f.rowid as facid, f.rowid as ref, f.facnumber, f.amount,';
$sql.= ' s.rowid as socid, s.nom,'; $sql.= ' s.rowid as socid, s.nom,';
$sql.= ' c.libelle as paiement_type, p.num_paiement,'; $sql.= ' c.libelle as paiement_type,';
$sql.= ' ba.rowid as bid, ba.label'; $sql.= ' ba.rowid as bid, ba.label,';
if (!$user->rights->societe->client->voir) $sql .= ", sc.fk_soc, sc.fk_user "; if (!$user->rights->societe->client->voir) $sql .= ' sc.fk_soc, sc.fk_user,';
$sql.= ' SUM(f.amount)';
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiementfourn AS p'; $sql.= ' FROM '.MAIN_DB_PREFIX.'paiementfourn AS p';
if (!$user->rights->societe->client->voir) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn AS pf ON p.rowid=pf.fk_paiementfourn'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn AS pf ON p.rowid=pf.fk_paiementfourn';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'facture_fourn AS f ON f.rowid=pf.fk_facturefourn '; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'facture_fourn AS f ON f.rowid=pf.fk_facturefourn';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement AS c ON p.fk_paiement = c.id'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement AS c ON p.fk_paiement = c.id';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe AS s ON s.rowid = f.fk_soc'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe AS s ON s.rowid = f.fk_soc';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid';
@ -378,26 +379,28 @@ if (! $_GET['action'] && ! $_POST['action'])
// Search criteria // Search criteria
if ($_REQUEST["search_ref"]) if ($_REQUEST["search_ref"])
{ {
$sql .=" AND p.rowid=".$_REQUEST["search_ref"]; $sql .= ' AND p.rowid='.$db->escape($_REQUEST["search_ref"]);
} }
if ($_REQUEST["search_account"]) if ($_REQUEST["search_account"])
{ {
$sql .=" AND b.fk_account=".$_REQUEST["search_account"]; $sql .= ' AND b.fk_account='.$db->escape($_REQUEST["search_account"]);
} }
if ($_REQUEST["search_paymenttype"]) if ($_REQUEST["search_paymenttype"])
{ {
$sql .=" AND c.code='".$_REQUEST["search_paymenttype"]."'"; $sql .= " AND c.code='".$db->escape($_REQUEST["search_paymenttype"])."'";
} }
if ($_REQUEST["search_amount"]) if ($_REQUEST["search_amount"])
{ {
$sql .=" AND p.amount=".price2num($_REQUEST["search_amount"]); $sql .= " AND p.amount=".price2num($_REQUEST["search_amount"]);
} }
if ($_REQUEST["search_company"]) if ($_REQUEST["search_company"])
{ {
$sql .=" AND s.nom LIKE '%".$db->escape($_REQUEST["search_company"])."%'"; $sql .= " AND s.nom LIKE '%".$db->escape($_REQUEST["search_company"])."%'";
} }
$sql.= " GROUP BY p.rowid, p.datep, p.amount, p.num_paiement, s.rowid, s.nom, c.libelle, ba.rowid, ba.label";
if (!$user->rights->societe->client->voir) $sql .= ", sc.fk_soc, sc.fk_user";
$sql.= $db->order($sortfield,$sortorder); $sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($limit + 1 ,$offset); $sql.= $db->plimit($limit+1, $offset);
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
@ -413,8 +416,8 @@ if (! $_GET['action'] && ! $_POST['action'])
print_barre_liste($langs->trans('SupplierPayments'), $page, 'paiement.php',$paramlist,$sortfield,$sortorder,'',$num); print_barre_liste($langs->trans('SupplierPayments'), $page, 'paiement.php',$paramlist,$sortfield,$sortorder,'',$num);
if ($mesg) print $mesg; if ($mesg) dol_htmloutput_mesg($mesg);
if ($errmsg) print $errmsg; if ($errmsg) dol_htmloutput_errors($errmsg);
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';

View File

@ -177,11 +177,13 @@ if ($result > 0)
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr>'; print '<tr>';
print '<td valign="top" width="20%" colspan="2">'.$langs->trans('Ref').'</td><td colspan="3">'.$object->id.'</td></tr>'; print '<td valign="top" width="20%" colspan="2">'.$langs->trans('Ref').'</td><td colspan="3">';
print $form->showrefnav($object,'id','',1,'rowid','ref');
print '</td></tr>';
// Date payment // Date payment
print '<tr><td valign="top" colspan="2">'.$form->editfieldkey("Date",'date',$object->date,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer).'</td><td colspan="3">'; print '<tr><td valign="top" colspan="2">'.$form->editfieldkey("Date",'date',$object->date,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer).'</td><td colspan="3">';
print $form->editfieldval("Date",'date',$object->date,'id',$object->id,$object->statut == 0 && $user->rights->fournisseur->facture->creer,'day'); print $form->editfieldval("Date",'date',$object->date,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer,'day');
print '</td></tr>'; print '</td></tr>';
// Payment mode // Payment mode
@ -189,7 +191,7 @@ if ($result > 0)
// Payment numero // Payment numero
print '<tr><td valign="top" colspan="2">'.$form->editfieldkey("Numero",'num',$object->numero,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer).'</td><td colspan="3">'; print '<tr><td valign="top" colspan="2">'.$form->editfieldkey("Numero",'num',$object->numero,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer).'</td><td colspan="3">';
print $form->editfieldval("Numero",'num',$object->numero,'id',$object->id,$object->statut == 0 && $user->rights->fournisseur->facture->creer,'string'); print $form->editfieldval("Numero",'num',$object->numero,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer,'string');
print '</td></tr>'; print '</td></tr>';
// Amount // Amount
@ -202,7 +204,7 @@ if ($result > 0)
// Note // Note
print '<tr><td valign="top"" colspan="2">'.$form->editfieldkey("Note",'note',$object->note,$object,$user->rights->fournisseur->facture->creer).'</td><td colspan="3">'; print '<tr><td valign="top"" colspan="2">'.$form->editfieldkey("Note",'note',$object->note,$object,$user->rights->fournisseur->facture->creer).'</td><td colspan="3">';
print $form->editfieldval("Note",'note',$object->note,'id',$object->id,$user->rights->fournisseur->facture->creer,'text'); print $form->editfieldval("Note",'note',$object->note,$object,$user->rights->fournisseur->facture->creer,'text');
print '</td></tr>'; print '</td></tr>';
// Bank account // Bank account

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -33,6 +33,10 @@ require_once(DOL_DOCUMENT_ROOT."/boxes.php");
if (! isset($_GET["mainmenu"])) $_GET["mainmenu"]="home"; if (! isset($_GET["mainmenu"])) $_GET["mainmenu"]="home";
include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php');
$hookmanager=new HookManager($db);
$hookmanager->callHooks(array('index'));
/* /*
* Actions * Actions
@ -250,6 +254,11 @@ if ($user->societe_id == 0)
} }
} }
$object=(object) array();
$parameters=array();
$action='';
$reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
print '</table>'; print '</table>';
} }

View File

@ -1354,13 +1354,11 @@ function migrate_price_propal($db,$langs,$conf)
else else
{ {
print "Error id=".$propal->id; print "Error id=".$propal->id;
$err++;
} }
} }
else else
{ {
print "Error #3"; print "Error #3";
$err++;
} }
*/ */
$i++; $i++;
@ -1378,7 +1376,6 @@ function migrate_price_propal($db,$langs,$conf)
else else
{ {
print "Error #1 ".$db->error(); print "Error #1 ".$db->error();
$err++;
$db->rollback(); $db->rollback();
} }
@ -1458,13 +1455,11 @@ function migrate_price_contrat($db,$langs,$conf)
else else
{ {
print "Error id=".$propal->id; print "Error id=".$propal->id;
$err++;
} }
} }
else else
{ {
print "Error #3"; print "Error #3";
$err++;
} }
*/ */
$i++; $i++;
@ -1482,7 +1477,6 @@ function migrate_price_contrat($db,$langs,$conf)
else else
{ {
print "Error #1 ".$db->error(); print "Error #1 ".$db->error();
$err++;
$db->rollback(); $db->rollback();
} }
@ -1560,13 +1554,11 @@ function migrate_price_commande($db,$langs,$conf)
else else
{ {
print "Error id=".$commande->id; print "Error id=".$commande->id;
$err++;
} }
} }
else else
{ {
print "Error #3"; print "Error #3";
$err++;
} }
*/ */
$i++; $i++;
@ -1594,7 +1586,6 @@ function migrate_price_commande($db,$langs,$conf)
else else
{ {
print "Error #1 ".$db->error(); print "Error #1 ".$db->error();
$err++;
$db->rollback(); $db->rollback();
} }
@ -1672,13 +1663,11 @@ function migrate_price_commande_fournisseur($db,$langs,$conf)
else else
{ {
print "Error id=".$commande->id; print "Error id=".$commande->id;
$err++;
} }
} }
else else
{ {
print "Error #3"; print "Error #3";
$err++;
} }
*/ */
$i++; $i++;
@ -1706,7 +1695,6 @@ function migrate_price_commande_fournisseur($db,$langs,$conf)
else else
{ {
print "Error #1 ".$db->error(); print "Error #1 ".$db->error();
$err++;
$db->rollback(); $db->rollback();
} }

Some files were not shown because too many files have changed in this diff Show More