';
@@ -152,7 +154,7 @@ $sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
$sql.= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl";
$sql.= " , ".MAIN_DB_PREFIX."societe as s";
$sql.= " , ".MAIN_DB_PREFIX."prelevement_rejet as pr";
-$sql.= " WHERE p.rowid=".$prev_id;
+$sql.= " WHERE p.rowid=".$object->id;
$sql.= " AND pl.fk_prelevement_bons = p.rowid";
$sql.= " AND p.entity = ".$conf->entity;
$sql.= " AND pl.fk_soc = s.rowid";
diff --git a/htdocs/compta/prelevement/fiche-stat.php b/htdocs/compta/prelevement/fiche-stat.php
index a5583dffa6d..f0e335da5cf 100644
--- a/htdocs/compta/prelevement/fiche-stat.php
+++ b/htdocs/compta/prelevement/fiche-stat.php
@@ -58,14 +58,16 @@ $object = new BonPrelevement($db,"");
llxHeader('',$langs->trans("WithdrawalsReceipts"));
-if ($prev_id)
+if ($prev_id > 0 || $ref)
{
- if ($object->fetch($prev_id) == 0)
+ if ($object->fetch($prev_id, $ref) >= 0)
{
$head = prelevement_prepare_head($object);
dol_fiche_head($head, 'statistics', $langs->trans("WithdrawalsReceipts"), -1, 'payment');
- dol_banner_tab($object, 'ref', '', 1, 'ref', 'ref');
+ $linkback = '
';
print '
';
@@ -144,7 +146,7 @@ if ($prev_id)
$sql = "SELECT sum(pl.amount), pl.statut";
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_lignes as pl";
- $sql.= " WHERE pl.fk_prelevement_bons = ".$prev_id;
+ $sql.= " WHERE pl.fk_prelevement_bons = ".$object->id;
$sql.= " GROUP BY pl.statut";
$resql=$db->query($sql);
diff --git a/htdocs/compta/salaries/card.php b/htdocs/compta/salaries/card.php
index a456777f631..608b5a737b0 100644
--- a/htdocs/compta/salaries/card.php
+++ b/htdocs/compta/salaries/card.php
@@ -255,7 +255,8 @@ if ($action == 'create')
// Employee
print '
| ';
print fieldLabel('Employee','fk_user',1).' | ';
- print $form->select_dolusers(GETPOST('fk_user','int'), 'fk_user', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
+ $noactive=0; // We keep active and unactive users
+ print $form->select_dolusers(GETPOST('fk_user','int'), 'fk_user', 1, '', 0, '', '', 0, 0, 0, 'AND employee=1', 0, '', 'maxwidth300', $noactive);
print ' |
';
// Label
diff --git a/htdocs/compta/salaries/index.php b/htdocs/compta/salaries/index.php
index 2fee94c3216..47cafad0f0a 100644
--- a/htdocs/compta/salaries/index.php
+++ b/htdocs/compta/salaries/index.php
@@ -100,7 +100,7 @@ $salstatic = new PaymentSalary($db);
$userstatic = new User($db);
$accountstatic = new Account($db);
-$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.admin, u.salary as current_salary, u.fk_soc as fk_soc,";
+$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.admin, u.salary as current_salary, u.fk_soc as fk_soc, u.statut as status,";
$sql.= " s.rowid, s.fk_user, s.amount, s.salary, s.label, s.datep as datep, s.datev as datev, s.fk_typepayment as type, s.num_payment, s.fk_bank,";
$sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel,";
$sql.= " pst.code as payment_code";
@@ -222,6 +222,7 @@ if ($result)
$userstatic->login=$obj->login;
$userstatic->email=$obj->email;
$userstatic->societe_id=$obj->fk_soc;
+ $userstatic->statut=$obj->status;
$salstatic->id=$obj->rowid;
$salstatic->ref=$obj->rowid;
diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php
index 2defcd0e2cc..dd8081754d8 100644
--- a/htdocs/core/class/conf.class.php
+++ b/htdocs/core/class/conf.class.php
@@ -503,7 +503,7 @@ class Conf
if (! isset($this->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE)) $this->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE=1;
// Define list of limited modules (value must be key found for "name" property of module, so for example 'supplierproposal' for Module "Supplier Proposal"
- if (! isset($this->global->MAIN_MODULES_FOR_EXTERNAL)) $this->global->MAIN_MODULES_FOR_EXTERNAL='user,societe,propal,commande,facture,categorie,supplierproposal,fournisseur,contact,projet,contrat,ficheinter,expedition,agenda,resource,adherent'; // '' means 'all'. Note that contact is added here as it should be a module later.
+ if (! isset($this->global->MAIN_MODULES_FOR_EXTERNAL)) $this->global->MAIN_MODULES_FOR_EXTERNAL='user,societe,propal,commande,facture,categorie,supplierproposal,fournisseur,contact,projet,contrat,ficheinter,expedition,agenda,resource,adherent,blockedlog'; // '' means 'all'. Note that contact is added here as it should be a module later.
// Enable select2
if (empty($this->global->MAIN_USE_JQUERY_MULTISELECT) || $this->global->MAIN_USE_JQUERY_MULTISELECT == '1') $this->global->MAIN_USE_JQUERY_MULTISELECT='select2';
@@ -581,6 +581,8 @@ class Conf
if (empty($this->global->MAIN_SIZE_SHORTLIST_LIMIT)) $this->global->MAIN_SIZE_SHORTLIST_LIMIT=3;
+ if (! isset($this->global->THEME_HIDE_BORDER_ON_INPUT)) $this->global->THEME_HIDE_BORDER_ON_INPUT=0;
+
// Save inconsistent option
if (empty($conf->global->AGENDA_USE_EVENT_TYPE) && (! isset($conf->global->AGENDA_DEFAULT_FILTER_TYPE) || $conf->global->AGENDA_DEFAULT_FILTER_TYPE == 'AC_NON_AUTO'))
{
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 839a4c56fe0..085b9874aeb 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -1442,7 +1442,7 @@ class Form
* @param array $exclude Array list of users id to exclude
* @param int $disabled If select list must be disabled
* @param array|string $include Array list of users id to include or 'hierarchy' to have only supervised users or 'hierarchyme' to have supervised + me
- * @param array $enableonly Array list of users id to be enabled. If defined, it means that other must be disabled
+ * @param array $enableonly Array list of users id to be enabled. If defined, it means that others will be disabled
* @param int $force_entity 0 or Id of environment to force
* @param int $maxlength Maximum length of string into list (0=no limit)
* @param int $showstatus 0=show user status only if status is disabled, 1=always show user status into label, -1=never show user status
@@ -1481,7 +1481,7 @@ class Form
$out='';
- // On recherche les utilisateurs
+ // Forge request to select users
$sql = "SELECT DISTINCT u.rowid, u.lastname as lastname, u.firstname, u.statut, u.login, u.admin, u.entity";
if (! empty($conf->multicompany->enabled) && $conf->entity == 1 && $user->admin && ! $user->entity)
{
@@ -4594,7 +4594,8 @@ class Form
}
if (! empty($conf->global->SERVICE_ARE_ECOMMERCE_200238EC)) // If option to have vat for end customer for services is on
{
- if (! $societe_vendeuse->isInEEC() && (! is_object($societe_acheteuse) || ($societe_acheteuse->isInEEC() && ! $societe_acheteuse->isACompany())))
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
+ if (! isInEEC($societe_vendeuse) && (! is_object($societe_acheteuse) || (isInEEC($societe_acheteuse) && ! $societe_acheteuse->isACompany())))
{
// We also add the buyer
if (is_numeric($type))
diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php
index 6423d9709e9..a3a37c86e8c 100644
--- a/htdocs/core/class/html.formmail.class.php
+++ b/htdocs/core/class/html.formmail.class.php
@@ -853,30 +853,23 @@ class FormMail extends Form
// Complete substitution array
$paymenturl='';
- if (! empty($conf->global->PAYMENT_ADD_PAYMENT_URL) // Option to enable to add online link into __PERSONALIZED__
- || (! empty($conf->paypal->enabled) && ! empty($conf->global->PAYPAL_ADD_PAYMENT_URL))
- )
+ if (empty($this->substit['__REF__']))
{
- if (empty($this->substit['__REF__']))
- {
- //$paymenturl='LinkToPayOnlineNotAvailableInThisContext';
- $paymenturl='';
- }
- else
- {
- // Set the online payment message and url link into __PERSONALIZED__ key
- require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
- $langs->load('paypal');
- $typeforonlinepayment='free';
- if ($this->param["models"]=='order_send') $typeforonlinepayment='order'; // TODO use detection on something else than template
- if ($this->param["models"]=='facture_send') $typeforonlinepayment='invoice'; // TODO use detection on something else than template
- if ($this->param["models"]=='member_send') $typeforonlinepayment='member'; // TODO use detection on something else than template
- $url=getOnlinePaymentUrl(0, $typeforonlinepayment, $this->substit['__REF__']);
- //$paymenturl=str_replace('\n',"\n",$langs->transnoentitiesnoconv("PredefinedMailContentLink",$url));
- $paymenturl=$url;
- }
+ $paymenturl='';
}
- $this->substit['__PERSONALIZED__']=$paymenturl; // deprecated
+ else
+ {
+ // Set the online payment url link into __ONLINE_PAYMENT_URL__ key
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
+ $langs->load('paypal');
+ $typeforonlinepayment='free';
+ if ($this->param["models"]=='order_send') $typeforonlinepayment='order'; // TODO use detection on something else than template
+ if ($this->param["models"]=='facture_send') $typeforonlinepayment='invoice'; // TODO use detection on something else than template
+ if ($this->param["models"]=='member_send') $typeforonlinepayment='member'; // TODO use detection on something else than template
+ $url=getOnlinePaymentUrl(0, $typeforonlinepayment, $this->substit['__REF__']);
+ $paymenturl=$url;
+ }
+
$this->substit['__ONLINE_PAYMENT_URL__']=$paymenturl;
//Add lines substitution key from each line
diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php
index 565cd4310b4..dfd70a075f0 100644
--- a/htdocs/core/class/html.formother.class.php
+++ b/htdocs/core/class/html.formother.class.php
@@ -222,7 +222,7 @@ class FormOther
$out='';
- $sql = "SELECT r.taux";
+ $sql = "SELECT r.taux, r.revenuestamp_type";
$sql.= " FROM ".MAIN_DB_PREFIX."c_revenuestamp as r,".MAIN_DB_PREFIX."c_country as c";
$sql.= " WHERE r.active = 1 AND r.fk_pays = c.rowid";
$sql.= " AND c.code = '".$country_code."'";
@@ -242,14 +242,14 @@ class FormOther
$obj = $this->db->fetch_object($resql);
if (($selected && $selected == $obj->taux) || $num == 1)
{
- $out.='
';
$i++;
}
diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php
index bf8433cb5d6..4b78bb53bb7 100644
--- a/htdocs/core/lib/company.lib.php
+++ b/htdocs/core/lib/company.lib.php
@@ -581,6 +581,8 @@ function getFormeJuridiqueLabel($code)
*/
function isInEEC($object)
{
+ if (empty($object->country_code)) return false;
+
// List of all country codes that are in europe for european vat rules
// List found on http://ec.europa.eu/taxation_customs/common/faq/faq_1179_en.htm#9
$country_code_in_EEC=array(
diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php
index 220a390d577..daf4621ebcb 100644
--- a/htdocs/core/lib/files.lib.php
+++ b/htdocs/core/lib/files.lib.php
@@ -2723,3 +2723,44 @@ function dol_readcachefile($directory, $filename)
$object = unserialize(file_get_contents($cachefile));
return $object;
}
+
+
+/**
+ * Function to get list of updated or modified files.
+ * $file_list is used as global variable
+ *
+ * @param array $file_list Array for response
+ * @param SimpleXMLElement $dir SimpleXMLElement of files to test
+ * @param string $path Path of files relative to $pathref. We start with ''. Used by recursive calls.
+ * @param string $pathref Path ref (DOL_DOCUMENT_ROOT)
+ * @param array $checksumconcat Array of checksum
+ * @return array Array of filenames
+ */
+function getFilesUpdated(&$file_list, SimpleXMLElement $dir, $path = '', $pathref = '', &$checksumconcat = array())
+{
+ $exclude = 'install';
+
+ foreach ($dir->md5file as $file) // $file is a simpleXMLElement
+ {
+ $filename = $path.$file['name'];
+ $file_list['insignature'][] = $filename;
+
+ //if (preg_match('#'.$exclude.'#', $filename)) continue;
+
+ if (!file_exists($pathref.'/'.$filename))
+ {
+ $file_list['missing'][] = array('filename'=>$filename, 'expectedmd5'=>(string) $file);
+ }
+ else
+ {
+ $md5_local = md5_file($pathref.'/'.$filename);
+ if ($md5_local != (string) $file) $file_list['updated'][] = array('filename'=>$filename, 'expectedmd5'=>(string) $file, 'md5'=>(string) $md5_local);
+ $checksumconcat[] = $md5_local;
+ }
+ }
+
+ foreach ($dir->dir as $subdir) getFilesUpdated($file_list, $subdir, $path.$subdir['name'].'/', $pathref, $checksumconcat);
+
+ return $file_list;
+}
+
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 61f85b88a12..ea71f3e1100 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -516,7 +516,7 @@ function GETPOST($paramname, $check='none', $method=0, $filter=NULL, $options=NU
if (! is_numeric($out)) { $out=''; }
break;
case 'intcomma':
- if (preg_match('/[^0-9,]+/i',$out)) $out='';
+ if (preg_match('/[^0-9,-]+/i',$out)) $out='';
break;
case 'alpha':
if (! is_array($out))
@@ -4026,7 +4026,7 @@ function price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerou
{
if ($currency_code == 'auto') $currency_code=$conf->currency;
- $listofcurrenciesbefore=array('USD','GBP','AUD','MXN','PEN');
+ $listofcurrenciesbefore=array('USD','GBP','AUD','MXN','PEN','CNY');
if (in_array($currency_code,$listofcurrenciesbefore)) $cursymbolbefore.=$outlangs->getCurrencySymbol($currency_code);
else
{
@@ -6127,15 +6127,15 @@ function dol_osencode($str)
* Store also Code-Id into a cache to speed up next request on same key.
*
* @param DoliDB $db Database handler
- * @param string $key Code or Id to get Id or Code
+ * @param string $key Code or Id to get Id or Code
* @param string $tablename Table name without prefix
- * @param string $fieldkey Field for code
- * @param string $fieldid Field for id
+ * @param string $fieldkey Field to search the key into
+ * @param string $fieldid Field to get
* @param int $entityfilter Filter by entity
* @return int <0 if KO, Id of code if OK
* @see $langs->getLabelFromKey
*/
-function dol_getIdFromCode($db,$key,$tablename,$fieldkey='code',$fieldid='id',$entityfilter=0)
+function dol_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0)
{
global $cache_codes;
diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php
index 6fe236d6b41..b8833e42543 100644
--- a/htdocs/core/lib/usergroups.lib.php
+++ b/htdocs/core/lib/usergroups.lib.php
@@ -224,7 +224,7 @@ function group_prepare_head($object)
if ($canreadperms)
{
$head[$h][0] = DOL_URL_ROOT.'/user/group/perms.php?id='.$object->id;
- $head[$h][1] = $langs->trans("GroupRights");
+ $head[$h][1] = $langs->trans("GroupRights"). '
'.($object->nb_rights).'';
$head[$h][2] = 'rights';
$h++;
}
@@ -267,7 +267,7 @@ function user_admin_prepare_head()
$head[$h][2] = 'attributes';
$h++;
- $head[$h][0] = DOL_URL_ROOT.'/user/admin/group_extrafields.php';
+ $head[$h][0] = DOL_URL_ROOT.'/user/admin/group_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFields")." ".$langs->trans("Groups");
$head[$h][2] = 'attributes_group';
$h++;
diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php
index 08fcdd82a58..9dc1b2c3863 100644
--- a/htdocs/core/lib/website.lib.php
+++ b/htdocs/core/lib/website.lib.php
@@ -39,7 +39,7 @@ function dolWebsiteReplacementOfLinks($website, $content, $removephppart=0)
if ($removephppart) $replacewith='';
$content = preg_replace('/value="<\?php((?!\?>).)*\?>\n*/ims', 'value="'.$replacewith.'"', $content);
- $replacewith='
...php...';
+ $replacewith='
...php...';
if ($removephppart) $replacewith='';
$content = preg_replace('/<\?php((?!\?>).)*\?>\n*/ims', $replacewith, $content);
diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php
index 0155634ed25..eaf674d5eea 100644
--- a/htdocs/core/modules/DolibarrModules.class.php
+++ b/htdocs/core/modules/DolibarrModules.class.php
@@ -641,6 +641,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
if ((float) DOL_VERSION >= 6.0)
{
@include_once DOL_DOCUMENT_ROOT.'/core/lib/parsemd.lib.php';
+
$content = dolMd2Html($content, 'parsedown',
array(
'doc/'=>dol_buildpath(strtolower($this->name).'/doc/', 1),
@@ -1666,7 +1667,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
$r_def = $this->rights[$key][3];
$r_perms = $this->rights[$key][4];
$r_subperms = isset($this->rights[$key][5])?$this->rights[$key][5]:'';
- $r_modul = $this->rights_class;
+ $r_modul = empty($this->rights_class)?strtolower($this->name):$this->rights_class;
if (empty($r_type)) $r_type='w';
diff --git a/htdocs/core/modules/modBlockedLog.class.php b/htdocs/core/modules/modBlockedLog.class.php
index 95d1933cc89..eece7323c68 100644
--- a/htdocs/core/modules/modBlockedLog.class.php
+++ b/htdocs/core/modules/modBlockedLog.class.php
@@ -36,10 +36,12 @@ class modBlockedLog extends DolibarrModules
*/
function __construct($db)
{
- global $langs,$conf,$mysoc;
+ global $langs, $conf, $mysoc;
$this->db = $db;
$this->numero = 3200;
+ // Key text used to identify module (for permissions, menus, etc...)
+ $this->rights_class = 'blockedlog';
// Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
// It is used to group modules in module setup page
@@ -61,7 +63,7 @@ class modBlockedLog extends DolibarrModules
// Config pages
//-------------
- $this->config_page_url = array('blockedlog.php@blockedlog');
+ $this->config_page_url = array('blockedlog.php?withtab=1@blockedlog');
// Dependancies
//-------------
@@ -77,17 +79,27 @@ class modBlockedLog extends DolibarrModules
// Currently, activation is not automatic because only companies (in France) making invoices to non business customers must
// enable this module.
- // It is automatic only if $conf->global->BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY is on.
- if (! empty($conf->global->BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY))
+ /*if (! empty($conf->global->BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY))
{
- $this->automatic_activation = array('FR'=>'BlockedLogActivatedBecauseRequiredByYourCountryLegislation');
- }
+ $tmp=explode(',', $conf->global->BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY);
+ $this->automatic_activation = array();
+ foreach($tmp as $key)
+ {
+ $this->automatic_activation[$key]='BlockedLogActivatedBecauseRequiredByYourCountryLegislation';
+ }
+ }*/
+ //var_dump($this->automatic_activation);
- $this->always_enabled = !empty($conf->blockedlog->enabled) && !empty($conf->global->BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY) && in_array($mysoc->country_code, explode(',', $conf->global->BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY));
+ $this->always_enabled = (!empty($conf->blockedlog->enabled)
+ && !empty($conf->global->BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY)
+ && in_array($mysoc->country_code, explode(',', $conf->global->BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY))
+ && $this->alreadyUsed(1));
// Constants
//-----------
- $this->const = array();
+ $this->const = array(
+ 1=>array('BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY', 'chaine', 'FR', 'This is list of country code where the module may be mandatory', 0, 'current', 0)
+ );
// New pages on tabs
// -----------------
@@ -97,23 +109,91 @@ class modBlockedLog extends DolibarrModules
//------
$this->boxes = array();
+ // Permissions
+ // -----------------
+ $this->rights = array(); // Permission array used by this module
+
+ $r=0;
+ $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
+ $this->rights[$r][1] = 'Read archived events and fingerprints'; // Permission label
+ $this->rights[$r][3] = 0; // Permission by default for new user (0/1)
+ $this->rights[$r][4] = 'read'; // In php code, permission will be checked by test if ($user->rights->mymodule->level1->level2)
+ $this->rights[$r][5] = '';
+
// Main menu entries
- //------------------
- $this->menu = array();
+ // -----------------
+ $r=0;
+ $this->menu[$r]=array(
+ 'fk_menu'=>'fk_mainmenu=tools', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
+ 'mainmenu'=>'tools',
+ 'leftmenu'=>'blockedlogbrowser',
+ 'type'=>'left', // This is a Left menu entry
+ 'titre'=>'BrowseBlockedLog',
+ 'url'=>'/blockedlog/admin/blockedlog_list.php?mainmenu=tools&leftmenu=blockedlogbrowser',
+ 'langs'=>'blockedlog', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
+ 'position'=>200,
+ 'enabled'=>'$conf->blockedlog->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
+ 'perms'=>'$user->rights->blockedlog->read', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
+ 'target'=>'',
+ 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
+ $r++;
}
+
/**
* Check if module was already used before unactivation linked to warnings_unactivation property
+ *
+ * @return boolean True if already used, otherwise False
*/
function alreadyUsed() {
- $res = $this->db->query("SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."blockedlog");
- if($res!==false) {
- $obj = $this->db->fetch_object($res);
- return ($obj->nb > 0);
+ require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php';
+ $b=new BlockedLog($this->db);
+ return $b->alreadyUsed(1);
+ }
+
+
+ /**
+ * Function called when module is enabled.
+ * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
+ * It also creates data directories.
+ *
+ * @param string $options Options when enabling module ('', 'noboxes')
+ * @return int 1 if OK, 0 if KO
+ */
+ function init($options='')
+ {
+ global $conf, $user;
+
+ $sql = array();
+
+ // If already used, we add an entry to show we enable module
+ require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php';
+
+ $object=new stdClass;
+ $object->id = 1;
+ $object->element = 'module';
+ $object->ref = 'systemevent';
+ $object->entity = $conf->entity;
+ $object->date = dol_now();
+
+ $b=new BlockedLog($this->db);
+ $result = $b->setObjectData($object, 'MODULE_SET', 0);
+ if ($result < 0)
+ {
+ $this->error = $b->error;
+ $this->errors = $b->erros;
+ return 0;
}
- return false;
+ $res = $b->create($user);
+ if ($res<=0) {
+ $this->error = $b->error;
+ $this->errors = $b->errors;
+ return $res;
+ }
+
+ return $this->_init($sql, $options);
}
/**
@@ -126,26 +206,43 @@ class modBlockedLog extends DolibarrModules
*/
function remove($options = '') {
- global $user;
+ global $conf, $user;
- require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php';
+ $sql = array();
- $object=new stdClass;
+ // If already used, we add an entry to show we enable module
+ require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php';
+
+ $object=new stdClass;
$object->id = 1;
$object->element = 'module';
- $object->ref = 'module';
+ $object->ref = 'systemevent';
+ $object->entity = $conf->entity;
$object->date = dol_now();
$b=new BlockedLog($this->db);
- $b->setObjectData($object, 'MODULE_RESET', -1);
-
- $res = $b->create($user);
- if($res<=0) {
+ $result = $b->setObjectData($object, 'MODULE_RESET', 0);
+ if ($result < 0)
+ {
$this->error = $b->error;
- return $res;
+ $this->errors = $b->erros;
+ return 0;
}
- return $this->_remove(array(), $options);
+ if ($b->alreadyUsed(1))
+ {
+ $res = $b->create($user, '0000000000'); // If already used for something else than SET or UNSET, we log with error
+ }
+ else
+ {
+ $res = $b->create($user);
+ }
+ if ($res<=0) {
+ $this->error = $b->error;
+ $this->errors = $b->errors;
+ return $res;
+ }
+ return $this->_remove($sql, $options);
}
}
diff --git a/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php b/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php
index 48ed23aba32..64796c79654 100644
--- a/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php
+++ b/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php
@@ -55,16 +55,35 @@ class InterfaceActionsBlockedLog extends DolibarrTriggers
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
- // Event/record is qualified
- if ($action==='BILL_VALIDATE' || $action === 'BILL_PAYED' || $action==='BILL_UNPAYED' || $action==='BILL_DELETE'
- || $action === 'BILL_SENTBYMAIL' || $action === 'DOC_DOWNLOAD' || $action === 'DOC_PREVIEW'
- || $action === 'BILL_SUPPLIER_PAYED')
+ $b=new BlockedLog($this->db);
+
+ // Tracked events
+ if (! in_array($action, array_keys($b->trackedevents)))
{
+ return 0;
+ }
+
+ // Event/record is qualified
+ $qualified = 0;
+ $amounts = 0;
+ if ($action==='BILL_VALIDATE' || $action==='BILL_DELETE' || $action === 'BILL_SENTBYMAIL'
+ || $action==='BILL_SUPPLIER_VALIDATE' || $action==='BILL_SUPPLIER_DELETE' || $action === 'BILL_SUPPLIER_SENTBYMAIL'
+ || (in_array($object->element, array('facture','suplier_invoice')) && $action === 'DOC_DOWNLOAD') || (in_array($object->element, array('facture','suplier_invoice')) && $action === 'DOC_PREVIEW')
+ )
+ {
+ $qualified++;
$amounts= (double) $object->total_ttc;
}
- else if ($action === 'PAYMENT_CUSTOMER_CREATE' || $action === 'PAYMENT_SUPPLIER_CREATE'
+ /*if ($action === 'BILL_PAYED' || $action==='BILL_UNPAYED'
+ || $action === 'BILL_SUPPLIER_PAYED' || $action === 'BILL_SUPPLIER_UNPAYED')
+ {
+ $qualified++;
+ $amounts= (double) $object->total_ttc;
+ }*/
+ if ($action === 'PAYMENT_CUSTOMER_CREATE' || $action === 'PAYMENT_SUPPLIER_CREATE'
|| $action === 'PAYMENT_CUSTOMER_DELETE' || $action === 'PAYMENT_SUPPLIER_DELETE') // 'PAYMENT_ADD_TO_BANK'
{
+ $qualified++;
$amounts = 0;
if(!empty($object->amounts)) {
foreach($object->amounts as $amount) {
@@ -72,22 +91,33 @@ class InterfaceActionsBlockedLog extends DolibarrTriggers
}
}
}
- else if (strpos($action,'PAYMENT')!==false && ! in_array($action, array('PAYMENT_ADD_TO_BANK'))) {
+ if (strpos($action,'PAYMENT')!==false && ! in_array($action, array('PAYMENT_ADD_TO_BANK')))
+ {
+ $qualified++;
$amounts= (double) $object->amount;
}
- else {
+
+ // Another protection.
+ // May be used when event is DOC_DOWNLOAD or DOC_PREVIEW and element is not an invoice
+ if (! $qualified)
+ {
return 0; // not implemented action log
}
- $b=new BlockedLog($this->db);
- $b->setObjectData($object, $action, $amounts); // Set field date_object, ref_object, fk_object, element, object_data
+ $result = $b->setObjectData($object, $action, $amounts); // Set field date_object, ref_object, fk_object, element, object_data
+ if ($result < 0)
+ {
+ $this->error = $b->error;
+ $this->errors = $b->erros;
+ return -1;
+ }
$res = $b->create($user);
if ($res<0)
{
- setEventMessage($b->error,'errors');
+ setEventMessages($b->error, $b->errors, 'errors');
return -1;
}
else
diff --git a/htdocs/includes/parsedown/Parsedown.php b/htdocs/includes/parsedown/Parsedown.php
index a1ec563683f..df718bce111 100644
--- a/htdocs/includes/parsedown/Parsedown.php
+++ b/htdocs/includes/parsedown/Parsedown.php
@@ -1180,7 +1180,9 @@ class Parsedown
'name' => 'img',
'attributes' => array(
'src' => $Link['element']['attributes']['href'],
- 'alt' => $Link['element']['text'],
+ 'alt' => $Link['element']['text'],
+ // @CHANGE LDR
+ 'class' => $Link['element']['attributes']['class']
),
),
);
@@ -1231,6 +1233,13 @@ class Parsedown
}
$extent += strlen($matches[0]);
+
+ // @CHANGE LDR
+ if (preg_match('/{([^}]+)}/', $remainder, $matches2))
+ {
+ $Element['attributes']['class'] = $matches2[1];
+ $remainder = preg_replace('/{'.preg_quote($matches2[1],'/').'}/', '', $remainder);
+ }
}
else
{
@@ -1426,7 +1435,9 @@ class Parsedown
if (isset($Element['handler']))
{
- $markup .= $this->{$Element['handler']}($Element['text']);
+ // @CHANGE LDR
+ //$markup .= $this->{$Element['handler']}($Element['text']);
+ $markup .= preg_replace('/>{[^}]+}/', '>', $this->{$Element['handler']}($Element['text']));
}
else
{
diff --git a/htdocs/install/mysql/data/llx_c_revenuestamp.sql b/htdocs/install/mysql/data/llx_c_revenuestamp.sql
index 040a8370485..ee4e9ab7873 100644
--- a/htdocs/install/mysql/data/llx_c_revenuestamp.sql
+++ b/htdocs/install/mysql/data/llx_c_revenuestamp.sql
@@ -27,4 +27,10 @@
delete from llx_c_revenuestamp;
-- TUNISIA (id country=10) --
-insert into llx_c_revenuestamp(rowid,fk_pays,taux,note,active) values (101, 10, 0.4, 'Revenue stamp tunisia', 1);
+insert into llx_c_revenuestamp(rowid,fk_pays,taux,revenuestamp_type,note,active) values (101, 10, 0.4, 'fixed', 'Revenue stamp tunisia', 1);
+
+
+-- MEXICO (id country=154) --
+insert into llx_c_revenuestamp(rowid,fk_pays,taux,revenuestamp_type,note,active) values (1541, 154, 1.5, 'percent', 'Revenue stamp mexico', 1);
+insert into llx_c_revenuestamp(rowid,fk_pays,taux,revenuestamp_type,note,active) values (1542, 154, 3, 'percent', 'Revenue stamp mexico', 1);
+
diff --git a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql
index bf49e8730fb..f042cb83556 100644
--- a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql
+++ b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql
@@ -37,6 +37,8 @@
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_stock_mouvement MODIFY batch VARCHAR(30) COLLATE utf8_unicode_ci;
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_product_lot MODIFY batch VARCHAR(30) CHARACTER SET utf8;
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_product_lot MODIFY batch VARCHAR(30) COLLATE utf8_unicode_ci;
+-- VMYSQLUTF8UNICODECI ALTER TABLE llx_expeditiondet_batch MODIFY batch VARCHAR(30) CHARACTER SET utf8;
+-- VMYSQLUTF8UNICODECI ALTER TABLE llx_expeditiondet_batch MODIFY batch VARCHAR(30) COLLATE utf8_unicode_ci;
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_product_batch MODIFY batch VARCHAR(30) CHARACTER SET utf8;
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_product_batch MODIFY batch VARCHAR(30) COLLATE utf8_unicode_ci;
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_product MODIFY accountancy_code_sell VARCHAR(32) CHARACTER SET utf8;
@@ -69,6 +71,8 @@ ALTER TABLE llx_website_page ADD COLUMN type_container varchar(16) NOT NULL DEFA
-- For 7.0
+ALTER TABLE llx_c_revenuestamp ADD COLUMN revenuestamp_type varchar(16) DEFAULT 'fixed' NOT NULL;
+
UPDATE llx_contrat SET ref = rowid WHERE ref IS NULL OR ref = '';
ALTER TABLE llx_contratdet ADD COLUMN vat_src_code varchar(10) DEFAULT '';
diff --git a/htdocs/install/mysql/tables/llx_c_revenuestamp.sql b/htdocs/install/mysql/tables/llx_c_revenuestamp.sql
index 0eb5a46216d..9bdff7f0053 100644
--- a/htdocs/install/mysql/tables/llx_c_revenuestamp.sql
+++ b/htdocs/install/mysql/tables/llx_c_revenuestamp.sql
@@ -21,6 +21,7 @@ create table llx_c_revenuestamp
rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
fk_pays integer NOT NULL,
taux double NOT NULL,
+ revenuestamp_type varchar(16) DEFAULT 'fixed' NOT NULL,
note varchar(128),
active tinyint DEFAULT 1 NOT NULL,
accountancy_code_sell varchar(32) DEFAULT NULL,
diff --git a/htdocs/install/mysql/tables/llx_projet_task_comment.sql b/htdocs/install/mysql/tables/llx_comment.sql
similarity index 86%
rename from htdocs/install/mysql/tables/llx_projet_task_comment.sql
rename to htdocs/install/mysql/tables/llx_comment.sql
index 561f8276455..df5f41ba91b 100644
--- a/htdocs/install/mysql/tables/llx_projet_task_comment.sql
+++ b/htdocs/install/mysql/tables/llx_comment.sql
@@ -16,13 +16,15 @@
--
-- ===========================================================================
-CREATE TABLE llx_projet_task_comment (
+CREATE TABLE llx_comment (
rowid integer AUTO_INCREMENT PRIMARY KEY,
datec datetime DEFAULT NULL,
tms timestamp,
description text NOT NULL,
- fk_user integer DEFAULT NULL,
- fk_task integer DEFAULT NULL,
+ fk_user_author integer DEFAULT NULL,
+ fk_element integer DEFAULT NULL,
+ element_type varchar(50) DEFAULT NULL,
entity integer DEFAULT 1,
import_key varchar(125) DEFAULT NULL
-) ENGINE=innodb;
+)ENGINE=innodb;
+
diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php
index 1a486cb34af..eda1a4d26d5 100644
--- a/htdocs/install/upgrade2.php
+++ b/htdocs/install/upgrade2.php
@@ -380,7 +380,9 @@ if (! GETPOST('action','aZ09') || preg_match('/upgrade/i',GETPOST('action','aZ09
if (versioncompare($versiontoarray,$afterversionarray) >= 0 && versioncompare($versiontoarray,$beforeversionarray) <= 0)
{
// Migrate contact association
- migrate_event_assignement_contact($db,$langs,$conf);
+ migrate_event_assignement_contact($db,$langs,$conf);
+
+ migrate_reset_blocked_log($db,$langs,$conf);
}
}
@@ -3872,6 +3874,127 @@ function migrate_event_assignement_contact($db,$langs,$conf)
print '';
}
+
+/**
+ * Migrate to reset the blocked log for V7+ algorithm
+ *
+ * @param DoliDB $db Database handler
+ * @param Translate $langs Object langs
+ * @param Conf $conf Object conf
+ * @return void
+ */
+function migrate_reset_blocked_log($db,$langs,$conf)
+{
+ global $user;
+
+ require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php';
+
+ print '
';
+
+ print ' ';
+ print ''.$langs->trans('MigrationResetBlockedLog')." \n";
+
+ $error = 0;
+
+ dolibarr_install_syslog("upgrade2::migrate_reset_blocked_log");
+
+ $db->begin();
+
+ $sqlSelect = "SELECT DISTINCT entity";
+ $sqlSelect.= " FROM ".MAIN_DB_PREFIX."blockedlog";
+
+ //print $sqlSelect;
+
+ $resql = $db->query($sqlSelect);
+ if ($resql)
+ {
+ $i = 0;
+ $num = $db->num_rows($resql);
+
+ if ($num)
+ {
+ while ($i < $num)
+ {
+ $obj = $db->fetch_object($resql);
+
+ print 'Process entity '.$obj->entity;
+
+ $sqlSearch = "SELECT count(rowid) as nb FROM ".MAIN_DB_PREFIX."blockedlog WHERE action = 'MODULE_SET' and entity = ".$obj->entity;
+ $resqlSearch = $db->query($sqlSearch);
+ if ($resqlSearch)
+ {
+ $objSearch = $db->fetch_object($resqlSearch);
+ //var_dump($objSearch);
+ if ($objSearch && $objSearch->nb == 0)
+ {
+ print ' - Record for entity must be reset...';
+
+ $sqlUpdate = "DELETE FROM ".MAIN_DB_PREFIX."blockedlog";
+ $sqlUpdate.= " WHERE entity = " . $obj->entity;
+ $resqlUpdate=$db->query($sqlUpdate);
+ if (! $resqlUpdate)
+ {
+ $error++;
+ dol_print_error($db);
+ }
+ else
+ {
+ // Add set line
+ $object=new stdClass;
+ $object->id = 1;
+ $object->element = 'module';
+ $object->ref = 'systemevent';
+ $object->entity = $obj->entity;
+ $object->date = dol_now();
+
+ $b=new BlockedLog($db);
+ $b->setObjectData($object, 'MODULE_SET', 0);
+
+ $res = $b->create($user);
+ if ($res<=0) {
+ $this->error = $b->error;
+ $this->errors = $b->errors;
+ $error++;
+ }
+ }
+ }
+ else
+ {
+ print ' - '.$langs->trans('AlreadyInV7');
+ }
+ }
+ else
+ {
+ dol_print_error($db);
+ }
+
+ $i++;
+ }
+ }
+ else
+ {
+ print $langs->trans('NothingToDo')." \n";
+ }
+
+ if (! $error)
+ {
+ $db->commit();
+ }
+ else
+ {
+ $db->rollback();
+ }
+ }
+ else
+ {
+ dol_print_error($db);
+ $db->rollback();
+ }
+
+ print ' |
';
+}
+
+
/**
* Migrate to add entity value into llx_societe_remise
*
@@ -3946,7 +4069,6 @@ function migrate_remise_entity($db,$langs,$conf)
$db->rollback();
}
-
print '';
}
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index fc3caa74657..a4ece445581 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -539,7 +539,7 @@ Module320Desc=Add RSS feed inside Dolibarr screen pages
Module330Name=Bookmarks
Module330Desc=Bookmarks management
Module400Name=Projects/Opportunities/Leads
-Module400Desc=Management of projects, opportunities or leads. You can then assign any element (invoice, order, proposal, intervention, ...) to a project and get a transversal view from the project view.
+Module400Desc=Management of projects, opportunities/leads and/or tasks. You can also assign any element (invoice, order, proposal, intervention, ...) to a project and get a transversal view from the project view.
Module410Name=Webcalendar
Module410Desc=Webcalendar integration
Module500Name=Special expenses
@@ -904,6 +904,7 @@ SetupSaved=Setup saved
SetupNotSaved=Setup not saved
BackToModuleList=Back to modules list
BackToDictionaryList=Back to dictionaries list
+TypeOfRevenueStamp=Type of revenue stamp
VATManagement=VAT Management
VATIsUsedDesc=By default when creating prospects, invoices, orders etc the VAT rate follows the active standard rule:
If the seller is not subjected to VAT, then VAT defaults to 0. End of rule.
If the (selling country= buying country), then the VAT by default equals the VAT of the product in the selling country. End of rule.
If seller and buyer are both in the European Community and goods are transport products (car, ship, plane), the default VAT is 0 ( The VAT should be paid by the buyer to the customoffice of his country and not to the seller). End of rule.
If seller and buyer are both in the European Community and the buyer is not a company, then the VAT by defaults to the VAT of the product sold. End of rule.
If seller and buyer are both in the European Community and the buyer is a company, then the VAT is 0 by default . End of rule.
In any othe case the proposed default is VAT=0. End of rule.
VATIsNotUsedDesc=By default the proposed VAT is 0 which can be used for cases like associations, individuals ou small companies.
diff --git a/htdocs/langs/en_US/blockedlog.lang b/htdocs/langs/en_US/blockedlog.lang
index 5b455fdd7b4..a047b9ff0f0 100644
--- a/htdocs/langs/en_US/blockedlog.lang
+++ b/htdocs/langs/en_US/blockedlog.lang
@@ -2,10 +2,11 @@ BlockedLog=Unalterable Logs
Field=Field
BlockedLogDesc=This module tracks some events into an unalterable log (that you can't modify once recorded) into a block chain, in real time. This module provides compatibility with requirements of laws of some countries (like France with the law Fincance 2016 - Norme NF535).
Fingerprints=Archived events and fingerprints
-FingerprintsDesc=Archived business events and fingerprints
+FingerprintsDesc=This is the tool to browse the archived unalterable logs. Note that, by definition, there is no feature to purge this log and every change tried to be done directly into this log (by a hacker for example) will be reported with a non valid fingerprint. If you really need to purge this table because you used your application for a demo/test purpose and want to clean your data to start your production, you can ask your reseller or integrator to reset your database (all your data will be removed).
CompanyInitialKey=Company initial key (hash of genesis block)
+BrowseBlockedLog=Browse unalterable logs
ShowAllFingerPrintsMightBeTooLong=Show all archived logs (might be long)
-ShowAllFingerPrintsErrorsMightBeTooLong=Show all archive logs with error (might be long)
+ShowAllFingerPrintsErrorsMightBeTooLong=Show all non valid archive logs (might be long)
DownloadBlockChain=Download fingerprints
KoCheckFingerprintValidity=Archived log is not valid. It means someone (a hacker ?) has modified some datas of this archived log after it was recorded, or has erased the previous archived record (check that line with previous # exists).
OkCheckFingerprintValidity=Archived log is valid. It means all data on this line were not modified and record follow the previous one.
@@ -21,7 +22,10 @@ logBILL_UNPAYED=Customer bill set unpayed
logBILL_VALIDATE=Customer bill validated
logBILL_SENTBYMAIL=Customer bill send by mail
logBILL_DELETE=Customer bill deleted
+logMODULE_RESET=Module BlockedLog was disabled
+logMODULE_SET=Module BlockedLog was enabled
BlockedlogInfoDialog=Log Details
+ListOfTrackedEvents=List of tracked events
Fingerprint=Fingerprint
DownloadLogCSV=Download archive logs (CSV)
logDOC_PREVIEW=Preview of a validated document in order to print or download
@@ -30,4 +34,4 @@ DataOfArchivedEvent=Full datas of archived event
ImpossibleToReloadObject=Object (type %s, id %s) removed (see 'Full data' link for unerasable saved data)
BlockedLogAreRequiredByYourCountryLegislation=Unalterable Logs module may be required by the legislation of your country. Disabling this module may render any future transactions invalid with respect to the law and the use of legal software as they can not be validated by a tax audit.
BlockedLogActivatedBecauseRequiredByYourCountryLegislation=Unalterable Logs module was activated because of the legislation of your country. Disabling this module may render any future transactions invalid with respect to the law and the use of legal software as they can not be validated by a tax audit.
-BlockedLogDisableNotAllowedForCountry=Disable not allowed for this countries (just to prevent to disable the module by error, if your country is...)
\ No newline at end of file
+BlockedLogDisableNotAllowedForCountry=List of countries where usage of this module is mandatory (just to prevent to disable the module by error, if your country is in this list, disable of module is not possible without editing this list first)
\ No newline at end of file
diff --git a/htdocs/langs/en_US/install.lang b/htdocs/langs/en_US/install.lang
index 7204938098b..87ef7d79b13 100644
--- a/htdocs/langs/en_US/install.lang
+++ b/htdocs/langs/en_US/install.lang
@@ -141,6 +141,7 @@ KeepDefaultValuesProxmox=You use the Dolibarr setup wizard from a Proxmox virtua
UpgradeExternalModule=Run dedicated upgrade process of external modules
SetAtLeastOneOptionAsUrlParameter=Set at least one option as a parameter in URL. For example: '...repair.php?standard=confirmed'
NothingToDelete=Nothing to clean/delete
+NothingToDo=Nothing to do
#########
# upgrade
MigrationFixData=Fix for denormalized data
@@ -196,6 +197,7 @@ MigrationEventsContact=Migration of events to add event contact into assignement
MigrationRemiseEntity=Update entity field value of llx_societe_remise
MigrationRemiseExceptEntity=Update entity field value of llx_societe_remise_except
MigrationReloadModule=Reload module %s
+MigrationResetBlockedLog=Reset module BlockedLog for v7 algorithm
ShowNotAvailableOptions=Show not available options
HideNotAvailableOptions=Hide not available options
ErrorFoundDuringMigration=Error were reported during migration process so next step is not available. To ignore errors, you can
click here, but application or some features may not work correctly until fixed.
diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang
index 7075f45ecd2..48bd55a41ee 100644
--- a/htdocs/langs/en_US/projects.lang
+++ b/htdocs/langs/en_US/projects.lang
@@ -215,6 +215,7 @@ AllowToLinkFromOtherCompany=Allow to link project from other company
S
LatestProjects=Latest %s projects
LatestModifiedProjects=Latest %s modified projects
OtherFilteredTasks=Other filtered tasks
+NoAssignedTasks=No assigned tasks (assign yourself project/tasks from the top select box to enter time on it)
# Comments trans
AllowCommentOnTask=Allow user comments on tasks
AllowCommentOnProject=Allow user comments on projects
diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php
index 32d8aa1c2aa..b920c8d1a6a 100644
--- a/htdocs/loan/card.php
+++ b/htdocs/loan/card.php
@@ -27,8 +27,8 @@ require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/loan.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
-if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
+if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
@@ -124,42 +124,42 @@ if (empty($reshook))
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Rate")), null, 'errors');
}
- if (! $error)
- {
- $object->label = GETPOST('label');
- $object->fk_bank = GETPOST('accountid');
- $object->capital = $capital;
- $object->datestart = $datestart;
- $object->dateend = $dateend;
- $object->nbterm = GETPOST('nbterm');
- $object->rate = $rate;
- $object->note_private = GETPOST('note_private','none');
- $object->note_public = GETPOST('note_public','none');
- $object->fk_project = GETPOST('projectid','int');
+ if (! $error)
+ {
+ $object->label = GETPOST('label');
+ $object->fk_bank = GETPOST('accountid');
+ $object->capital = $capital;
+ $object->datestart = $datestart;
+ $object->dateend = $dateend;
+ $object->nbterm = GETPOST('nbterm');
+ $object->rate = $rate;
+ $object->note_private = GETPOST('note_private','none');
+ $object->note_public = GETPOST('note_public','none');
+ $object->fk_project = GETPOST('projectid','int');
- $accountancy_account_capital = GETPOST('accountancy_account_capital');
- $accountancy_account_insurance = GETPOST('accountancy_account_insurance');
- $accountancy_account_interest = GETPOST('accountancy_account_interest');
+ $accountancy_account_capital = GETPOST('accountancy_account_capital');
+ $accountancy_account_insurance = GETPOST('accountancy_account_insurance');
+ $accountancy_account_interest = GETPOST('accountancy_account_interest');
- if ($accountancy_account_capital <= 0) { $object->account_capital = ''; } else { $object->account_capital = $accountancy_account_capital; }
- if ($accountancy_account_insurance <= 0) { $object->account_insurance = ''; } else { $object->account_insurance = $accountancy_account_insurance; }
- if ($accountancy_account_interest <= 0) { $object->account_interest = ''; } else { $object->account_interest = $accountancy_account_interest; }
+ if ($accountancy_account_capital <= 0) { $object->account_capital = ''; } else { $object->account_capital = $accountancy_account_capital; }
+ if ($accountancy_account_insurance <= 0) { $object->account_insurance = ''; } else { $object->account_insurance = $accountancy_account_insurance; }
+ if ($accountancy_account_interest <= 0) { $object->account_interest = ''; } else { $object->account_interest = $accountancy_account_interest; }
- $id=$object->create($user);
- if ($id <= 0)
- {
- $error++;
- setEventMessages($object->error, $object->errors, 'errors');
- $action = 'create';
- }
- }
- }
- else
- {
- header("Location: index.php");
- exit();
- }
- }
+ $id=$object->create($user);
+ if ($id <= 0)
+ {
+ $error++;
+ setEventMessages($object->error, $object->errors, 'errors');
+ $action = 'create';
+ }
+ }
+ }
+ else
+ {
+ header("Location: index.php");
+ exit();
+ }
+ }
// Update record
else if ($action == 'update' && $user->rights->loan->write)
@@ -550,11 +550,13 @@ if ($id > 0)
print '';
// Accountancy account capital
- print '| ';
- print $langs->trans("LoanAccountancyCapitalCode");
- print ' | ';
+ print ' |
';
if ($action == 'edit')
{
+ print '| ';
+ print $langs->trans("LoanAccountancyCapitalCode");
+ print ' | ';
+
if (! empty($conf->accounting->enabled))
{
print $formaccounting->select_account($object->account_capital, 'accountancy_account_capital', 1, '', 1, 1);
@@ -563,23 +565,36 @@ if ($id > 0)
{
print '';
}
+ print ' | ';
}
else
{
- if (! empty($conf->accounting->enabled)) {
- print length_accountg($object->account_capital);
+ print '';
+ print $langs->trans("LoanAccountancyCapitalCode");
+ print ' | ';
+
+ if (! empty($conf->accounting->enabled))
+ {
+ $accountingaccount = new AccountingAccount($db);
+ $accountingaccount->fetch('',$object->account_capital, 1);
+
+ print $accountingaccount->getNomUrl(0,1,1,'',1);
} else {
print $object->account_capital;
}
+
+ print ' | ';
}
- print '
';
+ print '';
// Accountancy account insurance
- print '| ';
- print $langs->trans("LoanAccountancyInsuranceCode");
- print ' | ';
+ print ' |
';
if ($action == 'edit')
{
+ print '| ';
+ print $langs->trans("LoanAccountancyInsuranceCode");
+ print ' | ';
+
if (! empty($conf->accounting->enabled))
{
print $formaccounting->select_account($object->account_insurance, 'accountancy_account_insurance', 1, '', 1, 1);
@@ -588,23 +603,36 @@ if ($id > 0)
{
print '';
}
+ print ' | ';
}
else
{
- if (! empty($conf->accounting->enabled)) {
- print length_accountg($object->account_insurance);
+ print '';
+ print $langs->trans("LoanAccountancyCapitalCode");
+ print ' | ';
+
+ if (! empty($conf->accounting->enabled))
+ {
+ $accountingaccount = new AccountingAccount($db);
+ $accountingaccount->fetch('',$object->account_insurance, 1);
+
+ print $accountingaccount->getNomUrl(0,1,1,'',1);
} else {
print $object->account_insurance;
}
+
+ print ' | ';
}
- print '
';
+ print '';
// Accountancy account interest
- print '| ';
- print $langs->trans("LoanAccountancyInterestCode");
- print ' | ';
+ print ' |
';
if ($action == 'edit')
{
+ print '| ';
+ print $langs->trans("LoanAccountancyInterestCode");
+ print ' | ';
+
if (! empty($conf->accounting->enabled))
{
print $formaccounting->select_account($object->account_interest, 'accountancy_account_interest', 1, '', 1, 1);
@@ -613,16 +641,27 @@ if ($id > 0)
{
print '';
}
+ print ' | ';
}
else
{
- if (! empty($conf->accounting->enabled)) {
- print length_accountg($object->account_interest);
+ print '';
+ print $langs->trans("LoanAccountancyInterestCode");
+ print ' | ';
+
+ if (! empty($conf->accounting->enabled))
+ {
+ $accountingaccount = new AccountingAccount($db);
+ $accountingaccount->fetch('',$object->account_interest, 1);
+
+ print $accountingaccount->getNomUrl(0,1,1,'',1);
} else {
print $object->account_interest;
}
+
+ print ' | ';
}
- print '
';
+ print '';
print '';
diff --git a/htdocs/loan/class/loan.class.php b/htdocs/loan/class/loan.class.php
index 8464860be2f..19e8f5f84bf 100644
--- a/htdocs/loan/class/loan.class.php
+++ b/htdocs/loan/class/loan.class.php
@@ -297,6 +297,9 @@ class Loan extends CommonObject
$sql.= " capital='".price2num($this->db->escape($this->capital))."',";
$sql.= " datestart='".$this->db->idate($this->datestart)."',";
$sql.= " dateend='".$this->db->idate($this->dateend)."',";
+ $sql.= " accountancy_account_capital = '".$this->db->escape($this->account_capital)."',";
+ $sql.= " accountancy_account_insurance = '".$this->db->escape($this->account_insurance)."',";
+ $sql.= " accountancy_account_interest = '".$this->db->escape($this->account_interest)."',";
$sql.= " fk_projet=".(empty($this->fk_project)?'NULL':$this->fk_project).",";
$sql.= " fk_user_modif = ".$user->id;
$sql.= " WHERE rowid=".$this->id;
diff --git a/htdocs/modulebuilder/template/README.md b/htdocs/modulebuilder/template/README.md
index 1eb5ffe771a..d745c808bf4 100644
--- a/htdocs/modulebuilder/template/README.md
+++ b/htdocs/modulebuilder/template/README.md
@@ -3,6 +3,10 @@
## Features
Description...
+
+
Other modules are available on Dolistore.com.
@@ -25,44 +29,44 @@ There is a [Transifex project](https://transifex.com/projects/p/dolibarr-module-
Install
-------
-### Manually
+### From the ZIP file and GUI interface
-- Make sure Dolibarr is already installed and configured on your workstation or development server.
+- If you get the module in a zip file (like when downloading it from the market place [Dolistore](https://www.dolistore.com)), go into
+menu ```Home - Setup - Modules - Deploy external module``` and upload the zip file.
-- In your Dolibarr installation directory, edit the ```htdocs/conf/conf.php``` file
-- Find the following lines:
+Note: If this screen tell you there is no custom directory, check your setup is correct:
+
+- In your Dolibarr installation directory, edit the ```htdocs/conf/conf.php``` file and check that following lines are not commented:
+
```php
//$dolibarr_main_url_root_alt ...
//$dolibarr_main_document_root_alt ...
```
-- And uncomment these lines (delete the leading ```//```) and assign a sensible value according to your Dolibarr installation
+- Uncomment them if necessary (delete the leading ```//```) and assign a sensible value according to your Dolibarr installation
For example :
- UNIX:
```php
- $dolibarr_main_url_root = 'http://localhost/Dolibarr/htdocs';
- $dolibarr_main_document_root = '/var/www/Dolibarr/htdocs';
$dolibarr_main_url_root_alt = '/custom';
$dolibarr_main_document_root_alt = '/var/www/Dolibarr/htdocs/custom';
```
- Windows:
```php
- $dolibarr_main_url_root = 'http://localhost/Dolibarr/htdocs';
- $dolibarr_main_document_root = 'C:/My Web Sites/Dolibarr/htdocs';
$dolibarr_main_url_root_alt = '/custom';
$dolibarr_main_document_root_alt = 'C:/My Web Sites/Dolibarr/htdocs/custom';
```
-
- For more information about the ```conf.php``` file take a look at the conf.php.example file.
+
+### From a GIT repository
- Clone the repository in ```$dolibarr_main_document_root_alt/mymodule```
```sh
-git clone git@github.com:Dolibarr/dolibarr-module-template.git mymodule
+cd ....../custom
+git clone git@github.com:gitlogin/mymodule.git mymodule
```
### Final steps
@@ -75,11 +79,6 @@ From your browser:
-## Publishing the module
-The de-facto standard for publishing and marketing modules for Dolibarr is the [Dolistore](https://www.dolistore.com).
-Templates for required images and texts are [provided](dev/dolistore).
-Check the dedicated [README](dev/dolistore/README.md) for more informations.
-
-->
diff --git a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php
index dd489b5b491..0dba5024136 100644
--- a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php
+++ b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php
@@ -299,12 +299,12 @@ class modMyModule extends DolibarrModules
}
/**
- * Function called when module is enabled.
- * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
- * It also creates data directories
+ * Function called when module is enabled.
+ * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
+ * It also creates data directories
*
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
+ * @param string $options Options when enabling module ('', 'noboxes')
+ * @return int 1 if OK, 0 if KO
*/
public function init($options='')
{
@@ -326,12 +326,12 @@ class modMyModule extends DolibarrModules
}
/**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
+ * Function called when module is disabled.
+ * Remove from database constants, boxes and permissions from Dolibarr database.
+ * Data directories are not deleted
*
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
+ * @param string $options Options when enabling module ('', 'noboxes')
+ * @return int 1 if OK, 0 if KO
*/
public function remove($options = '')
{
diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php
index b33ab447592..7d0c5a7d26c 100644
--- a/htdocs/modulebuilder/template/myobject_list.php
+++ b/htdocs/modulebuilder/template/myobject_list.php
@@ -102,6 +102,7 @@ if ($user->societe_id > 0)
//$socid = $user->societe_id;
accessforbidden();
}
+//$result = restrictedArea($user, 'mymodule', $id,'');
// Initialize array of search criterias
$search_all=trim(GETPOST("search_all",'alpha'));
diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php
index eb710ce62a2..e3e5a2a4efb 100644
--- a/htdocs/projet/activity/perday.php
+++ b/htdocs/projet/activity/perday.php
@@ -568,7 +568,7 @@ if (count($tasksarray) > 0)
}
else
{
- print '| '.$langs->trans("NoTasks").' |
';
+ print '| '.$langs->trans("NoAssignedTasks").' |
';
}
print "";
print '';
diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php
index 97574ef53b9..023ccd611dd 100644
--- a/htdocs/projet/activity/perweek.php
+++ b/htdocs/projet/activity/perweek.php
@@ -332,10 +332,10 @@ if ($search_task_ref) $morewherefilter.=natural_search("t.ref", $search_task_r
if ($search_task_label) $morewherefilter.=natural_search(array("t.ref", "t.label"), $search_task_label);
if ($search_thirdparty) $morewherefilter.=natural_search("s.nom", $search_thirdparty);
-$tasksarray=$taskstatic->getTasksArray(0, 0, ($project->id?$project->id:0), $socid, 0, $search_project_ref, $onlyopenedproject, $morewherefilter, ($search_usertoprocessid?$search_usertoprocessid:0)); // We want to see all task of opened project i am allowed to see and that match filter, not only my tasks. Later only mine will be editable later.
+$tasksarray=$taskstatic->getTasksArray(0, 0, ($project->id?$project->id:0), $socid, 0, $search_project_ref, $onlyopenedproject, $morewherefilter, ($search_usertoprocessid?$search_usertoprocessid:0)); // We want to see all tasks of open project i am allowed to see and that match filter, not only my tasks. Later only mine will be editable later.
if ($morewherefilter) // Get all task with no filter so we can show total of time spent for not visible tasks
{
- $tasksarraywithoutfilter=$taskstatic->getTasksArray(0, 0, ($project->id?$project->id:0), $socid, 0, '', $onlyopenedproject, '', ($search_usertoprocessid?$search_usertoprocessid:0)); // We want to see all task of opened project i am allowed to see and that match filter, not only my tasks. Later only mine will be editable later.
+ $tasksarraywithoutfilter=$taskstatic->getTasksArray(0, 0, ($project->id?$project->id:0), $socid, 0, '', $onlyopenedproject, '', ($search_usertoprocessid?$search_usertoprocessid:0)); // We want to see all tasks of open project i am allowed to see and that match filter, not only my tasks. Later only mine will be editable later.
}
$projectsrole=$taskstatic->getUserRolesForProjectsOrTasks($usertoprocess, 0, ($project->id?$project->id:0), 0, $onlyopenedproject);
$tasksrole=$taskstatic->getUserRolesForProjectsOrTasks(0, $usertoprocess, ($project->id?$project->id:0), 0, $onlyopenedproject);
@@ -595,7 +595,7 @@ if (count($tasksarray) > 0)
}
else
{
- print '