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

This commit is contained in:
Laurent Destailleur 2011-12-06 08:50:35 +01:00
commit 86b4b636ea
122 changed files with 517 additions and 488 deletions

View File

@ -136,7 +136,6 @@ print '</table>'."\n";
print '<br>'."\n"; print '<br>'."\n";
print '<!-- Editor name = '.$conf->global->FCKEDITOR_EDITORNAME.' -->';
print_fiche_titre($langs->trans("TestSubmitForm"),'',''); print_fiche_titre($langs->trans("TestSubmitForm"),'','');
print '<form name="formtest" method="POST" action="'.$_SERVER["PHP_SELF"].'">'."\n"; print '<form name="formtest" method="POST" action="'.$_SERVER["PHP_SELF"].'">'."\n";
$uselocalbrowser=true; $uselocalbrowser=true;

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

@ -46,13 +46,15 @@ function printBoxesArea($user,$areacode)
print '<table width="100%" class="notopnoleftnoright">'; print '<table width="100%" class="notopnoleftnoright">';
print '<tr><td class="notopnoleftnoright">'."\n"; print '<tr><td class="notopnoleftnoright">'."\n";
print '<div class="fichehalfleft">'; print '<div class="fichehalfleft">';
print "\n<!-- Box left container -->\n"; print "\n<!-- Box left container -->\n";
print '<div id="left" class="connectedSortable">'."\n"; print '<div id="left" class="connectedSortable">'."\n";
// Define $box_max_lines
$box_max_lines=5;
if (! empty($conf->global->MAIN_BOXES_MAXLINES)) $box_max_lines=$conf->global->MAIN_BOXES_MAXLINES;
$ii=0; $ii=0;
foreach ($boxarray as $key => $box) foreach ($boxarray as $key => $box)
{ {
@ -62,7 +64,7 @@ function printBoxesArea($user,$areacode)
//print 'box_id '.$boxarray[$ii]->box_id.' '; //print 'box_id '.$boxarray[$ii]->box_id.' ';
//print 'box_order '.$boxarray[$ii]->box_order.'<br>'; //print 'box_order '.$boxarray[$ii]->box_order.'<br>';
// Affichage boite key // Affichage boite key
$box->loadBox($conf->box_max_lines); $box->loadBox($box_max_lines);
$box->showBox(); $box->showBox();
} }
} }
@ -90,7 +92,7 @@ function printBoxesArea($user,$areacode)
//print 'box_id '.$boxarray[$ii]->box_id.' '; //print 'box_id '.$boxarray[$ii]->box_id.' ';
//print 'box_order '.$boxarray[$ii]->box_order.'<br>'; //print 'box_order '.$boxarray[$ii]->box_order.'<br>';
// Affichage boite key // Affichage boite key
$box->loadBox($conf->box_max_lines); $box->loadBox($box_max_lines);
$box->showBox(); $box->showBox();
} }
} }

View File

@ -121,15 +121,18 @@ class Categorie
/** /**
* Add category into database * Add category into database
* *
* @return int -1 : erreur SQL * @param User $user Object user
* -2 : nouvel ID inconnu * @return int -1 : erreur SQL
* -3 : categorie invalide * -2 : nouvel ID inconnu
* -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
* *
* @return int 1 : OK * @param User $user Object user
* -1 : SQL error * @return int 1 : OK
* -2 : invalid category * -1 : SQL error
* -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;
@ -447,9 +445,10 @@ class Commande extends CommonObject
} }
/** /**
* Close order * Close order
* @param user Objet user that close *
* @return int <0 if KO, >0 if OK * @param user Objet user that close
* @return int <0 if KO, >0 if OK
*/ */
function cloture($user) function cloture($user)
{ {
@ -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;
@ -526,17 +527,20 @@ class Commande extends CommonObject
// If stock is decremented on validate order, we must reincrement it // If stock is decremented on validate order, we must reincrement it
if ($conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER == 1) if ($conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER == 1)
{ {
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");
if ($this->lines[$i]->fk_product > 0) $num=count($this->lines);
{ for ($i = 0; $i < $num; $i++)
$mouvP = new MouvementStock($this->db); {
// We increment stock of product (and sub-products) if ($this->lines[$i]->fk_product > 0)
$entrepot_id = "1"; //Todo: ajouter possibilite de choisir l'entrepot {
$result=$mouvP->reception($user, $this->lines[$i]->fk_product, $entrepot_id, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("OrderCanceledInDolibarr",$this->ref)); $mouvP = new MouvementStock($this->db);
if ($result < 0) { $error++; } // We increment stock of product (and sub-products)
} $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("OrderCanceledInDolibarr",$this->ref));
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,15 +2290,16 @@ class Commande extends CommonObject
/** /**
* Delete the customer order * Delete the customer order
* @param user User object *
* @return int <=0 if KO, >0 if OK * @param User $user User object
* @return int <=0 if KO, >0 if OK
*/ */
function delete($user) function delete($user)
{ {
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

@ -54,11 +54,7 @@ llxHeader();
$form = new Form($db); $form = new Form($db);
// If lib forced $datetime = dol_now();
if (! empty($_GET["lib"])) $conf->global->MAIN_GRAPH_LIBRARY=$_GET["lib"];
$datetime = time();
$year = dol_print_date($datetime, "%Y"); $year = dol_print_date($datetime, "%Y");
$month = dol_print_date($datetime, "%m"); $month = dol_print_date($datetime, "%m");
$day = dol_print_date($datetime, "%d"); $day = dol_print_date($datetime, "%d");

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
* *
* @return int <0 if KO, >0 if OK * @param User $user User object
* @param int $notrigger Disable triggers
* @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

@ -92,10 +92,11 @@ abstract class ActionsContactCardCommon
/** /**
* Load data control * Load data control
* *
* @param int $id Id of object * @param string &$action Type of action
* @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=''; $generated_password=getRandomPassword('');
if (! $ldap_sid)
{
$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

@ -34,41 +34,40 @@
class Conf class Conf
{ {
/** \public */ /** \public */
//! Object with database handler
var $db;
//! To store properties found in conf file //! To store properties found in conf file
var $file; var $file;
//! Object with database handler
var $db;
//! To store properties found into database //! To store properties found into database
var $global; var $global;
//! To store if javascript/ajax is enabked //! To store if javascript/ajax is enabked
var $use_javascript_ajax; public $use_javascript_ajax;
//! Used to store current currency //! Used to store current currency
var $monnaie; public $currency;
//! Used to store current css (from theme) //! Used to store current css (from theme)
var $theme; // Contains current theme ("eldy", "auguria", ...) public $theme; // Contains current theme ("eldy", "auguria", ...)
var $css; // Contains full path of css page ("/theme/eldy/style.css.php", ...) public $css; // Contains full path of css page ("/theme/eldy/style.css.php", ...)
//! Used to store current menu handlers //! Used to store current menu handlers
var $top_menu; public $top_menu;
var $smart_menu; public $smart_menu;
//! To store properties of multi-company //! To store properties of multi-company
var $multicompany; public $multicompany;
//! Used to store instance for multi-company (default 1) //! Used to store running instance for multi-company (default 1)
var $entity=1; public $entity=1;
//! Used to store list of entities to use for each element
public $entities = array();
var $css_modules = array(); public $modules = array(); // List of modules
var $tabs_modules = array(); public $css_modules = array();
var $triggers_modules = array(); public $tabs_modules = array();
var $hooks_modules = array(); public $triggers_modules = array('/core/triggers');
public $login_method_modules = array(); public $hooks_modules = array();
var $modules = array(); public $login_method_modules = array();
var $entities = array();
var $logbuffer = array(); var $logbuffer = array();
var $filesystem_forbidden_chars = array('<','>',':','/','\\','?','*','|','"');
/** /**
@ -98,10 +97,7 @@ class Conf
*/ */
function setValues($db) function setValues($db)
{ {
dol_syslog("Conf::setValues"); dol_syslog(get_class($this)."::setValues");
// Directory of core triggers
$this->triggers_modules[] = "/core/triggers"; // Default relative path to triggers file
// Avoid warning if not defined // Avoid warning if not defined
if (empty($this->db->dolibarr_main_db_encryption)) $this->db->dolibarr_main_db_encryption=0; if (empty($this->db->dolibarr_main_db_encryption)) $this->db->dolibarr_main_db_encryption=0;
@ -125,21 +121,21 @@ class Conf
} }
$sql.= " ORDER BY entity"; // This is to have entity 0 first, then entity 1 that overwrite. $sql.= " ORDER BY entity"; // This is to have entity 0 first, then entity 1 that overwrite.
$result = $db->query($sql); $resql = $db->query($sql);
if ($result) if ($resql)
{ {
$numr = $db->num_rows($result);
$multicompany_sharing=array(); $multicompany_sharing=array();
$i = 0;
$i = 0;
$numr = $db->num_rows($resql);
while ($i < $numr) while ($i < $numr)
{ {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($resql);
$key=$objp->name; $key=$objp->name;
$value=$objp->value; $value=$objp->value;
if ($key) if ($key)
{ {
if (! defined("$key")) define ("$key", $value); // In some cases, the constant might be already forced (Example: SYSLOG_FILE_ON and SYSLOG_FILE during install) if (! defined("$key")) define("$key", $value); // In some cases, the constant might be already forced (Example: SYSLOG_FILE_ON and SYSLOG_FILE during install)
$this->global->$key=$value; $this->global->$key=$value;
if ($value && preg_match('/^MAIN_MODULE_/',$key)) if ($value && preg_match('/^MAIN_MODULE_/',$key))
@ -154,7 +150,6 @@ class Conf
{ {
$params=explode(':',$value,2); $params=explode(':',$value,2);
$this->tabs_modules[$params[0]][]=$value; $this->tabs_modules[$params[0]][]=$value;
//print 'xxx'.$params[0].'-'.$value;
} }
// If this is constant for triggers activated by a module // If this is constant for triggers activated by a module
elseif (preg_match('/^MAIN_MODULE_([A-Z_]+)_TRIGGERS$/i',$key,$reg)) elseif (preg_match('/^MAIN_MODULE_([A-Z_]+)_TRIGGERS$/i',$key,$reg))
@ -207,7 +202,7 @@ class Conf
} }
// Sharings between entities // Sharings between entities
if (isset($this->multicompany->enabled) && $this->multicompany->enabled && ! empty($multicompany_sharing)) if (! empty($this->multicompany->enabled) && ! empty($multicompany_sharing))
{ {
$ret = @dol_include_once('/multicompany/class/actions_multicompany.class.php'); $ret = @dol_include_once('/multicompany/class/actions_multicompany.class.php');
if ($ret) if ($ret)
@ -221,7 +216,7 @@ class Conf
} }
} }
} }
$db->free($result); $db->free($resql);
//var_dump($this->modules); //var_dump($this->modules);
// Clean some variables // Clean some variables
@ -259,15 +254,15 @@ class Conf
$this->$module->dir_temp=$rootfordata."/".$module."/temp"; $this->$module->dir_temp=$rootfordata."/".$module."/temp";
} }
// For mycompany setup // For mycompany storage
$this->mycompany->dir_output=$rootfordata."/mycompany"; $this->mycompany->dir_output=$rootfordata."/mycompany";
$this->mycompany->dir_temp=$rootfordata."/mycompany/temp"; $this->mycompany->dir_temp=$rootfordata."/mycompany/temp";
// For admin features // For admin storage
$this->admin->dir_output=$rootfordata.'/admin'; $this->admin->dir_output=$rootfordata.'/admin';
$this->admin->dir_temp=$rootfordata.'/admin/temp'; $this->admin->dir_temp=$rootfordata.'/admin/temp';
// Module user // For user storage
$this->user->dir_output=$rootforuser."/users"; $this->user->dir_output=$rootforuser."/users";
$this->user->dir_temp=$rootforuser."/users/temp"; $this->user->dir_temp=$rootforuser."/users/temp";
@ -291,17 +286,15 @@ class Conf
$this->service->dir_temp =$rootfordata."/produit/temp"; $this->service->dir_temp =$rootfordata."/produit/temp";
// Module contrat // Module contrat
$this->contrat->dir_output=$rootfordata."/contracts"; $this->contrat->dir_output=$rootfordata."/contracts";
$this->contrat->dir_temp=$rootfordata."/contracts/temp"; $this->contrat->dir_temp =$rootfordata."/contracts/temp";
/* // Set some default values
* Set some default values
*/
// societe // societe
if (empty($this->global->SOCIETE_CODECLIENT_ADDON)) $this->global->SOCIETE_CODECLIENT_ADDON="mod_codeclient_leopard"; if (empty($this->global->SOCIETE_CODECLIENT_ADDON)) $this->global->SOCIETE_CODECLIENT_ADDON="mod_codeclient_leopard";
if (empty($this->global->SOCIETE_CODEFOURNISSEUR_ADDON)) $this->global->SOCIETE_CODEFOURNISSEUR_ADDON=$this->global->SOCIETE_CODECLIENT_ADDON; if (empty($this->global->SOCIETE_CODEFOURNISSEUR_ADDON)) $this->global->SOCIETE_CODEFOURNISSEUR_ADDON=$this->global->SOCIETE_CODECLIENT_ADDON;
if (empty($this->global->SOCIETE_CODECOMPTA_ADDON)) $this->global->SOCIETE_CODECOMPTA_ADDON="mod_codecompta_panicum"; if (empty($this->global->SOCIETE_CODECOMPTA_ADDON)) $this->global->SOCIETE_CODECOMPTA_ADDON="mod_codecompta_panicum";
if (empty($this->global->COMPANY_AQUARIUM_MASK_SUPPLIER)) $this->global->COMPANY_AQUARIUM_MASK_SUPPLIER='401'; if (empty($this->global->COMPANY_AQUARIUM_MASK_SUPPLIER)) $this->global->COMPANY_AQUARIUM_MASK_SUPPLIER='401';
if (empty($this->global->COMPANY_AQUARIUM_MASK_CUSTOMER)) $this->global->COMPANY_AQUARIUM_MASK_CUSTOMER='411'; if (empty($this->global->COMPANY_AQUARIUM_MASK_CUSTOMER)) $this->global->COMPANY_AQUARIUM_MASK_CUSTOMER='411';
@ -309,60 +302,44 @@ class Conf
if (empty($this->global->USER_PASSWORD_GENERATED)) $this->global->USER_PASSWORD_GENERATED='standard'; // Default password generator if (empty($this->global->USER_PASSWORD_GENERATED)) $this->global->USER_PASSWORD_GENERATED='standard'; // Default password generator
if (empty($this->global->MAIN_UMASK)) $this->global->MAIN_UMASK='0664'; // Default mask if (empty($this->global->MAIN_UMASK)) $this->global->MAIN_UMASK='0664'; // Default mask
// conf->box_max_lines
$this->box_max_lines=5;
if (isset($this->global->MAIN_BOXES_MAXLINES)) $this->box_max_lines=$this->global->MAIN_BOXES_MAXLINES;
// conf->use_preview_tabs
$this->use_preview_tabs=0;
if (isset($this->global->MAIN_USE_PREVIEW_TABS)) $this->use_preview_tabs=$this->global->MAIN_USE_PREVIEW_TABS;
// conf->use_javascript_ajax // conf->use_javascript_ajax
$this->use_javascript_ajax=1; $this->use_javascript_ajax=1;
if (isset($this->global->MAIN_DISABLE_JAVASCRIPT)) $this->use_javascript_ajax=! $this->global->MAIN_DISABLE_JAVASCRIPT; if (isset($this->global->MAIN_DISABLE_JAVASCRIPT)) $this->use_javascript_ajax=! $this->global->MAIN_DISABLE_JAVASCRIPT;
// If no javascript_ajax, Ajax features are disabled. // If no javascript_ajax, Ajax features are disabled.
if (! $this->use_javascript_ajax) if (! $this->use_javascript_ajax) $this->global->PRODUIT_USE_SEARCH_TO_SELECT=0;
{
$this->global->PRODUIT_USE_SEARCH_TO_SELECT=0;
}
// conf->currency // conf->currency
if (empty($this->global->MAIN_MONNAIE)) $this->global->MAIN_MONNAIE='EUR'; if (empty($this->global->MAIN_MONNAIE)) $this->global->MAIN_MONNAIE='EUR';
$this->currency=$this->global->MAIN_MONNAIE; $this->currency=$this->global->MAIN_MONNAIE;
// $this->global->COMPTA_MODE = Option des modules Comptabilites (simple ou expert). Defini le mode de calcul des etats comptables (CA,...) // conf->global->COMPTA_MODE = Option des modules Comptabilites (simple ou expert). Defini le mode de calcul des etats comptables (CA,...)
if (empty($this->global->COMPTA_MODE)) $this->global->COMPTA_MODE='RECETTES-DEPENSES'; // By default. Can be 'RECETTES-DEPENSES' ou 'CREANCES-DETTES' if (empty($this->global->COMPTA_MODE)) $this->global->COMPTA_MODE='RECETTES-DEPENSES'; // By default. Can be 'RECETTES-DEPENSES' ou 'CREANCES-DETTES'
// $this->liste_limit = constante de taille maximale des listes // conf->liste_limit = constante de taille maximale des listes
if (empty($this->global->MAIN_SIZE_LISTE_LIMIT)) $this->global->MAIN_SIZE_LISTE_LIMIT=25; if (empty($this->global->MAIN_SIZE_LISTE_LIMIT)) $this->global->MAIN_SIZE_LISTE_LIMIT=25;
$this->liste_limit=$this->global->MAIN_SIZE_LISTE_LIMIT; $this->liste_limit=$this->global->MAIN_SIZE_LISTE_LIMIT;
// $this->product->limit_size = constante de taille maximale des select de produit // conf->product->limit_size = constante de taille maximale des select de produit
if (! isset($this->global->PRODUIT_LIMIT_SIZE)) $this->global->PRODUIT_LIMIT_SIZE=100; if (! isset($this->global->PRODUIT_LIMIT_SIZE)) $this->global->PRODUIT_LIMIT_SIZE=100;
$this->product->limit_size=$this->global->PRODUIT_LIMIT_SIZE; $this->product->limit_size=$this->global->PRODUIT_LIMIT_SIZE;
// $this->theme et $this->css // conf->theme et $this->css
if (empty($this->global->MAIN_THEME)) $this->global->MAIN_THEME="eldy"; if (empty($this->global->MAIN_THEME)) $this->global->MAIN_THEME="eldy";
$this->theme=$this->global->MAIN_THEME; $this->theme=$this->global->MAIN_THEME;
$this->css = "/theme/".$this->theme."/style.css.php"; $this->css = "/theme/".$this->theme."/style.css.php";
// $this->email_from = email pour envoi par dolibarr des mails automatiques // conf->email_from = email pour envoi par dolibarr des mails automatiques
$this->email_from = "dolibarr-robot@domain.com"; $this->email_from = "dolibarr-robot@domain.com";
if (! empty($this->global->MAIN_MAIL_EMAIL_FROM)) $this->email_from = $this->global->MAIN_MAIL_EMAIL_FROM; if (! empty($this->global->MAIN_MAIL_EMAIL_FROM)) $this->email_from = $this->global->MAIN_MAIL_EMAIL_FROM;
// $this->notification->email_from = email pour envoi par Dolibarr des notifications // conf->notification->email_from = email pour envoi par Dolibarr des notifications
$this->notification->email_from=$this->email_from; $this->notification->email_from=$this->email_from;
if (! empty($this->global->NOTIFICATION_EMAIL_FROM)) $this->notification->email_from=$this->global->NOTIFICATION_EMAIL_FROM; if (! empty($this->global->NOTIFICATION_EMAIL_FROM)) $this->notification->email_from=$this->global->NOTIFICATION_EMAIL_FROM;
// $this->mailing->email_from = email pour envoi par Dolibarr des mailings // conf->mailing->email_from = email pour envoi par Dolibarr des mailings
$this->mailing->email_from=$this->email_from; $this->mailing->email_from=$this->email_from;
if (! empty($this->global->MAILING_EMAIL_FROM)) $this->mailing->email_from=$this->global->MAILING_EMAIL_FROM; if (! empty($this->global->MAILING_EMAIL_FROM)) $this->mailing->email_from=$this->global->MAILING_EMAIL_FROM;
// Defini MAIN_GRAPH_LIBRARY
if (empty($this->global->MAIN_GRAPH_LIBRARY)) $this->global->MAIN_GRAPH_LIBRARY = 'artichow';
if (! isset($this->global->FCKEDITOR_EDITORNAME)) $this->global->FCKEDITOR_EDITORNAME='ckeditor'; // fckeditor to switch
// Format for date (used by default when not found or searched in lang) // Format for date (used by default when not found or searched in lang)
$this->format_date_short="%d/%m/%Y"; // Format of day with PHP/C tags (strftime functions) $this->format_date_short="%d/%m/%Y"; // Format of day with PHP/C tags (strftime functions)
$this->format_date_short_java="dd/MM/yyyy"; // Format of day with Java tags $this->format_date_short_java="dd/MM/yyyy"; // Format of day with Java tags

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

@ -139,14 +139,15 @@ class DolEditor
* Output edit area inside the HTML stream. * Output edit area inside the HTML stream.
* Output depends on this->tool (fckeditor, ckeditor, texatrea, ...) * Output depends on this->tool (fckeditor, ckeditor, texatrea, ...)
* *
* @param noprint 1=Return HTML string instead of printing it to output * @param int $noprint 1=Return HTML string instead of printing it to output
* @return void
*/ */
function Create($noprint=0) function Create($noprint=0)
{ {
global $conf; global $conf;
$found=0; $found=0;
$out=''; $out='';
if ($this->tool == 'fckeditor') if ($this->tool == 'fckeditor')
{ {

View File

@ -66,15 +66,15 @@ class DolGraph
var $Legend=array(); var $Legend=array();
var $LegendWidthMin=0; var $LegendWidthMin=0;
var $graph; // Objet Graph (Artichow, Phplot...) var $graph; // Objet Graph (Artichow, Phplot...)
var $error; var $error;
var $library=''; // Par defaut on utiliser PHPlot var $library='artichow'; // Graphic library to use
var $bordercolor; // array(R,G,B) var $bordercolor; // array(R,G,B)
var $bgcolor; // array(R,G,B) var $bgcolor; // array(R,G,B)
var $bgcolorgrid; // array(R,G,B) var $bgcolorgrid; // array(R,G,B)
var $datacolor; // array(array(R,G,B),...) var $datacolor; // array(array(R,G,B),...)
/** /**
@ -85,7 +85,6 @@ class DolGraph
global $conf; global $conf;
global $theme_bordercolor, $theme_datacolor, $theme_bgcolor, $theme_bgcoloronglet; global $theme_bordercolor, $theme_datacolor, $theme_bgcolor, $theme_bgcoloronglet;
// Test si module GD present // Test si module GD present
$modules_list = get_loaded_extensions(); $modules_list = get_loaded_extensions();
$isgdinstalled=0; $isgdinstalled=0;
@ -99,15 +98,11 @@ class DolGraph
return -1; return -1;
} }
// Defini proprietes de l'objet graphe
$this->library=$conf->global->MAIN_GRAPH_LIBRARY;
$this->bordercolor = array(235,235,224); $this->bordercolor = array(235,235,224);
$this->datacolor = array(array(120,130,150), array(160,160,180), array(190,190,220)); $this->datacolor = array(array(120,130,150), array(160,160,180), array(190,190,220));
$this->bgcolor = array(235,235,224); $this->bgcolor = array(235,235,224);
$color_file = DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/graph-color.php"; $color_file = DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/graph-color.php';
if (is_readable($color_file)) if (is_readable($color_file))
{ {
include_once($color_file); include_once($color_file);

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

@ -41,7 +41,7 @@ function fichinter_prepare_head($object)
$head[$h][2] = 'contact'; $head[$h][2] = 'contact';
$h++; $h++;
if ($conf->use_preview_tabs) if (! empty($conf->global->MAIN_USE_PREVIEW_TABS))
{ {
$head[$h][0] = DOL_URL_ROOT.'/fichinter/apercu.php?id='.$object->id; $head[$h][0] = DOL_URL_ROOT.'/fichinter/apercu.php?id='.$object->id;
$head[$h][1] = $langs->trans('Preview'); $head[$h][1] = $langs->trans('Preview');

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

@ -373,8 +373,8 @@ function dol_now($mode='gmt')
*/ */
function dol_sanitizeFileName($str,$newstr='_') function dol_sanitizeFileName($str,$newstr='_')
{ {
global $conf; $filesystem_forbidden_chars = array('<','>',':','/','\\','?','*','|','"');
return dol_string_nospecial(dol_string_unaccent($str),$newstr,$conf->filesystem_forbidden_chars); return dol_string_nospecial(dol_string_unaccent($str), $newstr, $filesystem_forbidden_chars);
} }
/** /**
@ -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

@ -44,7 +44,7 @@ function facture_prepare_head($object)
$head[$h][2] = 'contact'; $head[$h][2] = 'contact';
$h++; $h++;
if ($conf->use_preview_tabs) if (! empty($conf->global->MAIN_USE_PREVIEW_TABS))
{ {
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/apercu.php?facid='.$object->id; $head[$h][0] = DOL_URL_ROOT.'/compta/facture/apercu.php?facid='.$object->id;
$head[$h][1] = $langs->trans('Preview'); $head[$h][1] = $langs->trans('Preview');

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

@ -54,7 +54,7 @@ function commande_prepare_head($object)
$h++; $h++;
} }
if ($conf->use_preview_tabs) if (! empty($conf->global->MAIN_USE_PREVIEW_TABS))
{ {
$head[$h][0] = DOL_URL_ROOT.'/commande/apercu.php?id='.$object->id; $head[$h][0] = DOL_URL_ROOT.'/commande/apercu.php?id='.$object->id;
$head[$h][1] = $langs->trans("Preview"); $head[$h][1] = $langs->trans("Preview");

View File

@ -806,6 +806,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)
{ {

View File

@ -43,7 +43,7 @@ function prelevement_prepare_head($object)
$head[$h][2] = 'prelevement'; $head[$h][2] = 'prelevement';
$h++; $h++;
if ($conf->use_preview_tabs) if (! empty($conf->global->MAIN_USE_PREVIEW_TABS))
{ {
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/bon.php?id='.$object->id; $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/bon.php?id='.$object->id;
$head[$h][1] = $langs->trans("Preview"); $head[$h][1] = $langs->trans("Preview");

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

@ -49,13 +49,7 @@ function propal_prepare_head($object)
$head[$h][2] = 'shipping'; $head[$h][2] = 'shipping';
$h++; $h++;
} }
/* if (! empty($conf->global->MAIN_USE_PREVIEW_TABS))
$head[$h][0] = DOL_URL_ROOT.'/compta/propal.php?id='.$propal->id;
$head[$h][1] = $langs->trans('AccountancyCard');
$head[$h][2] = 'compta';
$h++;
*/
if ($conf->use_preview_tabs)
{ {
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/apercu.php?id='.$object->id; $head[$h][0] = DOL_URL_ROOT.'/comm/propal/apercu.php?id='.$object->id;
$head[$h][1] = $langs->trans("Preview"); $head[$h][1] = $langs->trans("Preview");

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

@ -386,7 +386,6 @@ function build_rssfile($format,$title,$desc,$events_array,$outputfile,$filter=''
/** /**
* Encode for cal export * Encode for cal export
* string must be encoded in conf->file->character_set_client
* *
* @param string $format vcal or ical * @param string $format vcal or ical
* @param string $string string to encode * @param string $string string to encode
@ -396,10 +395,8 @@ function format_cal($format,$string)
{ {
global $conf; global $conf;
if ($conf->file->character_set_client == 'ISO-8859-1') $newstring=utf8_encode($string); $newstring=$string;
else $newstring=$string;
// Now newstring is always UTF8 string
if ($format == 'vcal') if ($format == 'vcal')
{ {
$newstring=quotedPrintEncode($newstring); $newstring=quotedPrintEncode($newstring);

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
* *
* @return int <0 if KO, >0 if OK * @param User $user Object user
* @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

@ -197,10 +197,6 @@ if ($action == "set")
//print "<tr><td>Creation de la table $name/td>"; //print "<tr><td>Creation de la table $name/td>";
$requestnb++; $requestnb++;
if ($conf->file->character_set_client == "UTF-8")
{
$buffer=utf8_encode($buffer);
}
dolibarr_install_syslog("Request: ".$buffer,LOG_DEBUG); dolibarr_install_syslog("Request: ".$buffer,LOG_DEBUG);
$resql=$db->query($buffer,0,'dml'); $resql=$db->query($buffer,0,'dml');
@ -344,10 +340,6 @@ if ($action == "set")
//print "<tr><td>Creation des cles et index de la table $name: '$buffer'</td>"; //print "<tr><td>Creation des cles et index de la table $name: '$buffer'</td>";
$requestnb++; $requestnb++;
if ($conf->file->character_set_client == "UTF-8")
{
$buffer=utf8_encode($buffer);
}
dolibarr_install_syslog("Request: ".$buffer,LOG_DEBUG); dolibarr_install_syslog("Request: ".$buffer,LOG_DEBUG);
$resql=$db->query($buffer,0,'dml'); $resql=$db->query($buffer,0,'dml');

View File

@ -84,6 +84,7 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 1
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 14, 1, '5.5','0','VAT reduced rate (France hors DOM-TOM)',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 14, 1, '5.5','0','VAT reduced rate (France hors DOM-TOM)',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 15, 1, '0','0','VAT Rate 0 ou non applicable',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 15, 1, '0','0','VAT Rate 0 ou non applicable',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 16, 1, '2.1','0','VAT super-reduced rate',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 16, 1, '2.1','0','VAT super-reduced rate',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 17, 1, '7','0','VAT reduced rate',1);
-- GERMANY (id country=5) -- GERMANY (id country=5)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 51, 5, '19','0','VAT standard rate',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 51, 5, '19','0','VAT standard rate',1);

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();
} }

View File

@ -293,7 +293,7 @@ class Livraison extends CommonObject
} }
else else
{ {
$this->error='Delivery with id '.$rowid.' not found sql='.$sql; $this->error='Delivery with id '.$id.' not found sql='.$sql;
dol_syslog('Livraison::Fetch Error '.$this->error, LOG_ERR); dol_syslog('Livraison::Fetch Error '.$this->error, LOG_ERR);
return -2; return -2;
} }
@ -308,12 +308,13 @@ class Livraison extends CommonObject
/** /**
* Validate object and update stock if option enabled * Validate object and update stock if option enabled
* @param user Object user that validate *
* @return int * @param User $user Object user that validate
* @return int
*/ */
function valid($user) function valid($user)
{ {
global $conf; global $conf, $langs;
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"); require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
dol_syslog("livraison.class.php::valid begin"); dol_syslog("livraison.class.php::valid begin");
@ -375,11 +376,11 @@ class Livraison extends CommonObject
if ($resql) if ($resql)
{ {
// On efface le repertoire de pdf provisoire // On efface le repertoire de pdf provisoire
$livraisonref = dol_sanitizeFileName($this->ref); $numref = dol_sanitizeFileName($this->ref);
if ($conf->expedition->dir_output) if ($conf->expedition->dir_output)
{ {
$dir = $conf->livraison->dir_output . "/" . $livraisonref ; $dir = $conf->livraison->dir_output . "/" . $numref ;
$file = $dir . "/" . $livraisonref . ".pdf"; $file = $dir . "/" . $numref . ".pdf";
if (file_exists($file)) if (file_exists($file))
{ {
if (!dol_delete_file($file)) if (!dol_delete_file($file))

View File

@ -308,10 +308,7 @@ $login='';
if (! defined('NOLOGIN')) if (! defined('NOLOGIN'))
{ {
// $authmode lists the different means of identification to be tested in order of preference. // $authmode lists the different means of identification to be tested in order of preference.
// Example: 'http' // Example: 'http', 'dolibarr', 'ldap', 'http,forceuser'
// Example: 'dolibarr'
// Example: 'ldap'
// Example: 'http,forceuser'
// Authentication mode // Authentication mode
if (empty($dolibarr_main_authentication)) $dolibarr_main_authentication='http,dolibarr'; if (empty($dolibarr_main_authentication)) $dolibarr_main_authentication='http,dolibarr';
@ -545,7 +542,7 @@ if (! defined('NOLOGIN'))
$_SESSION["dol_screenwidth"]=isset($dol_screenwidth)?$dol_screenwidth:''; $_SESSION["dol_screenwidth"]=isset($dol_screenwidth)?$dol_screenwidth:'';
$_SESSION["dol_screenheight"]=isset($dol_screenheight)?$dol_screenheight:''; $_SESSION["dol_screenheight"]=isset($dol_screenheight)?$dol_screenheight:'';
$_SESSION["dol_company"]=$conf->global->MAIN_INFO_SOCIETE_NOM; $_SESSION["dol_company"]=$conf->global->MAIN_INFO_SOCIETE_NOM;
if (! empty($conf->multicompany->enabled)) $_SESSION["dol_entity"]=$conf->entity; $_SESSION["dol_entity"]=$conf->entity;
dol_syslog("This is a new started user session. _SESSION['dol_login']=".$_SESSION["dol_login"].' Session id='.session_id()); dol_syslog("This is a new started user session. _SESSION['dol_login']=".$_SESSION["dol_login"].' Session id='.session_id());
$db->begin(); $db->begin();
@ -944,7 +941,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/flot/jquery.flot.stack.min.js"></script>'."\n"; print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/flot/jquery.flot.stack.min.js"></script>'."\n";
} }
// CKEditor // CKEditor
if (! empty($conf->fckeditor->enabled) && ! empty($conf->global->FCKEDITOR_EDITORNAME) && $conf->global->FCKEDITOR_EDITORNAME == 'ckeditor') if (! empty($conf->fckeditor->enabled) && (empty($conf->global->FCKEDITOR_EDITORNAME) || $conf->global->FCKEDITOR_EDITORNAME == 'ckeditor'))
{ {
print '<!-- Includes JS for CKEditor -->'."\n"; print '<!-- Includes JS for CKEditor -->'."\n";
print '<script type="text/javascript">var CKEDITOR_BASEPATH = \''.DOL_URL_ROOT.'/includes/ckeditor/\';</script>'."\n"; print '<script type="text/javascript">var CKEDITOR_BASEPATH = \''.DOL_URL_ROOT.'/includes/ckeditor/\';</script>'."\n";

View File

@ -56,16 +56,12 @@ $conf->db->dolibarr_main_db_encryption = $dolibarr_main_db_encryption;
$conf->db->dolibarr_main_db_cryptkey = $dolibarr_main_db_cryptkey; $conf->db->dolibarr_main_db_cryptkey = $dolibarr_main_db_cryptkey;
$conf->file->main_limit_users = $dolibarr_main_limit_users; $conf->file->main_limit_users = $dolibarr_main_limit_users;
$conf->file->mailing_limit_sendbyweb = $dolibarr_mailing_limit_sendbyweb; $conf->file->mailing_limit_sendbyweb = $dolibarr_mailing_limit_sendbyweb;
if (defined('TEST_DB_FORCE_TYPE')) $conf->db->type=constant('TEST_DB_FORCE_TYPE'); // For test purpose // Identification mode
// Identifiant autres
$conf->file->main_authentication = empty($dolibarr_main_authentication)?'':$dolibarr_main_authentication; $conf->file->main_authentication = empty($dolibarr_main_authentication)?'':$dolibarr_main_authentication;
// Force https // Force https
$conf->file->main_force_https = empty($dolibarr_main_force_https)?'':$dolibarr_main_force_https; $conf->file->main_force_https = empty($dolibarr_main_force_https)?'':$dolibarr_main_force_https;
// Define charset for HTML Output (can set hidden value force_charset in conf file)
$conf->file->character_set_client = strtoupper($force_charset_do_notuse);
// Cookie cryptkey // Cookie cryptkey
$conf->file->cookie_cryptkey = empty($dolibarr_main_cookie_cryptkey)?'':$dolibarr_main_cookie_cryptkey; $conf->file->cookie_cryptkey = empty($dolibarr_main_cookie_cryptkey)?'':$dolibarr_main_cookie_cryptkey;
// Define array of document root directories // Define array of document root directories
$conf->file->dol_document_root = array('main' => DOL_DOCUMENT_ROOT); $conf->file->dol_document_root = array('main' => DOL_DOCUMENT_ROOT);
if (! empty($dolibarr_main_document_root_alt)) if (! empty($dolibarr_main_document_root_alt))
@ -77,6 +73,8 @@ if (! empty($dolibarr_main_document_root_alt))
$conf->file->dol_document_root['alt']=$value; $conf->file->dol_document_root['alt']=$value;
} }
} }
// Force db type (for test purpose)
if (defined('TEST_DB_FORCE_TYPE')) $conf->db->type=constant('TEST_DB_FORCE_TYPE');
// Multi-Company transverse mode // Multi-Company transverse mode
$conf->multicompany->transverse_mode = empty($multicompany_transverse_mode)?'':$multicompany_transverse_mode; $conf->multicompany->transverse_mode = empty($multicompany_transverse_mode)?'':$multicompany_transverse_mode;
@ -91,7 +89,7 @@ if (! defined('NOREQUIRESOC')) require_once(DOL_DOCUMENT_ROOT ."/societe/class/
*/ */
if (! defined('NOREQUIRETRAN')) if (! defined('NOREQUIRETRAN'))
{ {
$langs = new Translate("",$conf); // A mettre apres lecture de la conf $langs = new Translate('',$conf); // A mettre apres lecture de la conf
} }
/* /*
@ -107,9 +105,10 @@ if (! defined('NOREQUIREDB'))
exit; exit;
} }
} }
// Now database connexion is known, so we can forget password // Now database connexion is known, so we can forget password
//$dolibarr_main_db_pass=''; // Comment this because this constant is used in a lot of pages //unset($dolibarr_main_db_pass); // We comment this because this constant is used in a lot of pages
$conf->db->pass=''; // This is to avoid password to be shown in memory/swap dump unset($conf->db->pass); // This is to avoid password to be shown in memory/swap dump
/* /*
* Creation objet $user * Creation objet $user
@ -126,29 +125,27 @@ if (! defined('NOREQUIREUSER'))
if (! defined('NOREQUIREDB')) if (! defined('NOREQUIREDB'))
{ {
// By default conf->entity is 1, but we change this if we ask another value. // By default conf->entity is 1, but we change this if we ask another value.
if (session_id() && ! empty($_SESSION["dol_entity"])) // Entity inside an opened session if (session_id() && ! empty($_SESSION["dol_entity"])) // Entity inside an opened session
{ {
$conf->entity = $_SESSION["dol_entity"]; $conf->entity = $_SESSION["dol_entity"];
} }
elseif (! empty($_ENV["dol_entity"])) // Entity inside a CLI script elseif (! empty($_ENV["dol_entity"])) // Entity inside a CLI script
{ {
$conf->entity = $_ENV["dol_entity"]; $conf->entity = $_ENV["dol_entity"];
} }
elseif (isset($_POST["loginfunction"]) && ! empty($_POST["entity"])) // Just after a login page elseif (isset($_POST["loginfunction"]) && GETPOST("entity")) // Just after a login page
{ {
$conf->entity = $_POST["entity"]; $conf->entity = GETPOST("entity",'int');
} }
else else // TODO Does this "else" still usefull ?
{ {
$prefix=dol_getprefix(); $prefix=dol_getprefix();
$entityCookieName = 'DOLENTITYID_'.$prefix; $entityCookieName = 'DOLENTITYID_'.$prefix;
if (! empty($_COOKIE[$entityCookieName]) && ! empty($conf->file->cookie_cryptkey)) // Just for view specific login page if (! empty($_COOKIE[$entityCookieName]) && ! empty($conf->file->cookie_cryptkey)) // Just for view specific login page
{ {
include_once(DOL_DOCUMENT_ROOT."/core/class/cookie.class.php"); include_once(DOL_DOCUMENT_ROOT."/core/class/cookie.class.php");
$lastuser = ''; $lastuser = '';
$lastentity = ''; $lastentity = '';
$entityCookie = new DolCookie($conf->file->cookie_cryptkey); $entityCookie = new DolCookie($conf->file->cookie_cryptkey);
$cookieValue = $entityCookie->_getCookie($entityCookieName); $cookieValue = $entityCookie->_getCookie($entityCookieName);
list($lastuser, $lastentity) = explode('|', $cookieValue); list($lastuser, $lastentity) = explode('|', $cookieValue);

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