diff --git a/COPYRIGHT b/COPYRIGHT index 4c478710bc6..5ab01cec555 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -30,6 +30,7 @@ jQuery FileUpload 5.0.3 GPL and MIT Licence Yes JS library to upload files jQuery JCrop 0.9.8 GPL and MIT Licence Yes JS library plugin Crop (to crop images) jQuery jeditable 1.7.1 GPL and MIT Licence Yes JS library plugin jeditable (to edit in place) jQuery jNotify 1.1.00 Apache Software License 2.0 No (GPLv3 only) JS library plugin jNotify (to use ajax popups) +jQuery blockUI 2.43 GPL and MIT Licence Yes JS library plugin blockUI (to use ajax popups) jQuery jPicker 1.1.00 GPL and MIT Licence Yes JS library for color picker with not defined list of colors jQuery Layout 1.3.0 GPL and MIT Licence Yes JS library plugin Layout (RC-29.15) jQuery TableDnD 0.5 GPL and MIT Licence Yes JS library plugin TableDnD (to reorder table rows) diff --git a/ChangeLog b/ChangeLog index 4736aa6f3e5..c723a0e626d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,7 +3,7 @@ English Dolibarr ChangeLog -------------------------------------------------------------- -***** ChangeLog for 3.3 compared to 3.2.1 ***** +***** ChangeLog for 3.3 compared to 3.2.2 ***** For users: - New: If field "signature" is filled into user table, text is added at end of predefined email texts. If option MAIL_DO_NOT_USE_SIGN is on, this @@ -42,6 +42,7 @@ For users: - New: Can select thirdparties into emailing targets, even if module category is not enabled. - New: [ task #498 ] Improvement of the block to add products/services lines. - New: Add margin and commissions management module. +- New: ECM autodir works also for files joined to products and services. - Fix: [ bug #499 ]: Supplier order input method not translated - Fix: No images into product description lines as PDF generation does not work with this. @@ -70,6 +71,11 @@ For translators: +***** ChangeLog for 3.2.2 compared to 3.2.1 ***** +Fix: Modify spanish VAT to new rates + + + ***** ChangeLog for 3.2.1 compared to 3.2.0 ***** - Fix: Edit of projects. - Fix: Activation of modules does not fails if directory install was removed. diff --git a/build/exe/doliwamp/README.md b/build/exe/doliwamp/README.md new file mode 100644 index 00000000000..ca3aaa6aece --- /dev/null +++ b/build/exe/doliwamp/README.md @@ -0,0 +1,7 @@ +# DOLIWAMP, THE DOLIBARR INSTALLER FOR WINDOWS + +DoliWamp is a special all in one package installer for Windows (Dolibarr+Mysql+Apache+PHP). +It's a dedicated Dolibarr version for Windows newbies with no technical knowledge. This package will install or upgrade Dolibarr but also and all prerequisites like the web server, and the database in one autoinstall process. + +If you have technical knowledge in web administration and plan to share your server instance (Apache, Mysql or PHP) with other projects than Dolibarr or want to use Dolibarr other components (PostgreSQL), you should not use this assistant and make a manual installation of Dolibarr on your existing server by downloading the standard package (.tgz or .zip file). + diff --git a/htdocs/admin/agenda_xcal.php b/htdocs/admin/agenda_xcal.php index 5a1ccc3c6df..14b21de4fc4 100644 --- a/htdocs/admin/agenda_xcal.php +++ b/htdocs/admin/agenda_xcal.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2008-2012 Laurent Destailleur * Copyright (C) 2012 Juanjo Menent * * This program is free software; you can redistribute it and/or modify @@ -95,7 +95,7 @@ print ""; print ""; print ''.$langs->trans("PasswordTogetVCalExport").""; -print "global->MAIN_AGENDA_XCAL_EXPORTKEY) . "\" size=\"40\">"; +print "global->MAIN_AGENDA_XCAL_EXPORTKEY) . "\" size=\"40\">"; print " "; print ""; diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index 1a00c229150..16f73042b66 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -517,49 +517,6 @@ print " \n"; print "\n"; $var=true; -// Valider la commande apres cloture de la propale -// permet de na pas passer par l'option commande provisoire -/* -$var=! $var; -print '
'; -print ''; -print ''; -print ''; -print ''.$langs->trans("ValidOrderAfterPropalClosed").''; -print ''.$form->selectyesno("validorder",$conf->global->COMMANDE_VALID_AFTER_CLOSE_PROPAL,1).''; -print ''; -print ''; -print '
'; -*/ - -// Ajouter une ligne de frais port indiquant le poids de la commande -/* -$var=! $var; -print '
'; -print ''; -print ''; -print ''; -print ''.$langs->trans("AddDeliveryCostLine").''; -print ''.$form->selectyesno("addline",$conf->global->COMMANDE_ADD_DELIVERY_COST_LINE,1).''; -print ''; -print ''; -print '
'; -*/ - -// Utiliser le contact de la commande dans le document -/* -$var=! $var; -print '
'; -print ''; -print ''; -print ''; -print ''.$langs->trans("UseCustomerContactAsOrderRecipientIfExist").''; -print ''.$form->selectyesno("use_customer_contact_as_recipient",$conf->global->COMMANDE_USE_CUSTOMER_CONTACT_AS_RECIPIENT,1).''; -print ''; -print ''; -print '
'; -*/ - $var=! $var; print '
'; print ''; diff --git a/htdocs/admin/mailing.php b/htdocs/admin/mailing.php index ccded6ec1c7..fb135dcfb8e 100644 --- a/htdocs/admin/mailing.php +++ b/htdocs/admin/mailing.php @@ -103,7 +103,7 @@ print ''; $var=true; -print ''; +print '
'; print ''; print ''; print ''; @@ -123,7 +123,7 @@ print ''; -// TODO the precedent values are deleted after turn on this switch +// TODO the precedent values are deleted after turn on this switch $var=!$var; print ''; - -print ''; print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; print $langs->trans("ActivateCheckRead").''; @@ -149,12 +149,12 @@ print $langs->trans("ActivateCheckReadKey").''; print ''; print '
'; -$db->close(); +print '
'; +print '
'; llxFooter(); +$db->close(); ?> diff --git a/htdocs/admin/security_other.php b/htdocs/admin/security_other.php index 2ba43a0aedf..2d46976428f 100644 --- a/htdocs/admin/security_other.php +++ b/htdocs/admin/security_other.php @@ -1,6 +1,6 @@ - * Copyright (C) 2005-2010 Regis Houssin + * Copyright (C) 2005-2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,13 +24,17 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; $langs->load("users"); $langs->load("admin"); $langs->load("other"); -if (!$user->admin) accessforbidden(); +if (! $user->admin) + accessforbidden(); + +$action=GETPOST('action','alpha'); $upload_dir=$conf->admin->dir_temp; @@ -43,65 +47,75 @@ if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC)) { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - dol_add_file_process($upload_dir,0,0); + dol_add_file_process($upload_dir, 0, 0, 'userfile'); } -if ($_GET["action"] == 'activate_captcha') +if (preg_match('/set_(.*)/',$action,$reg)) { - dolibarr_set_const($db, "MAIN_SECURITY_ENABLECAPTCHA", '1','chaine',0,'',$conf->entity); - header("Location: security_other.php"); - exit; -} -else if ($_GET["action"] == 'disable_captcha') -{ - dolibarr_del_const($db, "MAIN_SECURITY_ENABLECAPTCHA",$conf->entity); - header("Location: security_other.php"); - exit; + $code=$reg[1]; + $value=(GETPOST($code) ? GETPOST($code) : 1); + if (dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity) > 0) + { + Header("Location: ".$_SERVER["PHP_SELF"]); + exit; + } + else + { + dol_print_error($db); + } } -if ($_GET["action"] == 'activate_advancedperms') +else if (preg_match('/del_(.*)/',$action,$reg)) { - dolibarr_set_const($db, "MAIN_USE_ADVANCED_PERMS", '1','chaine',0,'',$conf->entity); - header("Location: security_other.php"); - exit; -} -else if ($_GET["action"] == 'disable_advancedperms') -{ - dolibarr_del_const($db, "MAIN_USE_ADVANCED_PERMS",$conf->entity); - header("Location: security_other.php"); - exit; + $code=$reg[1]; + if (dolibarr_del_const($db, $code, $conf->entity) > 0) + { + Header("Location: ".$_SERVER["PHP_SELF"]); + exit; + } + else + { + dol_print_error($db); + } } -if ($_GET["action"] == 'MAIN_SESSION_TIMEOUT') +else if ($action == 'MAIN_SESSION_TIMEOUT') { if (! dolibarr_set_const($db, "MAIN_SESSION_TIMEOUT", $_POST["MAIN_SESSION_TIMEOUT"],'chaine',0,'',$conf->entity)) dol_print_error($db); else $mesg=$langs->trans("RecordModifiedSuccessfully"); } - -if ($_GET["action"] == 'MAIN_UPLOAD_DOC') +else if ($action == 'MAIN_UPLOAD_DOC') { if (! dolibarr_set_const($db, 'MAIN_UPLOAD_DOC',$_POST["MAIN_UPLOAD_DOC"],'chaine',0,'',$conf->entity)) dol_print_error($db); else $mesg=$langs->trans("RecordModifiedSuccessfully"); } - -if ($_GET["action"] == 'MAIN_UMASK') +else if ($action == 'MAIN_UMASK') { if (! dolibarr_set_const($db, "MAIN_UMASK", $_POST["MAIN_UMASK"],'chaine',0,'',$conf->entity)) dol_print_error($db); else $mesg=$langs->trans("RecordModifiedSuccessfully"); } - -if ($_GET["action"] == 'MAIN_ANTIVIRUS_COMMAND') +else if ($action == 'MAIN_ANTIVIRUS_COMMAND') { if (! dolibarr_set_const($db, "MAIN_ANTIVIRUS_COMMAND", $_POST["MAIN_ANTIVIRUS_COMMAND"],'chaine',0,'',$conf->entity)) dol_print_error($db); else $mesg=$langs->trans("RecordModifiedSuccessfully"); } - -if ($_GET["action"] == 'MAIN_ANTIVIRUS_PARAM') +else if ($action == 'MAIN_ANTIVIRUS_PARAM') { if (! dolibarr_set_const($db, "MAIN_ANTIVIRUS_PARAM", $_POST["MAIN_ANTIVIRUS_PARAM"],'chaine',0,'',$conf->entity)) dol_print_error($db); else $mesg=$langs->trans("RecordModifiedSuccessfully"); } +// Delete file +else if ($action == 'delete') +{ + $langs->load("other"); + $file = $conf->admin->dir_temp . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). + $ret=dol_delete_file($file); + if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); + else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); + Header('Location: '.$_SERVER["PHP_SELF"]); + exit; +} /* * View @@ -168,14 +182,21 @@ print ''.$langs->trans("UseCaptchaCode").''; print ''; if (function_exists("imagecreatefrompng")) { - if ($conf->global->MAIN_SECURITY_ENABLECAPTCHA == 0) - { - print ''.img_picto($langs->trans("Disabled"),'switch_off').''; - } - if($conf->global->MAIN_SECURITY_ENABLECAPTCHA == 1) - { - print ''.img_picto($langs->trans("Enabled"),'switch_on').''; - } + if (! empty($conf->use_javascript_ajax)) + { + print ajax_constantonoff('MAIN_SECURITY_ENABLECAPTCHA'); + } + else + { + if (empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA)) + { + print ''.img_picto($langs->trans("Disabled"),'off').''; + } + else + { + print ''.img_picto($langs->trans("Enabled"),'on').''; + } + } } else { @@ -183,35 +204,34 @@ else $desc = $form->textwithpicto('',$langs->transnoentities("EnableGDLibraryDesc"),1,'warning'); print $desc; } -print ""; - -print ""; -print ''; +print ''; // Enable advanced perms $var=!$var; print ""; print ''.$langs->trans("UseAdvancedPerms").''; print ''; -if ($conf->global->MAIN_USE_ADVANCED_PERMS == 0) +if (! empty($conf->use_javascript_ajax)) { - print ''.img_picto($langs->trans("Disabled"),'switch_off').''; + print ajax_constantonoff('MAIN_USE_ADVANCED_PERMS'); } -if($conf->global->MAIN_USE_ADVANCED_PERMS == 1) +else { - print ''.img_picto($langs->trans("Enabled"),'switch_on').''; + if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) + { + print ''.img_picto($langs->trans("Disabled"),'off').''; + } + else + { + print ''.img_picto($langs->trans("Enabled"),'on').''; + } } -print ""; - -print ""; -print ''; +print ""; print ''; - print '
'; - // Upload options $var=false; @@ -274,7 +294,7 @@ if (ini_get('safe_mode') && ! empty($conf->global->MAIN_ANTIVIRUS_COMMAND)) dol_syslog("safe_mode is on, basedir is ".$basedir.", safe_mode_exec_dir is ".ini_get('safe_mode_exec_dir'), LOG_WARNING); } } -print ''; +print ''; print ""; print ''; print ''; @@ -291,7 +311,7 @@ print ''.$langs->trans("AntiVirusParam").'
'; print $langs->trans("AntiVirusParamExample"); print ''; print ''; -print ''; +print ''; print ""; print ''; print ''; @@ -301,19 +321,16 @@ print ''; print ''; -print ''; - - // Form to test upload -dol_htmloutput_mesg($mesg); - -// Affiche formulaire upload print '
'; $formfile=new FormFile($db); -$formfile->form_attach_new_file(DOL_URL_ROOT.'/admin/security_other.php',$langs->trans("FormToTestFileUploadForm"),0,0,1); +$formfile->form_attach_new_file($_SERVER['PHP_SELF'], $langs->trans("FormToTestFileUploadForm"), 0, 0, 1); + +// List of document +$filearray=dol_dir_list($upload_dir, "files", 0, '', '', 'name', SORT_ASC, 1); +$formfile->list_of_documents($filearray, '', 'admin_temp', ''); llxFooter(); - $db->close(); ?> diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index caab3dcc3a6..0c5722ac0a7 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -120,11 +120,11 @@ class ActionComm extends CommonObject if (empty($this->punctual)) $this->punctual = 0; if ($this->percentage > 100) $this->percentage = 100; if ($this->percentage == 100 && ! $this->dateend) $this->dateend = $this->date; - if ($this->datep && $this->datef) $this->durationp=($this->datef - $this->datep); - if ($this->date && $this->dateend) $this->durationa=($this->dateend - $this->date); - if ($this->datep && $this->datef && $this->datep > $this->datef) $this->datef=$this->datep; - if ($this->date && $this->dateend && $this->date > $this->dateend) $this->dateend=$this->date; - if ($this->fk_project < 0) $this->fk_project = 0; + if (! empty($this->datep) && ! empty($this->datef)) $this->durationp=($this->datef - $this->datep); + if (! empty($this->date) && ! empty($this->dateend)) $this->durationa=($this->dateend - $this->date); + if (! empty($this->datep) && ! empty($this->datef) && $this->datep > $this->datef) $this->datef=$this->datep; + if (! empty($this->date) && ! empty($this->dateend) && $this->date > $this->dateend) $this->dateend=$this->date; + if (! isset($this->fk_project) || $this->fk_project < 0) $this->fk_project = 0; if ($this->elementtype=='facture') $this->elementtype='invoice'; if ($this->elementtype=='commande') $this->elementtype='order'; if ($this->elementtype=='contrat') $this->elementtype='contract'; @@ -186,19 +186,19 @@ class ActionComm extends CommonObject $sql.= (strval($this->datef)!=''?"'".$this->db->idate($this->datef)."'":"null").","; //$sql.= (strval($this->date)!=''?"'".$this->db->idate($this->date)."'":"null").","; //$sql.= (strval($this->dateend)!=''?"'".$this->db->idate($this->dateend)."'":"null").","; - $sql.= ($this->durationp >= 0 && $this->durationp != ''?"'".$this->durationp."'":"null").","; + $sql.= (isset($this->durationp) && $this->durationp >= 0 && $this->durationp != ''?"'".$this->durationp."'":"null").","; //$sql.= ($this->durationa >= 0 && $this->durationa != ''?"'".$this->durationa."'":"null").","; $sql.= " '".$this->type_id."',"; - $sql.= ($this->societe->id>0?" '".$this->societe->id."'":"null").","; - $sql.= ($this->fk_project>0?" '".$this->fk_project."'":"null").","; + $sql.= (isset($this->societe->id) && $this->societe->id > 0?" '".$this->societe->id."'":"null").","; + $sql.= (isset($this->fk_project) && $this->fk_project > 0?" '".$this->fk_project."'":"null").","; $sql.= " '".$this->db->escape($this->note)."',"; - $sql.= ($this->contact->id > 0?"'".$this->contact->id."'":"null").","; - $sql.= ($user->id > 0 ? "'".$user->id."'":"null").","; - $sql.= ($this->usertodo->id > 0?"'".$this->usertodo->id."'":"null").","; - $sql.= ($this->userdone->id > 0?"'".$this->userdone->id."'":"null").","; + $sql.= (isset($this->contact->id) && $this->contact->id > 0?"'".$this->contact->id."'":"null").","; + $sql.= (isset($user->id) && $user->id > 0 ? "'".$user->id."'":"null").","; + $sql.= (isset($this->usertodo->id) && $this->usertodo->id > 0?"'".$this->usertodo->id."'":"null").","; + $sql.= (isset($this->userdone->id) && $this->userdone->id > 0?"'".$this->userdone->id."'":"null").","; $sql.= "'".$this->db->escape($this->label)."','".$this->percentage."','".$this->priority."','".$this->fulldayevent."','".$this->db->escape($this->location)."','".$this->punctual."',"; - $sql.= ($this->fk_element?$this->fk_element:"null").","; - $sql.= ($this->elementtype?"'".$this->elementtype."'":"null").","; + $sql.= (! empty($this->fk_element)?$this->fk_element:"null").","; + $sql.= (! empty($this->elementtype)?"'".$this->elementtype."'":"null").","; $sql.= $conf->entity; $sql.= ")"; diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php index aec3b331d45..7d7bd4a0595 100644 --- a/htdocs/comm/action/fiche.php +++ b/htdocs/comm/action/fiche.php @@ -93,13 +93,14 @@ if ($action == 'add_action') } $fulldayevent=GETPOST('fullday'); + $percentage=in_array(GETPOST('status'),array(-1,100))?GETPOST('status'):GETPOST("percentage"); // If status is -1 or 100, percentage is not defined and we must use status // Clean parameters $datep=dol_mktime($fulldayevent?'00':$_POST["aphour"], $fulldayevent?'00':$_POST["apmin"], 0, $_POST["apmonth"], $_POST["apday"], $_POST["apyear"]); $datef=dol_mktime($fulldayevent?'23':$_POST["p2hour"], $fulldayevent?'59':$_POST["p2min"], $fulldayevent?'59':'0', $_POST["p2month"], $_POST["p2day"], $_POST["p2year"]); // Check parameters - if (! $datef && GETPOST('percentage') == 100) + if (! $datef && $percentage == 100) { $error++; $action = 'create'; @@ -143,7 +144,7 @@ if ($action == 'add_action') $actioncomm->fk_project = isset($_POST["projectid"])?$_POST["projectid"]:0; $actioncomm->datep = $datep; $actioncomm->datef = $datef; - $actioncomm->percentage = isset($_POST["percentage"])?$_POST["percentage"]:0; + $actioncomm->percentage = $percentage; $actioncomm->duree=((GETPOST('dureehour') * 60) + GETPOST('dureemin')) * 60; $usertodo=new User($db); @@ -266,7 +267,7 @@ if ($action == 'confirm_delete' && GETPOST("confirm") == 'yes') } /* - * Action mise a jour de l'action + * Action update event */ if ($action == 'update') { @@ -277,14 +278,13 @@ if ($action == 'update') $apmin=GETPOST('apmin'); $p2hour=GETPOST('p2hour'); $p2min=GETPOST('p2min'); + $percentage=in_array(GETPOST('status'),array(-1,100))?GETPOST('status'):GETPOST("percentage"); // If status is -1 or 100, percentage is not defined and we must use status // Clean parameters if ($aphour == -1) $aphour='0'; if ($apmin == -1) $apmin='0'; if ($p2hour == -1) $p2hour='0'; if ($p2min == -1) $p2min='0'; - //if ($_POST["adhour"] == -1) $_POST["adhour"]='0'; - //if ($_POST["admin"] == -1) $_POST["admin"]='0'; $actioncomm = new Actioncomm($db); $actioncomm->fetch($id); @@ -295,9 +295,7 @@ if ($action == 'update') $actioncomm->label = $_POST["label"]; $actioncomm->datep = $datep; $actioncomm->datef = $datef; - //$actioncomm->date = $datea; - //$actioncomm->dateend = $datea2; - $actioncomm->percentage = $_POST["percentage"]; + $actioncomm->percentage = $percentage; $actioncomm->priority = $_POST["priority"]; $actioncomm->fulldayevent= $_POST["fullday"]?1:0; $actioncomm->location = isset($_POST["location"])?$_POST["location"]:''; @@ -307,7 +305,7 @@ if ($action == 'update') $actioncomm->note = $_POST["note"]; $actioncomm->pnote = $_POST["note"]; - if (! $datef && $_POST["percentage"] == 100) + if (! $datef && $percentage == 100) { $error=$langs->trans("ErrorFieldRequired",$langs->trans("DateEnd")); $action = 'edit'; @@ -809,7 +807,7 @@ if ($id) // Affichage fiche action en mode visu print ''; - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; // Ref print ''; print ''; print ''; print ''; print ''; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 04fc64cdc6b..d14eadca5b5 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1688,7 +1688,7 @@ class Facture extends CommonInvoice $result=$this->client->set_as_client(); // Si active on decremente le produit principal et ses composants a la validation de facture - if ($this->type != 3 && $result >= 0 && $conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_BILL) + if ($this->type != 3 && $result >= 0 && ! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_BILL)) { require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; $langs->load("agenda"); diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php index 102f28d696e..1460d87bfba 100644 --- a/htdocs/core/ajax/ajaxdirpreview.php +++ b/htdocs/core/ajax/ajaxdirpreview.php @@ -61,8 +61,8 @@ if (! isset($mode) || $mode != 'noajax') // For ajax call $result=$ecmdir->fetch($section); if (! $result > 0) { - dol_print_error($db,$ecmdir->error); - exit; + //dol_print_error($db,$ecmdir->error); + //exit; } } else // For no ajax call @@ -223,6 +223,16 @@ if ($type == 'directory') $formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$user->rights->ecm->upload,1,$textifempty,$maxlengthname,$url); } + else if ($module == 'product') // Auto area for products + { + $upload_dir = $conf->product->dir_output; + $filearray=dol_dir_list($upload_dir,"files",1,'',array('^SPECIMEN\.pdf$','^\.','\.meta$','^temp$','^CVS$','^thumbs$'),$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); + + $param.='&module='.$module; + $textifempty=($section?$langs->trans("NoFileFound"):($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("NoFileFound"))); + + $formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$user->rights->ecm->upload,1,$textifempty,$maxlengthname,$url); + } else if ($module == 'tax') // Auto area for suppliers invoices { $upload_dir = $conf->tax->dir_output; diff --git a/htdocs/core/ajax/ajaxdirtree.php b/htdocs/core/ajax/ajaxdirtree.php index 9de59a527d1..21487924b91 100644 --- a/htdocs/core/ajax/ajaxdirtree.php +++ b/htdocs/core/ajax/ajaxdirtree.php @@ -78,7 +78,7 @@ $userstatic=new User($db); $form=new Form($db); $ecmdirstatic = new EcmDirectory($db); -// Load full tree. We will use it to define nbofsubdir and nboffilesinsubdir +// Load full tree from database. We will use it to define nbofsubdir and nboffilesinsubdir if (empty($sqltree)) $sqltree=$ecmdirstatic->get_full_arbo(0); // Try to find key into $sqltree @@ -93,13 +93,13 @@ foreach($sqltree as $keycursor => $val) } -if( file_exists($fullpathselecteddir) ) +if (file_exists($fullpathselecteddir)) { $files = @scandir($fullpathselecteddir); if ($files) { natcasesort($files); - if( count($files) > 2 ) /* The 2 accounts for . and .. */ + if ( count($files) > 2 ) /* The 2 accounts for . and .. */ { echo "
    \n"; @@ -111,16 +111,27 @@ if( file_exists($fullpathselecteddir) ) $nbofsubdir=0; $nboffilesinsubdir=0; - // Try to find key into $sqltree $val=array(); + // Loop on all database entries (sqltree) to find the one matching the subdir found into dir to scan foreach($sqltree as $key => $tmpval) { - //print "-- ".$val['fullrelativename']." vs ".(($selecteddir != '/'?$selecteddir.'/':'').$file).'
    '; - if ($tmpval['fullrelativename'] == (($selecteddir != '/'?$selecteddir.'/':'').$file)) + //print "-- key=".$key." - ".$val['fullrelativename']." vs ".(($selecteddir != '/'?$selecteddir.'/':'').$file).'
    '; + if ($tmpval['fullrelativename'] == (($selecteddir != '/'?$selecteddir.'/':'').$file)) // We found equivalent record into database { $val=$tmpval; - $resarray=tree_showpad($sqltree,$key,1); + $resarray=tree_showpad($sqltree,$key,1); + + // Refresh cache for this subdir + if (isset($val['cachenbofdoc']) && $val['cachenbofdoc'] < 0) // Cache is not up to date, so we update it for this directory t + { + $result=$ecmdirstatic->fetch($val['id']); + $ecmdirstatic->ref=$ecmdirstatic->label; + + $result=$ecmdirstatic->refreshcachenboffile(0); + $val['cachenbofdoc']=$result; + } + $a=$resarray[0]; $nbofsubdir=$resarray[1]; $nboffilesinsubdir=$resarray[2]; @@ -128,10 +139,18 @@ if( file_exists($fullpathselecteddir) ) } } - //if (file_exists($fullpathselecteddir . $file) && $file != '.' && $file != '..' && is_dir($fullpathselecteddir . $file)) - if ($file != '.' && $file != '..' && ((! empty($val['fullrelativename']) && $val['id'] >= 0) || dol_is_dir($fullpathselecteddir . $file))) + //print 'modulepart='.$modulepart.' fullpathselecteddir='.$fullpathselecteddir.' - val[fullrelativename] (in database)='.$val['fullrelativename'].' - val[id]='.$val['id'].' - is_dir='.dol_is_dir($fullpathselecteddir . $file).' - file='.$file."\n"; + if ($file != '.' && $file != '..' && ((! empty($val['fullrelativename']) && $val['id'] >= 0) || dol_is_dir($fullpathselecteddir . (preg_match('/\/$/',$fullpathselecteddir)?'':'/') . $file))) { - print '
'; print ''; // Edit link @@ -163,16 +182,16 @@ if( file_exists($fullpathselecteddir) ) // Info print '"; diff --git a/htdocs/core/ajax/constantonoff.php b/htdocs/core/ajax/constantonoff.php index a79a9f5d0ff..d195df7631f 100644 --- a/htdocs/core/ajax/constantonoff.php +++ b/htdocs/core/ajax/constantonoff.php @@ -30,6 +30,8 @@ if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +$action=GETPOST('action','alpha'); +$name=GETPOST('name','alpha'); /* * View @@ -45,17 +47,16 @@ top_httphead(); print ''."\n"; // Registering the location of boxes -if ((isset($_GET['action']) && ! empty($_GET['action'])) && (isset($_GET['name']) && ! empty($_GET['name'])) ) +if (! empty($action) && ! empty($name)) { $entity = GETPOST('entity','int'); - $action = GETPOST('action', 'alpha'); - $name = GETPOST('name', 'alpha'); + $value = (GETPOST('value')?GETPOST('value'):1); if ($user->admin) { if ($action == 'set') { - dolibarr_set_const($db, $name, 1, 'chaine', 0, '', $entity); + dolibarr_set_const($db, $name, $value, 'chaine', 0, '', $entity); } else if ($action == 'del') { diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 9a589a06fa6..5007dca817f 100755 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -1,8 +1,8 @@ - * Copyright (C) 2004-2010 Laurent Destailleur - * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2005-2007 Regis Houssin +/* Copyright (C) 2003-2005 Rodolphe Quiedeville + * Copyright (C) 2004-2010 Laurent Destailleur + * Copyright (C) 2004 Eric Seigne + * Copyright (C) 2005-2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -50,11 +50,11 @@ abstract class CommonDocGenerator 'myuser_lastname'=>$user->lastname, 'myuser_firstname'=>$user->firstname, 'myuser_login'=>$user->login, - 'myuser_phone'=>$user->officephone, - 'myuser_fax'=>$user->officefax, + 'myuser_phone'=>$user->office_phone, + 'myuser_fax'=>$user->office_fax, 'myuser_mobile'=>$user->user_mobile, - 'myuser_email'=>$user->user_email, - 'myuser_web'=>$user->url + 'myuser_email'=>$user->email, + 'myuser_web'=>'' // url not exist in $user object ); } diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index fc44cc02332..514d6e06cad 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -382,6 +382,9 @@ class Conf if (! isset($this->global->MAIN_MAX_DECIMALS_TOT)) $this->global->MAIN_MAX_DECIMALS_TOT=2; if (! isset($this->global->MAIN_MAX_DECIMALS_SHOWN)) $this->global->MAIN_MAX_DECIMALS_SHOWN=8; + // Default max file size for upload + $this->maxfilesize = (! empty($this->global->MAIN_UPLOAD_DOC) ? $this->global->MAIN_UPLOAD_DOC * 1024 : 0); + // Timeouts if (empty($this->global->MAIN_USE_CONNECT_TIMEOUT)) $this->global->MAIN_USE_CONNECT_TIMEOUT=10; if (empty($this->global->MAIN_USE_RESPONSE_TIMEOUT)) $this->global->MAIN_USE_RESPONSE_TIMEOUT=30; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index b2978a7bc4d..c6a4141c152 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -985,8 +985,8 @@ class Form $out=''; // On recherche les utilisateurs - $sql = "SELECT u.rowid, u.name as lastname, u.firstname, u.login, u.admin, u.entity"; - if(! empty($conf->multicompany->enabled) && $conf->entity == 1 && $user->admin && ! $user->entity) + $sql = "SELECT DISTINCT u.rowid, u.name as lastname, u.firstname, u.login, u.admin, u.entity"; + if (! empty($conf->multicompany->enabled) && $conf->entity == 1 && $user->admin && ! $user->entity) { $sql.= ", e.label"; } @@ -999,7 +999,16 @@ class Form } else { - $sql.= " WHERE u.entity IN (0,".$conf->entity.")"; + if (! empty($conf->multicompany->transverse_mode)) + { + $sql.= ", ".MAIN_DB_PREFIX."usergroup_user as ug"; + $sql.= " WHERE ug.fk_user = u.rowid"; + $sql.= " AND ug.entity = ".$conf->entity; + } + else + { + $sql.= " WHERE u.entity IN (0,".$conf->entity.")"; + } } if (! empty($user->societe_id)) $sql.= " AND u.fk_societe = ".$user->societe_id; if (is_array($exclude) && $excludeUsers) $sql.= " AND u.rowid NOT IN ('".$excludeUsers."')"; diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index ed6321ec47a..9435cebb1a4 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -49,7 +49,7 @@ class FormActions * Show list of action status * * @param string $formname Name of form where select in included - * @param string $selected Preselected value + * @param string $selected Preselected value (-1..100) * @param int $canedit 1=can edit, 0=read only * @param string $htmlname Name of html prefix for html fields (selectX and valX) * @return void @@ -96,15 +96,18 @@ class FormActions $('.hideifna').hide(); } else if (defaultvalue == 0) { - percentage.attr('disabled', 'disabled'); + percentage.val(0); + percentage.attr('disabled', 'disabled'); $('.hideifna').show(); } else if (defaultvalue == 100) { + percentage.val(100); percentage.attr('disabled', 'disabled'); $('.hideifna').show(); } else { - percentage.removeAttr('disabled'); + if (defaultvalue == 50 && (percentage.val() == 0 || percentage.val() == 100)) { percentage.val(50) }; + percentage.removeAttr('disabled'); $('.hideifna').show(); } } diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 34b6a9448d7..74f190074b6 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -495,17 +495,18 @@ class FormFile $out.= ''."\n"; if (! $iconPDF) { + $size=(! empty($file['size'])?$file['size']:dol_filesize($filedir."/".$file["name"])); + $date=(! empty($file['date'])?$file['date']:dol_filemtime($filedir."/".$file["name"])); $out.= ''; // Show file size - $out.= ''; + $out.= ''; // Show file date - $out.= ''; + $out.= ''; } if ($delallowed) { $out.= 'global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>>
trans('AddNewLine'); ?> -
- - - - + + + + + - + diff --git a/htdocs/core/tpl/passwordforgotten.tpl.php b/htdocs/core/tpl/passwordforgotten.tpl.php index c9ea31a7117..e786e4ce69a 100644 --- a/htdocs/core/tpl/passwordforgotten.tpl.php +++ b/htdocs/core/tpl/passwordforgotten.tpl.php @@ -34,11 +34,30 @@ print ' print ''."\n"; if (constant('JS_JQUERY_UI')) print ''."\n"; // JQuery else print ''."\n"; // JQuery +// CSS forced by modules (relative url starting with /) +if (isset($conf->modules_parts['css'])) +{ + $arraycss=(array) $conf->modules_parts['css']; + foreach($arraycss as $modcss => $filescss) + { + $filescss=(array) $filescss; // To be sure filecss is an array + foreach($filescss as $cssfile) + { + // cssfile is a relative path + print ''."\n"; + } + } +} // JQuery. Must be before other includes +$ext='.js'; +if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x01)) $ext='.jgz'; print ''."\n"; if (constant('JS_JQUERY')) print ''."\n"; else print ''."\n"; -print ''."\n"; +print ''."\n"; if (! empty($conf->global->MAIN_HTML_HEADER)) print $conf->global->MAIN_HTML_HEADER; print ''; @@ -68,12 +87,17 @@ print ' id="username" name="username" class="flat" size="15" maxlength="25" value="" tabindex="1" /> - - - - +resArray['options'])) { + foreach ($hookmanager->resArray['options'] as $format => $option) + { + if ($format == 'table') { + echo ''; + echo $option; + } + } +} +?> diff --git a/htdocs/document.php b/htdocs/document.php index 5ec0f4686ab..0fa3f3d4d8f 100644 --- a/htdocs/document.php +++ b/htdocs/document.php @@ -75,46 +75,17 @@ if (empty($modulepart)) accessforbidden('Bad value for parameter modulepart'); $type = 'application/octet-stream'; if (GETPOST('type','alpha')) $type=GETPOST('type','alpha'); else $type=dol_mimetype($original_file); -//print 'X'.$type.'-'.$original_file;exit; -// Define attachment (attachment=true to force choice popup 'open'/'save as') -$attachment = true; -// Text files -if (preg_match('/\.txt$/i',$original_file)) { $attachment = false; } -if (preg_match('/\.csv$/i',$original_file)) { $attachment = true; } -if (preg_match('/\.tsv$/i',$original_file)) { $attachment = true; } -// Documents MS office -if (preg_match('/\.doc(x)?$/i',$original_file)) { $attachment = true; } -if (preg_match('/\.dot(x)?$/i',$original_file)) { $attachment = true; } -if (preg_match('/\.mdb$/i',$original_file)) { $attachment = true; } -if (preg_match('/\.ppt(x)?$/i',$original_file)) { $attachment = true; } -if (preg_match('/\.xls(x)?$/i',$original_file)) { $attachment = true; } -// Documents Open office -if (preg_match('/\.odp$/i',$original_file)) { $attachment = true; } -if (preg_match('/\.ods$/i',$original_file)) { $attachment = true; } -if (preg_match('/\.odt$/i',$original_file)) { $attachment = true; } -// Misc -if (preg_match('/\.(html|htm)$/i',$original_file)) { $attachment = false; } -if (preg_match('/\.pdf$/i',$original_file)) { $attachment = true; } -if (preg_match('/\.sql$/i',$original_file)) { $attachment = true; } -// Images -if (preg_match('/\.jpg$/i',$original_file)) { $attachment = true; } -if (preg_match('/\.jpeg$/i',$original_file)) { $attachment = true; } -if (preg_match('/\.png$/i',$original_file)) { $attachment = true; } -if (preg_match('/\.gif$/i',$original_file)) { $attachment = true; } -if (preg_match('/\.bmp$/i',$original_file)) { $attachment = true; } -if (preg_match('/\.tiff$/i',$original_file)) { $attachment = true; } -// Calendar -if (preg_match('/\.vcs$/i',$original_file)) { $attachment = true; } -if (preg_match('/\.ics$/i',$original_file)) { $attachment = true; } -if (GETPOST("attachment")) { $attachment = true; } -if (! empty($conf->global->MAIN_DISABLE_FORCE_SAVEAS)) $attachment=false; -//print "XX".$attachment;exit; +// Define attachment (attachment=true to force choice popup 'open'/'save as') +$attachment = true; +if (preg_match('/\.(html|htm)$/i',$original_file)) $attachment = false; +if (isset($_GET["attachment"])) $attachment = GETPOST("attachment")?true:false; +if (! empty($conf->global->MAIN_DISABLE_FORCE_SAVEAS)) $attachment=false; -// Suppression de la chaine de caractere ../ dans $original_file -$original_file = str_replace("../","/", $original_file); - -// find the subdirectory name as the reference +// Suppression de la chaine de caractere ../ dans $original_file +$original_file = str_replace("../","/", $original_file); + +// Find the subdirectory name as the reference $refname=basename(dirname($original_file)."/"); // Security check @@ -382,6 +353,14 @@ if ($modulepart) $original_file=$conf->admin->dir_output.'/'.$original_file; } + // Wrapping for upload file test + else if ($modulepart == 'admin_temp') + { + if ($user->admin) + $accessallowed=1; + $original_file=$conf->admin->dir_temp.'/'.$original_file; + } + // Wrapping pour BitTorrent else if ($modulepart == 'bittorrent') { @@ -483,65 +462,38 @@ if (preg_match('/\.\./',$original_file) || preg_match('/[<>|]/',$original_file)) exit; } -// TODO Remove this. Some part of code still use it. -if ($action == 'remove_file') // Remove a file + +clearstatcache(); + +$filename = basename($original_file); + +// Output file on browser +dol_syslog("document.php download $original_file $filename content-type=$type"); +$original_file_osencoded=dol_osencode($original_file); // New file name encoded in OS encoding charset + +// This test if file exists should be useless. We keep it to find bug more easily +if (! file_exists($original_file_osencoded)) { - clearstatcache(); - - dol_syslog("document.php remove $original_file $urlsource", LOG_DEBUG); - - // This test should be useless. We keep it to find bug more easily - $original_file_osencoded=dol_osencode($original_file); // New file name encoded in OS encoding charset - if (! file_exists($original_file_osencoded)) - { - $file=basename($original_file); // Do no show plain path of original_file in shown error message - dol_print_error(0,$langs->trans("ErrorFileDoesNotExists",$file)); - exit; - } - - $ret=dol_delete_file($original_file); - if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); - else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); - - dol_syslog("document.php back to ".urldecode($urlsource), LOG_DEBUG); - - header("Location: ".urldecode($urlsource)); - - return; + dol_print_error(0,$langs->trans("ErrorFileDoesNotExists",$original_file)); + exit; } -else // Open and return file -{ - clearstatcache(); - $filename = basename($original_file); +// Les drois sont ok et fichier trouve, on l'envoie - // Output file on browser - dol_syslog("document.php download $original_file $filename content-type=$type"); - $original_file_osencoded=dol_osencode($original_file); // New file name encoded in OS encoding charset +header('Content-Description: File Transfer'); +if ($encoding) header('Content-Encoding: '.$encoding); +if ($type) header('Content-Type: '.$type.(preg_match('/text/',$type)?'; charset="'.$conf->file->character_set_client:'')); +// Add MIME Content-Disposition from RFC 2183 (inline=automatically displayed, atachment=need user action to open) +if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"'); +else header('Content-Disposition: inline; filename="'.$filename.'"'); +header('Content-Length: ' . dol_filesize($original_file)); +// Ajout directives pour resoudre bug IE +header('Cache-Control: Public, must-revalidate'); +header('Pragma: public'); - // This test if file exists should be useless. We keep it to find bug more easily - if (! file_exists($original_file_osencoded)) - { - dol_print_error(0,$langs->trans("ErrorFileDoesNotExists",$original_file)); - exit; - } +//ob_clean(); +//flush(); - // Les drois sont ok et fichier trouve, on l'envoie - - header('Content-Description: File Transfer'); - if ($encoding) header('Content-Encoding: '.$encoding); - if ($type) header('Content-Type: '.$type.(preg_match('/text/',$type)?'; charset="'.$conf->file->character_set_client:'')); - if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"'); - else header('Content-Disposition: inline; filename="'.$filename.'"'); - header('Content-Length: ' . dol_filesize($original_file)); - // Ajout directives pour resoudre bug IE - header('Cache-Control: Public, must-revalidate'); - header('Pragma: public'); - - //ob_clean(); - //flush(); - - readfile($original_file_osencoded); -} +readfile($original_file_osencoded); ?> diff --git a/htdocs/ecm/class/ecmdirectory.class.php b/htdocs/ecm/class/ecmdirectory.class.php index 6a20cca9426..f42444a986c 100644 --- a/htdocs/ecm/class/ecmdirectory.class.php +++ b/htdocs/ecm/class/ecmdirectory.class.php @@ -20,13 +20,11 @@ * \file htdocs/ecm/class/ecmdirectory.class.php * \ingroup ecm * \brief This file is an example for a class file - * \author Laurent Destailleur */ /** * \class EcmDirectory * \brief Class to manage ECM directories - * \remarks Initialy built by build_class_from_table on 2008-02-24 19:24 */ class EcmDirectory // extends CommonObject { @@ -38,7 +36,7 @@ class EcmDirectory // extends CommonObject var $label; var $fk_parent; var $description; - var $cachenbofdoc; + var $cachenbofdoc=-1; // By default cache initialized with value 'not calculated' var $date_c; var $date_m; @@ -77,7 +75,6 @@ class EcmDirectory // extends CommonObject $this->label=dol_sanitizeFileName(trim($this->label)); $this->fk_parent=trim($this->fk_parent); $this->description=trim($this->description); - if (! $this->cachenbofdoc) $this->cachenbofdoc=0; $this->date_c=$now; $this->fk_user_c=$user->id; if ($this->fk_parent <= 0) $this->fk_parent=0; @@ -132,7 +129,7 @@ class EcmDirectory // extends CommonObject $sql.= " '".$conf->entity."',"; $sql.= " '".$this->fk_parent."',"; $sql.= " '".$this->db->escape($this->description)."',"; - $sql.= " ".($this->cachenbofdoc).","; + $sql.= " ".$this->cachenbofdoc.","; $sql.= " '".$this->db->idate($this->date_c)."',"; $sql.= " '".$this->fk_user_c."'"; $sql.= ")"; @@ -544,8 +541,7 @@ class EcmDirectory // extends CommonObject $sql.= " c.date_c,"; $sql.= " u.login as login_c,"; $sql.= " ca.rowid as rowid_fille"; - $sql.= " FROM ".MAIN_DB_PREFIX."user as u"; - $sql.= ", ".MAIN_DB_PREFIX."ecm_directories as c"; + $sql.= " FROM ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."ecm_directories as c"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."ecm_directories as ca"; $sql.= " ON c.rowid = ca.fk_parent"; $sql.= " WHERE c.fk_user_c = u.rowid"; @@ -569,9 +565,9 @@ class EcmDirectory // extends CommonObject $this->cats[$obj->rowid]['fk_user_c'] = $obj->fk_user_c; $this->cats[$obj->rowid]['login_c'] = $obj->login_c; - if ($obj->rowid_fille) + if (! empty($obj->rowid_fille)) { - if (is_array($this->cats[$obj->rowid]['id_children'])) + if (isset($this->cats[$obj->rowid]['id_children']) && is_array($this->cats[$obj->rowid]['id_children'])) { $newelempos=count($this->cats[$obj->rowid]['id_children']); //print "this->cats[$i]['id_children'] est deja un tableau de $newelem elements
"; @@ -650,10 +646,10 @@ class EcmDirectory // extends CommonObject } /** - * Refresh value for cachenboffile + * Refresh value for cachenboffile. This scan and count files into directory. * - * @param int $all 0=refresh this id , 1=refresh this entity - * @return int <0 if KO, Nb of files in directory if OK + * @param int $all 0=refresh record using this->id , 1=refresh record using this->entity + * @return int -1 if KO, Nb of files in directory if OK */ function refreshcachenboffile($all=0) { diff --git a/htdocs/ecm/docdir.php b/htdocs/ecm/docdir.php index 30a90e1c26d..5cf1deb331b 100644 --- a/htdocs/ecm/docdir.php +++ b/htdocs/ecm/docdir.php @@ -124,7 +124,7 @@ if ($action == 'add' && $user->rights->ecm->setup) } // Suppression fichier -if ($action == 'confirm_deletesection' && $confirm == 'yes') +else if ($action == 'confirm_deletesection' && $confirm == 'yes') { $result=$ecmdir->delete($user); setEventMessage($langs->trans("ECMSectionWasRemoved", $ecmdir->label)); diff --git a/htdocs/ecm/index.php b/htdocs/ecm/index.php index d034e66af3d..17b00274582 100644 --- a/htdocs/ecm/index.php +++ b/htdocs/ecm/index.php @@ -205,7 +205,7 @@ if ($action == 'refreshmanual') $diroutputslash.='/'; // Scan directory tree on disk - $disktree=dol_dir_list($conf->ecm->dir_output,'directories',1,'','','','',0); + $disktree=dol_dir_list($conf->ecm->dir_output,'directories',1,'','^temp$','','',0); // Scan directory tree in database $sqltree=$ecmdirstatic->get_full_arbo(0); @@ -283,7 +283,7 @@ if ($action == 'refreshmanual') $txt="We create directory ".$ecmdirtmp->label." with parent ".$fk_parent; dol_syslog($txt); - //print $txt."
\n"; + //print $ecmdirtmp->cachenbofdoc."
\n";exit; $id = $ecmdirtmp->create($user); if ($id > 0) { @@ -309,7 +309,8 @@ if ($action == 'refreshmanual') } } - $sql="UPDATE ".MAIN_DB_PREFIX."ecm_directories set cachenbofdoc=0 WHERE cachenbofdoc < 0"; + $sql="UPDATE ".MAIN_DB_PREFIX."ecm_directories set cachenbofdoc = -1 WHERE cachenbofdoc < 0"; // If pb into cahce counting, we set to value -1 = "unknown" + dol_syslog("sql = ".$sql); $db->query($sql); // If a directory was added, the fulltree array is not correctly completed and sorted, so we clean @@ -378,7 +379,7 @@ llxHeader($moreheadcss.$moreheadjs,$langs->trans("ECMArea"),'','','','',$morejs, // Add sections to manage $rowspan=0; $sectionauto=array(); -if ($conf->product->enabled || $conf->service->enabled) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'product', 'test'=>$conf->product->enabled, 'label'=>$langs->trans("ProductsAndServices"), 'desc'=>$langs->trans("ECMDocsByProducts")); } +if ($conf->product->enabled || $conf->service->enabled) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'product', 'test'=>($conf->product->enabled || $conf->service->enabled), 'label'=>$langs->trans("ProductsAndServices"), 'desc'=>$langs->trans("ECMDocsByProducts")); } if ($conf->societe->enabled) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'company', 'test'=>$conf->societe->enabled, 'label'=>$langs->trans("ThirdParties"), 'desc'=>$langs->trans("ECMDocsByThirdParties")); } if ($conf->propal->enabled) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'propal', 'test'=>$conf->propal->enabled, 'label'=>$langs->trans("Prop"), 'desc'=>$langs->trans("ECMDocsByProposals")); } if ($conf->contrat->enabled) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'contract','test'=>$conf->contrat->enabled, 'label'=>$langs->trans("Contracts"), 'desc'=>$langs->trans("ECMDocsByContracts")); } @@ -693,7 +694,7 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$acti $result=$ecmdirstatic->fetch($val['id']); $ecmdirstatic->ref=$ecmdirstatic->label; - $result=$ecmdirstatic->refreshcachenboffile(); + $result=$ecmdirstatic->refreshcachenboffile(0); $val['cachenbofdoc']=$result; } diff --git a/htdocs/ecm/search.php b/htdocs/ecm/search.php index 16ca5d56a36..8870d50c639 100644 --- a/htdocs/ecm/search.php +++ b/htdocs/ecm/search.php @@ -48,9 +48,9 @@ $result = restrictedArea($user, 'ecm',''); $user->getrights('ecm'); // Get parameters -$socid = isset($_GET["socid"])?$_GET["socid"]:''; -$action = isset($_GET["action"])?$_GET["action"]:$_POST['action']; -$section=isset($_GET["section"])?$_GET["section"]:$_POST['section']; +$socid = GETPOST('socid','int'); +$action = GETPOST('action','alpha'); +$section=GETPOST('section'); if (! $section) $section=0; $upload_dir = $conf->ecm->dir_output.'/'.$section; @@ -66,9 +66,9 @@ if (! $sortorder) $sortorder="ASC"; if (! $sortfield) $sortfield="label"; $ecmdir = new EcmDirectory($db); -if (! empty($_REQUEST["section"])) +if (! empty($section)) { - $result=$ecmdir->fetch($_REQUEST["section"]); + $result=$ecmdir->fetch($section); if (! $result > 0) { dol_print_error($db,$ecmdir->error); @@ -123,10 +123,8 @@ print_fiche_titre($langs->trans("ECMArea").' - '.$langs->trans("Search")); //print "
\n"; print $langs->trans("FeatureNotYetAvailable").'.

'; -if ($mesg) { print $mesg."
"; } - // Tool bar -$head = ecm_prepare_head_fm($fac); +$head = ecm_prepare_head_fm($ecmdir); //dol_fiche_head($head, 'search_form', '', 1); @@ -210,7 +208,6 @@ print '
'.$langs->trans("Ref").''; diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php index 1d811b0149c..cfe2b4c4fb3 100644 --- a/htdocs/comm/remx.php +++ b/htdocs/comm/remx.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2008 Raphael Bertrand (Resultic) * * This program is free software; you can redistribute it and/or modify @@ -272,7 +272,7 @@ if ($socid > 0) print ' '.$langs->trans("Currency".$conf->currency).'
'.$langs->trans("VAT").''; - print $form->load_tva('tva_tx',GETPOST('tva_tx'),'',$mysoc,''); + print $form->load_tva('tva_tx',GETPOST('tva_tx'),$mysoc,$objsoc); print '
'.$langs->trans("NoteReason").'
'; - print isset($val['cachenbofdoc'])?$val['cachenbofdoc']:' '; + print (isset($val['cachenbofdoc']) && $val['cachenbofdoc'] >= 0)?$val['cachenbofdoc']:' '; print ''; - if ($nbofsubdir && $nboffilesinsubdir) print '+'.$nboffilesinsubdir.' '; + if ($nbofsubdir > 0 && $nboffilesinsubdir > 0) print '+'.$nboffilesinsubdir.' '; print ''; - $userstatic->id=$val['fk_user_c']; - $userstatic->lastname=$val['login_c']; + $userstatic->id=isset($val['fk_user_c'])?$val['fk_user_c']:0; + $userstatic->lastname=isset($val['login_c'])?$val['login_c']:0; $htmltooltip=''.$langs->trans("ECMSection").': '.$val['label'].'
'; $htmltooltip=''.$langs->trans("Type").': '.$langs->trans("ECMSectionManual").'
'; $htmltooltip.=''.$langs->trans("ECMCreationUser").': '.$userstatic->getNomUrl(1).'
'; - $htmltooltip.=''.$langs->trans("ECMCreationDate").': '.dol_print_date($val['date_c'],"dayhour").'
'; + $htmltooltip.=''.$langs->trans("ECMCreationDate").': '.(isset($val['date_c'])?dol_print_date($val['date_c'],"dayhour"):$langs->trans("NeedRefresh")).'
'; $htmltooltip.=''.$langs->trans("Description").': '.$val['description'].'
'; - $htmltooltip.=''.$langs->trans("ECMNbOfFilesInDir").': '.$val['cachenbofdoc'].'
'; - if ($nbofsubdir) $htmltooltip.=''.$langs->trans("ECMNbOfFilesInSubDir").': '.$nboffilesinsubdir; - else $htmltooltip.=''.$langs->trans("ECMNbOfSubDir").': '.$nbofsubdir.'
'; + $htmltooltip.=''.$langs->trans("ECMNbOfFilesInDir").': '.((isset($val['cachenbofdoc']) && $val['cachenbofdoc'] >= 0)?$val['cachenbofdoc']:$langs->trans("NeedRefresh")).'
'; + if ($nboffilesinsubdir > 0) $htmltooltip.=''.$langs->trans("ECMNbOfFilesInSubDir").': '.$nboffilesinsubdir; + else $htmltooltip.=''.$langs->trans("ECMNbOfSubDir").': '.($nbofsubdir >= 0 ? $nbofsubdir : $langs->trans("NeedRefresh")).'
'; print $form->textwithpicto('',$htmltooltip,1,"info"); print "
'.dol_print_size(dol_filesize($filedir."/".$file["name"])).''.dol_print_size($size).''.dol_print_date(dol_filemtime($filedir."/".$file["name"]),'dayhour').''.dol_print_date($date, 'dayhour').''; - //$out.= 'db); } + else if ($modulepart == 'product') + { + include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; + $object_instance=new Product($this->db); + } else if ($modulepart == 'tax') { include_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'; @@ -733,6 +738,7 @@ class FormFile if ($modulepart == 'order') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); } if ($modulepart == 'order_supplier') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); } if ($modulepart == 'contract') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); } + if ($modulepart == 'product') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); } if ($modulepart == 'tax') { preg_match('/(\d+)\/[^\/]+$/',$relativefile,$reg); $id=(isset($reg[1])?$reg[1]:''); } if (! $id && ! $ref) continue; diff --git a/htdocs/core/db/mysql.class.php b/htdocs/core/db/mysql.class.php index 8d6b08d90de..dc33a4eb17d 100644 --- a/htdocs/core/db/mysql.class.php +++ b/htdocs/core/db/mysql.class.php @@ -1,9 +1,9 @@ - * Copyright (C) 2002-2007 Rodolphe Quiedeville - * Copyright (C) 2004-2011 Laurent Destailleur - * Copyright (C) 2006 Andre Cianfarani - * Copyright (C) 2005-2009 Regis Houssin +/* Copyright (C) 2001 Fabien Seisen + * Copyright (C) 2002-2007 Rodolphe Quiedeville + * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2006 Andre Cianfarani + * Copyright (C) 2005-2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -714,7 +714,7 @@ class DoliDBMysql global $conf; // Type of encryption (2: AES (recommended), 1: DES , 0: no encryption) - $cryptType = ($conf->db->dolibarr_main_db_encryption?$conf->db->dolibarr_main_db_encryption:0); + $cryptType = (! empty($conf->db->dolibarr_main_db_encryption)?$conf->db->dolibarr_main_db_encryption:0); //Encryption key $cryptKey = (!empty($conf->db->dolibarr_main_db_cryptkey)?$conf->db->dolibarr_main_db_cryptkey:''); @@ -747,7 +747,7 @@ class DoliDBMysql global $conf; // Type of encryption (2: AES (recommended), 1: DES , 0: no encryption) - $cryptType = ($conf->db->dolibarr_main_db_encryption?$conf->db->dolibarr_main_db_encryption:0); + $cryptType = (!empty($conf->db->dolibarr_main_db_encryption)?$conf->db->dolibarr_main_db_encryption:0); //Encryption key $cryptKey = (!empty($conf->db->dolibarr_main_db_cryptkey)?$conf->db->dolibarr_main_db_cryptkey:''); diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 3db424d4db2..8db96ca32a1 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -1,9 +1,9 @@ - * Copyright (C) 2002-2005 Rodolphe Quiedeville - * Copyright (C) 2004-2011 Laurent Destailleur - * Copyright (C) 2006 Andre Cianfarani - * Copyright (C) 2005-2009 Regis Houssin +/* Copyright (C) 2001 Fabien Seisen + * Copyright (C) 2002-2005 Rodolphe Quiedeville + * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2006 Andre Cianfarani + * Copyright (C) 2005-2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -709,7 +709,7 @@ class DoliDBMysqli global $conf; // Type of encryption (2: AES (recommended), 1: DES , 0: no encryption) - $cryptType = ($conf->db->dolibarr_main_db_encryption?$conf->db->dolibarr_main_db_encryption:0); + $cryptType = (!empty($conf->db->dolibarr_main_db_encryption)?$conf->db->dolibarr_main_db_encryption:0); //Encryption key $cryptKey = (!empty($conf->db->dolibarr_main_db_cryptkey)?$conf->db->dolibarr_main_db_cryptkey:''); @@ -742,7 +742,7 @@ class DoliDBMysqli global $conf; // Type of encryption (2: AES (recommended), 1: DES , 0: no encryption) - $cryptType = ($conf->db->dolibarr_main_db_encryption?$conf->db->dolibarr_main_db_encryption:0); + $cryptType = (!empty($conf->db->dolibarr_main_db_encryption)?$conf->db->dolibarr_main_db_encryption:0); //Encryption key $cryptKey = (!empty($conf->db->dolibarr_main_db_cryptkey)?$conf->db->dolibarr_main_db_cryptkey:''); diff --git a/htdocs/core/js/blockUI.js b/htdocs/core/js/blockUI.js new file mode 100644 index 00000000000..9be6eaa4de1 --- /dev/null +++ b/htdocs/core/js/blockUI.js @@ -0,0 +1,90 @@ +// Copyright (C) 2012 Regis Houssin +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// or see http://www.gnu.org/ +// + +// +// \file htdocs/core/js/blockUI.js +// \brief File that include javascript functions for blockUI default options +// + +// Examples +$(document).ready(function() { + // override these in your code to change the default behavior and style + $.blockUI.defaults = { + + // styles applied when using $.growlUI + dolEventValidCSS: { + width: '350px', + top: '10px', + left: '', + right: '10px', + border: 'none', + padding: '5px', + opacity: 0.8, + cursor: 'default', + color: '#fff', + backgroundColor: '#e3f0db', + '-webkit-border-radius': '10px', + '-moz-border-radius': '10px', + 'border-radius': '10px' + }, + + // styles applied when using $.growlUI + dolEventErrorCSS: { + width: '350px', + top: '10px', + left: '', + right: '10px', + border: 'none', + padding: '5px', + opacity: 0.8, + cursor: 'default', + color: '#a72947', + backgroundColor: '#d79eac', + '-webkit-border-radius': '10px', + '-moz-border-radius': '10px', + 'border-radius': '10px' + } + + }; + + $.dolEventValid = function(title, message, timeout, onClose) { + var $m = $('
'); + if (title) $m.append('

'+title+'

'); + if (message) $m.append('

'+message+'

'); + if (timeout == undefined) timeout = 3000; + $.blockUI({ + message: $m, fadeIn: 200, fadeOut: 700, centerY: false, + timeout: timeout, showOverlay: false, + onUnblock: onClose, + css: $.blockUI.defaults.dolEventValidCSS + }); + }; + + $.dolEventError = function(title, message, timeout, onClose) { + var $m = $('
'); + if (title) $m.append('

'+title+'

'); + if (message) $m.append('

'+message+'

'); + if (timeout == undefined) timeout = 0; + $.blockUI({ + message: $m, fadeIn: 200, centerY: false, + timeout: timeout, showOverlay: false, + onUnblock: onClose, + css: $.blockUI.defaults.dolEventErrorCSS + }); + $('.dolEventError').click($.unblockUI); + }; +}); \ No newline at end of file diff --git a/htdocs/core/js/lib_head.js b/htdocs/core/js/lib_head.js index aee93a8f0dc..2f9de0c6e27 100644 --- a/htdocs/core/js/lib_head.js +++ b/htdocs/core/js/lib_head.js @@ -1,5 +1,5 @@ // Copyright (C) 2005-2010 Laurent Destailleur -// Copyright (C) 2005-2009 Regis Houssin +// Copyright (C) 2005-2012 Regis Houssin // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -627,8 +627,134 @@ function hideMessage(fieldId,message) { if (textbox.value == message) textbox.value = ''; } +/* + * + */ +function setConstant(url, code, input, entity) { + $.get( url, { + action: "set", + name: code, + entity: entity + }, + function() { + $("#set_" + code).hide(); + $("#del_" + code).show(); + $.each(input, function(type, data) { + // Enable another element + if (type == "disabled") { + $.each(data, function(key, value) { + $("#" + value).removeAttr("disabled"); + if ($("#" + value).hasClass("butActionRefused") == true) { + $("#" + value).removeClass("butActionRefused"); + $("#" + value).addClass("butAction"); + } + }); + // Show another element + } else if (type == "showhide" || type == "show") { + $.each(data, function(key, value) { + $("#" + value).show(); + }); + // Set another constant + } else if (type == "set") { + $.each(data, function(key, value) { + $("#set_" + key).hide(); + $("#del_" + key).show(); + $.get( url, { + action: "set", + name: key, + value: value, + entity: entity + }); + }); + } + }); + }); +} +/* + * + */ +function delConstant(url, code, input, entity) { + $.get( url, { + action: "del", + name: code, + entity: entity + }, + function() { + $("#del_" + code).hide(); + $("#set_" + code).show(); + $.each(input, function(type, data) { + // Disable another element + if (type == "disabled") { + $.each(data, function(key, value) { + $("#" + value).attr("disabled", true); + if ($("#" + value).hasClass("butAction") == true) { + $("#" + value).removeClass("butAction"); + $("#" + value).addClass("butActionRefused"); + } + }); + // Hide another element + } else if (type == "showhide" || type == "hide") { + $.each(data, function(key, value) { + $("#" + value).hide(); + }); + // Delete another constant + } else if (type == "del") { + $.each(data, function(key, value) { + $("#del_" + value).hide(); + $("#set_" + value).show(); + $.get( url, { + action: "del", + name: value, + entity: entity + }); + }); + } + }); + }); +} +/* + * + */ +function confirmConstantAction(action, url, code, input, box, entity, yesButton, noButton) { + $("#confirm_" + code) + .attr("title", box.title) + .html(box.content) + .dialog({ + resizable: false, + height: 170, + width: 500, + modal: true, + buttons: [ + { + text : yesButton, + click : function() { + if (action == "set") { + setConstant(url, code, input, entity); + } else if (action == "del") { + delConstant(url, code, input, entity); + } + // Close dialog + $(this).dialog("close"); + // Execute another function + if (box.function) { + var fnName = box.function; + if (window.hasOwnProperty(fnName)) { + window[fnName](); + } + } + } + }, + { + text : noButton, + click : function() { + $(this).dialog("close"); + } + } + ] + }); +} /* This is to allow to transform all select box into ajax autocomplete box * with just one line: $(function() { $( "#listmotifcons" ).combobox(); }); diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 2993197b660..e5b8a1d5f12 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -277,7 +277,7 @@ function ajax_dialog($title,$message,$w=350,$h=150) modal: true, buttons: { Ok: function() { - jQuery(this ).dialog(\'close\'); + jQuery(this).dialog(\'close\'); } } }); @@ -346,11 +346,11 @@ function ajax_combobox($htmlname, $event=array()) * On/off button for constant * * @param string $code Name of constant - * @param array $input Input element + * @param array $input Input element (enable/disable or show/hide another element, set/del another constant) * @param int $entity Entity to set * @return void */ -function ajax_constantonoff($code,$input=array(),$entity=false) +function ajax_constantonoff($code, $input=array(), $entity=false) { global $conf, $langs; @@ -359,65 +359,33 @@ function ajax_constantonoff($code,$input=array(),$entity=false) $out= ''; + $out.= ''; $out.= ''.img_picto($langs->trans("Disabled"),'switch_off').''; $out.= ''.img_picto($langs->trans("Enabled"),'switch_on').''; diff --git a/htdocs/core/lib/doc.lib.php b/htdocs/core/lib/doc.lib.php index d6da55569ca..bc5cd90951b 100644 --- a/htdocs/core/lib/doc.lib.php +++ b/htdocs/core/lib/doc.lib.php @@ -1,10 +1,10 @@ - * Copyright (C) 2006 Rodolphe Quiedeville - * Copyright (C) 2007 Patrick Raguin - * Copyright (C) 2010-2011 Regis Houssin - * Copyright (C) 2010 Juanjo Menent - * Copyright (C) 2012 Christophe Battarel +/* Copyright (C) 2006-2011 Laurent Destailleur + * Copyright (C) 2006 Rodolphe Quiedeville + * Copyright (C) 2007 Patrick Raguin + * Copyright (C) 2010-2012 Regis Houssin + * Copyright (C) 2010 Juanjo Menent + * Copyright (C) 2012 Christophe Battarel * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -43,10 +43,10 @@ function doc_getlinedesc($line,$outputlangs,$hideref=0,$hidedesc=0,$issupplierli global $db, $conf, $langs; $idprod=$line->fk_product; - $label=$line->label; if (empty($label)) $label=$line->libelle; - $desc=$line->desc; if (empty($desc)) $desc=$line->description; - $ref_supplier=$line->ref_supplier; if (empty($ref_supplier)) $ref_supplier=$line->ref_fourn; // TODO Not yet saved for supplier invoices, only supplier orders - $note=$line->note; + $label=(! empty($line->label)?$line->label:(! empty($line->libelle)?$line->libelle:'')); + $desc=(! empty($line->desc)?$line->desc:(! empty($line->description)?$line->description:'')); + $ref_supplier=(! empty($line->ref_supplier)?$line->ref_supplier:(! empty($line->ref_fourn)?$line->ref_fourn:'')); // TODO Not yet saved for supplier invoices, only supplier orders + $note=(! empty($line->note)?$line->note:''); if ($issupplierline) $prodser = new ProductFournisseur($db); else $prodser = new Product($db); @@ -55,7 +55,7 @@ function doc_getlinedesc($line,$outputlangs,$hideref=0,$hidedesc=0,$issupplierli { $prodser->fetch($idprod); // If a predefined product and multilang and on other lang, we renamed label with label translated - if ($conf->global->MAIN_MULTILANGS && ($outputlangs->defaultlang != $langs->defaultlang)) + if (! empty($conf->global->MAIN_MULTILANGS) && ($outputlangs->defaultlang != $langs->defaultlang)) { if (! empty($prodser->multilangs[$outputlangs->defaultlang]["label"]) && $label == $prodser->label) $label=$prodser->multilangs[$outputlangs->defaultlang]["label"]; if (! empty($prodser->multilangs[$outputlangs->defaultlang]["description"]) && $desc == $prodser->description) $desc=$prodser->multilangs[$outputlangs->defaultlang]["description"]; @@ -89,7 +89,8 @@ function doc_getlinedesc($line,$outputlangs,$hideref=0,$hidedesc=0,$issupplierli { if ($idprod) { - if ( empty($hidedesc) ) $libelleproduitservice.=$desc; + if (empty($hidedesc)) + $libelleproduitservice.=$desc; } else { @@ -106,9 +107,9 @@ function doc_getlinedesc($line,$outputlangs,$hideref=0,$hidedesc=0,$issupplierli { $prefix_prodserv = ""; $ref_prodserv = ""; - if ($conf->global->PRODUCT_ADD_TYPE_IN_DOCUMENTS) // In standard mode, we do not show this + if (! empty($conf->global->PRODUCT_ADD_TYPE_IN_DOCUMENTS)) // In standard mode, we do not show this { - if($prodser->isservice()) + if ($prodser->isservice()) { $prefix_prodserv = $outputlangs->transnoentitiesnoconv("Service")." "; } @@ -118,7 +119,7 @@ function doc_getlinedesc($line,$outputlangs,$hideref=0,$hidedesc=0,$issupplierli } } - if ( empty($hideref) ) + if (empty($hideref)) { if ($issupplierline) $ref_prodserv = $prodser->ref.' ('.$outputlangs->trans("SupplierRef").' '.$ref_supplier.')'; // Show local ref and supplier ref else $ref_prodserv = $prodser->ref; // Show local ref only @@ -130,7 +131,7 @@ function doc_getlinedesc($line,$outputlangs,$hideref=0,$hidedesc=0,$issupplierli } } - if ($line->date_start || $line->date_end) + if (! empty($line->date_start) || ! empty($line->date_end)) { $format='day'; // Show duration if exists diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 36851694460..4ac18c0985f 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -139,12 +139,12 @@ function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefil closedir($dir); // Obtain a list of columns - if ($sortcriteria) + if (! empty($sortcriteria)) { $myarray=array(); foreach ($file_list as $key => $row) { - $myarray[$key] = $row[$sortcriteria]; + $myarray[$key] = (isset($row[$sortcriteria])?$row[$sortcriteria]:''); } // Sort the data if ($sortorder) array_multisort($myarray, $sortorder, $file_list); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index cccc2429817..dacce61e572 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3033,10 +3033,11 @@ function get_exdir($num,$level=3,$alpha=0,$withoutslash=0) /** * Creation of a directory (this can create recursive subdir) * - * @param string $dir Directory to create (Separator must be '/'. Example: '/mydir/mysubdir') - * @return int < 0 if KO, 0 = already exists, > 0 if OK + * @param string $dir Directory to create (Separator must be '/'. Example: '/mydir/mysubdir') + * @param string $dataroot Data root directory (To avoid having the data root in the loop. Using this will also lost the warning on first dir PHP has no permission when open_basedir is used) + * @return int < 0 if KO, 0 = already exists, > 0 if OK */ -function dol_mkdir($dir) +function dol_mkdir($dir, $dataroot='') { global $conf; @@ -3048,13 +3049,19 @@ function dol_mkdir($dir) $nberr=0; $nbcreated=0; - $ccdir = ''; - $cdir = explode("/",$dir); + $ccdir=''; + if (! empty($dataroot)) { + // Remove data root from loop + $dir = str_replace($dataroot.'/', '', $dir); + $ccdir = $dataroot.'/'; + } + + $cdir = explode("/", $dir); $num=count($cdir); for ($i = 0; $i < $num; $i++) { if ($i > 0) $ccdir .= '/'.$cdir[$i]; - else $ccdir = $cdir[$i]; + else $ccdir .= $cdir[$i]; if (preg_match("/^.:$/",$ccdir,$regs)) continue; // Si chemin Windows incomplet, on poursuit par rep suivant // Attention, le is_dir() peut echouer bien que le rep existe. @@ -3582,14 +3589,19 @@ function get_htmloutput_mesg($mesgstring='',$mesgarray='', $style='ok', $keepemb if ($out) { - if ($conf->use_javascript_ajax && empty($conf->global->MAIN_DISABLE_JQUERY_JNOTIFY) && empty($keepembedded)) + if (! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_DISABLE_JQUERY_JNOTIFY) && empty($keepembedded)) { $return = ''; } diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 5460f0f3771..529a9e423c4 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -271,7 +271,8 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature { //print '
feature='.$feature.' creer='.$user->rights->$feature->supprimer.' write='.$user->rights->$feature->delete; if (empty($user->rights->$feature->supprimer) - && empty($user->rights->$feature->delete)) $deleteok=0; + && empty($user->rights->$feature->delete) + && empty($user->rights->$feature->run)) $deleteok=0; } } @@ -488,4 +489,4 @@ function accessforbidden($message='',$printheader=1,$printfooter=1,$showonlymess exit(0); } -?> \ No newline at end of file +?> diff --git a/htdocs/core/lib/treeview.lib.php b/htdocs/core/lib/treeview.lib.php index 0b72e156b40..06eda753b3d 100644 --- a/htdocs/core/lib/treeview.lib.php +++ b/htdocs/core/lib/treeview.lib.php @@ -101,8 +101,7 @@ function tree_showpad(&$fulltree,$key,$silent=0) if ($fulltree[$key2]['level'] > $pos) { $nbofdirinsub++; - if (! empty($fulltree[$key2]['cachenbofdoc'])) - $nbofdocinsub+=$fulltree[$key2]['cachenbofdoc']; + if (isset($fulltree[$key2]['cachenbofdoc']) && $fulltree[$key2]['cachenbofdoc'] > 0) $nbofdocinsub+=$fulltree[$key2]['cachenbofdoc']; } if ($fulltree[$key2]['level'] == $pos) { diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index ab33d464c8d..199f06c43de 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -1170,7 +1170,7 @@ abstract class DolibarrModules $err=0; - if (is_array($this->dirs)) + if (isset($this->dirs) && is_array($this->dirs)) { foreach ($this->dirs as $key => $value) { @@ -1184,19 +1184,19 @@ abstract class DolibarrModules $subname = empty($this->dirs[$key][3])?'':strtoupper($this->dirs[$key][3]); // Add submodule name (ex: $conf->module->submodule->dir_output) $forcename = empty($this->dirs[$key][4])?'':strtoupper($this->dirs[$key][4]); // Change the module name if different - if ($forcename) $constname = 'MAIN_MODULE_'.$forcename."_DIR_"; - if ($subname) $constname = $constname.$subname."_"; + if (! empty($forcename)) $constname = 'MAIN_MODULE_'.$forcename."_DIR_"; + if (! empty($subname)) $constname = $constname.$subname."_"; - $name = $constname.strtoupper($this->dirs[$key][0]); + $name = $constname.strtoupper($this->dirs[$key][0]); } // Define directory full path ($dir must start with "/") if (empty($conf->global->MAIN_MODULE_MULTICOMPANY) || $conf->entity == 1) $fulldir = DOL_DATA_ROOT.$dir; else $fulldir = DOL_DATA_ROOT."/".$conf->entity.$dir; // Create dir if it does not exists - if ($fulldir && ! file_exists($fulldir)) + if (! empty($fulldir) && ! file_exists($fulldir)) { - if (dol_mkdir($fulldir) < 0) + if (dol_mkdir($fulldir, DOL_DATA_ROOT) < 0) { $this->error = $langs->trans("ErrorCanNotCreateDir",$fulldir); dol_syslog(get_class($this)."::_init ".$this->error, LOG_ERR); @@ -1205,9 +1205,9 @@ abstract class DolibarrModules } // Define the constant in database if requested (not the default mode) - if ($addtodatabase) + if (! empty($addtodatabase)) { - $result = $this->insert_dirs($name,$dir); + $result = $this->insert_dirs($name, $dir); if ($result) $err++; } } @@ -1273,7 +1273,7 @@ abstract class DolibarrModules $err=0; $sql = "DELETE FROM ".MAIN_DB_PREFIX."const"; - $sql.= " WHERE ".$this->db->decrypt('name')." like '".$this->const_name."_DIR_%'"; + $sql.= " WHERE ".$this->db->decrypt('name')." LIKE '".$this->const_name."_DIR_%'"; $sql.= " AND entity = ".$conf->entity; dol_syslog(get_class($this)."::delete_dirs sql=".$sql); @@ -1408,4 +1408,4 @@ abstract class DolibarrModules } } -?> \ No newline at end of file +?> 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 e04c9b5c759..d796fee8441 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 @@ -1,5 +1,6 @@ +/* Copyright (C) 2010-2012 Laurent Destailleur + * Copyright (C) 2012 Regis Houssin * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -108,12 +109,12 @@ class doc_generic_invoice_odt extends ModelePDFFactures 'object_ref'=>$object->ref, 'object_ref_ext'=>$object->ref_ext, 'object_ref_customer'=>$object->ref_client, - 'object_ref_supplier'=>$object->ref_fournisseur, + 'object_ref_supplier'=>(! empty($object->ref_fournisseur)?$object->ref_fournisseur:''), 'object_source_invoice_ref'=>$invoice_source->ref, 'object_date'=>dol_print_date($object->date,'day'), 'object_date_limit'=>dol_print_date($object->date_lim_reglement,'day'), 'object_date_creation'=>dol_print_date($object->date_creation,'day'), - 'object_date_modification'=>dol_print_date($object->date_modification,'day'), + 'object_date_modification'=>(! empty($object->date_modification)?dol_print_date($object->date_modification,'day'):''), 'object_date_validation'=>dol_print_date($object->date_validation,'dayhour'), 'object_payment_mode_code'=>$object->mode_reglement_code, 'object_payment_mode'=>($outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code)!='PaymentType'.$object->mode_reglement_code?$outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code):$object->mode_reglement), @@ -122,7 +123,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures 'object_total_ht'=>price($object->total_ht,0,$outputlangs), 'object_total_vat'=>price($object->total_tva,0,$outputlangs), 'object_total_ttc'=>price($object->total_ttc,0,$outputlangs), - 'object_vatrate'=>vatrate($object->tva), + 'object_vatrate'=>(isset($object->tva)?vatrate($object->tva):''), 'object_note_private'=>$object->note, 'object_note'=>$object->note_public, // Payments @@ -339,7 +340,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures '__FROM_EMAIL__' => $this->emetteur->email, '__TOTAL_TTC__' => $object->total_ttc, '__TOTAL_HT__' => $object->total_ht, - '__TOTAL_VAT__' => $object->total_vat + '__TOTAL_VAT__' => $object->total_tva ); complete_substitutions_array($substitutionarray, $langs, $object); diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index 783f9f053dd..dce9949a47c 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -1,6 +1,6 @@ - * Copyright (C) 2009-2010 Regis Houssin +/* Copyright (C) 2006-2012 Laurent Destailleur + * Copyright (C) 2009-2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -95,21 +95,23 @@ class ImportCsv extends ModeleImports } /** - * getDriverLabel + * getDriverLabel * - * @return string Label + * @param string $key Key + * @return string Label */ - function getDriverLabel() + function getDriverLabel($key='') { return $this->label; } /** - * getDriverDesc + * getDriverDesc * - * @return string Description + * @param string $key Key + * @return string Description */ - function getDriverDesc() + function getDriverDesc($key='') { return $this->desc; } @@ -125,21 +127,23 @@ class ImportCsv extends ModeleImports } /** - * getDriverVersion + * getDriverVersion * - * @return string Driver version + * @param string $key Key + * @return string Driver version */ - function getDriverVersion() + function getDriverVersion($key='') { return $this->version; } /** - * getDriverLabel + * getDriverLabel * - * @return string Label of external lib + * @param string $key Key + * @return string Label of external lib */ - function getLibLabel() + function getLibLabel($key='') { return $this->label_lib; } @@ -147,9 +151,10 @@ class ImportCsv extends ModeleImports /** * getLibVersion * - * @return string Version of external lib + * @param string $key Key + * @return string Version of external lib */ - function getLibVersion() + function getLibVersion($key='') { return $this->version_lib; } diff --git a/htdocs/core/modules/import/modules_import.php b/htdocs/core/modules/import/modules_import.php index eda1702da5b..87c0db7a972 100644 --- a/htdocs/core/modules/import/modules_import.php +++ b/htdocs/core/modules/import/modules_import.php @@ -1,6 +1,6 @@ - * Copyright (C) 2005-2007 Regis Houssin +/* Copyright (C) 2005-2012 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -94,12 +94,12 @@ class ModeleImports // Picto $this->picto[$module->id]=$module->picto; // Driver properties - $this->_driverlabel[$module->id]=$module->getDriverLabel(); - $this->_driverdesc[$module->id]=$module->getDriverDesc(); - $this->_driverversion[$module->id]=$module->getDriverVersion(); + $this->_driverlabel[$module->id]=$module->getDriverLabel(''); + $this->_driverdesc[$module->id]=$module->getDriverDesc(''); + $this->_driverversion[$module->id]=$module->getDriverVersion(''); // If use an external lib - $this->_liblabel[$module->id]=$module->getLibLabel(); - $this->_libversion[$module->id]=$module->getLibVersion(); + $this->_liblabel[$module->id]=$module->getLibLabel(''); + $this->_libversion[$module->id]=$module->getLibVersion(''); $i++; } diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index 61d398b1b48..a8455abcb31 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -34,6 +34,23 @@ print ' print ''."\n"; if (constant('JS_JQUERY_UI')) print ''."\n"; // JQuery else print ''."\n"; // JQuery +// CSS forced by modules (relative url starting with /) +if (isset($conf->modules_parts['css'])) +{ + $arraycss=(array) $conf->modules_parts['css']; + foreach($arraycss as $modcss => $filescss) + { + $filescss=(array) $filescss; // To be sure filecss is an array + foreach($filescss as $cssfile) + { + // cssfile is a relative path + print ''."\n"; + } + } +} // JQuery. Must be before other includes $ext='.js'; if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x01)) $ext='.jgz'; @@ -98,10 +115,12 @@ $(document).ready(function () { resArray['options'])) { - foreach ($hookmanager->resArray['options'] as $option) + foreach ($hookmanager->resArray['options'] as $format => $option) { - echo ''; - echo $option; + if ($format == 'table') { + echo ''; + echo $option; + } } } ?> diff --git a/htdocs/core/tpl/objectline_add.tpl.php b/htdocs/core/tpl/objectline_add.tpl.php index f24a256df6a..a9e01947861 100644 --- a/htdocs/core/tpl/objectline_add.tpl.php +++ b/htdocs/core/tpl/objectline_add.tpl.php @@ -26,14 +26,14 @@ */ ?> - +
trans('VAT'); ?>trans('PriceUHT'); ?>trans('PriceUTTC'); ?>trans('Qty'); ?>trans('ReductionShort'); ?>trans('VAT'); ?>trans('PriceUHT'); ?>trans('PriceUTTC'); ?>trans('Qty'); ?>trans('ReductionShort'); ?>
  trans('Entity'); ?>   - -
  trans('SecurityCode'); ?>
'; print '
'; // End of page -$db->close(); - llxFooter(); +$db->close(); ?> diff --git a/htdocs/imports/class/import.class.php b/htdocs/imports/class/import.class.php index 40ec8d6a274..e3949eafd2e 100644 --- a/htdocs/imports/class/import.class.php +++ b/htdocs/imports/class/import.class.php @@ -96,7 +96,7 @@ class Import require_once $file; $module = new $classname($this->db); - if (is_array($module->import_code)) + if (isset($module->import_code) && is_array($module->import_code)) { foreach($module->import_code as $r => $value) { @@ -138,7 +138,7 @@ class Import // Array of tables to import (key=alias, value=tablename) $this->array_import_tables[$i]=$module->import_tables_array[$r]; // Array of tables creator field to import (key=alias, value=creator field) - $this->array_import_tables_creator[$i]=$module->import_tables_creator_array[$r]; + $this->array_import_tables_creator[$i]=(isset($module->import_tables_creator_array[$r])?$module->import_tables_creator_array[$r]:''); // Array of fields to import (key=field, value=label) $this->array_import_fields[$i]=$module->import_fields_array[$r]; // Array of hidden fields to import (key=field, value=label) @@ -150,7 +150,7 @@ class Import // Tableau des alias a exporter (cle=champ, valeur=exemple) $this->array_import_examplevalues[$i]=$module->import_examplevalues_array[$r]; // Tableau des regles de conversion d'une valeur depuis une autre source (cle=champ, valeur=tableau des regles) - $this->array_import_convertvalue[$i]=$module->import_convertvalue_array[$r]; + $this->array_import_convertvalue[$i]=(isset($module->import_convertvalue_array[$r])?$module->import_convertvalue_array[$r]:''); // Module $this->array_import_module[$i]=$module; diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index c9bd77bacb6..c79126cbed9 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -35,8 +35,8 @@ $langs->load("exports"); $langs->load("errors"); // Security check -if ($user->societe_id) $socid=$user->societe_id; -$result=restrictedArea($user,'import',$origin_id,''); +if (! empty($user->societe_id)) $socid=$user->societe_id; +$result=restrictedArea($user, 'import'); $entitytoicon=array( 'invoice'=>'bill','invoice_line'=>'bill', @@ -68,7 +68,8 @@ $entitytolang=array( // Translation code $datatoimport = GETPOST('datatoimport'); $format = GETPOST('format'); $filetoimport = GETPOST('filetoimport'); -$action = GETPOST('action'); +$action = GETPOST('action','alpha'); +$confirm = GETPOST('confirm','alpha'); $step = (GETPOST('step') ? GETPOST('step') : 1); $import_name = GETPOST('import_name'); $hexa = GETPOST('hexa'); @@ -92,7 +93,7 @@ foreach($fieldsarray as $elem) { $tabelem=explode('=',$elem,2); $key=$tabelem[0]; - $val=$tabelem[1]; + $val=(isset($tabelem[1])?$tabelem[1]:''); if ($key && $val) { $array_match_file_to_database[$key]=$val; @@ -192,7 +193,7 @@ if ($action == 'add_import_model') if ($step == 3 && $datatoimport) { - if ( $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) + if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC)) { dol_mkdir($conf->import->dir_temp); $nowyearmonth=dol_print_date(dol_now(),'%Y%m%d%H%M%S'); @@ -205,9 +206,25 @@ if ($step == 3 && $datatoimport) else { $langs->load("errors"); - $mesg = $langs->trans("ErrorFailedToSaveFile"); + setEventMessage($langs->trans("ErrorFailedToSaveFile"), 'errors'); } } + + // Delete file + if ($action == 'confirm_deletefile' && $confirm == 'yes') + { + $langs->load("other"); + + $param='&datatoimport='.$datatoimport.'&format='.$format; + if ($excludefirstline) $param.='&excludefirstline=1'; + + $file = $conf->import->dir_temp . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). + $ret=dol_delete_file($file); + if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); + else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); + Header('Location: '.$_SERVER["PHP_SELF"].'?step='.$step.$param); + exit; + } } if ($step == 4 && $action == 'select_model') @@ -305,7 +322,7 @@ if ($step == 1 || ! $datatoimport) $array_match_file_to_database=array(); $_SESSION["dol_array_match_file_to_database"]=''; - $parm=''; + $param=''; if ($excludefirstline) $param.='&excludefirstline=1'; llxHeader('',$langs->trans("NewImport"),'EN:Module_Imports_En|FR:Module_Imports|ES:Módulo_Importaciones'); @@ -447,10 +464,18 @@ if ($step == 3 && $datatoimport) llxHeader('',$langs->trans("NewImport"),'EN:Module_Imports_En|FR:Module_Imports|ES:Módulo_Importaciones'); - $head = import_prepare_head($param,3); + $head = import_prepare_head($param, 3); dol_fiche_head($head, 'step3', $langs->trans("NewImport")); + /* + * Confirm delete file + */ + if ($action == 'delete') + { + $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?urlfile='.urlencode(GETPOST('urlfile')).'&step=3'.$param, $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1); + if ($ret == 'html') print '
'; + } print ''; @@ -511,7 +536,7 @@ if ($step == 3 && $datatoimport) print "\n"; // Search available imports - $filearray=dol_dir_list($conf->import->dir_temp,'files',0,'','','name',SORT_DESC); + $filearray=dol_dir_list($conf->import->dir_temp, 'files', 0, '', '', 'name', SORT_DESC); if (count($filearray) > 0) { $dir=$conf->import->dir_temp; @@ -534,8 +559,6 @@ if ($step == 3 && $datatoimport) print ''; print ''; print ''; // Del button - print ''; // Action button print ''; print ''; } diff --git a/htdocs/includes/jquery/plugins/blockUI/jquery.blockUI.js b/htdocs/includes/jquery/plugins/blockUI/jquery.blockUI.js new file mode 100644 index 00000000000..6acca8c7b81 --- /dev/null +++ b/htdocs/includes/jquery/plugins/blockUI/jquery.blockUI.js @@ -0,0 +1,529 @@ +/*! + * jQuery blockUI plugin + * Version 2.43 (29-JUL-2012) + * @requires jQuery v1.2.3 or later + * + * Examples at: http://malsup.com/jquery/block/ + * Copyright (c) 2007-2010 M. Alsup + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + * + * Thanks to Amir-Hossein Sobhi for some excellent contributions! + */ + +;(function() { + + function setup($) { + if (/1\.(0|1|2)\.(0|1|2)/.test($.fn.jquery) || /^1.1/.test($.fn.jquery)) { + alert('blockUI requires jQuery v1.2.3 or later! You are using v' + $.fn.jquery); + return; + } + + $.fn._fadeIn = $.fn.fadeIn; + + var noOp = function() {}; + + // this bit is to ensure we don't call setExpression when we shouldn't (with extra muscle to handle + // retarded userAgent strings on Vista) + var mode = document.documentMode || 0; + var setExpr = $.browser.msie && (($.browser.version < 8 && !mode) || mode < 8); + var ie6 = $.browser.msie && /MSIE 6.0/.test(navigator.userAgent) && !mode; + + // global $ methods for blocking/unblocking the entire page + $.blockUI = function(opts) { install(window, opts); }; + $.unblockUI = function(opts) { remove(window, opts); }; + + // convenience method for quick growl-like notifications (http://www.google.com/search?q=growl) + $.growlUI = function(title, message, timeout, onClose) { + var $m = $('
'); + if (title) $m.append('

'+title+'

'); + if (message) $m.append('

'+message+'

'); + if (timeout == undefined) timeout = 3000; + $.blockUI({ + message: $m, fadeIn: 700, fadeOut: 1000, centerY: false, + timeout: timeout, showOverlay: false, + onUnblock: onClose, + css: $.blockUI.defaults.growlCSS + }); + }; + + // plugin method for blocking element content + $.fn.block = function(opts) { + var fullOpts = $.extend({}, $.blockUI.defaults, opts || {}); + this.each(function() { + var $el = $(this); + if (fullOpts.ignoreIfBlocked && $el.data('blockUI.isBlocked')) + return; + $el.unblock({ fadeOut: 0 }); + }); + + return this.each(function() { + if ($.css(this,'position') == 'static') + this.style.position = 'relative'; + if ($.browser.msie) + this.style.zoom = 1; // force 'hasLayout' + install(this, opts); + }); + }; + + // plugin method for unblocking element content + $.fn.unblock = function(opts) { + return this.each(function() { + remove(this, opts); + }); + }; + + $.blockUI.version = 2.42; // 2nd generation blocking at no extra cost! + + // override these in your code to change the default behavior and style + $.blockUI.defaults = { + // message displayed when blocking (use null for no message) + message: '

Please wait...

', + + title: null, // title string; only used when theme == true + draggable: true, // only used when theme == true (requires jquery-ui.js to be loaded) + + theme: false, // set to true to use with jQuery UI themes + + // styles for the message when blocking; if you wish to disable + // these and use an external stylesheet then do this in your code: + // $.blockUI.defaults.css = {}; + css: { + padding: 0, + margin: 0, + width: '30%', + top: '40%', + left: '35%', + textAlign: 'center', + color: '#000', + border: '3px solid #aaa', + backgroundColor:'#fff', + cursor: 'wait' + }, + + // minimal style set used when themes are used + themedCSS: { + width: '30%', + top: '40%', + left: '35%' + }, + + // styles for the overlay + overlayCSS: { + backgroundColor: '#000', + opacity: 0.6, + cursor: 'wait' + }, + + // styles applied when using $.growlUI + growlCSS: { + width: '350px', + top: '10px', + left: '', + right: '10px', + border: 'none', + padding: '5px', + opacity: 0.6, + cursor: 'default', + color: '#fff', + backgroundColor: '#000', + '-webkit-border-radius': '10px', + '-moz-border-radius': '10px', + 'border-radius': '10px' + }, + + // IE issues: 'about:blank' fails on HTTPS and javascript:false is s-l-o-w + // (hat tip to Jorge H. N. de Vasconcelos) + iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank', + + // force usage of iframe in non-IE browsers (handy for blocking applets) + forceIframe: false, + + // z-index for the blocking overlay + baseZ: 1000, + + // set these to true to have the message automatically centered + centerX: true, // <-- only effects element blocking (page block controlled via css above) + centerY: true, + + // allow body element to be stetched in ie6; this makes blocking look better + // on "short" pages. disable if you wish to prevent changes to the body height + allowBodyStretch: true, + + // enable if you want key and mouse events to be disabled for content that is blocked + bindEvents: true, + + // be default blockUI will supress tab navigation from leaving blocking content + // (if bindEvents is true) + constrainTabKey: true, + + // fadeIn time in millis; set to 0 to disable fadeIn on block + fadeIn: 200, + + // fadeOut time in millis; set to 0 to disable fadeOut on unblock + fadeOut: 400, + + // time in millis to wait before auto-unblocking; set to 0 to disable auto-unblock + timeout: 0, + + // disable if you don't want to show the overlay + showOverlay: true, + + // if true, focus will be placed in the first available input field when + // page blocking + focusInput: true, + + // suppresses the use of overlay styles on FF/Linux (due to performance issues with opacity) + applyPlatformOpacityRules: true, + + // callback method invoked when fadeIn has completed and blocking message is visible + onBlock: null, + + // callback method invoked when unblocking has completed; the callback is + // passed the element that has been unblocked (which is the window object for page + // blocks) and the options that were passed to the unblock call: + // onUnblock(element, options) + onUnblock: null, + + // don't ask; if you really must know: http://groups.google.com/group/jquery-en/browse_thread/thread/36640a8730503595/2f6a79a77a78e493#2f6a79a77a78e493 + quirksmodeOffsetHack: 4, + + // class name of the message block + blockMsgClass: 'blockMsg', + + // if it is already blocked, then ignore it (don't unblock and reblock) + ignoreIfBlocked: false + }; + + // private data and functions follow... + + var pageBlock = null; + var pageBlockEls = []; + + function install(el, opts) { + var css, themedCSS; + var full = (el == window); + var msg = (opts && opts.message !== undefined ? opts.message : undefined); + opts = $.extend({}, $.blockUI.defaults, opts || {}); + + if (opts.ignoreIfBlocked && $(el).data('blockUI.isBlocked')) + return; + + opts.overlayCSS = $.extend({}, $.blockUI.defaults.overlayCSS, opts.overlayCSS || {}); + css = $.extend({}, $.blockUI.defaults.css, opts.css || {}); + themedCSS = $.extend({}, $.blockUI.defaults.themedCSS, opts.themedCSS || {}); + msg = msg === undefined ? opts.message : msg; + + // remove the current block (if there is one) + if (full && pageBlock) + remove(window, {fadeOut:0}); + + // if an existing element is being used as the blocking content then we capture + // its current place in the DOM (and current display style) so we can restore + // it when we unblock + if (msg && typeof msg != 'string' && (msg.parentNode || msg.jquery)) { + var node = msg.jquery ? msg[0] : msg; + var data = {}; + $(el).data('blockUI.history', data); + data.el = node; + data.parent = node.parentNode; + data.display = node.style.display; + data.position = node.style.position; + if (data.parent) + data.parent.removeChild(node); + } + + $(el).data('blockUI.onUnblock', opts.onUnblock); + var z = opts.baseZ; + + // blockUI uses 3 layers for blocking, for simplicity they are all used on every platform; + // layer1 is the iframe layer which is used to supress bleed through of underlying content + // layer2 is the overlay layer which has opacity and a wait cursor (by default) + // layer3 is the message content that is displayed while blocking + + var lyr1 = ($.browser.msie || opts.forceIframe) + ? $('') + : $(''); + + var lyr2 = opts.theme + ? $('') + : $(''); + + var lyr3, s; + if (opts.theme && full) { + s = ''; + } + else if (opts.theme) { + s = ''; + } + else if (full) { + s = ''; + } + else { + s = ''; + } + lyr3 = $(s); + + // if we have a message, style it + if (msg) { + if (opts.theme) { + lyr3.css(themedCSS); + lyr3.addClass('ui-widget-content'); + } + else + lyr3.css(css); + } + + // style the overlay + if (!opts.theme && (!opts.applyPlatformOpacityRules || !($.browser.mozilla && /Linux/.test(navigator.platform)))) + lyr2.css(opts.overlayCSS); + lyr2.css('position', full ? 'fixed' : 'absolute'); + + // make iframe layer transparent in IE + if ($.browser.msie || opts.forceIframe) + lyr1.css('opacity',0.0); + + //$([lyr1[0],lyr2[0],lyr3[0]]).appendTo(full ? 'body' : el); + var layers = [lyr1,lyr2,lyr3], $par = full ? $('body') : $(el); + $.each(layers, function() { + this.appendTo($par); + }); + + if (opts.theme && opts.draggable && $.fn.draggable) { + lyr3.draggable({ + handle: '.ui-dialog-titlebar', + cancel: 'li' + }); + } + + // ie7 must use absolute positioning in quirks mode and to account for activex issues (when scrolling) + var expr = setExpr && (!$.boxModel || $('object,embed', full ? null : el).length > 0); + if (ie6 || expr) { + // give body 100% height + if (full && opts.allowBodyStretch && $.boxModel) + $('html,body').css('height','100%'); + + // fix ie6 issue when blocked element has a border width + if ((ie6 || !$.boxModel) && !full) { + var t = sz(el,'borderTopWidth'), l = sz(el,'borderLeftWidth'); + var fixT = t ? '(0 - '+t+')' : 0; + var fixL = l ? '(0 - '+l+')' : 0; + } + + // simulate fixed position + $.each([lyr1,lyr2,lyr3], function(i,o) { + var s = o[0].style; + s.position = 'absolute'; + if (i < 2) { + full ? s.setExpression('height','Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.boxModel?0:'+opts.quirksmodeOffsetHack+') + "px"') + : s.setExpression('height','this.parentNode.offsetHeight + "px"'); + full ? s.setExpression('width','jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"') + : s.setExpression('width','this.parentNode.offsetWidth + "px"'); + if (fixL) s.setExpression('left', fixL); + if (fixT) s.setExpression('top', fixT); + } + else if (opts.centerY) { + if (full) s.setExpression('top','(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"'); + s.marginTop = 0; + } + else if (!opts.centerY && full) { + var top = (opts.css && opts.css.top) ? parseInt(opts.css.top) : 0; + var expression = '((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + '+top+') + "px"'; + s.setExpression('top',expression); + } + }); + } + + // show the message + if (msg) { + if (opts.theme) + lyr3.find('.ui-widget-content').append(msg); + else + lyr3.append(msg); + if (msg.jquery || msg.nodeType) + $(msg).show(); + } + + if (($.browser.msie || opts.forceIframe) && opts.showOverlay) + lyr1.show(); // opacity is zero + if (opts.fadeIn) { + var cb = opts.onBlock ? opts.onBlock : noOp; + var cb1 = (opts.showOverlay && !msg) ? cb : noOp; + var cb2 = msg ? cb : noOp; + if (opts.showOverlay) + lyr2._fadeIn(opts.fadeIn, cb1); + if (msg) + lyr3._fadeIn(opts.fadeIn, cb2); + } + else { + if (opts.showOverlay) + lyr2.show(); + if (msg) + lyr3.show(); + if (opts.onBlock) + opts.onBlock(); + } + + // bind key and mouse events + bind(1, el, opts); + + if (full) { + pageBlock = lyr3[0]; + pageBlockEls = $(':input:enabled:visible',pageBlock); + if (opts.focusInput) + setTimeout(focus, 20); + } + else + center(lyr3[0], opts.centerX, opts.centerY); + + if (opts.timeout) { + // auto-unblock + var to = setTimeout(function() { + full ? $.unblockUI(opts) : $(el).unblock(opts); + }, opts.timeout); + $(el).data('blockUI.timeout', to); + } + }; + + // remove the block + function remove(el, opts) { + var full = (el == window); + var $el = $(el); + var data = $el.data('blockUI.history'); + var to = $el.data('blockUI.timeout'); + if (to) { + clearTimeout(to); + $el.removeData('blockUI.timeout'); + } + opts = $.extend({}, $.blockUI.defaults, opts || {}); + bind(0, el, opts); // unbind events + + if (opts.onUnblock === null) { + opts.onUnblock = $el.data('blockUI.onUnblock'); + $el.removeData('blockUI.onUnblock'); + } + + var els; + if (full) // crazy selector to handle odd field errors in ie6/7 + els = $('body').children().filter('.blockUI').add('body > .blockUI'); + else + els = $('.blockUI', el); + + if (full) + pageBlock = pageBlockEls = null; + + if (opts.fadeOut) { + els.fadeOut(opts.fadeOut); + setTimeout(function() { reset(els,data,opts,el); }, opts.fadeOut); + } + else + reset(els, data, opts, el); + }; + + // move blocking element back into the DOM where it started + function reset(els,data,opts,el) { + els.each(function(i,o) { + // remove via DOM calls so we don't lose event handlers + if (this.parentNode) + this.parentNode.removeChild(this); + }); + + if (data && data.el) { + data.el.style.display = data.display; + data.el.style.position = data.position; + if (data.parent) + data.parent.appendChild(data.el); + $(el).removeData('blockUI.history'); + } + + if (typeof opts.onUnblock == 'function') + opts.onUnblock(el,opts); + }; + + // bind/unbind the handler + function bind(b, el, opts) { + var full = el == window, $el = $(el); + + // don't bother unbinding if there is nothing to unbind + if (!b && (full && !pageBlock || !full && !$el.data('blockUI.isBlocked'))) + return; + + $el.data('blockUI.isBlocked', b); + + // don't bind events when overlay is not in use or if bindEvents is false + if (!opts.bindEvents || (b && !opts.showOverlay)) + return; + + // bind anchors and inputs for mouse and key events + var events = 'mousedown mouseup keydown keypress'; + b ? $(document).bind(events, opts, handler) : $(document).unbind(events, handler); + + // former impl... + // var $e = $('a,:input'); + // b ? $e.bind(events, opts, handler) : $e.unbind(events, handler); + }; + + // event handler to suppress keyboard/mouse events when blocking + function handler(e) { + // allow tab navigation (conditionally) + if (e.keyCode && e.keyCode == 9) { + if (pageBlock && e.data.constrainTabKey) { + var els = pageBlockEls; + var fwd = !e.shiftKey && e.target === els[els.length-1]; + var back = e.shiftKey && e.target === els[0]; + if (fwd || back) { + setTimeout(function(){focus(back)},10); + return false; + } + } + } + var opts = e.data; + // allow events within the message content + if ($(e.target).parents('div.' + opts.blockMsgClass).length > 0) + return true; + + // allow events for content that is not being blocked + return $(e.target).parents().children().filter('div.blockUI').length == 0; + }; + + function focus(back) { + if (!pageBlockEls) + return; + var e = pageBlockEls[back===true ? pageBlockEls.length-1 : 0]; + if (e) + e.focus(); + }; + + function center(el, x, y) { + var p = el.parentNode, s = el.style; + var l = ((p.offsetWidth - el.offsetWidth)/2) - sz(p,'borderLeftWidth'); + var t = ((p.offsetHeight - el.offsetHeight)/2) - sz(p,'borderTopWidth'); + if (x) s.left = l > 0 ? (l+'px') : '0'; + if (y) s.top = t > 0 ? (t+'px') : '0'; + }; + + function sz(el, p) { + return parseInt($.css(el,p))||0; + }; + + }; + + + if (typeof define === 'function' && define.amd && define.amd.jQuery) { + define(['jquery'], setup); + } else { + setup(jQuery); + } + +})(); diff --git a/htdocs/install/etape5.php b/htdocs/install/etape5.php index 60c386153b7..ffccf5f04a8 100644 --- a/htdocs/install/etape5.php +++ b/htdocs/install/etape5.php @@ -1,9 +1,9 @@ - * Copyright (C) 2004-2011 Laurent Destailleur - * Copyright (C) 2004 Benoit Mortier - * Copyright (C) 2004 Sebastien DiCintio - * Copyright (C) 2005-2009 Regis Houssin +/* Copyright (C) 2004 Rodolphe Quiedeville + * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2004 Benoit Mortier + * Copyright (C) 2004 Sebastien DiCintio + * Copyright (C) 2005-2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -31,23 +31,24 @@ require_once $dolibarr_main_document_root . '/core/lib/admin.lib.php'; require_once $dolibarr_main_document_root . '/core/lib/security.lib.php'; // for dol_hash -$setuplang=isset($_POST["selectlang"])?$_POST["selectlang"]:(isset($_GET["selectlang"])?$_GET["selectlang"]:'auto'); +$setuplang=GETPOST("selectlang",'',3)?GETPOST("selectlang",'',3):'auto'; $langs->setDefaultLang($setuplang); +$versionfrom=GETPOST("versionfrom",'',3)?GETPOST("versionfrom",'',3):(empty($argv[1])?'':$argv[1]); +$versionto=GETPOST("versionto",'',3)?GETPOST("versionto",'',3):(empty($argv[2])?'':$argv[2]); +$action=GETPOST('action', 'alpha'); // Define targetversion used to update MAIN_VERSION_LAST_INSTALL for first install // or MAIN_VERSION_LAST_UPGRADE for upgrade. $targetversion=DOL_VERSION; // It it's last upgrade -if (isset($_POST["action"]) && preg_match('/upgrade/i',$_POST["action"])) // If it's an old upgrade +if (! empty($action) && preg_match('/upgrade/i', $action)) // If it's an old upgrade { - $tmp=explode('_',$_POST["action"],2); + $tmp=explode('_', $action, 2); if ($tmp[0]=='upgrade' && ! empty($tmp[1])) $targetversion=$tmp[1]; } $langs->load("admin"); $langs->load("install"); -$action=GETPOST('action'); - $success=0; // Init "forced values" to nothing. "forced values" are used after using an install wizard (using a file install.forced.php). @@ -105,14 +106,14 @@ pHeader($langs->trans("SetupEnd"),"etape5"); print '
'; // Test if we can run a first install process -if (! GETPOST("versionfrom") && ! GETPOST("versionto") && ! is_writable($conffile)) +if (empty($versionfrom) && empty($versionto) && ! is_writable($conffile)) { print $langs->trans("ConfFileIsNotWritable",$conffiletoshow); pFooter(1,$setuplang,'jscheckparam'); exit; } -if ($action == "set" || preg_match('/upgrade/i',$action)) +if ($action == "set" || empty($action) || preg_match('/upgrade/i',$action)) { print '
'.img_mime($file).''; - $modulepart='import'; - //$relativepath=$filetoimport; print ''; print $file; print ''; @@ -545,12 +568,11 @@ if ($step == 3 && $datatoimport) // Affiche date fichier print ''.dol_print_date(dol_filemtime($dir.'/'.$file),'dayhour').''.img_delete().''; - print ''.img_picto($langs->trans("NewImport"),'filenew').''; + print ''.img_picto($langs->trans("NewImport"),'filenew').''; print '
'; $error=0; @@ -250,7 +251,7 @@ if ($action == "set" || preg_match('/upgrade/i',$action)) } } // If upgrade - elseif (preg_match('/upgrade/i',$action)) + elseif (empty($action) || preg_match('/upgrade/i',$action)) { if ($db->connected == 1) { @@ -355,7 +356,7 @@ if ($action == "set") } } // If upgrade -elseif (preg_match('/upgrade/i',$action)) +elseif (empty($action) || preg_match('/upgrade/i',$action)) { if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE) || ($conf->global->MAIN_VERSION_LAST_UPGRADE == DOL_VERSION)) { diff --git a/htdocs/install/mysql/data/llx_c_tva.sql b/htdocs/install/mysql/data/llx_c_tva.sql index fcb338191c6..b22295e0466 100644 --- a/htdocs/install/mysql/data/llx_c_tva.sql +++ b/htdocs/install/mysql/data/llx_c_tva.sql @@ -190,8 +190,8 @@ INSERT INTO llx_c_tva(rowid, fk_pays, taux, recuperableonly, note, active) VALUE INSERT INTO llx_c_tva(rowid, fk_pays, taux, recuperableonly, note, active) VALUES (2023, 202, '0', '0', 'VAT Rate 0', 1); -- SPAIN (id country=4) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,note,active) values ( 41, 4, '18','0','4','VAT standard rate',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,note,active) values ( 42, 4, '8','0','1','VAT reduced rate',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,note,active) values ( 41, 4, '21','0','5.2','VAT standard rate',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,note,active) values ( 42, 4, '10','0','1.4','VAT reduced rate',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,note,active) values ( 43, 4, '4','0','0.5','VAT super-reduced rate',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 44, 4, '0','0','VAT Rate 0',1); diff --git a/htdocs/install/mysql/migration/3.1.0-3.2.0.sql b/htdocs/install/mysql/migration/3.1.0-3.2.0.sql index 3b5bd43e5ad..a7add395e4c 100755 --- a/htdocs/install/mysql/migration/3.1.0-3.2.0.sql +++ b/htdocs/install/mysql/migration/3.1.0-3.2.0.sql @@ -37,7 +37,7 @@ update llx_commande set fk_user_author = null where fk_user_author not in (selec update llx_commande set fk_user_valid = null where fk_user_valid not in (select rowid from llx_user); -ALTER TABLE llx_extrafields ADD COLUMN TYPE VARCHAR(8); +ALTER TABLE llx_extrafields ADD COLUMN type VARCHAR(8); UPDATE llx_c_paper_format SET active=1 WHERE active=0; @@ -455,8 +455,6 @@ ALTER TABLE llx_facture_fourn ADD COLUMN extraparams varchar(255) AFTER import_k ALTER TABLE llx_boxes ADD COLUMN maxline integer NULL; -ALTER TABLE llx_commande_fournisseur ADD COLUMN date_livraison date NULL; - ALTER TABLE llx_product_fournisseur_price MODIFY fk_product_fournisseur integer DEFAULT 0; UPDATE llx_product SET canvas = NULL where canvas = 'default@product'; diff --git a/htdocs/install/mysql/migration/3.2.0-3.3.0.sql b/htdocs/install/mysql/migration/3.2.0-3.3.0.sql index 86f7a852f11..f9ad48af159 100755 --- a/htdocs/install/mysql/migration/3.2.0-3.3.0.sql +++ b/htdocs/install/mysql/migration/3.2.0-3.3.0.sql @@ -7,7 +7,7 @@ -- To add a column: ALTER TABLE llx_table ADD COLUMN newcol varchar(60) NOT NULL DEFAULT '0' AFTER existingcol; -- To rename a column: ALTER TABLE llx_table CHANGE COLUMN oldname newname varchar(60); -- To drop a column: ALTER TABLE llx_table DROP COLUMN oldname; --- To change type of field: ALTER TABLE llx_table MODIFY name varchar(60); +-- To change type of field: ALTER TABLE llx_table MODIFY COLUMN name varchar(60); -- To restrict request to Mysql version x.y use -- VMYSQLx.y -- To restrict request to Pgsql version x.y use -- VPGSQLx.y @@ -43,8 +43,8 @@ ALTER TABLE llx_mailing MODIFY COLUMN body mediumtext; ALTER TABLE llx_mailing ADD COLUMN extraparams varchar(255); -ALTER TABLE llx_product MODIFY ref varchar(128) NOT NULL; -ALTER TABLE llx_product MODIFY ref_ext varchar(128); +ALTER TABLE llx_product MODIFY COLUMN ref varchar(128) NOT NULL; +ALTER TABLE llx_product MODIFY COLUMN ref_ext varchar(128); ALTER TABLE llx_product_fournisseur_price DROP COLUMN fk_product_fournisseur; ALTER TABLE llx_product_fournisseur_price ADD charges DOUBLE( 24, 8 ) DEFAULT 0 AFTER unitprice; @@ -64,9 +64,9 @@ alter table llx_propaldet drop column pa_ht; alter table llx_propaldet drop column marge_tx; alter table llx_propaldet drop column marque_tx; -ALTER TABLE llx_commande CHANGE fk_demand_reason fk_input_reason INT(11) NULL DEFAULT NULL; -ALTER TABLE llx_propal CHANGE fk_demand_reason fk_input_reason INT(11) NULL DEFAULT NULL; -ALTER TABLE llx_commande_fournisseur CHANGE fk_methode_commande fk_input_method INT(11) NULL DEFAULT 0; +ALTER TABLE llx_commande CHANGE COLUMN fk_demand_reason fk_input_reason INT(11) NULL DEFAULT NULL; +ALTER TABLE llx_propal CHANGE COLUMN fk_demand_reason fk_input_reason INT(11) NULL DEFAULT NULL; +ALTER TABLE llx_commande_fournisseur CHANGE COLUMN fk_methode_commande fk_input_method INT(11) NULL DEFAULT 0; INSERT INTO llx_const (name, value, type, note, visible) values ('PRODUCT_CODEPRODUCT_ADDON','mod_codeproduct_leopard','yesno','Module to control product codes',0); @@ -84,3 +84,42 @@ ALTER TABLE llx_facturedet_rec ADD COLUMN label varchar(255) DEFAULT NULL AFTER ALTER TABLE llx_accountingaccount ADD COLUMN active tinyint DEFAULT 1 NOT NULL AFTER label; ALTER TABLE llx_actioncomm MODIFY elementtype VARCHAR(32); + +-- TASK #107 +ALTER TABLE llx_ecm_directories MODIFY COLUMN label varchar(64) NOT NULL; +ALTER TABLE llx_ecm_directories ADD COLUMN acl text; +ALTER TABLE llx_ecm_directories ADD INDEX idx_ecm_directories_fk_user_c (fk_user_c); +ALTER TABLE llx_ecm_directories ADD INDEX idx_ecm_directories_fk_user_m (fk_user_m); +ALTER TABLE llx_ecm_directories ADD CONSTRAINT fk_ecm_directories_fk_user_c FOREIGN KEY (fk_user_c) REFERENCES llx_user (rowid); +ALTER TABLE llx_ecm_directories ADD CONSTRAINT fk_ecm_directories_fk_user_m FOREIGN KEY (fk_user_m) REFERENCES llx_user (rowid); + +ALTER TABLE llx_ecm_documents DROP INDEX idx_ecm_documents; +ALTER TABLE llx_ecm_documents DROP COLUMN manualkeyword; +ALTER TABLE llx_ecm_documents DROP COLUMN fullpath_orig; +ALTER TABLE llx_ecm_documents DROP COLUMN private; +ALTER TABLE llx_ecm_documents DROP COLUMN crc; +ALTER TABLE llx_ecm_documents DROP COLUMN cryptkey; +ALTER TABLE llx_ecm_documents DROP COLUMN cipher; +ALTER TABLE llx_ecm_documents CHANGE COLUMN fullpath_dol fullpath varchar(255) NOT NULL; +ALTER TABLE llx_ecm_documents MODIFY COLUMN filemime varchar(128) NOT NULL; +ALTER TABLE llx_ecm_documents ADD COLUMN metadata text after description; +ALTER TABLE llx_ecm_documents ADD UNIQUE INDEX idx_ecm_documents_ref (ref, fk_directory, entity); +ALTER TABLE llx_ecm_documents ADD INDEX idx_ecm_documents_fk_create (fk_create); +ALTER TABLE llx_ecm_documents ADD INDEX idx_ecm_documents_fk_update (fk_update); +ALTER TABLE llx_ecm_documents ADD CONSTRAINT fk_ecm_documents_fk_directory FOREIGN KEY (fk_directory) REFERENCES llx_ecm_directories (rowid); +ALTER TABLE llx_ecm_documents ADD CONSTRAINT fk_ecm_documents_fk_create FOREIGN KEY (fk_create) REFERENCES llx_user (rowid); +ALTER TABLE llx_ecm_documents ADD CONSTRAINT fk_ecm_documents_fk_update FOREIGN KEY (fk_update) REFERENCES llx_user (rowid); + +create table llx_element_tag +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + entity integer DEFAULT 1 NOT NULL, -- multi company id + lang varchar(5) NOT NULL, + tag varchar(255) NOT NULL, + fk_element integer NOT NULL, + element varchar(64) NOT NULL + +)ENGINE=innodb; + +ALTER TABLE llx_element_tag ADD UNIQUE INDEX uk_element_tag (entity, lang, tag, fk_element, element); +-- END TASK #107 diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index 14f8e688218..3a9673fb137 100644 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -51,6 +51,8 @@ UPDATE llx_product SET canvas = NULL where canvas = 'default@product'; DELETE FROM llx_boxes where box_id NOT IN (SELECT rowid FROM llx_boxes_def); +DELETE FROM llx_document_model WHERE nom ='elevement' AND type='delivery'; + -- VMYSQL4.1 DELETE T1 FROM llx_boxes_def as T1, llx_boxes_def as T2 where T1.entity = T2.entity AND T1.file = T2.file AND T1.note = T2.note and T1.rowid > T2.rowid -- VPGSQL8.2 DELETE FROM llx_boxes_def as T1 WHERE rowid NOT IN (SELECT min(rowid) FROM llx_boxes_def GROUP BY file, entity, note) diff --git a/htdocs/install/mysql/tables/llx_ecm_directories.key.sql b/htdocs/install/mysql/tables/llx_ecm_directories.key.sql index 8423185a73d..bd474c4d52a 100644 --- a/htdocs/install/mysql/tables/llx_ecm_directories.key.sql +++ b/htdocs/install/mysql/tables/llx_ecm_directories.key.sql @@ -1,5 +1,6 @@ -- ============================================================================ --- Copyright (C) 2010 Laurent Destailleur +-- Copyright (C) 2010 Laurent Destailleur +-- Copyright (C) 2012 Regis Houssin -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by @@ -18,4 +19,8 @@ ALTER TABLE llx_ecm_directories ADD UNIQUE INDEX idx_ecm_directories (label, fk_parent, entity); - \ No newline at end of file +ALTER TABLE llx_ecm_directories ADD INDEX idx_ecm_directories_fk_user_c (fk_user_c); +ALTER TABLE llx_ecm_directories ADD INDEX idx_ecm_directories_fk_user_m (fk_user_m); + +ALTER TABLE llx_ecm_directories ADD CONSTRAINT fk_ecm_directories_fk_user_c FOREIGN KEY (fk_user_c) REFERENCES llx_user (rowid); +ALTER TABLE llx_ecm_directories ADD CONSTRAINT fk_ecm_directories_fk_user_m FOREIGN KEY (fk_user_m) REFERENCES llx_user (rowid); \ No newline at end of file diff --git a/htdocs/install/mysql/tables/llx_ecm_directories.sql b/htdocs/install/mysql/tables/llx_ecm_directories.sql index 3ea75bcbea1..ea4da6e4a36 100644 --- a/htdocs/install/mysql/tables/llx_ecm_directories.sql +++ b/htdocs/install/mysql/tables/llx_ecm_directories.sql @@ -1,6 +1,6 @@ -- =================================================================== --- Copyright (C) 2008 Laurent Destailleur --- Copyright (C) 2009 Regis Houssin +-- Copyright (C) 2008-2012 Laurent Destailleur +-- Copyright (C) 2009-2012 Regis Houssin -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by @@ -21,14 +21,16 @@ create table llx_ecm_directories ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - label varchar(32) NOT NULL, - entity integer DEFAULT 1 NOT NULL, -- multi company id - fk_parent integer, - description varchar(255) NOT NULL, - cachenbofdoc integer NOT NULL DEFAULT 0, - date_c datetime, - date_m timestamp, - fk_user_c integer, - fk_user_m integer + rowid integer AUTO_INCREMENT PRIMARY KEY, + label varchar(64) NOT NULL, + entity integer DEFAULT 1 NOT NULL, -- multi company id + fk_parent integer, + description varchar(255) NOT NULL, + cachenbofdoc integer NOT NULL DEFAULT 0, + date_c datetime, + date_m timestamp, + fk_user_c integer, + fk_user_m integer, + acl text + ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_ecm_documents.key.sql b/htdocs/install/mysql/tables/llx_ecm_documents.key.sql index 79475d499ed..a29292dea1c 100644 --- a/htdocs/install/mysql/tables/llx_ecm_documents.key.sql +++ b/htdocs/install/mysql/tables/llx_ecm_documents.key.sql @@ -1,5 +1,6 @@ -- ============================================================================ --- Copyright (C) 2010 Laurent Destailleur +-- Copyright (C) 2010 Laurent Destailleur +-- Copyright (C) 2012 Regis Houssin -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by @@ -17,5 +18,11 @@ -- ============================================================================ -ALTER TABLE llx_ecm_documents ADD UNIQUE INDEX idx_ecm_documents (fullpath_dol); +ALTER TABLE llx_ecm_documents ADD UNIQUE INDEX idx_ecm_documents_ref (ref, fk_directory, entity); +ALTER TABLE llx_ecm_documents ADD INDEX idx_ecm_documents_fk_create (fk_create); +ALTER TABLE llx_ecm_documents ADD INDEX idx_ecm_documents_fk_update (fk_update); + +ALTER TABLE llx_ecm_documents ADD CONSTRAINT fk_ecm_documents_fk_directory FOREIGN KEY (fk_directory) REFERENCES llx_ecm_directories (rowid); +ALTER TABLE llx_ecm_documents ADD CONSTRAINT fk_ecm_documents_fk_create FOREIGN KEY (fk_create) REFERENCES llx_user (rowid); +ALTER TABLE llx_ecm_documents ADD CONSTRAINT fk_ecm_documents_fk_update FOREIGN KEY (fk_update) REFERENCES llx_user (rowid); \ No newline at end of file diff --git a/htdocs/install/mysql/tables/llx_ecm_documents.sql b/htdocs/install/mysql/tables/llx_ecm_documents.sql index 860b44e25bd..876262dcb7c 100644 --- a/htdocs/install/mysql/tables/llx_ecm_documents.sql +++ b/htdocs/install/mysql/tables/llx_ecm_documents.sql @@ -1,6 +1,6 @@ -- =================================================================== --- Copyright (C) 2008 Laurent Destailleur --- Copyright (C) 2009 Regis Houssin +-- Copyright (C) 2008-2012 Laurent Destailleur +-- Copyright (C) 2009-2012 Regis Houssin -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by @@ -20,24 +20,20 @@ create table llx_ecm_documents ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - ref varchar(16) NOT NULL, - entity integer DEFAULT 1 NOT NULL, -- multi company id - filename varchar(255) NOT NULL, - filesize integer NOT NULL, - filemime varchar(32) NOT NULL, - fullpath_dol varchar(255) NOT NULL, - fullpath_orig varchar(255) NOT NULL, - description text, - manualkeyword text, - fk_create integer NOT NULL, - fk_update integer, - date_c datetime NOT NULL, - date_u timestamp, - fk_directory integer, - fk_status smallint DEFAULT 0, - private smallint DEFAULT 0, - crc varchar(32) NOT NULL DEFAULT '', -- checksum - cryptkey varchar(50) NOT NULL DEFAULT '', -- crypt key - cipher varchar(50) NOT NULL DEFAULT 'twofish' -- crypt cipher + rowid integer AUTO_INCREMENT PRIMARY KEY, + ref varchar(16) NOT NULL, + entity integer DEFAULT 1 NOT NULL, + filename varchar(255) NOT NULL, + filesize integer NOT NULL, + filemime varchar(128) NOT NULL, + description text, + metadata text, + fullpath varchar(255) NOT NULL, + fk_directory integer, + fk_create integer NOT NULL, + fk_update integer, + date_c datetime NOT NULL, + date_u timestamp, + fk_status smallint DEFAULT 0 + ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_element_tag.key.sql b/htdocs/install/mysql/tables/llx_element_tag.key.sql new file mode 100644 index 00000000000..6d798826e7a --- /dev/null +++ b/htdocs/install/mysql/tables/llx_element_tag.key.sql @@ -0,0 +1,20 @@ +-- ============================================================================ +-- Copyright (C) 2012 Regis Houssin +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- ============================================================================ + + +ALTER TABLE llx_element_tag ADD UNIQUE INDEX uk_element_tag (entity, lang, tag, fk_element, element); diff --git a/htdocs/install/mysql/tables/llx_element_tag.sql b/htdocs/install/mysql/tables/llx_element_tag.sql new file mode 100644 index 00000000000..4752b12e200 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_element_tag.sql @@ -0,0 +1,29 @@ +-- ============================================================================ +-- Copyright (C) 2012 Regis Houssin +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- =========================================================================== + +create table llx_element_tag +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + entity integer DEFAULT 1 NOT NULL, -- multi company id + lang varchar(5) NOT NULL, + tag varchar(255) NOT NULL, + fk_element integer NOT NULL, + element varchar(64) NOT NULL + +)ENGINE=innodb; + diff --git a/htdocs/install/upgrade.php b/htdocs/install/upgrade.php index 7f3d3be9bc9..1ee92b5444d 100644 --- a/htdocs/install/upgrade.php +++ b/htdocs/install/upgrade.php @@ -48,7 +48,8 @@ $versionfrom=GETPOST("versionfrom",'',3)?GETPOST("versionfrom",'',3):(empty($arg $versionto=GETPOST("versionto",'',3)?GETPOST("versionto",'',3):(empty($argv[2])?'':$argv[2]); $langs->load("admin"); -$langs->load("install"); +$langs->load("install"); +$langs->load("errors"); if ($dolibarr_main_db_type == "mysql") $choix=1; if ($dolibarr_main_db_type == "mysqli") $choix=1; @@ -152,79 +153,96 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action'))) print ''; print ''; dolibarr_install_syslog("upgrade: ".$langs->transnoentities("ServerVersion")." : $version"); - //print ''; + + // Test database version + $versionmindb=getStaticMember(get_class($db),'versionmin'); + //print join('.',$versionarray).' - '.join('.',$versionmindb); + if (count($versionmindb) && count($versionarray) + && versioncompare($versionarray,$versionmindb) < 0) + { + // Warning: database version too low. + print "\n"; + dolibarr_install_syslog("upgrade: ".$langs->transnoentities("ErrorDatabaseVersionTooLow",join('.',$versionarray),join('.',$versionmindb))); + $ok=0; + } + } // Force l'affichage de la progression - print ''; - flush(); - + if ($ok) + { + print ''; + flush(); + } /* * Delete duplicates in table categorie_association */ - $couples=array(); - $filles=array(); - $sql = "SELECT fk_categorie_mere, fk_categorie_fille"; - $sql.= " FROM ".MAIN_DB_PREFIX."categorie_association"; - dolibarr_install_syslog("upgrade: search duplicate sql=".$sql); - $resql = $db->query($sql); - if ($resql) + if ($ok) { - $num=$db->num_rows($resql); - while ($obj=$db->fetch_object($resql)) - { - if (! isset($filles[$obj->fk_categorie_fille])) // Only one record as child (a child has only on parent). - { - if ($obj->fk_categorie_mere != $obj->fk_categorie_fille) - { - $filles[$obj->fk_categorie_fille]=1; // Set record for this child - $couples[$obj->fk_categorie_mere.'_'.$obj->fk_categorie_fille]=array('mere'=>$obj->fk_categorie_mere, 'fille'=>$obj->fk_categorie_fille); - } - } - } + $couples=array(); + $filles=array(); + $sql = "SELECT fk_categorie_mere, fk_categorie_fille"; + $sql.= " FROM ".MAIN_DB_PREFIX."categorie_association"; + dolibarr_install_syslog("upgrade: search duplicate sql=".$sql); + $resql = $db->query($sql); + if ($resql) + { + $num=$db->num_rows($resql); + while ($obj=$db->fetch_object($resql)) + { + if (! isset($filles[$obj->fk_categorie_fille])) // Only one record as child (a child has only on parent). + { + if ($obj->fk_categorie_mere != $obj->fk_categorie_fille) + { + $filles[$obj->fk_categorie_fille]=1; // Set record for this child + $couples[$obj->fk_categorie_mere.'_'.$obj->fk_categorie_fille]=array('mere'=>$obj->fk_categorie_mere, 'fille'=>$obj->fk_categorie_fille); + } + } + } - dolibarr_install_syslog("upgrade: result is num=".$num." count(couples)=".count($couples)); + dolibarr_install_syslog("upgrade: result is num=".$num." count(couples)=".count($couples)); - // If there is duplicates couples or child with two parents - if (count($couples) > 0 && $num > count($couples)) - { - $error=0; + // If there is duplicates couples or child with two parents + if (count($couples) > 0 && $num > count($couples)) + { + $error=0; - $db->begin(); + $db->begin(); - $sql="DELETE FROM ".MAIN_DB_PREFIX."categorie_association"; - dolibarr_install_syslog("upgrade: delete association sql=".$sql); - $resqld=$db->query($sql); - if ($resqld) - { - foreach($couples as $key => $val) - { - $sql ="INSERT INTO ".MAIN_DB_PREFIX."categorie_association(fk_categorie_mere,fk_categorie_fille)"; - $sql.=" VALUES(".$val['mere'].", ".$val['fille'].")"; - dolibarr_install_syslog("upgrade: insert association sql=".$sql); - $resqli=$db->query($sql); - if (! $resqli) $error++; - } - } + $sql="DELETE FROM ".MAIN_DB_PREFIX."categorie_association"; + dolibarr_install_syslog("upgrade: delete association sql=".$sql); + $resqld=$db->query($sql); + if ($resqld) + { + foreach($couples as $key => $val) + { + $sql ="INSERT INTO ".MAIN_DB_PREFIX."categorie_association(fk_categorie_mere,fk_categorie_fille)"; + $sql.=" VALUES(".$val['mere'].", ".$val['fille'].")"; + dolibarr_install_syslog("upgrade: insert association sql=".$sql); + $resqli=$db->query($sql); + if (! $resqli) $error++; + } + } - if (! $error) - { - print ''; - print ''; - $db->commit(); - } - else - { - print ''; - print ''; - $db->rollback(); - } - } - } - else - { - print '
'.$langs->trans("Error").'
'; + if (! $error) + { + print ''; + print ''; + $db->commit(); + } + else + { + print ''; + print ''; + $db->rollback(); + } + } + } + else + { + print '
'.$langs->trans("Error").'
'; + } } /* @@ -232,7 +250,7 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action'))) */ if ($ok && preg_match('/mysql/',$db->type)) { - $versioncommande=explode('.','4.0'); + $versioncommande=array(4,0,0); if (count($versioncommande) && count($versionarray) && versioncompare($versioncommande,$versionarray) <= 0) // Si mysql >= 4.0 { @@ -292,11 +310,15 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action'))) { $dir = "mysql/migration/"; // We use mysql migration scripts whatever is database driver + // For minor version + $newversionfrom=preg_replace('/(\.[0-9]+)$/i','.0',$versionfrom); + $newversionto=preg_replace('/(\.[0-9]+)$/i','.0',$versionto); + $filelist=array(); $i = 0; $ok = 0; - $from='^'.$versionfrom; - $to=$versionto.'\.sql$'; + $from='^'.$newversionfrom; + $to=$newversionto.'\.sql$'; // Get files list $filesindir=array(); diff --git a/htdocs/langs/el_GR/compta.lang b/htdocs/langs/el_GR/compta.lang index 0a6b4ee47b3..356ea6907b4 100644 --- a/htdocs/langs/el_GR/compta.lang +++ b/htdocs/langs/el_GR/compta.lang @@ -4,14 +4,8 @@ Accountancy=Λογιστική AccountancyCard=Καρτέλα λογιστικής Treasury=Περιουσιακά MenuFinancial=Οικονομικά -TaxModuleSetupToModifyRules=Go to module setup to modify rules for calculation OptionMode=Επιλογές λογιστικής OptionModeTrue=Επιλογές εσόδων-εξόδων -OptionModeVirtual=Option Credits-Debits -OptionModeTrueDesc=In this context, the turnover is calculated over payments (date of payments). \nThe validity of the figures is assured only if the book-keeping is scrutinized through the input/output on the accounts via invoices. -OptionModeVirtualDesc=In this context, the turnover is calculated over invoices (date of validation). When these invoices are due, whether they have been paid or not, they are listed in the turnover output. -FeatureIsSupportedInInOutModeOnly=Feature only available in CREDITS-DEBTS accountancy mode (See Accountancy module configuration) -VATReportBuildWithOptionDefinedInModule=Amounts shown here are calculated using rules defined by Tax module setup. Param=Παραμετροποίηση AccountsGeneral=Λογαριασμοί Account=Λογαριασμός diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang index c45fab84a99..a74ea55ddd1 100644 --- a/htdocs/langs/en_US/compta.lang +++ b/htdocs/langs/en_US/compta.lang @@ -8,7 +8,7 @@ TaxModuleSetupToModifyRules=Go to module setup to modify rules OptionMode=Option for accountancy OptionModeTrue=Option Incomes-Expenses OptionModeVirtual=Option Claims-Debts -OptionModeTrueDesc=In this context, the turnover is calculated over payments (date of payments). \nThe validity of the figures is assured only if the book-keeping is scrutinized through the input/output on the accounts via invoices. +OptionModeTrueDesc=In this context, the turnover is calculated over payments (date of payments). The validity of the figures is assured only if the book-keeping is scrutinized through the input/output on the accounts via invoices. OptionModeVirtualDesc=In this context, the turnover is calculated over invoices (date of validation). When these invoices are due, whether they have been paid or not, they are listed in the turnover output. FeatureIsSupportedInInOutModeOnly=Feature only available in CREDITS-DEBTS accountancy mode (See Accountancy module configuration) VATReportBuildWithOptionDefinedInModule=Amounts shown here are calculated using rules defined by Tax module setup. diff --git a/htdocs/langs/en_US/install.lang b/htdocs/langs/en_US/install.lang index 8b078507d7c..cd43be5c0af 100644 --- a/htdocs/langs/en_US/install.lang +++ b/htdocs/langs/en_US/install.lang @@ -26,6 +26,7 @@ ErrorGoBackAndCorrectParameters=Go backward and correct wrong parameters. ErrorWrongValueForParameter=You may have typed a wrong value for parameter '%s'. ErrorFailedToCreateDatabase=Failed to create database '%s'. ErrorFailedToConnectToDatabase=Failed to connect to database '%s'. +ErrorDatabaseVersionTooLow=Database version (%s) too old. Version %s or higher is required. ErrorPHPVersionTooLow=PHP version too old. Version %s is required. WarningPHPVersionTooLow=PHP version too old. Version %s or more is expected. This version should allow install but is not supported. ErrorConnectedButDatabaseNotFound=Connection to server successfull but database '%s' not found. diff --git a/htdocs/langs/en_US/other.lang b/htdocs/langs/en_US/other.lang index 324a0e24ee6..7587bdc12d5 100644 --- a/htdocs/langs/en_US/other.lang +++ b/htdocs/langs/en_US/other.lang @@ -169,6 +169,7 @@ AddFiles=Add Files StartUpload=Start upload CancelUpload=Cancel upload FileIsTooBig=Files is too big +PleaseBePatient=Please be patient... ##### Calendar common ##### AddCalendarEntry=Add entry in calendar %s diff --git a/htdocs/langs/fr_FR/install.lang b/htdocs/langs/fr_FR/install.lang index 83553a53b5b..2dd0216fbc8 100644 --- a/htdocs/langs/fr_FR/install.lang +++ b/htdocs/langs/fr_FR/install.lang @@ -26,6 +26,7 @@ ErrorGoBackAndCorrectParameters=Revenez en arrière et corrigez les paramètres ErrorWrongValueForParameter=Vous avez peut-être saisi une mauvaise valeur pour le paramètre '%s'. ErrorFailedToCreateDatabase=Echec de création de la base '%s'. ErrorFailedToConnectToDatabase=Echec de connexion à la base '%s'. +ErrorDatabaseVersionTooLow=Version de base de donnée (%s) trop ancienne. La version %s ou supérieure est requise. ErrorPHPVersionTooLow=Version de PHP trop ancienne. La version %s est requise. WarningPHPVersionTooLow=Version de PHP trop ancienne. La version %s ou plus est recommandée. Cette version reste utilisable mais n'est pas supportée. ErrorConnectedButDatabaseNotFound=Connexion au serveur réussi mais base '%s' introuvable. diff --git a/htdocs/langs/fr_FR/other.lang b/htdocs/langs/fr_FR/other.lang index 670940a8a10..bb43e302431 100644 --- a/htdocs/langs/fr_FR/other.lang +++ b/htdocs/langs/fr_FR/other.lang @@ -168,6 +168,8 @@ AddFiles=Ajouter des fichiers StartUpload=Transférer CancelUpload=Annuler le transfert FileIsTooBig=Le fichier est trop volumineux +PleaseBePatient=Merci de patienter quelques instants... + ##### Calendar common ##### AddCalendarEntry=Ajouter entrée dans le calendrier %s NewCompanyToDolibarr=Société %s ajoutée dans Dolibarr diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 06e0d7df71f..c756301a762 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -937,7 +937,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) print ''."\n"; // Output standard javascript links - if (! $disablejs && $conf->use_javascript_ajax) + if (! $disablejs && ! empty($conf->use_javascript_ajax)) { $ext='.js'; if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x01)) { @@ -963,6 +963,12 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs print ''."\n"; print ''."\n"; } + // jQuery blockUI + if (! empty($conf->global->MAIN_USE_JQUERY_BLOCKUI)) + { + print ''."\n"; + print ''."\n"; + } // Flot if (empty($conf->global->MAIN_DISABLE_JQUERY_FLOT)) { @@ -1000,7 +1006,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs print ''."\n"; } // jQuery File Upload - if (! empty($conf->global->MAIN_USE_JQUERY_FILEUPLOAD)) + if (! empty($conf->global->MAIN_USE_JQUERY_FILEUPLOAD) || (defined('REQUIRE_JQUERY_FILEUPLOAD') && constant('REQUIRE_JQUERY_FILEUPLOAD'))) { print ''."\n"; print ''."\n"; diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 39d514defa1..62365027f6d 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -363,6 +363,7 @@ class Product extends CommonObject { // Product already exists with this ref $langs->load("products"); + $error++; $this->error = "ErrorProductAlreadyExists"; } } diff --git a/htdocs/societe/canvas/actions_card_common.class.php b/htdocs/societe/canvas/actions_card_common.class.php index 0e22c08b86d..3faba3cf2d8 100644 --- a/htdocs/societe/canvas/actions_card_common.class.php +++ b/htdocs/societe/canvas/actions_card_common.class.php @@ -436,7 +436,7 @@ abstract class ActionsCardCommon $res=dol_include_once($dirroot.$module.'.php'); if ($res) break; } - $modCodeClient = new $module; + $modCodeClient = new $module($db); $this->tpl['auto_customercode'] = $modCodeClient->code_auto; // We verified if the tag prefix is used if ($modCodeClient->code_auto) $this->tpl['prefix_customercode'] = $modCodeClient->verif_prefixIsUsed(); @@ -714,4 +714,4 @@ abstract class ActionsCardCommon } -?> \ No newline at end of file +?> diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index b08667613af..156133c9252 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -1013,7 +1013,7 @@ else $res=dol_include_once($dirroot.$module.'.php'); if ($res) break; } - $modCodeClient = new $module; + $modCodeClient = new $module($db); // We verified if the tag prefix is used if ($modCodeClient->code_auto) { @@ -1031,7 +1031,7 @@ else $res=dol_include_once($dirroot.$module.'.php'); if ($res) break; } - $modCodeFournisseur = new $module; + $modCodeFournisseur = new $module($db); // On verifie si la balise prefix est utilisee if ($modCodeFournisseur->code_auto) { diff --git a/htdocs/theme/amarok/img/working2.gif b/htdocs/theme/amarok/img/working2.gif new file mode 100644 index 00000000000..bf0fc8f2167 Binary files /dev/null and b/htdocs/theme/amarok/img/working2.gif differ diff --git a/htdocs/theme/auguria/img/working2.gif b/htdocs/theme/auguria/img/working2.gif new file mode 100644 index 00000000000..bf0fc8f2167 Binary files /dev/null and b/htdocs/theme/auguria/img/working2.gif differ diff --git a/htdocs/theme/bureau2crea/img/bg_mainNav.jpg b/htdocs/theme/bureau2crea/img/bg_mainNav.jpg index 0d575ec5f70..93e65598156 100644 Binary files a/htdocs/theme/bureau2crea/img/bg_mainNav.jpg and b/htdocs/theme/bureau2crea/img/bg_mainNav.jpg differ diff --git a/htdocs/theme/bureau2crea/img/bg_navHorizontal.jpg b/htdocs/theme/bureau2crea/img/bg_navHorizontal.jpg index eddb17e1803..34008a24cd7 100644 Binary files a/htdocs/theme/bureau2crea/img/bg_navHorizontal.jpg and b/htdocs/theme/bureau2crea/img/bg_navHorizontal.jpg differ diff --git a/htdocs/theme/bureau2crea/img/working2.gif b/htdocs/theme/bureau2crea/img/working2.gif new file mode 100644 index 00000000000..bf0fc8f2167 Binary files /dev/null and b/htdocs/theme/bureau2crea/img/working2.gif differ diff --git a/htdocs/theme/bureau2crea/style.css.php b/htdocs/theme/bureau2crea/style.css.php index bba333bf69e..475428486d2 100644 --- a/htdocs/theme/bureau2crea/style.css.php +++ b/htdocs/theme/bureau2crea/style.css.php @@ -35,6 +35,7 @@ if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1); if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1); if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); +session_cache_limiter(FALSE); require_once '../../main.inc.php'; diff --git a/htdocs/theme/bureau2crea/tpl/login.tpl.php b/htdocs/theme/bureau2crea/tpl/login.tpl.php index 8d79accc79d..67c96b12da7 100644 --- a/htdocs/theme/bureau2crea/tpl/login.tpl.php +++ b/htdocs/theme/bureau2crea/tpl/login.tpl.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2009-2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -33,11 +33,31 @@ print ' print ''."\n"; if (constant('JS_JQUERY_UI')) print ''."\n"; // JQuery else print ''."\n"; // JQuery +// CSS forced by modules (relative url starting with /) +if (isset($conf->modules_parts['css'])) +{ + $arraycss=(array) $conf->modules_parts['css']; + foreach($arraycss as $modcss => $filescss) + { + $filescss=(array) $filescss; // To be sure filecss is an array + foreach($filescss as $cssfile) + { + // cssfile is a relative path + print ''."\n"; + } + } +} // JQuery. Must be before other includes +$ext='.js'; +if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x01)) $ext='.jgz'; print ''."\n"; if (constant('JS_JQUERY')) print ''."\n"; else print ''."\n"; -print ' +print ''."\n"; +print '
'.$langs->trans("ServerVersion").''.$version.'
'.join('.',$versionarray).'
".$langs->trans("ErrorDatabaseVersionTooLow",join('.',$versionarray),join('.',$versionmindb))."".$langs->trans("Error")."
'.$langs->trans("PleaseBePatient").'
'.$langs->trans("PleaseBePatient").'
'.$langs->trans("RemoveDuplicates").''.$langs->trans("Success").' ('.$num.'=>'.count($couples).')
'.$langs->trans("RemoveDuplicates").''.$langs->trans("Failed").'
'.$langs->trans("RemoveDuplicates").''.$langs->trans("Success").' ('.$num.'=>'.count($couples).')
'.$langs->trans("RemoveDuplicates").''.$langs->trans("Failed").'