diff --git a/htdocs/admin/fckeditor.php b/htdocs/admin/fckeditor.php index a6b953265fc..16ac49d543b 100644 --- a/htdocs/admin/fckeditor.php +++ b/htdocs/admin/fckeditor.php @@ -136,7 +136,6 @@ print ''."\n"; print '
'."\n"; -print ''; print_fiche_titre($langs->trans("TestSubmitForm"),'',''); print '
'."\n"; $uselocalbrowser=true; diff --git a/htdocs/boutique/commande/class/boutiquecommande.class.php b/htdocs/boutique/commande/class/boutiquecommande.class.php index 4b2d41e5221..143a4e3f1ad 100644 --- a/htdocs/boutique/commande/class/boutiquecommande.class.php +++ b/htdocs/boutique/commande/class/boutiquecommande.class.php @@ -41,12 +41,11 @@ class BoutiqueCommande /** * Constructor * - * @param DoliDB $DB Database handler + * @param DoliDB $db Database handler */ - function BoutiqueCommande($DB) + function BoutiqueCommande($db) { - $this->db = $DB; - $this->id = $id; + $this->db = $db; $this->billing_adr = new Address(); $this->delivry_adr = new Address(); @@ -107,7 +106,8 @@ class BoutiqueCommande if ( $result ) { $num = $this->db->num_rows($result); - + + $i=0; while ($i < $num) { $array = $this->db->fetch_array($result); diff --git a/htdocs/boutique/promotion/class/promotion.class.php b/htdocs/boutique/promotion/class/promotion.class.php index d78c54e729f..5ee5a743a3f 100644 --- a/htdocs/boutique/promotion/class/promotion.class.php +++ b/htdocs/boutique/promotion/class/promotion.class.php @@ -41,12 +41,11 @@ class Promotion /** * Constructor * - * @param DoliDB $DB Database handler + * @param DoliDB $db Database handler */ - function Promotion($DB) + function Promotion($db) { - $this->db = $DB; - $this->id = $id; + $this->db = $db; } /** diff --git a/htdocs/boxes.php b/htdocs/boxes.php index ad661583a8f..84e899f8290 100644 --- a/htdocs/boxes.php +++ b/htdocs/boxes.php @@ -46,13 +46,15 @@ function printBoxesArea($user,$areacode) print ''; print '"; $requestnb++; - if ($conf->file->character_set_client == "UTF-8") - { - $buffer=utf8_encode($buffer); - } dolibarr_install_syslog("Request: ".$buffer,LOG_DEBUG); $resql=$db->query($buffer,0,'dml'); diff --git a/htdocs/install/mysql/data/llx_c_tva.sql b/htdocs/install/mysql/data/llx_c_tva.sql index e56d1524460..097986925a9 100644 --- a/htdocs/install/mysql/data/llx_c_tva.sql +++ b/htdocs/install/mysql/data/llx_c_tva.sql @@ -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 ( 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 ( 17, 1, '7','0','VAT reduced rate',1); -- 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); diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 820a8921a6c..de78ffcc49f 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -1354,13 +1354,11 @@ function migrate_price_propal($db,$langs,$conf) else { print "Error id=".$propal->id; - $err++; } } else { print "Error #3"; - $err++; } */ $i++; @@ -1378,7 +1376,6 @@ function migrate_price_propal($db,$langs,$conf) else { print "Error #1 ".$db->error(); - $err++; $db->rollback(); } @@ -1458,13 +1455,11 @@ function migrate_price_contrat($db,$langs,$conf) else { print "Error id=".$propal->id; - $err++; } } else { print "Error #3"; - $err++; } */ $i++; @@ -1482,7 +1477,6 @@ function migrate_price_contrat($db,$langs,$conf) else { print "Error #1 ".$db->error(); - $err++; $db->rollback(); } @@ -1560,13 +1554,11 @@ function migrate_price_commande($db,$langs,$conf) else { print "Error id=".$commande->id; - $err++; } } else { print "Error #3"; - $err++; } */ $i++; @@ -1594,7 +1586,6 @@ function migrate_price_commande($db,$langs,$conf) else { print "Error #1 ".$db->error(); - $err++; $db->rollback(); } @@ -1672,13 +1663,11 @@ function migrate_price_commande_fournisseur($db,$langs,$conf) else { print "Error id=".$commande->id; - $err++; } } else { print "Error #3"; - $err++; } */ $i++; @@ -1706,7 +1695,6 @@ function migrate_price_commande_fournisseur($db,$langs,$conf) else { print "Error #1 ".$db->error(); - $err++; $db->rollback(); } diff --git a/htdocs/livraison/class/livraison.class.php b/htdocs/livraison/class/livraison.class.php index 7f1f32c1741..2bf23fcb2df 100644 --- a/htdocs/livraison/class/livraison.class.php +++ b/htdocs/livraison/class/livraison.class.php @@ -293,7 +293,7 @@ class Livraison extends CommonObject } 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); return -2; } @@ -308,12 +308,13 @@ class Livraison extends CommonObject /** * 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) { - global $conf; + global $conf, $langs; require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"); dol_syslog("livraison.class.php::valid begin"); @@ -375,11 +376,11 @@ class Livraison extends CommonObject if ($resql) { // On efface le repertoire de pdf provisoire - $livraisonref = dol_sanitizeFileName($this->ref); + $numref = dol_sanitizeFileName($this->ref); if ($conf->expedition->dir_output) { - $dir = $conf->livraison->dir_output . "/" . $livraisonref ; - $file = $dir . "/" . $livraisonref . ".pdf"; + $dir = $conf->livraison->dir_output . "/" . $numref ; + $file = $dir . "/" . $numref . ".pdf"; if (file_exists($file)) { if (!dol_delete_file($file)) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index ee394539023..c6555ca0a0c 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -308,10 +308,7 @@ $login=''; if (! defined('NOLOGIN')) { // $authmode lists the different means of identification to be tested in order of preference. - // Example: 'http' - // Example: 'dolibarr' - // Example: 'ldap' - // Example: 'http,forceuser' + // Example: 'http', 'dolibarr', 'ldap', 'http,forceuser' // Authentication mode 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_screenheight"]=isset($dol_screenheight)?$dol_screenheight:''; $_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()); $db->begin(); @@ -944,7 +941,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs print ''."\n"; } // 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 ''."\n"; print ''."\n"; diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index 5ee36650668..ad05ee10535 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -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->file->main_limit_users = $dolibarr_main_limit_users; $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 -// Identifiant autres +// Identification mode $conf->file->main_authentication = empty($dolibarr_main_authentication)?'':$dolibarr_main_authentication; // 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 $conf->file->cookie_cryptkey = empty($dolibarr_main_cookie_cryptkey)?'':$dolibarr_main_cookie_cryptkey; - // Define array of document root directories $conf->file->dol_document_root = array('main' => DOL_DOCUMENT_ROOT); 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; } } +// Force db type (for test purpose) +if (defined('TEST_DB_FORCE_TYPE')) $conf->db->type=constant('TEST_DB_FORCE_TYPE'); // Multi-Company 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')) { - $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; } } + // 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 -$conf->db->pass=''; // This is to avoid password to be shown in memory/swap dump +//unset($dolibarr_main_db_pass); // We comment this because this constant is used in a lot of pages +unset($conf->db->pass); // This is to avoid password to be shown in memory/swap dump /* * Creation objet $user @@ -126,36 +125,34 @@ if (! defined('NOREQUIREUSER')) if (! defined('NOREQUIREDB')) { // 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"]; } - 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"]; } - 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(); $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"); - $lastuser = ''; $lastentity = ''; - $entityCookie = new DolCookie($conf->file->cookie_cryptkey); $cookieValue = $entityCookie->_getCookie($entityCookieName); list($lastuser, $lastentity) = explode('|', $cookieValue); $conf->entity = $lastentity; } } - + //print "Will work with data into entity instance number '".$conf->entity."'"; // Here we read database (llx_const table) and define $conf->global->XXX var. diff --git a/htdocs/paypal/lib/paypal.lib.php b/htdocs/paypal/lib/paypal.lib.php index fe7d05f877f..0797bbb78d8 100755 --- a/htdocs/paypal/lib/paypal.lib.php +++ b/htdocs/paypal/lib/paypal.lib.php @@ -155,6 +155,8 @@ function paypaladmin_prepare_head() $head[$h][2] = 'paypalaccount'; $h++; + $object=(object) array(); + // Show more tabs from modules // 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 diff --git a/htdocs/product/canvas/product/actions_card_product.class.php b/htdocs/product/canvas/product/actions_card_product.class.php index 675285fe2c0..57dd51a10a6 100755 --- a/htdocs/product/canvas/product/actions_card_product.class.php +++ b/htdocs/product/canvas/product/actions_card_product.class.php @@ -303,7 +303,7 @@ class ActionsCardProduct extends Product } else { - dol_print_error($db,$sql); + dol_print_error($this->db,$sql); } } @@ -441,7 +441,7 @@ class ActionsCardProduct extends Product } else { - dol_print_error($db); + dol_print_error($this->db); } } diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 3d200fef7e4..8192b4bb9e6 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -144,14 +144,13 @@ class Product extends CommonObject /** * Constructor * - * @param DoliDB $DB Database handler + * @param DoliDB $db Database handler */ - function Product($DB) + function Product($db) { global $langs; - $this->db = $DB; - $this->id = $id ; + $this->db = $db; $this->status = 0; $this->status_buy = 0; $this->nbphoto = 0; @@ -403,6 +402,8 @@ class Product extends CommonObject { global $langs, $conf; + $error=0; + // Verification parametres if (! $this->libelle) $this->libelle = 'MISSING LABEL'; @@ -881,7 +882,6 @@ class Product extends CommonObject dol_syslog("Product:get_buyprice ".$this->error, LOG_ERR); return -2; } - return $result; } @@ -2555,11 +2555,12 @@ class Product extends CommonObject * @param nbbyrow Nombre vignettes par ligne (si mode vignette) * @param showfilename 1=Show filename * @param showaction 1=Show icon with action links (resize, delete) - * @param maxheight Max height of image when size=1 + * @param maxHeight Max height of image when size=1 + * @param maxWidth Max width of image when size=1 * @return string Html code to show photo. Number of photos shown is saved in this->nbphoto * TODO Move this into html.formproduct.class.php */ - function show_photos($sdir,$size=0,$nbmax=0,$nbbyrow=5,$showfilename=0,$showaction=0,$maxheight=120) + function show_photos($sdir,$size=0,$nbmax=0,$nbbyrow=5,$showfilename=0,$showaction=0,$maxHeight=120,$maxWidth=160) { global $conf,$user,$langs; @@ -2629,17 +2630,17 @@ class Product extends CommonObject $return.= "\n"; $return.= ''; - // Show image (width height=$maxheight) + // Show image (width height=$maxHeight) // Si fichier vignette disponible et image source trop grande, on utilise la vignette, sinon on utilise photo origine $alt=$langs->transnoentitiesnoconv('File').': '.$pdir.$photo; $alt.=' - '.$langs->transnoentitiesnoconv('Size').': '.$imgarray['width'].'x'.$imgarray['height']; - if ($photo_vignette && $imgarray['height'] > $maxheight) { + if ($photo_vignette && $imgarray['height'] > $maxHeight) { $return.= ''; - $return.= ''; + $return.= ''; } else { $return.= ''; - $return.= ''; + $return.= ''; } $return.= ''."\n"; diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index c516101295b..5eb8a997094 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -258,7 +258,7 @@ class Entrepot extends CommonObject } else { - dol_print_error($db); + dol_print_error($this->db); } $this->pays=$objp->libelle; $this->pays_code=$objp->code; diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index d96539e311e..8dd66a154c1 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -58,7 +58,7 @@ class MouvementStock */ function _create($user, $fk_product, $entrepot_id, $qty, $type, $price=0, $label='') { - global $conf; + global $conf, $langs; $error = 0; dol_syslog("MouvementStock::_create start userid=$user->id, fk_product=$fk_product, warehouse=$entrepot_id, qty=$qty, type=$type, price=$price label=$label"); diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index bd3132a322c..94e75a45637 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -74,7 +74,7 @@ class Project extends CommonObject */ function create($user, $notrigger=0) { - global $conf; + global $conf, $langs; $error = 0; $ret = 0; @@ -170,7 +170,9 @@ class Project extends CommonObject function update($user, $notrigger=0) { global $langs, $conf; - + + $error=0; + // Clean parameters $this->title = trim($this->title); $this->description = trim($this->description); @@ -496,6 +498,8 @@ class Project extends CommonObject { global $langs, $conf; + $error=0; + if ($this->statut != 1) { $this->db->begin(); @@ -553,6 +557,8 @@ class Project extends CommonObject { global $langs, $conf; + $error=0; + if ($this->statut != 2) { $this->db->begin(); diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 462edcb1f25..317b9cab694 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -381,6 +381,7 @@ class Task extends CommonObject */ function hasChildren() { + $error=0; $ret=0; $sql = "SELECT COUNT(*) as nb"; @@ -664,6 +665,7 @@ class Task extends CommonObject { global $conf,$langs; + $error=0; $ret = 0; // Clean parameters @@ -781,6 +783,9 @@ class Task extends CommonObject */ function updateTimeSpent($user, $notrigger=0) { + global $conf,$langs; + + $error=0; $ret = 0; // Clean parameters diff --git a/htdocs/projet/ganttchart.php b/htdocs/projet/ganttchart.php index 4bd08f83c04..586fbf3518c 100644 --- a/htdocs/projet/ganttchart.php +++ b/htdocs/projet/ganttchart.php @@ -149,7 +149,7 @@ function constructGanttLine($tarr,$task,$project_dependencies,$level=0,$project_ $name=$task['task_name']; for($i=0; $i < $level; $i++) { $name='     '.$name; } // Add line to gantt - $s = "// Add taks id=".$tasks["task_id"]." level = ".$level."\n"; + $s = "// Add taks id=".$task["task_id"]." level = ".$level."\n"; //$s.= "g.AddElementItem(new JSGantt.ElementItem('task',".$task['task_id'].",'".$name."','".$start_date."', '".$end_date."', '".$task['task_color']."', '', ".$task['task_milestone'].", '".$resources."', ".$percent.", ".($task["task_is_group"]>0?1:0).", ".$parent.", 1".($depend?", ".$depend:"")."));"; $s = "g.AddTaskItem(new JSGantt.TaskItem(".$task['task_id'].",'".$name."','".$start_date."', '".$end_date."', '".$task['task_color']."', '".$link."', ".$task['task_milestone'].", '".$resources."', ".$percent.", ".($task["task_is_group"]>0?1:0).", '".$parent."', 1, '".($depend?$depend:"")."'));"; echo $s."\n"; diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 8c6f5898a49..d60cd2fab74 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -132,6 +132,8 @@ if ($_POST["action"] == 'createtask' && $user->rights->projet->creer) $form=new Form($db); $formother=new FormOther($db); +$projectstatic = new Project($db); +$taskstatic = new Task($db); $help_url="EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos"; llxHeader("",$langs->trans("Tasks"),$help_url); diff --git a/htdocs/public/members/public_card.php b/htdocs/public/members/public_card.php index 284b67825e5..b0ae5a8832b 100644 --- a/htdocs/public/members/public_card.php +++ b/htdocs/public/members/public_card.php @@ -119,8 +119,8 @@ llxFooterVierge(); /** * Show header for card member * - * @param string $title - * @param string $head + * @param string $title Title + * @param string $head More info into header * @return void */ function llxHeaderVierge($title, $head = "") diff --git a/htdocs/public/members/public_list.php b/htdocs/public/members/public_list.php index cec6d3e1896..1cbc014ce59 100644 --- a/htdocs/public/members/public_list.php +++ b/htdocs/public/members/public_list.php @@ -41,8 +41,8 @@ $langs->load("other"); /** * Show header for member list * - * @param string $title - * @param string $head + * @param string $title Title + * @param string $head More info into header * @return void */ function llxHeaderVierge($title, $head = "") diff --git a/htdocs/public/paypal/newpayment.php b/htdocs/public/paypal/newpayment.php index 3a614385e0a..e098fbf43cc 100755 --- a/htdocs/public/paypal/newpayment.php +++ b/htdocs/public/paypal/newpayment.php @@ -218,25 +218,11 @@ if (GETPOST("action") == 'dopayment') dol_syslog("email: $email", LOG_DEBUG); dol_syslog("desc: $desc", LOG_DEBUG); - /*header("Content-type: text/html; charset=".$conf->file->character_set_client); - - print ''."\n"; - print ''."\n"; - print "\n"; - print ''."\n"; - print ''."\n"; - print "\n"; - */ - $_SESSION["Payment_Amount"]=$PAYPAL_API_PRICE; // A redirect is added if API call successfull print_paypal_redirect($PAYPAL_API_PRICE,$PAYPAL_API_DEVISE,$PAYPAL_PAYMENT_TYPE,$PAYPAL_API_OK,$PAYPAL_API_KO, $FULLTAG); - /*print ''."\n"; - print "\n"; - */ - exit; } } diff --git a/htdocs/societe/canvas/actions_card_common.class.php b/htdocs/societe/canvas/actions_card_common.class.php index accc3365c6f..ff9430a0136 100644 --- a/htdocs/societe/canvas/actions_card_common.class.php +++ b/htdocs/societe/canvas/actions_card_common.class.php @@ -546,7 +546,7 @@ abstract class ActionsCardCommon { $head = societe_prepare_head($this->object); - $this->tpl['showhead']=dol_get_fiche_head($head, 'card', $title, 0, 'company'); + $this->tpl['showhead']=dol_get_fiche_head($head, 'card', '', 0, 'company'); $this->tpl['showend']=dol_get_fiche_end(); $this->tpl['showrefnav'] = $form->showrefnav($this->object,'socid','',($user->societe_id?0:1),'rowid','nom'); @@ -595,7 +595,7 @@ abstract class ActionsCardCommon } else if ($nbofsalesrepresentative > 0) { - $userstatic=new User($db); + $userstatic=new User($this->db); $i=0; foreach($listsalesrepresentatives as $val) { diff --git a/htdocs/societe/canvas/company/actions_card_company.class.php b/htdocs/societe/canvas/company/actions_card_company.class.php index 1238894b885..5f581d3b69b 100644 --- a/htdocs/societe/canvas/company/actions_card_company.class.php +++ b/htdocs/societe/canvas/company/actions_card_company.class.php @@ -75,8 +75,9 @@ class ActionsCardCompany extends ActionsCardCommon /** * Execute actions * - * @param int $socid Id of object (may be empty for creation) - * @return int <0 if KO, >0 if OK + * @param string &$action Type of action + * @param int $id Id of object + * @return int <0 if KO, >0 if OK */ function doActions(&$action, $id) { diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 3d1b5ac9f70..f154a18d0cf 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -175,6 +175,8 @@ class Societe extends CommonObject { global $langs,$conf; + $error=0; + // Clean parameters if (empty($this->status)) $this->status=0; $this->name=$this->name?trim($this->name):trim($this->nom); @@ -373,9 +375,10 @@ class Societe extends CommonObject */ function update($id, $user='', $call_trigger=1, $allowmodcodeclient=0, $allowmodcodefournisseur=0, $action='update') { + global $langs,$conf; require_once(DOL_DOCUMENT_ROOT."/core/lib/functions2.lib.php"); - global $langs,$conf; + $error=0; dol_syslog("Societe::Update id=".$id." call_trigger=".$call_trigger." allowmodcodeclient=".$allowmodcodeclient." allowmodcodefournisseur=".$allowmodcodefournisseur); @@ -544,7 +547,7 @@ class Societe extends CommonObject include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'); $hookmanager=new HookManager($this->db); $hookmanager->callHooks(array('thirdpartydao')); - $parameters=array('socid'=>$socid); + $parameters=array('socid'=>$this->id); $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks if (empty($reshook)) { @@ -2352,34 +2355,9 @@ class Societe extends CommonObject } - /** - * Add a line in log table to save status change. - * - * @param $id_status - */ - function set_status($id_status) - { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_log (datel, fk_soc, fk_statut, fk_user, author, label)"; - $sql.= " VALUES ('".$dateaction."', ".$socid.", ".$id_status.","; - $sql.= "'".$user->id."',"; - $sql.= "'".$this->db->escape($user->login)."',"; - $sql.= "'Change statut from ".$oldstcomm." to ".$stcommid."'"; - $sql.= ")"; - $result = $thi->db->query($sql); - if ($result) - { - $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm = ".$stcommid." WHERE rowid=".$socid; - $result = $this->db->query($sql); - } - else - { - $errmesg = $this->db->lasterror(); - } - } - - /** * Create a third party into database from a member object + * * @param member Object member * @param socname Name of third party to force * @return int <0 if KO, id of created account if OK diff --git a/htdocs/support/inc.php b/htdocs/support/inc.php index 7a372fd8ab8..cac281581ce 100644 --- a/htdocs/support/inc.php +++ b/htdocs/support/inc.php @@ -193,7 +193,6 @@ function conf($dolibarr_main_document_root) $conf->db->user = trim($dolibarr_main_db_user); $conf->db->pass = trim($dolibarr_main_db_pass); - if (empty($conf->file->character_set_client)) $conf->file->character_set_client="UTF-8"; if (empty($conf->db->dolibarr_main_db_collation)) $conf->db->dolibarr_main_db_collation='latin1_swedish_ci'; return 1; @@ -201,7 +200,12 @@ function conf($dolibarr_main_document_root) /** - * \brief Show HTML header + * Show HTML header + * + * @param string $soutitre Title + * @param string $next Next + * @param string $action Action + * @return void */ function pHeader($soutitre,$next,$action='none') { diff --git a/htdocs/theme/bureau2crea/graph-color.php b/htdocs/theme/bureau2crea/graph-color.php index a34e6c1735e..5870778f5ce 100644 --- a/htdocs/theme/bureau2crea/graph-color.php +++ b/htdocs/theme/bureau2crea/graph-color.php @@ -27,6 +27,6 @@ global $theme_bordercolor, $theme_datacolor, $theme_bgcolor, $theme_bgcolorongle $theme_bordercolor = array(235,235,224); $theme_datacolor = array(array(120,130,150), array(200,160,180), array(190,190,220)); $theme_bgcolor = array(hexdec('F4'),hexdec('F4'),hexdec('F4')); -$theme_bgcoloronglet = array(hexdec('DE'),hexdec('E7'),hexdec('EC')); +$theme_bgcoloronglet = array(hexdec('FF'),hexdec('FF'),hexdec('FF')); ?> diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 173608c820e..c866085e50c 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -654,6 +654,8 @@ class User extends CommonObject { global $user,$conf,$langs; + $error=0; + $this->db->begin(); $this->fetch($this->id); @@ -845,6 +847,8 @@ class User extends CommonObject { global $conf,$user,$langs; + $error=0; + // Positionne parametres $this->admin = 0; $this->nom = $contact->nom; // TODO deprecated @@ -1358,7 +1362,8 @@ class User extends CommonObject function send_password($user, $password='', $changelater=0) { global $conf,$langs; - + global $dolibarr_main_url_root; + require_once DOL_DOCUMENT_ROOT."/core/class/CMailFile.class.php"; $subject = $langs->trans("SubjectNewPassword"); diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index 0bf7953545e..653a28411c3 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -480,6 +480,8 @@ class UserGroup extends CommonObject { global $user,$conf,$langs; + $error=0; + $this->db->begin(); $sql = "DELETE FROM ".MAIN_DB_PREFIX."usergroup_rights"; @@ -523,6 +525,7 @@ class UserGroup extends CommonObject { global $user, $conf, $langs; + $error=0; $now=dol_now(); $entity=$conf->entity; diff --git a/scripts/invoices/email_unpaid_invoices_to_representatives.php b/scripts/invoices/email_unpaid_invoices_to_representatives.php index 2fe69d8055b..ea7ad071599 100644 --- a/scripts/invoices/email_unpaid_invoices_to_representatives.php +++ b/scripts/invoices/email_unpaid_invoices_to_representatives.php @@ -124,6 +124,7 @@ function envoi_mail($oldemail,$message,$total) $subject = "[Dolibarr] List of unpaid invoices"; $sendto = $oldemail; $from = $conf->global->MAIN_EMAIL_FROM; + $errorsto = $conf->global->MAIN_MAIL_ERRORS_TO; $msgishtml = 0; print "Envoi mail pour $oldemail, total: $total\n"; diff --git a/test/phpunit/CategorieTest.php b/test/phpunit/CategorieTest.php index 190afe1e2fb..52263f47341 100755 --- a/test/phpunit/CategorieTest.php +++ b/test/phpunit/CategorieTest.php @@ -245,12 +245,12 @@ class CategorieTest extends PHPUnit_Framework_TestCase $localobject2->initAsSpecimen(); $retarray=$localobject->liste_photos('/'); - print __METHOD__." retarry size=".count($rearray)."\n"; + print __METHOD__." retarray size=".count($retarray)."\n"; $this->assertTrue(is_array($retarray)); - $ret=$localobject->is_fille($localobject2); - print __METHOD__." retarry size=".count($rearray)."\n"; - $this->assertFalse($ret); + $retarray=$localobject->is_fille($localobject2); + print __METHOD__." retarry size=".count($retarray)."\n"; + $this->assertFalse($retarray); return $localobject->id; } @@ -292,7 +292,7 @@ class CategorieTest extends PHPUnit_Framework_TestCase print __METHOD__." retarray size=".count($retarray)."\n"; $this->assertTrue(is_array($retarray)); - return $result; + return $retarray; } } diff --git a/test/phpunit/SecurityTest.php b/test/phpunit/SecurityTest.php index bf4b5c85775..e961816e612 100755 --- a/test/phpunit/SecurityTest.php +++ b/test/phpunit/SecurityTest.php @@ -187,7 +187,7 @@ class SecurityTest extends PHPUnit_Framework_TestCase print __METHOD__." encodedstring=".$encodedstring." ".base64_encode($stringtotest)."\n"; $this->assertEquals($stringtotest,$decodedstring); - return $result; + return 0; } /** @@ -210,7 +210,7 @@ class SecurityTest extends PHPUnit_Framework_TestCase print __METHOD__." genpass3=".$genpass3."\n"; $this->assertEquals(strlen($genpass3),8); - return $result; + return 0; } } ?> \ No newline at end of file
'."\n"; - print '
'; - print "\n\n"; print '
'."\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; foreach ($boxarray as $key => $box) { @@ -62,7 +64,7 @@ function printBoxesArea($user,$areacode) //print 'box_id '.$boxarray[$ii]->box_id.' '; //print 'box_order '.$boxarray[$ii]->box_order.'
'; // Affichage boite key - $box->loadBox($conf->box_max_lines); + $box->loadBox($box_max_lines); $box->showBox(); } } @@ -90,7 +92,7 @@ function printBoxesArea($user,$areacode) //print 'box_id '.$boxarray[$ii]->box_id.' '; //print 'box_order '.$boxarray[$ii]->box_order.'
'; // Affichage boite key - $box->loadBox($conf->box_max_lines); + $box->loadBox($box_max_lines); $box->showBox(); } } diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index ab58b71972c..2985e4651e0 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -121,15 +121,18 @@ class Categorie /** * Add category into database * - * @return int -1 : erreur SQL - * -2 : nouvel ID inconnu - * -3 : categorie invalide + * @param User $user Object user + * @return int -1 : erreur SQL + * -2 : nouvel ID inconnu + * -3 : categorie invalide */ - function create() + function create($user='') { global $conf,$langs; $langs->load('categories'); + $error=0; + // Clean parameters if (empty($this->visible)) $this->visible=0; $this->parentId = ($this->id_mere) != "" ? intval($this->id_mere) : 0; @@ -201,14 +204,17 @@ class Categorie /** * Update category * - * @return int 1 : OK - * -1 : SQL error - * -2 : invalid category + * @param User $user Object user + * @return int 1 : OK + * -1 : SQL error + * -2 : invalid category */ - function update() + function update($user='') { global $conf, $langs; + $error=0; + // Clean parameters $this->label=trim($this->label); $this->description=trim($this->description); @@ -879,12 +885,12 @@ class Categorie $sql.= " AND c.label='".$this->db->escape($this->label)."'"; } dol_syslog("Categorie::already_exists sql=".$sql); - $res = $this->db->query($sql); - if ($res) + $resql = $this->db->query($sql); + 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 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, diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 6450eab568f..82057f92f64 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -381,7 +381,6 @@ class Propal extends CommonObject $this->line->subprice=$pu_ht; $this->line->rang=$rangtouse; $this->line->info_bits=$info_bits; - $this->line->fk_remise_except=$fk_remise_except; $this->line->total_ht=$total_ht; $this->line->total_tva=$total_tva; $this->line->total_localtax1=$total_localtax1; @@ -1149,6 +1148,7 @@ class Propal extends CommonObject { global $conf,$langs; + $error=0; $now=dol_now(); if ($user->rights->propale->valider) @@ -1477,7 +1477,8 @@ class Propal extends CommonObject global $langs,$conf; $this->statut = $statut; - + $error=0; + $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."propal"; @@ -2536,13 +2537,17 @@ class PropaleLigne } /** - * \brief Insert object line propal in database - * \return int <0 if KO, >0 if OK + * Insert object line propal in database + * + * @param int $notrigger 1=no trigger ran + * @return int <0 if KO, >0 if OK */ function insert($notrigger=0) { global $conf,$langs,$user; + $error=0; + dol_syslog("PropaleLigne::insert rang=".$this->rang); // Clean parameters @@ -2599,8 +2604,6 @@ class PropaleLigne $resql=$this->db->query($sql); if ($resql) { - $this->rang=$rangmax; - $this->rowid=$this->db->last_insert_id(MAIN_DB_PREFIX.'propaldet'); if (! $notrigger) { @@ -2632,6 +2635,7 @@ class PropaleLigne { global $conf,$langs,$user; + $error=0; $this->db->begin(); $sql = "DELETE FROM ".MAIN_DB_PREFIX."propaldet WHERE rowid = ".$this->rowid; @@ -2667,6 +2671,8 @@ class PropaleLigne { global $conf,$langs,$user; + $error=0; + // Clean parameters if (empty($this->tva_tx)) $this->tva_tx=0; if (empty($this->localtax1_tx)) $this->localtax1_tx=0; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 4734a881ed0..2e663f1fe4d 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -99,15 +99,13 @@ class Commande extends CommonObject /** * Constructor * - * @param DoliDB $DB Database handler + * @param DoliDB $db Database handler */ - function Commande($DB) + function Commande($db) { global $langs; $langs->load('orders'); - $this->db = $DB; - $this->socid = $socid; - $this->id = $commandeid; + $this->db = $db; $this->remise = 0; $this->remise_percent = 0; @@ -447,9 +445,10 @@ class Commande extends CommonObject } /** - * Close order - * @param user Objet user that close - * @return int <0 if KO, >0 if OK + * Close order + * + * @param user Objet user that close + * @return int <0 if KO, >0 if OK */ function cloture($user) { @@ -501,13 +500,15 @@ class Commande extends CommonObject } /** - * \brief Cancel an order - * \return int <0 if KO, >0 if OK - * \remarks If stock is decremented on order validation, we must reincrement it + * Cancel an order + * 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; @@ -526,17 +527,20 @@ class Commande extends CommonObject // If stock is decremented on validate order, we must reincrement it if ($conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER == 1) { - require_once(DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php"); - $langs->load("agenda"); - - if ($this->lines[$i]->fk_product > 0) - { - $mouvP = new MouvementStock($this->db); - // We increment stock of product (and sub-products) - $entrepot_id = "1"; //Todo: ajouter possibilite de choisir l'entrepot - $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $entrepot_id, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("OrderCanceledInDolibarr",$this->ref)); - if ($result < 0) { $error++; } - } + require_once(DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php"); + $langs->load("agenda"); + + $num=count($this->lines); + for ($i = 0; $i < $num; $i++) + { + if ($this->lines[$i]->fk_product > 0) + { + $mouvP = new MouvementStock($this->db); + // 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) @@ -604,7 +608,6 @@ class Commande extends CommonObject dol_syslog("Commande::create ".$this->error, LOG_ERR); return -1; } - if (! $remise) $remise=0; if (! $this->fk_project) $this->fk_project = 0; // $date_commande is deprecated @@ -1299,14 +1302,14 @@ class Commande extends CommonObject } else { - dol_syslog('Commande::Fetch Error rowid='.$rowid.' numrows=0 sql='.$sql); - $this->error='Order with id '.$rowid.' not found sql='.$sql; + dol_syslog('Commande::Fetch Error rowid='.$id.' numrows=0 sql='.$sql); + $this->error='Order with id '.$id.' not found sql='.$sql; return -2; } } 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(); return -1; } @@ -2194,8 +2197,8 @@ class Commande extends CommonObject $qty=price2num($qty); $pu = price2num($pu); $txtva=price2num($txtva); - $txlocaltax1=price2num($txtlocaltax1); - $txlocaltax2=price2num($txtlocaltax2); + $txlocaltax1=price2num($txlocaltax1); + $txlocaltax2=price2num($txlocaltax2); // Calcul du total TTC et de la TVA pour la ligne a partir de // qty, pu, remise_percent et txtva @@ -2287,15 +2290,16 @@ class Commande extends CommonObject /** * 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) { global $conf, $langs; require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"); - $err = 0; + $error = 0; $this->db->begin(); @@ -2305,7 +2309,7 @@ class Commande extends CommonObject if (! $this->db->query($sql) ) { dol_syslog("CustomerOrder::delete error", LOG_ERR); - $err++; + $error++; } // Delete order @@ -2314,7 +2318,7 @@ class Commande extends CommonObject if (! $this->db->query($sql) ) { dol_syslog("CustomerOrder::delete error", LOG_ERR); - $err++; + $error++; } // Delete linked object @@ -2326,7 +2330,7 @@ class Commande extends CommonObject if (! $this->db->query($sql) ) { dol_syslog("CustomerOrder::delete error", LOG_ERR); - $err++; + $error++; } // Delete linked contacts @@ -2334,7 +2338,7 @@ class Commande extends CommonObject if ($res < 0) { dol_syslog("CustomerOrder::delete error", LOG_ERR); - $err++; + $error++; } // On efface le repertoire de pdf provisoire @@ -2365,7 +2369,7 @@ class Commande extends CommonObject } } - if ($err == 0) + if ($error == 0) { // Appel des triggers 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) + * * @param user Objet user * @return int <0 if KO, >0 if OK */ @@ -2935,6 +2940,8 @@ class OrderLine { global $conf, $user, $langs; + $error=0; + $sql = 'DELETE FROM '.MAIN_DB_PREFIX."commandedet WHERE rowid='".$this->rowid."';"; dol_syslog("OrderLine::delete sql=".$sql); @@ -2968,6 +2975,8 @@ class OrderLine { global $langs, $conf, $user; + $error=0; + dol_syslog("OrderLine::insert rang=".$this->rang); // Clean parameters @@ -3065,6 +3074,8 @@ class OrderLine { global $conf,$langs,$user; + $error=0; + // Clean parameters if (empty($this->tva_tx)) $this->tva_tx=0; if (empty($this->localtax1_tx)) $this->localtax1_tx=0; diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 602da307cc0..b27e00bc39e 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -864,7 +864,6 @@ class Account extends CommonObject { $this->nbtodo++; if ($this->db->jdate($obj->datefin) < ($now - $conf->bank->rappro->warning_delay)) $this->nbtodolate++; - if ($obj->rappro) $foundaccounttoconciliate++; } return $num; } diff --git a/htdocs/compta/bank/graph.php b/htdocs/compta/bank/graph.php index df4f4f951c9..496c1605cf7 100644 --- a/htdocs/compta/bank/graph.php +++ b/htdocs/compta/bank/graph.php @@ -54,11 +54,7 @@ llxHeader(); $form = new Form($db); -// If lib forced -if (! empty($_GET["lib"])) $conf->global->MAIN_GRAPH_LIBRARY=$_GET["lib"]; - - -$datetime = time(); +$datetime = dol_now(); $year = dol_print_date($datetime, "%Y"); $month = dol_print_date($datetime, "%m"); $day = dol_print_date($datetime, "%d"); diff --git a/htdocs/compta/dons/class/don.class.php b/htdocs/compta/dons/class/don.class.php index c8e088cc128..f3dc9eee4cf 100644 --- a/htdocs/compta/dons/class/don.class.php +++ b/htdocs/compta/dons/class/don.class.php @@ -182,8 +182,8 @@ class Don extends CommonObject $this->specimen=1; $this->nom = 'Doe'; $this->prenom = 'John'; - $this->socid = $socids[$socid]; - $this->date = time(); + $this->socid = 1; + $this->date = dol_now(); $this->amount = 100; $this->public = 1; $this->societe = 'The Company'; diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 0ac3b4da79b..c39b3b2e959 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -190,9 +190,10 @@ class FactureRec extends Facture /** - * \brief 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 + * Recupere l'objet facture et ses lignes de factures + * + * @param int $rowid Id de la facture a recuperer + * @return int >0 si ok, <0 si ko */ 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.= ' 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); 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) { @@ -420,7 +423,6 @@ class FactureRec extends Facture $remise_percent=price2num($remise_percent); $qty=price2num($qty); if (! $qty) $qty=1; - if (! $ventil) $ventil=0; if (! $info_bits) $info_bits=0; $pu_ht=price2num($pu_ht); $pu_ttc=price2num($pu_ttc); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 3986a5d8a78..6b8715bd1a1 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1395,6 +1395,8 @@ class Facture extends CommonObject { global $conf,$langs; + $error=0; + dol_syslog(get_class($this)."::set_canceled rowid=".$this->id, LOG_DEBUG); $this->db->begin(); @@ -1515,7 +1517,7 @@ class Facture extends CommonObject $result=$facreplaced->set_canceled($user,'replaced',''); if ($result < 0) { - $this->error=$facreplaced->error." sql=".$sql; + $this->error=$facreplaced->error; $this->db->rollback(); return -13; } @@ -3420,6 +3422,8 @@ class FactureLigne { global $langs,$user,$conf; + $error=0; + dol_syslog(get_class($this)."::Insert rang=".$this->rang, LOG_DEBUG); // Clean parameters @@ -3562,12 +3566,16 @@ class FactureLigne /** * 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; + $error=0; + // Clean parameters $this->desc=trim($this->desc); if (empty($this->tva_tx)) $this->tva_tx=0; @@ -3651,6 +3659,8 @@ class FactureLigne { global $conf,$langs,$user; + $error=0; + $this->db->begin(); $sql = "DELETE FROM ".MAIN_DB_PREFIX."facturedet WHERE rowid = ".$this->rowid; diff --git a/htdocs/compta/localtax/class/localtax.class.php b/htdocs/compta/localtax/class/localtax.class.php index 4e0c70f07fa..97683e912b8 100644 --- a/htdocs/compta/localtax/class/localtax.class.php +++ b/htdocs/compta/localtax/class/localtax.class.php @@ -63,6 +63,8 @@ class localtax extends CommonObject { global $conf, $langs; + $error=0; + // Clean parameters $this->amount=trim($this->amount); $this->label=trim($this->label); @@ -128,6 +130,8 @@ class localtax extends CommonObject { global $conf, $langs; + $error=0; + // Clean parameters $this->amount=trim($this->amount); $this->label=trim($this->label); @@ -245,6 +249,8 @@ class localtax extends CommonObject { global $conf, $langs; + $error=0; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."localtax"; $sql.= " WHERE rowid=".$this->id; @@ -493,7 +499,7 @@ class localtax extends CommonObject $acc = new Account($this->db); $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); diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index 0a1fbb8c9f0..f031189d25c 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -471,6 +471,7 @@ class RemiseCheque extends CommonObject /** * Build document + * * @param model Model name * @param outputlangs Object langs * @return int <0 if KO, >0 if OK @@ -493,7 +494,7 @@ class RemiseCheque extends CommonObject require_once($dir.$file); $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.= " 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); if ($result > 0) { - $outputlangs->charset_output=$sav_charset_output; + //$outputlangs->charset_output=$sav_charset_output; return 1; } else { - $outputlangs->charset_output=$sav_charset_output; + //$outputlangs->charset_output=$sav_charset_output; dol_syslog("Error"); - dol_print_error($db,$docmodel->error); + dol_print_error($this->db,$docmodel->error); return 0; } } diff --git a/htdocs/compta/prelevement/class/bon-prelevement.class.php b/htdocs/compta/prelevement/class/bon-prelevement.class.php index 8176aa153f9..a7275205caf 100644 --- a/htdocs/compta/prelevement/class/bon-prelevement.class.php +++ b/htdocs/compta/prelevement/class/bon-prelevement.class.php @@ -320,7 +320,7 @@ class BonPrelevement extends CommonObject { global $user,$conf; - $error == 0; + $error = 0; if ($this->db->begin()) { @@ -401,7 +401,7 @@ class BonPrelevement extends CommonObject { global $conf,$langs; - $error == 0; + $error = 0; if ($this->_fetched == 1) { @@ -525,7 +525,8 @@ class BonPrelevement extends CommonObject { global $conf,$langs; - $error == 0; + $error = 0; + dol_syslog("bon-prelevement::set_infotrans Start",LOG_INFO); if ($this->db->begin()) { diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php index 98b494120a2..8dc51a45b4e 100644 --- a/htdocs/compta/tva/class/tva.class.php +++ b/htdocs/compta/tva/class/tva.class.php @@ -74,8 +74,9 @@ class Tva extends CommonObject { global $conf, $langs; + $error=0; + // Clean parameters - $this->amount=trim($this->amount); $this->label=trim($this->label); $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_modif=trim($this->fk_user_modif); - - // Check parameters // Put here code to add control on parameters values // Insert request $sql = "INSERT INTO ".MAIN_DB_PREFIX."tva("; - $sql.= "tms,"; $sql.= "datep,"; $sql.= "datev,"; @@ -148,8 +146,9 @@ class Tva extends CommonObject { global $conf, $langs; + $error=0; + // Clean parameters - $this->amount=trim($this->amount); $this->label=trim($this->label); $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_modif=trim($this->fk_user_modif); - - // Check parameters // Put here code to add control on parameters values @@ -275,6 +272,8 @@ class Tva extends CommonObject { global $conf, $langs; + $error=0; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."tva"; $sql.= " WHERE rowid=".$this->id; @@ -522,7 +521,7 @@ class Tva extends CommonObject $acc = new Account($this->db); $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); diff --git a/htdocs/contact/canvas/actions_contactcard_common.class.php b/htdocs/contact/canvas/actions_contactcard_common.class.php index f65a6a500c0..f456f31b5a8 100644 --- a/htdocs/contact/canvas/actions_contactcard_common.class.php +++ b/htdocs/contact/canvas/actions_contactcard_common.class.php @@ -92,10 +92,11 @@ abstract class ActionsContactCardCommon /** * Load data control * - * @param int $id Id of object + * @param string &$action Type of action + * @param int $id Id of object * @return void */ - function doActions(&$action) + function doActions(&$action, $id) { global $conf, $user, $langs; @@ -397,11 +398,7 @@ abstract class ActionsContactCardCommon include_once(DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'); $login=dol_buildlogin($this->object->nom, $this->object->prenom); - $generated_password=''; - if (! $ldap_sid) - { - $generated_password=getRandomPassword(''); - } + $generated_password=getRandomPassword(''); $password=$generated_password; // Create a form array diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index bb0e08de0fe..c37c500828f 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -867,13 +867,13 @@ class Contact extends CommonObject $code=$this->civilite_id; return $langs->trans("Civility".$code)!="Civility".$code ? $langs->trans("Civility".$code) : ''; - if (empty($ret)) + /*if (empty($ret)) { $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', } - return $ret; + return $ret;*/ } diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 9f58f2b2d81..3466e665f06 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -145,6 +145,8 @@ class Contrat extends CommonObject { global $langs,$conf; + $error=0; + $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."contratdet SET statut = 4,"; @@ -191,6 +193,8 @@ class Contrat extends CommonObject { global $langs,$conf; + $error=0; + // statut actif : 4 $this->db->begin(); @@ -225,11 +229,12 @@ class Contrat extends CommonObject /** - * \brief Close all lines of a contract - * \param user Object User making action - * \param langs Object Lang - * \param conf Object Conf - * + * Close all lines of a contract + * + * @param user Object User making action + * @param langs Object Lang + * @param conf Object Conf + * @return void */ function cloture($user,$langs='',$conf='') { @@ -268,7 +273,7 @@ class Contrat extends CommonObject } else { - dol_print_error($db,'Error in cloture function'); + dol_print_error($this->db,'Error in cloture function'); $this->db->rollback(); } } @@ -282,6 +287,8 @@ class Contrat extends CommonObject */ function validate($user,$langs,$conf) { + $error=0; + $sql = "UPDATE ".MAIN_DB_PREFIX."contrat SET statut = 1"; $sql .= " WHERE rowid = ".$this->id . " AND statut = 0"; @@ -835,7 +842,6 @@ class Contrat extends CommonObject $remise_percent=price2num($remise_percent); $qty=price2num($qty); if (! $qty) $qty=1; - if (! $ventil) $ventil=0; if (! $info_bits) $info_bits=0; if (! $pu_ht) $pu_ht=0; if (! $pu_ttc) $pu_ttc=0; @@ -883,7 +889,7 @@ class Contrat extends CommonObject $sql.= " price_ht, remise"; // TODO A virer if ($date_start > 0) { $sql.= ",date_ouverture_prevue"; } 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.= " '".$qty."',"; $sql.= " '".$txtva."',"; @@ -1031,6 +1037,8 @@ class Contrat extends CommonObject { global $conf, $langs; + $error=0; + if ($this->statut >= 0) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."contratdet"; @@ -1105,9 +1113,9 @@ class Contrat extends CommonObject $langs->load("contracts"); if ($mode == 0) { - if ($statut == 0) { return $langs->trans("ContractStatusDraft").$text; } - if ($statut == 1) { return $langs->trans("ContractStatusValidated").$text; } - if ($statut == 2) { return $langs->trans("ContractStatusClosed").$text; } + if ($statut == 0) { return $langs->trans("ContractStatusDraft"); } + if ($statut == 1) { return $langs->trans("ContractStatusValidated"); } + if ($statut == 2) { return $langs->trans("ContractStatusClosed"); } } if ($mode == 1) { @@ -1762,6 +1770,8 @@ class ContratLigne { global $conf, $langs; + $error=0; + // Clean parameters $this->fk_contrat=trim($this->fk_contrat); $this->fk_product=trim($this->fk_product); diff --git a/htdocs/core/boxes/box_external_rss.php b/htdocs/core/boxes/box_external_rss.php index 9d4e59358b4..f61df2d8c4c 100644 --- a/htdocs/core/boxes/box_external_rss.php +++ b/htdocs/core/boxes/box_external_rss.php @@ -43,13 +43,15 @@ class box_external_rss extends ModeleBoxes { /** * Constructor + * + * @param DoliDB $db Database handler */ - function box_external_rss($DB,$param) + function box_external_rss($db,$param) { global $langs; $langs->load("boxes"); - $this->db=$DB; + $this->db=$db; $this->param=$param; $this->boxlabel=$langs->trans("BoxLastRssInfos"); @@ -80,7 +82,7 @@ class box_external_rss extends ModeleBoxes { // Get RSS feed $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); // INFO on channel diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 32b51c8dd21..6b3337c4625 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -500,7 +500,8 @@ class CMailFile 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') { diff --git a/htdocs/core/class/CSMSFile.class.php b/htdocs/core/class/CSMSFile.class.php index 658e09f2db3..4c0771ba7d8 100755 --- a/htdocs/core/class/CSMSFile.class.php +++ b/htdocs/core/class/CSMSFile.class.php @@ -198,7 +198,8 @@ class CSMSFile 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); @@ -218,7 +219,8 @@ class CSMSFile 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); diff --git a/htdocs/core/class/antivir.class.php b/htdocs/core/class/antivir.class.php index 8a43c28f8a4..e90c208d32e 100644 --- a/htdocs/core/class/antivir.class.php +++ b/htdocs/core/class/antivir.class.php @@ -68,7 +68,7 @@ class AntiVir $return_var=0; $safemode=ini_get("safe_mode"); // 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% $lastline=exec($fullcommand, $output, $return_var); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 476d683c68e..9af3ec03256 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -81,6 +81,8 @@ abstract class CommonObject { global $user,$conf,$langs; + $error=0; + dol_syslog(get_class($this)."::add_contact $fk_socpeople, $type_contact, $source"); // Check parameters @@ -200,6 +202,8 @@ abstract class CommonObject { global $user,$langs,$conf; + $error=0; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."element_contact"; $sql.= " WHERE rowid =".$rowid; @@ -348,7 +352,7 @@ abstract class CommonObject $sql.= " AND ec.fk_c_type_contact=tc.rowid"; $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); if ($resql) { @@ -2055,7 +2059,7 @@ abstract class CommonObject // Produit 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->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 { - $discount=new DiscountAbsolute($db); + $discount=new DiscountAbsolute($this->db); $discount->fk_soc = $this->socid; $this->tpl['label'].= $discount->getNomUrl(0,'discount'); } diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 242d140dbaf..bd254742731 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -34,41 +34,40 @@ class Conf { /** \public */ - //! Object with database handler - var $db; //! To store properties found in conf file var $file; + //! Object with database handler + var $db; //! To store properties found into database var $global; //! To store if javascript/ajax is enabked - var $use_javascript_ajax; + public $use_javascript_ajax; //! Used to store current currency - var $monnaie; + public $currency; //! Used to store current css (from theme) - var $theme; // Contains current theme ("eldy", "auguria", ...) - var $css; // Contains full path of css page ("/theme/eldy/style.css.php", ...) + public $theme; // Contains current theme ("eldy", "auguria", ...) + public $css; // Contains full path of css page ("/theme/eldy/style.css.php", ...) //! Used to store current menu handlers - var $top_menu; - var $smart_menu; + public $top_menu; + public $smart_menu; //! To store properties of multi-company - var $multicompany; - //! Used to store instance for multi-company (default 1) - var $entity=1; - - var $css_modules = array(); - var $tabs_modules = array(); - var $triggers_modules = array(); - var $hooks_modules = array(); - public $login_method_modules = array(); - var $modules = array(); - var $entities = array(); - - var $logbuffer = array(); - - var $filesystem_forbidden_chars = array('<','>',':','/','\\','?','*','|','"'); + public $multicompany; + //! Used to store running instance for multi-company (default 1) + public $entity=1; + //! Used to store list of entities to use for each element + public $entities = array(); + + public $modules = array(); // List of modules + public $css_modules = array(); + public $tabs_modules = array(); + public $triggers_modules = array('/core/triggers'); + public $hooks_modules = array(); + public $login_method_modules = array(); + + var $logbuffer = array(); /** @@ -98,10 +97,7 @@ class Conf */ function setValues($db) { - dol_syslog("Conf::setValues"); - - // Directory of core triggers - $this->triggers_modules[] = "/core/triggers"; // Default relative path to triggers file + dol_syslog(get_class($this)."::setValues"); // Avoid warning if not defined 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. - $result = $db->query($sql); - if ($result) + $resql = $db->query($sql); + if ($resql) { - $numr = $db->num_rows($result); $multicompany_sharing=array(); + $i = 0; - + $numr = $db->num_rows($resql); while ($i < $numr) { - $objp = $db->fetch_object($result); + $objp = $db->fetch_object($resql); $key=$objp->name; $value=$objp->value; 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; if ($value && preg_match('/^MAIN_MODULE_/',$key)) @@ -154,7 +150,6 @@ class Conf { $params=explode(':',$value,2); $this->tabs_modules[$params[0]][]=$value; - //print 'xxx'.$params[0].'-'.$value; } // If this is constant for triggers activated by a module elseif (preg_match('/^MAIN_MODULE_([A-Z_]+)_TRIGGERS$/i',$key,$reg)) @@ -207,7 +202,7 @@ class Conf } // 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'); if ($ret) @@ -221,7 +216,7 @@ class Conf } } } - $db->free($result); + $db->free($resql); //var_dump($this->modules); // Clean some variables @@ -259,15 +254,15 @@ class Conf $this->$module->dir_temp=$rootfordata."/".$module."/temp"; } - // For mycompany setup + // For mycompany storage $this->mycompany->dir_output=$rootfordata."/mycompany"; $this->mycompany->dir_temp=$rootfordata."/mycompany/temp"; - // For admin features + // For admin storage $this->admin->dir_output=$rootfordata.'/admin'; $this->admin->dir_temp=$rootfordata.'/admin/temp'; - // Module user + // For user storage $this->user->dir_output=$rootforuser."/users"; $this->user->dir_temp=$rootforuser."/users/temp"; @@ -291,17 +286,15 @@ class Conf $this->service->dir_temp =$rootfordata."/produit/temp"; // Module contrat $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 - 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_CODECOMPTA_ADDON)) $this->global->SOCIETE_CODECOMPTA_ADDON="mod_codecompta_panicum"; + 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_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_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->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 $this->use_javascript_ajax=1; 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 (! $this->use_javascript_ajax) - { - $this->global->PRODUIT_USE_SEARCH_TO_SELECT=0; - } + if (! $this->use_javascript_ajax) $this->global->PRODUIT_USE_SEARCH_TO_SELECT=0; // conf->currency if (empty($this->global->MAIN_MONNAIE)) $this->global->MAIN_MONNAIE='EUR'; $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' - // $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; $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; $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"; $this->theme=$this->global->MAIN_THEME; $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"; 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; 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; 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) $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 diff --git a/htdocs/core/class/discount.class.php b/htdocs/core/class/discount.class.php index a759be3df03..ff065db2bae 100644 --- a/htdocs/core/class/discount.class.php +++ b/htdocs/core/class/discount.class.php @@ -208,7 +208,7 @@ class DiscountAbsolute } else { - dol_print_error($db); + dol_print_error($this->db); return -1; } } diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php index 5f4b6708309..55209c975a5 100644 --- a/htdocs/core/class/doleditor.class.php +++ b/htdocs/core/class/doleditor.class.php @@ -139,14 +139,15 @@ class DolEditor * Output edit area inside the HTML stream. * 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) { global $conf; $found=0; - $out=''; + $out=''; if ($this->tool == 'fckeditor') { diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index 2ef8ec650c9..dfae7d72d17 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -66,15 +66,15 @@ class DolGraph var $Legend=array(); var $LegendWidthMin=0; - var $graph; // Objet Graph (Artichow, Phplot...) + var $graph; // Objet Graph (Artichow, Phplot...) var $error; - var $library=''; // Par defaut on utiliser PHPlot + var $library='artichow'; // Graphic library to use - var $bordercolor; // array(R,G,B) - var $bgcolor; // array(R,G,B) - var $bgcolorgrid; // array(R,G,B) - var $datacolor; // array(array(R,G,B),...) + var $bordercolor; // array(R,G,B) + var $bgcolor; // array(R,G,B) + var $bgcolorgrid; // array(R,G,B) + var $datacolor; // array(array(R,G,B),...) /** @@ -85,7 +85,6 @@ class DolGraph global $conf; global $theme_bordercolor, $theme_datacolor, $theme_bgcolor, $theme_bgcoloronglet; - // Test si module GD present $modules_list = get_loaded_extensions(); $isgdinstalled=0; @@ -99,15 +98,11 @@ class DolGraph return -1; } - - // Defini proprietes de l'objet graphe - $this->library=$conf->global->MAIN_GRAPH_LIBRARY; - $this->bordercolor = array(235,235,224); $this->datacolor = array(array(120,130,150), array(160,160,180), array(190,190,220)); $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)) { include_once($color_file); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index ed5615f79f9..7953349e9a8 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1036,7 +1036,7 @@ class Form if ($num) { $out.= ''; - if ($show_empty) $out.= ''."\n"; + if ($show_empty) $out.= ''."\n"; while ($i < $num) { diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 2b9e28c07a9..743c75284eb 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -358,7 +358,7 @@ class FormFile $headershown=1; - $form = new Form($db); + $form = new Form($this->db); $buttonlabeltoshow=$buttonlabel; if (empty($buttonlabel)) $buttonlabel=$langs->trans('Generate'); @@ -537,7 +537,7 @@ class FormFile { global $user, $conf, $langs; global $bc; - global $sortfield, $sortorder; + global $sortfield, $sortorder, $maxheightmini; // Show list of existing files if (empty($useinecm)) print_titre($langs->trans("AttachedFiles")); diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 590282a5358..092dd13f6c1 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -223,7 +223,7 @@ class FormMail if (! empty($_SESSION["listofmimes"])) $listofmimes=explode(';',$_SESSION["listofmimes"]); - $form=new Form($DB); + $form=new Form($this->db); $out.= "\n\n"; if ($this->withform) diff --git a/htdocs/core/class/html.formorder.class.php b/htdocs/core/class/html.formorder.class.php index 147b141c938..68c4a21b688 100644 --- a/htdocs/core/class/html.formorder.class.php +++ b/htdocs/core/class/html.formorder.class.php @@ -47,16 +47,17 @@ class FormOrder /** - * \brief Renvoie la liste des sources de commandes - * \param selected Id de la source pre-selectionnee - * \param htmlname Nom de la liste deroulante - * \param addempty 0=liste sans valeur nulle, 1=ajoute valeur inconnue - * \return array Tableau 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 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) { global $conf,$langs; - print ''; if ($addempty) print ''; // TODO Use a table called llx_c_input_reason diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 679485a4a07..3ecc086a548 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -311,7 +311,6 @@ class FormOther $moreforfilter.='>'; $moreforfilter.=$obj_usr->firstname." ".$obj_usr->name." (".$obj_usr->login.')'; $moreforfilter.=''; - $i++; } $this->db->free($resql_usr); } diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php index a8cf6927cef..1f2483fc91b 100644 --- a/htdocs/core/class/ldap.class.php +++ b/htdocs/core/class/ldap.class.php @@ -633,8 +633,8 @@ class Ldap //Create file $result=create_exdir($conf->ldap->dir_temp); - $file=$conf->ldap->dir_temp.'/ldapinput.in'; - $fp=fopen($file,"w"); + $outputfile=$conf->ldap->dir_temp.'/ldapinput.in'; + $fp=fopen($outputfile,"w"); if ($fp) { fputs($fp, $content); diff --git a/htdocs/core/class/menubase.class.php b/htdocs/core/class/menubase.class.php index 53c05be3bb4..be940844072 100644 --- a/htdocs/core/class/menubase.class.php +++ b/htdocs/core/class/menubase.class.php @@ -395,7 +395,7 @@ class Menubase //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->recur($tab, $tab[$x][0], $rang +1, $lelfmenu); + $this->recur($tab, $tab[$x][0], $rang +1, $leftmenu); } } } diff --git a/htdocs/core/class/vcard.class.php b/htdocs/core/class/vcard.class.php index d54bf45643b..5b800867298 100755 --- a/htdocs/core/class/vcard.class.php +++ b/htdocs/core/class/vcard.class.php @@ -184,7 +184,7 @@ class vCard $key = "ADR"; if ($type!="") $key.= ";$type"; $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] == "") { diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php index 99e7050c096..0dc0583e481 100644 --- a/htdocs/core/lib/agenda.lib.php +++ b/htdocs/core/lib/agenda.lib.php @@ -374,6 +374,7 @@ function actions_prepare_head($action) /** * Define head array for tabs of agenda setup pages + * * @return Array of head */ function calendars_prepare_head($param) @@ -388,6 +389,8 @@ function calendars_prepare_head($param) $head[$h][2] = 'card'; $h++; + $object=(object) array(); + // Show more tabs from modules // 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 diff --git a/htdocs/core/lib/fichinter.lib.php b/htdocs/core/lib/fichinter.lib.php index 53ac8662738..dc89615c874 100644 --- a/htdocs/core/lib/fichinter.lib.php +++ b/htdocs/core/lib/fichinter.lib.php @@ -41,7 +41,7 @@ function fichinter_prepare_head($object) $head[$h][2] = 'contact'; $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][1] = $langs->trans('Preview'); diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index bad2bc75e70..67e72ed3fc5 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -495,6 +495,8 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable global $conf, $user, $langs, $db; global $object; + $error=0; + $file_name = $dest_file; // If an upload error has been reported 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); 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; + $error=0; + //print "x".$file." ".$disableglob; $ok=true; $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; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 6fa2328550f..2f4793d9df4 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -373,8 +373,8 @@ function dol_now($mode='gmt') */ function dol_sanitizeFileName($str,$newstr='_') { - global $conf; - return dol_string_nospecial(dol_string_unaccent($str),$newstr,$conf->filesystem_forbidden_chars); + $filesystem_forbidden_chars = array('<','>',':','/','\\','?','*','|','"'); + return dol_string_nospecial(dol_string_unaccent($str), $newstr, $filesystem_forbidden_chars); } /** @@ -4417,7 +4417,8 @@ function complete_head_from_modules($conf,$langs,$object,&$head,&$h,$type,$mode= function printCommonFooter($zone='private') { global $conf; - + global $micro_start_time; + if ($zone == 'private') print "\n".''."\n"; else print "\n".''."\n"; diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 2e423d2c1a1..c839d4fe462 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -675,7 +675,7 @@ function check_value($mask,$value) $maskrefclient_maskclientcode=$regClientRef[1]; $maskrefclient_maskcounter=$regClientRef[2]; $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=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'; @@ -936,7 +936,7 @@ function dol_set_user_param($db, $conf, &$user, $tab) foreach ($tab as $key => $value) { // 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.= " VALUES (".$user->id.",".$conf->entity.","; diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php index f718b345eec..7dbd628e82d 100644 --- a/htdocs/core/lib/invoice.lib.php +++ b/htdocs/core/lib/invoice.lib.php @@ -44,7 +44,7 @@ function facture_prepare_head($object) $head[$h][2] = 'contact'; $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][1] = $langs->trans('Preview'); diff --git a/htdocs/core/lib/member.lib.php b/htdocs/core/lib/member.lib.php index 65822f82972..59f6a150276 100644 --- a/htdocs/core/lib/member.lib.php +++ b/htdocs/core/lib/member.lib.php @@ -23,6 +23,7 @@ /** * Return array head with list of tabs to view object informations + * * @param object Member * @return array head */ diff --git a/htdocs/core/lib/order.lib.php b/htdocs/core/lib/order.lib.php index fb1000b0dd2..8c34d06cb19 100644 --- a/htdocs/core/lib/order.lib.php +++ b/htdocs/core/lib/order.lib.php @@ -54,7 +54,7 @@ function commande_prepare_head($object) $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][1] = $langs->trans("Preview"); diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 31e90acfe3a..d557c73bf3d 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -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) { + $format='day'; // Show duration if exists if ($object->lines[$i]->date_start && $object->lines[$i]->date_end) { diff --git a/htdocs/core/lib/prelevement.lib.php b/htdocs/core/lib/prelevement.lib.php index 2e1f13cc220..c1fa99af7a1 100644 --- a/htdocs/core/lib/prelevement.lib.php +++ b/htdocs/core/lib/prelevement.lib.php @@ -43,7 +43,7 @@ function prelevement_prepare_head($object) $head[$h][2] = 'prelevement'; $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][1] = $langs->trans("Preview"); diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index f02565209c3..8a56766f46c 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -265,13 +265,10 @@ function select_projects($socid=-1, $selected='', $htmlname='projectid') function PLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mytask=0) { global $user, $bc, $langs; - global $form; + global $form, $projectstatic, $taskstatic; $lastprojectid=0; - $projectstatic = new Project($db); - $taskstatic = new Task($db); - $var=true; $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='') { global $user, $bc, $langs; - + global $projectstatic, $taskstatic; + $lastprojectid=0; - $projectstatic = new Project($db); - $taskstatic = new Task($db); - $projectsArrayId=explode(',',$projectsListId); $numlines=count($lines); diff --git a/htdocs/core/lib/propal.lib.php b/htdocs/core/lib/propal.lib.php index 29451e58cd0..e30cde362f8 100644 --- a/htdocs/core/lib/propal.lib.php +++ b/htdocs/core/lib/propal.lib.php @@ -49,13 +49,7 @@ function propal_prepare_head($object) $head[$h][2] = 'shipping'; $h++; } -/* - $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) + if (! empty($conf->global->MAIN_USE_PREVIEW_TABS)) { $head[$h][0] = DOL_URL_ROOT.'/comm/propal/apercu.php?id='.$object->id; $head[$h][1] = $langs->trans("Preview"); diff --git a/htdocs/core/lib/report.lib.php b/htdocs/core/lib/report.lib.php index 79c3efb8dfc..02f982bcbb6 100644 --- a/htdocs/core/lib/report.lib.php +++ b/htdocs/core/lib/report.lib.php @@ -36,7 +36,7 @@ */ function report_header($nom,$variante='',$period,$periodlink,$description,$builddate,$exportlink='',$moreparam=array()) { - global $langs; + global $langs, $hselected; print "\n\n\n"; diff --git a/htdocs/core/lib/sendings.lib.php b/htdocs/core/lib/sendings.lib.php index 26eb692c8bd..490fa576ace 100644 --- a/htdocs/core/lib/sendings.lib.php +++ b/htdocs/core/lib/sendings.lib.php @@ -131,8 +131,6 @@ function show_list_sending_receive($origin='commande',$origin_id,$filter='') if ($num) { - if ($somethingshown) print '
'; - if ($filter) print_titre($langs->trans("OtherSendingsForSameOrder")); else print_titre($langs->trans("SendingsAndReceivingForSameOrder")); @@ -191,7 +189,7 @@ function show_list_sending_receive($origin='commande',$origin_id,$filter='') else { print "
"; - 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'); print $text.' '.nl2br($objp->description); diff --git a/htdocs/core/lib/xcal.lib.php b/htdocs/core/lib/xcal.lib.php index c0bb1c5eb7b..3b527142ac7 100644 --- a/htdocs/core/lib/xcal.lib.php +++ b/htdocs/core/lib/xcal.lib.php @@ -386,7 +386,6 @@ function build_rssfile($format,$title,$desc,$events_array,$outputfile,$filter='' /** * Encode for cal export - * string must be encoded in conf->file->character_set_client * * @param string $format vcal or ical * @param string $string string to encode @@ -396,10 +395,8 @@ function format_cal($format,$string) { global $conf; - if ($conf->file->character_set_client == 'ISO-8859-1') $newstring=utf8_encode($string); - else $newstring=$string; + $newstring=$string; - // Now newstring is always UTF8 string if ($format == 'vcal') { $newstring=quotedPrintEncode($newstring); diff --git a/htdocs/core/login/functions_ldap.php b/htdocs/core/login/functions_ldap.php index 794187d5ca5..bf216533e17 100644 --- a/htdocs/core/login/functions_ldap.php +++ b/htdocs/core/login/functions_ldap.php @@ -84,9 +84,9 @@ function check_user_password_ldap($usertotest,$passwordtotest,$entitytotest) 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 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: 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; diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php index a1a18fb613b..be59ec95da4 100644 --- a/htdocs/core/menus/standard/auguria.lib.php +++ b/htdocs/core/menus/standard/auguria.lib.php @@ -204,7 +204,7 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after) print ''; print ''; print ''; print ''; print ''."\n"; diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index b886c26fca1..493eb821e53 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -601,7 +601,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after) print ''; print ''; print ''; print ''; print ''."\n"; diff --git a/htdocs/core/modules/cheque/pdf/pdf_blochet.class.php b/htdocs/core/modules/cheque/pdf/pdf_blochet.class.php index 1a0ef43a2bc..4672b95dbce 100644 --- a/htdocs/core/modules/cheque/pdf/pdf_blochet.class.php +++ b/htdocs/core/modules/cheque/pdf/pdf_blochet.class.php @@ -167,7 +167,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts $pdf->Output($_file,'F'); 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; 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 $nbofline=dol_nboflines_bis($line,0,$outputlangs->charset_output); //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 { @@ -372,7 +372,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts $pdf->line($marge_gauche, $page_hauteur-$posy, 200, $page_hauteur-$posy); $posy--; - if ($line1) + /*if ($line1) { $pdf->SetXY($marge_gauche,-$posy); $pdf->MultiCell(200, 2, $line1, 0, 'C', 0); @@ -383,7 +383,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts $posy-=3; $pdf->SetXY($marge_gauche,-$posy); $pdf->MultiCell(200, 2, $line2, 0, 'C', 0); - } + }*/ // Show page nb only on iso languages (so default Helvetica font) if (pdf_getPDFFont($outputlangs) == 'Helvetica') diff --git a/htdocs/core/modules/commande/mod_commande_saphir.php b/htdocs/core/modules/commande/mod_commande_saphir.php index c4eece7500b..9d26ed47ef1 100644 --- a/htdocs/core/modules/commande/mod_commande_saphir.php +++ b/htdocs/core/modules/commande/mod_commande_saphir.php @@ -48,7 +48,7 @@ class mod_commande_saphir extends ModeleNumRefCommandes $langs->load("bills"); - $form = new Form($db); + $form = new Form($this->db); $texte = $langs->trans('GenericNumRefModelDesc')."
\n"; $texte.= ''; diff --git a/htdocs/core/modules/commande/modules_commande.php b/htdocs/core/modules/commande/modules_commande.php index b829321b019..732088d9afb 100644 --- a/htdocs/core/modules/commande/modules_commande.php +++ b/htdocs/core/modules/commande/modules_commande.php @@ -155,6 +155,8 @@ function commande_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0 global $conf,$user,$langs; $langs->load("orders"); + $error=0; + $dir = "/core/modules/commande/"; $srctemplatepath=''; $modelisok=0; diff --git a/htdocs/core/modules/contract/mod_contract_magre.php b/htdocs/core/modules/contract/mod_contract_magre.php index 5c71c303d5f..f963e3d02e5 100755 --- a/htdocs/core/modules/contract/mod_contract_magre.php +++ b/htdocs/core/modules/contract/mod_contract_magre.php @@ -43,7 +43,7 @@ class mod_contract_magre extends ModelNumRefContracts $langs->load("bills"); - $form = new Form($db); + $form = new Form($this->db); $texte = $langs->trans('GenericNumRefModelDesc')."
\n"; $texte.= ''; diff --git a/htdocs/core/modules/dons/modules_don.php b/htdocs/core/modules/dons/modules_don.php index eeb7771e853..df917b1f5d9 100644 --- a/htdocs/core/modules/dons/modules_don.php +++ b/htdocs/core/modules/dons/modules_don.php @@ -177,7 +177,7 @@ function don_create($db, $id, $message, $modele, $outputlangs) // we delete preview files require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"); - dol_delete_preview($object); + dol_delete_preview($obj); return 1; } else diff --git a/htdocs/core/modules/expedition/mod_expedition_ribera.php b/htdocs/core/modules/expedition/mod_expedition_ribera.php index 5363d435c2c..bf832c4042b 100755 --- a/htdocs/core/modules/expedition/mod_expedition_ribera.php +++ b/htdocs/core/modules/expedition/mod_expedition_ribera.php @@ -43,7 +43,7 @@ class mod_expedition_ribera extends ModelNumRefExpedition $langs->load("bills"); - $form = new Form($db); + $form = new Form($this->db); $texte = $langs->trans('GenericNumRefModelDesc')."
\n"; $texte.= ''; diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php index 5743a724b35..faea0a306c8 100644 --- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php +++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php @@ -166,7 +166,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures $langs->load("companies"); $langs->load("errors"); - $form = new Form($db); + $form = new Form($this->db); $texte = $this->description.".
\n"; $texte.= ''; @@ -266,11 +266,10 @@ class doc_generic_invoice_odt extends ModelePDFFactures { $id = $object; $object = new Facture($this->db); - $object->fetch($id); - + $result=$object->fetch($id); if ($result < 0) { - dol_print_error($db,$object->error); + dol_print_error($this->db,$object->error); return -1; } } diff --git a/htdocs/core/modules/facture/mod_facture_mercure.php b/htdocs/core/modules/facture/mod_facture_mercure.php index c18a185110d..b1ee4c11bf6 100644 --- a/htdocs/core/modules/facture/mod_facture_mercure.php +++ b/htdocs/core/modules/facture/mod_facture_mercure.php @@ -46,7 +46,7 @@ class mod_facture_mercure extends ModeleNumRefFactures $langs->load("bills"); - $form = new Form($db); + $form = new Form($this->db); $texte = $langs->trans('GenericNumRefModelDesc')."
\n"; $texte.= ''; diff --git a/htdocs/core/modules/facture/modules_facture.php b/htdocs/core/modules/facture/modules_facture.php index 386fc2e5feb..27579626d11 100644 --- a/htdocs/core/modules/facture/modules_facture.php +++ b/htdocs/core/modules/facture/modules_facture.php @@ -149,6 +149,8 @@ function facture_pdf_create($db, $object, $message, $modele, $outputlangs, $hide $langs->load("bills"); + $error=0; + // Increase limit for PDF build $err=error_reporting(); error_reporting(0); diff --git a/htdocs/core/modules/fichinter/mod_arctic.php b/htdocs/core/modules/fichinter/mod_arctic.php index 9b8be8762aa..0616a58f070 100644 --- a/htdocs/core/modules/fichinter/mod_arctic.php +++ b/htdocs/core/modules/fichinter/mod_arctic.php @@ -52,7 +52,7 @@ class mod_arctic extends ModeleNumRefFicheinter $langs->load("bills"); - $form = new Form($db); + $form = new Form($this->db); $texte = $langs->trans('GenericNumRefModelDesc')."
\n"; $texte.= ''; diff --git a/htdocs/core/modules/livraison/mod_livraison_saphir.php b/htdocs/core/modules/livraison/mod_livraison_saphir.php index e0bbc8665c9..8ebe1591c68 100644 --- a/htdocs/core/modules/livraison/mod_livraison_saphir.php +++ b/htdocs/core/modules/livraison/mod_livraison_saphir.php @@ -45,7 +45,7 @@ class mod_livraison_saphir extends ModeleNumRefDeliveryOrder $langs->load("bills"); - $form = new Form($db); + $form = new Form($this->db); $texte = $langs->trans('GenericNumRefModelDesc')."
\n"; $texte.= ''; diff --git a/htdocs/core/modules/livraison/pdf/pdf_sirocco.modules.php b/htdocs/core/modules/livraison/pdf/pdf_sirocco.modules.php index fa0f8acaec6..8f0d75ac593 100644 --- a/htdocs/core/modules/livraison/pdf/pdf_sirocco.modules.php +++ b/htdocs/core/modules/livraison/pdf/pdf_sirocco.modules.php @@ -234,7 +234,7 @@ class pdf_sirocco extends ModelePDFDeliveryOrder $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) { diff --git a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php index e65a12aad2f..ce32fa45bf9 100644 --- a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php +++ b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php @@ -298,7 +298,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder $tab_top_in_current_page=$tab_top_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) { @@ -344,7 +344,8 @@ class pdf_typhon extends ModelePDFDeliveryOrder // Check product remaining to be delivered // TODO doit etre modifie //$waitingDelivery = $object->getRemainingDelivered(); - + $waitingDelivery=''; + if (is_array($waitingDelivery) & !empty($waitingDelivery)) { $pdf->AddPage('P', 'A4'); diff --git a/htdocs/core/modules/mailings/framboise.modules.php b/htdocs/core/modules/mailings/framboise.modules.php index 3cc151abdda..6fb61212cc2 100644 --- a/htdocs/core/modules/mailings/framboise.modules.php +++ b/htdocs/core/modules/mailings/framboise.modules.php @@ -202,7 +202,7 @@ class mailing_framboise extends MailingTargets } else { - dol_print_error($db); + dol_print_error($this->db); } $s.=''; diff --git a/htdocs/core/modules/mailings/thirdparties.modules.php b/htdocs/core/modules/mailings/thirdparties.modules.php index 131ee661a18..39bcac186b3 100755 --- a/htdocs/core/modules/mailings/thirdparties.modules.php +++ b/htdocs/core/modules/mailings/thirdparties.modules.php @@ -218,7 +218,7 @@ class mailing_thirdparties extends MailingTargets } else { - dol_print_error($db); + dol_print_error($this->db); } $s.=''; diff --git a/htdocs/core/modules/member/cards/pdf_standard.class.php b/htdocs/core/modules/member/cards/pdf_standard.class.php index b058855a697..85eb6f1f182 100644 --- a/htdocs/core/modules/member/cards/pdf_standard.class.php +++ b/htdocs/core/modules/member/cards/pdf_standard.class.php @@ -357,10 +357,11 @@ class pdf_standard { /** - * \brief Function to build PDF on disk, then output on HTTP strem. - * \param arrayofmembers Array of members informations - * \param outputlangs Lang object for output language - * \return int 1=ok, 0=ko + * Function to build PDF on disk, then output on HTTP strem. + * + * @param arrayofmembers Array of members informations + * @param outputlangs Lang object for output language + * @return int 1=ok, 0=ko */ function write_file($arrayofmembers,$outputlangs) { @@ -457,7 +458,7 @@ class pdf_standard { $filename='tmpcards.pdf'; $type=dol_mimetype($filename); - if ($encoding) header('Content-Encoding: '.$encoding); + //if ($encoding) header('Content-Encoding: '.$encoding); if ($type) header('Content-Type: '.$type); if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"'); else header('Content-Disposition: inline; filename="'.$filename.'"'); diff --git a/htdocs/core/modules/member/labels/pdf_standardlabel.class.php b/htdocs/core/modules/member/labels/pdf_standardlabel.class.php index 85cba5f324a..583caddfe4d 100644 --- a/htdocs/core/modules/member/labels/pdf_standardlabel.class.php +++ b/htdocs/core/modules/member/labels/pdf_standardlabel.class.php @@ -144,7 +144,9 @@ class pdf_standardlabel { $logo=$conf->mycompany->dir_output.'/logos/'.$mysoc->logo; } } - + // Define photo + $photo=''; + // Print lines if ($this->code == "CARD") { @@ -436,7 +438,7 @@ class pdf_standardlabel { $filename='tmplabels.pdf'; $type=dol_mimetype($filename); - if ($encoding) header('Content-Encoding: '.$encoding); + //if ($encoding) header('Content-Encoding: '.$encoding); if ($type) header('Content-Type: '.$type); if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"'); else header('Content-Disposition: inline; filename="'.$filename.'"'); diff --git a/htdocs/core/modules/modComptabilite.class.php b/htdocs/core/modules/modComptabilite.class.php index fd0cb925e1f..6bd9416babe 100644 --- a/htdocs/core/modules/modComptabilite.class.php +++ b/htdocs/core/modules/modComptabilite.class.php @@ -132,6 +132,8 @@ class modComptabilite extends DolibarrModules // Nettoyage avant activation $this->remove(); + $sql = array(); + return $this->_init($sql); } diff --git a/htdocs/core/modules/modContrat.class.php b/htdocs/core/modules/modContrat.class.php index 7ba03b23c9e..323362bc461 100644 --- a/htdocs/core/modules/modContrat.class.php +++ b/htdocs/core/modules/modContrat.class.php @@ -129,6 +129,8 @@ class modContrat extends DolibarrModules // Nettoyage avant activation $this->remove(); + $sql = array(); + return $this->_init($sql); } diff --git a/htdocs/core/modules/modMailing.class.php b/htdocs/core/modules/modMailing.class.php index a6ed37f1f88..b822dd46fee 100644 --- a/htdocs/core/modules/modMailing.class.php +++ b/htdocs/core/modules/modMailing.class.php @@ -111,6 +111,8 @@ class modMailing extends DolibarrModules // Permissions $this->remove(); + $sql = array(); + return $this->_init($sql); } diff --git a/htdocs/core/modules/modNotification.class.php b/htdocs/core/modules/modNotification.class.php index ca430eab2da..1dbb3155ac1 100644 --- a/htdocs/core/modules/modNotification.class.php +++ b/htdocs/core/modules/modNotification.class.php @@ -84,6 +84,8 @@ class modNotification extends DolibarrModules // Permissions $this->remove(); + $sql = array(); + return $this->_init($sql); } diff --git a/htdocs/core/modules/modTax.class.php b/htdocs/core/modules/modTax.class.php index de015e2348c..f1857409197 100644 --- a/htdocs/core/modules/modTax.class.php +++ b/htdocs/core/modules/modTax.class.php @@ -149,6 +149,8 @@ class modTax extends DolibarrModules // Nettoyage avant activation $this->remove(); + $sql = array(); + return $this->_init($sql); } diff --git a/htdocs/core/modules/modWorkflow.class.php b/htdocs/core/modules/modWorkflow.class.php index e4d66941ee0..d9965833c35 100644 --- a/htdocs/core/modules/modWorkflow.class.php +++ b/htdocs/core/modules/modWorkflow.class.php @@ -147,7 +147,10 @@ class modWorkflow extends DolibarrModules */ function init() { - //$result=$this->load_tables(); + // Permissions + $this->remove(); + + $sql = array(); return $this->_init($sql); } diff --git a/htdocs/core/modules/project/mod_project_universal.php b/htdocs/core/modules/project/mod_project_universal.php index 744360612c6..0aaf3629dee 100644 --- a/htdocs/core/modules/project/mod_project_universal.php +++ b/htdocs/core/modules/project/mod_project_universal.php @@ -47,7 +47,7 @@ class mod_project_universal extends ModeleNumRefProjects $langs->load("projects"); $langs->load("admin"); - $form = new Form($db); + $form = new Form($this->db); $texte = $langs->trans('GenericNumRefModelDesc')."
\n"; $texte.= ''; diff --git a/htdocs/core/modules/propale/mod_propale_saphir.php b/htdocs/core/modules/propale/mod_propale_saphir.php index a44fc23a750..8249fa30604 100644 --- a/htdocs/core/modules/propale/mod_propale_saphir.php +++ b/htdocs/core/modules/propale/mod_propale_saphir.php @@ -48,7 +48,7 @@ class mod_propale_saphir extends ModeleNumRefPropales $langs->load("bills"); - $form = new Form($db); + $form = new Form($this->db); $texte = $langs->trans('GenericNumRefModelDesc')."
\n"; $texte.= ''; diff --git a/htdocs/core/modules/propale/modules_propale.php b/htdocs/core/modules/propale/modules_propale.php index f726b63727e..f04c20feae5 100644 --- a/htdocs/core/modules/propale/modules_propale.php +++ b/htdocs/core/modules/propale/modules_propale.php @@ -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 Object $object Object proposal @@ -145,6 +145,8 @@ function propale_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, global $conf,$user,$langs; $langs->load("propale"); + $error=0; + $dir = "/core/modules/propale/"; $srctemplatepath=''; $modelisok=0; @@ -181,7 +183,7 @@ function propale_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, } // Si model pas encore bon - if (! $modelisok && is_array($liste)) + if (! $modelisok) { $liste=ModelePDFPropales::liste_modeles($db); $modele=key($liste); // Renvoie premiere valeur de cle trouve dans le tableau diff --git a/htdocs/core/modules/propale/pdf_propale_azur.modules.php b/htdocs/core/modules/propale/pdf_propale_azur.modules.php index 2a036aa8f0f..2befc3339cd 100644 --- a/htdocs/core/modules/propale/pdf_propale_azur.modules.php +++ b/htdocs/core/modules/propale/pdf_propale_azur.modules.php @@ -654,9 +654,9 @@ class pdf_propale_azur extends ModelePDFPropales { $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->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 @@ -664,9 +664,9 @@ class pdf_propale_azur extends ModelePDFPropales { $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->MultiCell($largcol2, $tab2_hl, price($object->total_localtax2), $useborder, 'R', 1); + $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax2), 0, 'R', 1); } } else diff --git a/htdocs/core/modules/propale/pdf_propale_jaune.modules.php b/htdocs/core/modules/propale/pdf_propale_jaune.modules.php index 79c76a4c5c9..aed35de0c83 100644 --- a/htdocs/core/modules/propale/pdf_propale_jaune.modules.php +++ b/htdocs/core/modules/propale/pdf_propale_jaune.modules.php @@ -654,9 +654,9 @@ class pdf_propale_jaune extends ModelePDFPropales { $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->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 @@ -664,9 +664,9 @@ class pdf_propale_jaune extends ModelePDFPropales { $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->MultiCell($largcol2, $tab2_hl, price($object->total_localtax2), $useborder, 'R', 1); + $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax2), 0, 'R', 1); } } else diff --git a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php index 68681e069fc..1831e4cff2c 100644 --- a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php +++ b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php @@ -88,7 +88,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc $langs->load("companies"); $langs->load("errors"); - $form = new Form($db); + $form = new Form($this->db); $texte = $this->description.".
\n"; $texte.= ''; @@ -187,11 +187,10 @@ class doc_generic_odt extends ModeleThirdPartyDoc { $id = $object; $object = new Societe($this->db); - $object->fetch($id); - + $result=$object->fetch($id); if ($result < 0) { - dol_print_error($db,$object->error); + dol_print_error($this->db,$object->error); return -1; } } diff --git a/htdocs/core/modules/societe/mod_codeclient_elephant.php b/htdocs/core/modules/societe/mod_codeclient_elephant.php index 59b8196dc11..e3db286e92a 100644 --- a/htdocs/core/modules/societe/mod_codeclient_elephant.php +++ b/htdocs/core/modules/societe/mod_codeclient_elephant.php @@ -72,7 +72,7 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode $langs->load("companies"); - $form = new Form($db); + $form = new Form($this->db); $texte = $langs->trans('GenericNumRefModelDesc')."
\n"; $texte.= ''; diff --git a/htdocs/core/modules/societe/mod_codecompta_aquarium.php b/htdocs/core/modules/societe/mod_codecompta_aquarium.php index e4b94e0b75a..4d3ea14cd45 100644 --- a/htdocs/core/modules/societe/mod_codecompta_aquarium.php +++ b/htdocs/core/modules/societe/mod_codecompta_aquarium.php @@ -61,7 +61,7 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode $langs->load("companies"); - $form = new Form($db); + $form = new Form($this->db); $tooltip=''; $texte = ''; diff --git a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php index 26262e3bc96..1cdcc83c2f1 100755 --- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -355,6 +355,9 @@ class pdf_canelle extends ModelePDFSuppliersInvoices // Affiche zone totaux $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) { $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) $pdf->SetFillColor(248,248,248); + $index=0; foreach( $this->tva as $tvakey => $tvaval ) { if ($tvakey > 0) // On affiche pas taux 0 @@ -461,9 +465,9 @@ class pdf_canelle extends ModelePDFSuppliersInvoices { $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->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 @@ -471,9 +475,9 @@ class pdf_canelle extends ModelePDFSuppliersInvoices { $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->MultiCell($largcol2, $tab2_hl, price($object->total_localtax2), $useborder, 'R', 1); + $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax2), 0, 'R', 1); } } else diff --git a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php index e65a179f277..ae153661fb3 100644 --- a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php +++ b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php @@ -48,7 +48,7 @@ class mod_commande_fournisseur_orchidee extends ModeleNumRefSuppliersOrders $langs->load("bills"); $langs->load("admin"); - $form = new Form($db); + $form = new Form($this->db); $texte = $langs->trans('GenericNumRefModelDesc')."
\n"; $texte.= ''; diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php index 71b8c244d50..846c3de4c16 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -356,6 +356,8 @@ class pdf_muscadet extends ModelePDFSuppliersOrders // Affiche zone totaux $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) { $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) $pdf->SetFillColor(248,248,248); + $index=0; foreach( $this->tva as $tvakey => $tvaval ) { if ($tvakey > 0) // On affiche pas taux 0 @@ -465,9 +468,9 @@ class pdf_muscadet extends ModelePDFSuppliersOrders { $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->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 @@ -475,9 +478,9 @@ class pdf_muscadet extends ModelePDFSuppliersOrders { $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->MultiCell($largcol2, $tab2_hl, price($object->total_localtax2), $useborder, 'R', 1); + $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax2), 0, 'R', 1); } } else diff --git a/htdocs/ecm/class/ecmdirectory.class.php b/htdocs/ecm/class/ecmdirectory.class.php index 0c5f8c375f7..2ceac9d7035 100644 --- a/htdocs/ecm/class/ecmdirectory.class.php +++ b/htdocs/ecm/class/ecmdirectory.class.php @@ -70,6 +70,7 @@ class EcmDirectory // extends CommonObject { global $conf, $langs; + $error=0; $now=dol_now(); // Clean parameters @@ -328,6 +329,8 @@ class EcmDirectory // extends CommonObject global $conf, $langs; require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"); + $error=0; + $relativepath=$this->getRelativePath(1); // Ex: dir1/dir2/dir3 dol_syslog("EcmDirectories::delete remove directory ".$relativepath); diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 76c473ac851..7c956ae3405 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -398,14 +398,14 @@ class Expedition extends CommonObject } else { - dol_syslog('Expedition::Fetch Error rowid='.$rowid.' numrows=0 sql='.$sql); - $this->error='Delivery with id '.$rowid.' not found sql='.$sql; + dol_syslog('Expedition::Fetch Error -2'); + $this->error='Delivery with id '.$id.' not found sql='.$sql; return -2; } } 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(); return -1; } @@ -768,8 +768,10 @@ class Expedition extends CommonObject function delete() { global $conf, $langs, $user; - require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"); + + $error=0; + $this->db->begin(); $sql = "DELETE FROM ".MAIN_DB_PREFIX."expeditiondet"; diff --git a/htdocs/exports/class/export.class.php b/htdocs/exports/class/export.class.php index c5ddf7eb96e..c1f62634c16 100644 --- a/htdocs/exports/class/export.class.php +++ b/htdocs/exports/class/export.class.php @@ -267,7 +267,7 @@ class Export $file = "export_".$model.".modules.php"; $classname = "Export".$model; require_once($dir.$file); - $objmodel = new $classname($db); + $objmodel = new $classname($this->db); if ($sqlquery) $sql = $sqlquery; else $sql=$this->build_sql($indice,$array_selected); diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 212c7d84694..b1975181df7 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -309,7 +309,9 @@ class Fichinter extends CommonObject function setValid($user, $outputdir) { global $langs, $conf; - + + $error=0; + if ($this->statut != 1) { $this->db->begin(); @@ -578,6 +580,7 @@ class Fichinter extends CommonObject if (! $this->db->query($sql) ) { dol_syslog("Fichinter::delete error", LOG_ERR); + $this->error=$this->db->lasterror(); $error++; } @@ -589,7 +592,7 @@ class Fichinter extends CommonObject $error++; } - if ($err > 0) + if ($error) { $this->db->rollback(); return -1; diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index d4825c62fd1..1db422884f5 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -706,6 +706,8 @@ class CommandeFournisseur extends Commande { global $conf, $langs; + $error=0; + dol_syslog("CommandeFournisseur::Refuse"); $result = 0; if ($user->rights->fournisseur->commande->approuver) @@ -750,6 +752,8 @@ class CommandeFournisseur extends Commande { global $langs,$conf; + $error=0; + //dol_syslog("CommandeFournisseur::Cancel"); $result = 0; if ($user->rights->fournisseur->commande->commander) @@ -847,7 +851,8 @@ class CommandeFournisseur extends Commande global $langs,$conf; $this->db->begin(); - + + $error=0; $now=dol_now(); /* On positionne en mode brouillon la commande */ @@ -919,6 +924,7 @@ class CommandeFournisseur extends Commande /** * Add order line + * * @param desc Description * @param pu_ht Unit price * @param qty Quantity @@ -934,7 +940,7 @@ class CommandeFournisseur extends Commande * @param type Type of line (0=product, 1=service) * @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; @@ -1134,7 +1140,6 @@ class CommandeFournisseur extends Commande $error++; } } - $i++; } if ($error == 0) @@ -1188,13 +1193,14 @@ class CommandeFournisseur extends Commande /** * 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; - $err = 0; + $error = 0; $this->db->begin(); @@ -1202,7 +1208,7 @@ class CommandeFournisseur extends Commande dol_syslog("FournisseurCommande::delete sql=".$sql, LOG_DEBUG); if (! $this->db->query($sql) ) { - $err++; + $error++; } $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) { - $err++; + $error++; } } else { - $err++; + $error++; } - if ($err == 0) + if ($error == 0) { // Appel des triggers include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); @@ -1630,10 +1636,10 @@ class CommandeFournisseur extends Commande $sql.= ",localtax1_tx='".price2num($txlocaltax1)."'"; $sql.= ",localtax2_tx='".price2num($txlocaltax2)."'"; $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'; } if ($date_end) { $sql.= ",date_end='$date_end'"; } - else { $sql.=',date_end=null'; } + else { $sql.=',date_end=null'; }*/ $sql.= ",info_bits='".$info_bits."'"; $sql.= ",total_ht='".price2num($total_ht)."'"; $sql.= ",total_tva='".price2num($total_tva)."'"; diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index c21d73be1a3..43cfa12ca22 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -82,14 +82,11 @@ class FactureFournisseur extends Facture /** * Constructor * - * @param DoliDB $DB Database handler + * @param DoliDB $db Database handler */ - function FactureFournisseur($DB) + function FactureFournisseur($db) { - $this->db = $DB ; - - $this->id = $facid; - $this->socid = $socid; + $this->db = $db; $this->amount = 0; $this->remise = 0; @@ -115,6 +112,7 @@ class FactureFournisseur extends Facture { global $langs,$conf; + $error=0; $now=dol_now(); // Clear parameters @@ -255,6 +253,7 @@ class FactureFournisseur extends Facture function fetch($id='',$ref='') { global $langs; + $sql = "SELECT"; $sql.= " t.rowid,"; $sql.= " t.facnumber,"; @@ -356,8 +355,8 @@ class FactureFournisseur extends Facture } else { - $this->error='Bill with id '.$rowid.' not found sql='.$sql; - dol_syslog(get_class($this).'::Fetch rowid='.$rowid.' numrows=0 sql='.$sql); + $this->error='Bill with id '.$id.' not found sql='.$sql; + dol_syslog(get_class($this).'::Fetch rowid='.$id.' numrows=0 sql='.$sql); return -2; } diff --git a/htdocs/install/etape2.php b/htdocs/install/etape2.php index 8f81e55614c..b56c016d7c2 100644 --- a/htdocs/install/etape2.php +++ b/htdocs/install/etape2.php @@ -197,10 +197,6 @@ if ($action == "set") //print "
Creation de la table $name/td>"; $requestnb++; - if ($conf->file->character_set_client == "UTF-8") - { - $buffer=utf8_encode($buffer); - } dolibarr_install_syslog("Request: ".$buffer,LOG_DEBUG); $resql=$db->query($buffer,0,'dml'); @@ -344,10 +340,6 @@ if ($action == "set") //print "
Creation des cles et index de la table $name: '$buffer'