diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php
index 280f17adfe2..91003d7cc12 100644
--- a/htdocs/admin/modules.php
+++ b/htdocs/admin/modules.php
@@ -67,7 +67,7 @@ $familyinfo = array(
'hr'=>array('position'=>'001', 'label'=>$langs->trans("ModuleFamilyHr")),
'crm'=>array('position'=>'006', 'label'=>$langs->trans("ModuleFamilyCrm")),
'srm'=>array('position'=>'007', 'label'=>$langs->trans("ModuleFamilySrm")),
- 'financial'=>array('position'=>'009', 'label'=>$langs->trans("ModuleFamilyFinancial")),
+ 'financial'=>array('position'=>'009', 'label'=>$langs->trans("ModuleFamilyFinancial")),
'products'=>array('position'=>'012', 'label'=>$langs->trans("ModuleFamilyProducts")),
'projects'=>array('position'=>'015', 'label'=>$langs->trans("ModuleFamilyProjects")),
'ecm'=>array('position'=>'018', 'label'=>$langs->trans("ModuleFamilyECM")),
@@ -106,35 +106,35 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
if (GETPOST('buttonreset', 'alpha'))
{
- $search_keyword = '';
- $search_status = '';
- $search_nature = '';
- $search_version = '';
+ $search_keyword = '';
+ $search_status = '';
+ $search_nature = '';
+ $search_version = '';
}
if ($action == 'install')
{
- $error = 0;
+ $error = 0;
- // $original_file should match format module_modulename-x.y[.z].zip
- $original_file = basename($_FILES["fileinstall"]["name"]);
- $newfile = $conf->admin->dir_temp.'/'.$original_file.'/'.$original_file;
+ // $original_file should match format module_modulename-x.y[.z].zip
+ $original_file = basename($_FILES["fileinstall"]["name"]);
+ $newfile = $conf->admin->dir_temp.'/'.$original_file.'/'.$original_file;
- if (!$original_file)
- {
- $langs->load("Error");
- setEventMessages($langs->trans("ErrorModuleFileRequired"), null, 'warnings');
- $error++;
- }
- else
- {
- if (!$error && !preg_match('/\.zip$/i', $original_file))
- {
- $langs->load("errors");
- setEventMessages($langs->trans("ErrorFileMustBeADolibarrPackage", $original_file), null, 'errors');
- $error++;
- }
- if (!$error && !preg_match('/^(module[a-zA-Z0-9]*|theme)_.*\-([0-9][0-9\.]*)\.zip$/i', $original_file))
+ if (!$original_file)
+ {
+ $langs->load("Error");
+ setEventMessages($langs->trans("ErrorModuleFileRequired"), null, 'warnings');
+ $error++;
+ }
+ else
+ {
+ if (!$error && !preg_match('/\.zip$/i', $original_file))
+ {
+ $langs->load("errors");
+ setEventMessages($langs->trans("ErrorFileMustBeADolibarrPackage", $original_file), null, 'errors');
+ $error++;
+ }
+ if (!$error && !preg_match('/^(module[a-zA-Z0-9]*|theme)_.*\-([0-9][0-9\.]*)\.zip$/i', $original_file))
{
$langs->load("errors");
setEventMessages($langs->trans("ErrorFilenameDosNotMatchDolibarrPackageRules", $original_file, 'module_*-x.y*.zip'), null, 'errors');
@@ -142,140 +142,140 @@ if ($action == 'install')
}
if (empty($_FILES['fileinstall']['tmp_name']))
{
- $langs->load("errors");
- setEventMessages($langs->trans("ErrorFileNotUploaded"), null, 'errors');
- $error++;
+ $langs->load("errors");
+ setEventMessages($langs->trans("ErrorFileNotUploaded"), null, 'errors');
+ $error++;
}
- }
+ }
- if (!$error)
- {
- if ($original_file)
- {
- @dol_delete_dir_recursive($conf->admin->dir_temp.'/'.$original_file);
- dol_mkdir($conf->admin->dir_temp.'/'.$original_file);
- }
+ if (!$error)
+ {
+ if ($original_file)
+ {
+ @dol_delete_dir_recursive($conf->admin->dir_temp.'/'.$original_file);
+ dol_mkdir($conf->admin->dir_temp.'/'.$original_file);
+ }
- $tmpdir = preg_replace('/\.zip$/i', '', $original_file).'.dir';
- if ($tmpdir)
- {
- @dol_delete_dir_recursive($conf->admin->dir_temp.'/'.$tmpdir);
- dol_mkdir($conf->admin->dir_temp.'/'.$tmpdir);
- }
+ $tmpdir = preg_replace('/\.zip$/i', '', $original_file).'.dir';
+ if ($tmpdir)
+ {
+ @dol_delete_dir_recursive($conf->admin->dir_temp.'/'.$tmpdir);
+ dol_mkdir($conf->admin->dir_temp.'/'.$tmpdir);
+ }
- $result = dol_move_uploaded_file($_FILES['fileinstall']['tmp_name'], $newfile, 1, 0, $_FILES['fileinstall']['error']);
- if ($result > 0)
- {
- $result = dol_uncompress($newfile, $conf->admin->dir_temp.'/'.$tmpdir);
+ $result = dol_move_uploaded_file($_FILES['fileinstall']['tmp_name'], $newfile, 1, 0, $_FILES['fileinstall']['error']);
+ if ($result > 0)
+ {
+ $result = dol_uncompress($newfile, $conf->admin->dir_temp.'/'.$tmpdir);
- if (!empty($result['error']))
- {
- $langs->load("errors");
- setEventMessages($langs->trans($result['error'], $original_file), null, 'errors');
- $error++;
- }
- else
- {
- // Now we move the dir of the module
- $modulename = preg_replace('/module_/', '', $original_file);
- $modulename = preg_replace('/\-([0-9][0-9\.]*)\.zip$/i', '', $modulename);
- // Search dir $modulename
- $modulenamedir = $conf->admin->dir_temp.'/'.$tmpdir.'/'.$modulename; // Example ./mymodule
+ if (!empty($result['error']))
+ {
+ $langs->load("errors");
+ setEventMessages($langs->trans($result['error'], $original_file), null, 'errors');
+ $error++;
+ }
+ else
+ {
+ // Now we move the dir of the module
+ $modulename = preg_replace('/module_/', '', $original_file);
+ $modulename = preg_replace('/\-([0-9][0-9\.]*)\.zip$/i', '', $modulename);
+ // Search dir $modulename
+ $modulenamedir = $conf->admin->dir_temp.'/'.$tmpdir.'/'.$modulename; // Example ./mymodule
- if (!dol_is_dir($modulenamedir))
- {
- $modulenamedir = $conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulename; // Example ./htdocs/mymodule
- //var_dump($modulenamedir);
- if (!dol_is_dir($modulenamedir))
- {
- setEventMessages($langs->trans("ErrorModuleFileSeemsToHaveAWrongFormat").' '.$langs->trans("ErrorModuleFileSeemsToHaveAWrongFormat2", $modulename, 'htdocs/'.$modulename), null, 'errors');
- $error++;
- }
- }
+ if (!dol_is_dir($modulenamedir))
+ {
+ $modulenamedir = $conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulename; // Example ./htdocs/mymodule
+ //var_dump($modulenamedir);
+ if (!dol_is_dir($modulenamedir))
+ {
+ setEventMessages($langs->trans("ErrorModuleFileSeemsToHaveAWrongFormat").' '.$langs->trans("ErrorModuleFileSeemsToHaveAWrongFormat2", $modulename, 'htdocs/'.$modulename), null, 'errors');
+ $error++;
+ }
+ }
- if (!$error)
- {
- // TODO Make more test
- }
+ if (!$error)
+ {
+ // TODO Make more test
+ }
- dol_syslog("Uncompress of module file is a success.");
+ dol_syslog("Uncompress of module file is a success.");
- $modulenamearrays = array();
- if (dol_is_file($modulenamedir.'/metapackage.conf')) {
- // This is a meta package
- $metafile = file_get_contents($modulenamedir.'/metapackage.conf');
- $modulenamearrays = explode("\n", $metafile);
- }
- $modulenamearrays[$modulename] = $modulename;
- //var_dump($modulenamearrays);exit;
+ $modulenamearrays = array();
+ if (dol_is_file($modulenamedir.'/metapackage.conf')) {
+ // This is a meta package
+ $metafile = file_get_contents($modulenamedir.'/metapackage.conf');
+ $modulenamearrays = explode("\n", $metafile);
+ }
+ $modulenamearrays[$modulename] = $modulename;
+ //var_dump($modulenamearrays);exit;
- foreach ($modulenamearrays as $modulenameval) {
- if (strpos($modulenameval, '#') === 0) continue; // Discard comments
- if (strpos($modulenameval, '//') === 0) continue; // Discard comments
+ foreach ($modulenamearrays as $modulenameval) {
+ if (strpos($modulenameval, '#') === 0) continue; // Discard comments
+ if (strpos($modulenameval, '//') === 0) continue; // Discard comments
if (!trim($modulenameval)) continue;
- // Now we install the module
- if (!$error)
- {
- @dol_delete_dir_recursive($dirins.'/'.$modulenameval); // delete the zip file
- dol_syslog("We copy now directory ".$conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulenameval." into target dir ".$dirins.'/'.$modulenameval);
- $result = dolCopyDir($modulenamedir, $dirins.'/'.$modulenameval, '0444', 1);
- if ($result <= 0)
- {
- dol_syslog('Failed to call dolCopyDir result='.$result." with param ".$modulenamedir." and ".$dirins.'/'.$modulenameval, LOG_WARNING);
- $langs->load("errors");
- setEventMessages($langs->trans("ErrorFailToCopyDir", $modulenamedir, $dirins.'/'.$modulenameval), null, 'errors');
- $error++;
- }
- }
- }
- }
- }
- else
- {
- setEventMessages($langs->trans("ErrorFailToRenameFile", $_FILES['fileinstall']['tmp_name'], $newfile), null, 'errors');
- $error++;
- }
- }
+ // Now we install the module
+ if (!$error)
+ {
+ @dol_delete_dir_recursive($dirins.'/'.$modulenameval); // delete the zip file
+ dol_syslog("We copy now directory ".$conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulenameval." into target dir ".$dirins.'/'.$modulenameval);
+ $result = dolCopyDir($modulenamedir, $dirins.'/'.$modulenameval, '0444', 1);
+ if ($result <= 0)
+ {
+ dol_syslog('Failed to call dolCopyDir result='.$result." with param ".$modulenamedir." and ".$dirins.'/'.$modulenameval, LOG_WARNING);
+ $langs->load("errors");
+ setEventMessages($langs->trans("ErrorFailToCopyDir", $modulenamedir, $dirins.'/'.$modulenameval), null, 'errors');
+ $error++;
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ setEventMessages($langs->trans("ErrorFailToRenameFile", $_FILES['fileinstall']['tmp_name'], $newfile), null, 'errors');
+ $error++;
+ }
+ }
- if (!$error)
- {
- setEventMessages($langs->trans("SetupIsReadyForUse", DOL_URL_ROOT.'/admin/modules.php?mainmenu=home', $langs->transnoentitiesnoconv("Home").' - '.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Modules")), null, 'warnings');
- }
+ if (!$error)
+ {
+ setEventMessages($langs->trans("SetupIsReadyForUse", DOL_URL_ROOT.'/admin/modules.php?mainmenu=home', $langs->transnoentitiesnoconv("Home").' - '.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Modules")), null, 'warnings');
+ }
}
if ($action == 'set' && $user->admin)
{
- $resarray = activateModule($value);
- if (!empty($resarray['errors'])) setEventMessages('', $resarray['errors'], 'errors');
+ $resarray = activateModule($value);
+ if (!empty($resarray['errors'])) setEventMessages('', $resarray['errors'], 'errors');
else
{
- //var_dump($resarray);exit;
- if ($resarray['nbperms'] > 0)
- {
- $tmpsql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."user WHERE admin <> 1";
- $resqltmp = $db->query($tmpsql);
- if ($resqltmp)
- {
- $obj = $db->fetch_object($resqltmp);
- //var_dump($obj->nb);exit;
- if ($obj && $obj->nb > 1)
- {
- $msg = $langs->trans('ModuleEnabledAdminMustCheckRights');
- setEventMessages($msg, null, 'warnings');
- }
- }
- else dol_print_error($db);
- }
+ //var_dump($resarray);exit;
+ if ($resarray['nbperms'] > 0)
+ {
+ $tmpsql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."user WHERE admin <> 1";
+ $resqltmp = $db->query($tmpsql);
+ if ($resqltmp)
+ {
+ $obj = $db->fetch_object($resqltmp);
+ //var_dump($obj->nb);exit;
+ if ($obj && $obj->nb > 1)
+ {
+ $msg = $langs->trans('ModuleEnabledAdminMustCheckRights');
+ setEventMessages($msg, null, 'warnings');
+ }
+ }
+ else dol_print_error($db);
+ }
}
- header("Location: ".$_SERVER["PHP_SELF"]."?mode=".$mode.$param.($page_y ? '&page_y='.$page_y : ''));
+ header("Location: ".$_SERVER["PHP_SELF"]."?mode=".$mode.$param.($page_y ? '&page_y='.$page_y : ''));
exit;
}
elseif ($action == 'reset' && $user->admin && GETPOST('confirm') == 'yes')
{
- $result = unActivateModule($value);
- if ($result) setEventMessages($result, null, 'errors');
- header("Location: ".$_SERVER["PHP_SELF"]."?mode=".$mode.$param.($page_y ? '&page_y='.$page_y : ''));
+ $result = unActivateModule($value);
+ if ($result) setEventMessages($result, null, 'errors');
+ header("Location: ".$_SERVER["PHP_SELF"]."?mode=".$mode.$param.($page_y ? '&page_y='.$page_y : ''));
exit;
}
@@ -293,7 +293,7 @@ $morecss = array("/admin/dolistore/css/dolistore.css");
// Set dir where external modules are installed
if (!dol_is_dir($dirins))
{
- dol_mkdir($dirins);
+ dol_mkdir($dirins);
}
$dirins_ok = (dol_is_dir($dirins));
@@ -327,127 +327,127 @@ foreach ($modulesdir as $dir)
while (($file = readdir($handle)) !== false)
{
//print "$i ".$file."\n ";
- if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php')
- {
- $modName = substr($file, 0, dol_strlen($file) - 10);
+ if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php')
+ {
+ $modName = substr($file, 0, dol_strlen($file) - 10);
- if ($modName)
- {
- if (!empty($modNameLoaded[$modName])) // In cache of already loaded modules ?
- {
- $mesg = "Error: Module ".$modName." was found twice: Into ".$modNameLoaded[$modName]." and ".$dir.". You probably have an old file on your disk. ";
- setEventMessages($mesg, null, 'warnings');
- dol_syslog($mesg, LOG_ERR);
+ if ($modName)
+ {
+ if (!empty($modNameLoaded[$modName])) // In cache of already loaded modules ?
+ {
+ $mesg = "Error: Module ".$modName." was found twice: Into ".$modNameLoaded[$modName]." and ".$dir.". You probably have an old file on your disk. ";
+ setEventMessages($mesg, null, 'warnings');
+ dol_syslog($mesg, LOG_ERR);
continue;
- }
+ }
- try
- {
- $res = include_once $dir.$file; // A class already exists in a different file will send a non catchable fatal error.
- if (class_exists($modName))
+ try
+ {
+ $res = include_once $dir.$file; // A class already exists in a different file will send a non catchable fatal error.
+ if (class_exists($modName))
{
try {
- $objMod = new $modName($db);
+ $objMod = new $modName($db);
$modNameLoaded[$modName] = $dir;
- if (!$objMod->numero > 0 && $modName != 'modUser')
- {
- dol_syslog('The module descriptor '.$modName.' must have a numero property', LOG_ERR);
- }
+ if (!$objMod->numero > 0 && $modName != 'modUser')
+ {
+ dol_syslog('The module descriptor '.$modName.' must have a numero property', LOG_ERR);
+ }
$j = $objMod->numero;
- $modulequalified = 1;
+ $modulequalified = 1;
- // We discard modules according to features level (PS: if module is activated we always show it)
- $const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i', '', get_class($objMod)));
- if ($objMod->version == 'development' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 2))) $modulequalified = 0;
- if ($objMod->version == 'experimental' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 1))) $modulequalified = 0;
+ // We discard modules according to features level (PS: if module is activated we always show it)
+ $const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i', '', get_class($objMod)));
+ if ($objMod->version == 'development' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 2))) $modulequalified = 0;
+ if ($objMod->version == 'experimental' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 1))) $modulequalified = 0;
if (preg_match('/deprecated/', $objMod->version) && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL >= 0))) $modulequalified = 0;
- // We discard modules according to property ->hidden
- if (!empty($objMod->hidden)) $modulequalified = 0;
+ // We discard modules according to property ->hidden
+ if (!empty($objMod->hidden)) $modulequalified = 0;
- if ($modulequalified > 0)
- {
- $publisher = dol_escape_htmltag($objMod->getPublisher());
- $external = ($objMod->isCoreOrExternalModule() == 'external');
- if ($external)
- {
- if ($publisher)
- {
- $arrayofnatures['external_'.$publisher] = $langs->trans("External").' - '.$publisher;
- }
- else
- {
- $arrayofnatures['external_'] = $langs->trans("External").' - '.$langs->trans("UnknownPublishers");
- }
- }
- ksort($arrayofnatures);
+ if ($modulequalified > 0)
+ {
+ $publisher = dol_escape_htmltag($objMod->getPublisher());
+ $external = ($objMod->isCoreOrExternalModule() == 'external');
+ if ($external)
+ {
+ if ($publisher)
+ {
+ $arrayofnatures['external_'.$publisher] = $langs->trans("External").' - '.$publisher;
+ }
+ else
+ {
+ $arrayofnatures['external_'] = $langs->trans("External").' - '.$langs->trans("UnknownPublishers");
+ }
+ }
+ ksort($arrayofnatures);
- // Define array $categ with categ with at least one qualified module
- $filename[$i] = $modName;
- $modules[$modName] = $objMod;
+ // Define array $categ with categ with at least one qualified module
+ $filename[$i] = $modName;
+ $modules[$modName] = $objMod;
- // Gives the possibility to the module, to provide his own family info and position of this family
- if (is_array($objMod->familyinfo) && !empty($objMod->familyinfo)) {
- $familyinfo = array_merge($familyinfo, $objMod->familyinfo);
- $familykey = key($objMod->familyinfo);
- } else {
- $familykey = $objMod->family;
- }
+ // Gives the possibility to the module, to provide his own family info and position of this family
+ if (is_array($objMod->familyinfo) && !empty($objMod->familyinfo)) {
+ $familyinfo = array_merge($familyinfo, $objMod->familyinfo);
+ $familykey = key($objMod->familyinfo);
+ } else {
+ $familykey = $objMod->family;
+ }
- $moduleposition = ($objMod->module_position ? $objMod->module_position : '50');
- if ($moduleposition == '50' && ($objMod->isCoreOrExternalModule() == 'external'))
- {
- $moduleposition = '80'; // External modules at end by default
- }
+ $moduleposition = ($objMod->module_position ? $objMod->module_position : '50');
+ if ($moduleposition == '50' && ($objMod->isCoreOrExternalModule() == 'external'))
+ {
+ $moduleposition = '80'; // External modules at end by default
+ }
- // Add list of warnings to show into arrayofwarnings and arrayofwarningsext
- if (!empty($objMod->warnings_activation))
- {
- $arrayofwarnings[$modName] = $objMod->warnings_activation;
- }
- if (!empty($objMod->warnings_activation_ext))
- {
- $arrayofwarningsext[$modName] = $objMod->warnings_activation_ext;
- }
+ // Add list of warnings to show into arrayofwarnings and arrayofwarningsext
+ if (!empty($objMod->warnings_activation))
+ {
+ $arrayofwarnings[$modName] = $objMod->warnings_activation;
+ }
+ if (!empty($objMod->warnings_activation_ext))
+ {
+ $arrayofwarningsext[$modName] = $objMod->warnings_activation_ext;
+ }
- $familyposition = $familyinfo[$familykey]['position'];
- if ($external)
- {
- // TODO Find a solution so modules with their own family are always at end
- //var_dump($familyposition);
- //$familyposition += 100;
- }
+ $familyposition = $familyinfo[$familykey]['position'];
+ if ($external)
+ {
+ // TODO Find a solution so modules with their own family are always at end
+ //var_dump($familyposition);
+ //$familyposition += 100;
+ }
- $orders[$i] = $familyposition."_".$familykey."_".$moduleposition."_".$j; // Sort by family, then by module position then number
- $dirmod[$i] = $dir;
- //print $i.'-'.$dirmod[$i].' ';
- // Set categ[$i]
- $specialstring = 'unknown';
- if ($objMod->version == 'development' || $objMod->version == 'experimental') $specialstring = 'expdev';
- if (isset($categ[$specialstring])) $categ[$specialstring]++; // Array of all different modules categories
- else $categ[$specialstring] = 1;
- $j++;
- $i++;
- }
- else dol_syslog("Module ".get_class($objMod)." not qualified");
+ $orders[$i] = $familyposition."_".$familykey."_".$moduleposition."_".$j; // Sort by family, then by module position then number
+ $dirmod[$i] = $dir;
+ //print $i.'-'.$dirmod[$i].' ';
+ // Set categ[$i]
+ $specialstring = 'unknown';
+ if ($objMod->version == 'development' || $objMod->version == 'experimental') $specialstring = 'expdev';
+ if (isset($categ[$specialstring])) $categ[$specialstring]++; // Array of all different modules categories
+ else $categ[$specialstring] = 1;
+ $j++;
+ $i++;
+ }
+ else dol_syslog("Module ".get_class($objMod)." not qualified");
+ }
+ catch (Exception $e)
+ {
+ dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR);
}
- catch (Exception $e)
- {
- dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR);
- }
}
- else
+ else
{
print "Warning bad descriptor file : ".$dir.$file." (Class ".$modName." not found into file) ";
}
}
- catch (Exception $e)
- {
- dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR);
- }
- }
- }
+ catch (Exception $e)
+ {
+ dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR);
+ }
+ }
+ }
}
closedir($handle);
}
@@ -496,450 +496,450 @@ print " \n";
if ($mode == 'common')
{
- dol_set_focus('#search_keyword');
+ dol_set_focus('#search_keyword');
- print '
';
}
if ($mode == 'marketplace')
{
- dol_fiche_head($head, $mode, '', -1);
+ dol_fiche_head($head, $mode, '', -1);
- // Marketplace
- print '';
- print '
'."\n";
- print ''."\n";
- print ''.$form->textwithpicto($langs->trans("Provider"), $langs->trans("WebSiteDesc")).' ';
- print ' ';
- print ''.$langs->trans("URL").' ';
- print ' ';
+ // Marketplace
+ print '';
+ print '
'."\n";
+ print ''."\n";
+ print ''.$form->textwithpicto($langs->trans("Provider"), $langs->trans("WebSiteDesc")).' ';
+ print ' ';
+ print ''.$langs->trans("URL").' ';
+ print ' ';
- print ''."\n";
- $url = 'https://www.dolistore.com';
- print ' ';
- print ''.$langs->trans("DoliStoreDesc").' ';
- print ''.$url.' ';
- print ' ';
+ print ''."\n";
+ $url = 'https://www.dolistore.com';
+ print ' ';
+ print ''.$langs->trans("DoliStoreDesc").' ';
+ print ''.$url.' ';
+ print ' ';
- print "
\n";
+ print "
\n";
print '
';
- dol_fiche_end();
+ dol_fiche_end();
- print ' ';
+ print ' ';
- if (empty($conf->global->MAIN_DISABLE_DOLISTORE_SEARCH) && $conf->global->MAIN_FEATURES_LEVEL >= 1)
- {
- // $options is array with filter criterias
- //var_dump($options);
- $dolistore->getRemoteCategories();
- $dolistore->getRemoteProducts($options);
+ if (empty($conf->global->MAIN_DISABLE_DOLISTORE_SEARCH) && $conf->global->MAIN_FEATURES_LEVEL >= 1)
+ {
+ // $options is array with filter criterias
+ //var_dump($options);
+ $dolistore->getRemoteCategories();
+ $dolistore->getRemoteProducts($options);
- print ''.$langs->trans('DOLISTOREdescriptionLong').' ';
+ print ''.$langs->trans('DOLISTOREdescriptionLong').' ';
- $previouslink = $dolistore->get_previous_link();
- $nextlink = $dolistore->get_next_link();
+ $previouslink = $dolistore->get_previous_link();
+ $nextlink = $dolistore->get_next_link();
- print ''
+ print '
'
- ?>
+ ?>
';
- print '';
+ print $previouslink;
+ print $nextlink;
+ print '
';
+ print '';
- print '
';
- print '
';
+ print '
';
+ print '
';
- ?>
+ ?>
@@ -979,7 +979,7 @@ if ($mode == 'marketplace')
global->MAIN_UPLOAD_DOC))
{
- if ($user->admin)
- {
- $langs->load('other');
- print ' ';
- print info_admin($langs->trans("ThisLimitIsDefinedInSetup", $max, $maxphptoshow, $maxphptoshowparam), 1);
- }
+ if ($user->admin)
+ {
+ $langs->load('other');
+ print ' ';
+ print info_admin($langs->trans("ThisLimitIsDefinedInSetup", $max, $maxphptoshow, $maxphptoshowparam), 1);
+ }
}
else
{
- print ' ('.$langs->trans("UploadDisabled").')';
+ print ' ('.$langs->trans("UploadDisabled").')';
}
print '';
diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php
index a1bdfb6678d..762ebe0fbcf 100644
--- a/htdocs/compta/stats/cabyprodserv.php
+++ b/htdocs/compta/stats/cabyprodserv.php
@@ -290,6 +290,7 @@ if ($modecompta == 'CREANCES-DETTES')
// Show Array
$i = 0;
print '';
+} else {
+ // $modecompta != 'CREANCES-DETTES'
+ // "Calculation of part of each product for accountancy in this mode is not possible. When a partial payment (for example 5 euros) is done on an
+ // invoice with 2 product (product A for 10 euros and product B for 20 euros), what is part of paiment for product A and part of paiment for product B ?
+ // Because there is no way to know this, this report is not relevant.
+ print ' '.$langs->trans("TurnoverPerProductInCommitmentAccountingNotRelevant").' ';
+}
+
+// End of page
+llxFooter();
+$db->close();
diff --git a/htdocs/compta/stats/supplier_turnover_by_thirdparty.php b/htdocs/compta/stats/supplier_turnover_by_thirdparty.php
new file mode 100644
index 00000000000..ea55adcc8c2
--- /dev/null
+++ b/htdocs/compta/stats/supplier_turnover_by_thirdparty.php
@@ -0,0 +1,595 @@
+
+ *
+ * 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 3 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 .
+ */
+
+/**
+ * \file htdocs/compta/stats/supplier_ca_by_thirdparty.php
+ * \brief Page reporting purchase turnover by thirdparty
+ */
+
+require '../../main.inc.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
+require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
+
+// Load translation files required by the page
+$langs->loadLangs(array('companies', 'categories', 'bills', 'compta'));
+
+// Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES')
+$modecompta = $conf->global->ACCOUNTING_MODE;
+if (GETPOST("modecompta")) $modecompta = GETPOST("modecompta");
+
+$sortorder = isset($_GET["sortorder"]) ? $_GET["sortorder"] : $_POST["sortorder"];
+$sortfield = isset($_GET["sortfield"]) ? $_GET["sortfield"] : $_POST["sortfield"];
+if (!$sortorder) $sortorder = "asc";
+if (!$sortfield) $sortfield = "nom";
+
+$socid = GETPOST('socid', 'int');
+
+// Category
+$selected_cat = (int) GETPOST('search_categ', 'int');
+$subcat = false;
+if (GETPOST('subcat', 'alpha') === 'yes') {
+ $subcat = true;
+}
+
+// Security check
+if ($user->socid > 0) $socid = $user->socid;
+if (!empty($conf->comptabilite->enabled)) $result = restrictedArea($user, 'compta', '', '', 'resultat');
+if (!empty($conf->accounting->enabled)) $result = restrictedArea($user, 'accounting', '', '', 'comptarapport');
+
+// Date range
+$year = GETPOST("year", 'int');
+$month = GETPOST("month", 'int');
+$search_societe = GETPOST("search_societe", 'alpha');
+$search_zip = GETPOST("search_zip", 'alpha');
+$search_town = GETPOST("search_town", 'alpha');
+$search_country = GETPOST("search_country", 'alpha');
+$date_startyear = GETPOST("date_startyear", 'alpha');
+$date_startmonth = GETPOST("date_startmonth", 'alpha');
+$date_startday = GETPOST("date_startday", 'alpha');
+$date_endyear = GETPOST("date_endyear", 'alpha');
+$date_endmonth = GETPOST("date_endmonth", 'alpha');
+$date_endday = GETPOST("date_endday", 'alpha');
+if (empty($year))
+{
+ $year_current = strftime("%Y", dol_now());
+ $month_current = strftime("%m", dol_now());
+ $year_start = $year_current;
+} else {
+ $year_current = $year;
+ $month_current = strftime("%m", dol_now());
+ $year_start = $year;
+}
+$date_start = dol_mktime(0, 0, 0, GETPOST("date_startmonth"), GETPOST("date_startday"), GETPOST("date_startyear"));
+$date_end = dol_mktime(23, 59, 59, GETPOST("date_endmonth"), GETPOST("date_endday"), GETPOST("date_endyear"));
+// Quarter
+if (empty($date_start) || empty($date_end)) // We define date_start and date_end
+{
+ $q = GETPOST("q", "int") ?GETPOST("q", "int") : 0;
+ if (empty($q))
+ {
+ // We define date_start and date_end
+ $month_start = GETPOST("month") ?GETPOST("month") : ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
+ $year_end = $year_start;
+ $month_end = $month_start;
+ if (!GETPOST("month")) // If month not forced
+ {
+ if (!GETPOST('year') && $month_start > $month_current)
+ {
+ $year_start--;
+ $year_end--;
+ }
+ $month_end = $month_start - 1;
+ if ($month_end < 1) $month_end = 12;
+ else $year_end++;
+ }
+ $date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false);
+ }
+ if ($q == 1) { $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); }
+ if ($q == 2) { $date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false); }
+ if ($q == 3) { $date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false); }
+ if ($q == 4) { $date_start = dol_get_first_day($year_start, 10, false); $date_end = dol_get_last_day($year_start, 12, false); }
+}
+else
+{
+ // TODO We define q
+}
+
+// $date_start and $date_end are defined. We force $year_start and $nbofyear
+$tmps = dol_getdate($date_start);
+$year_start = $tmps['year'];
+$tmpe = dol_getdate($date_end);
+$year_end = $tmpe['year'];
+$nbofyear = ($year_end - $year_start) + 1;
+
+$commonparams = array();
+$commonparams['modecompta'] = $modecompta;
+$commonparams['sortorder'] = $sortorder;
+$commonparams['sortfield'] = $sortfield;
+
+$headerparams = array();
+$headerparams['date_startyear'] = $date_startyear;
+$headerparams['date_startmonth'] = $date_startmonth;
+$headerparams['date_startday'] = $date_startday;
+$headerparams['date_endyear'] = $date_endyear;
+$headerparams['date_endmonth'] = $date_endmonth;
+$headerparams['date_endday'] = $date_endday;
+$headerparams['q'] = $q;
+
+$tableparams = array();
+$tableparams['search_categ'] = $selected_cat;
+$tableparams['search_societe'] = $search_societe;
+$tableparams['search_zip'] = $search_zip;
+$tableparams['search_town'] = $search_town;
+$tableparams['search_country'] = $search_country;
+$tableparams['subcat'] = ($subcat === true) ? 'yes' : '';
+
+// Adding common parameters
+$allparams = array_merge($commonparams, $headerparams, $tableparams);
+$headerparams = array_merge($commonparams, $headerparams);
+$tableparams = array_merge($commonparams, $tableparams);
+
+foreach ($allparams as $key => $value) {
+ $paramslink .= '&'.$key.'='.$value;
+}
+
+
+/*
+ * View
+ */
+
+llxHeader();
+
+$form = new Form($db);
+$thirdparty_static = new Societe($db);
+$formother = new FormOther($db);
+
+// TODO Report from bookkeeping not yet available, so we switch on report on business events
+if ($modecompta == "BOOKKEEPING") $modecompta = "CREANCES-DETTES";
+if ($modecompta == "BOOKKEEPINGCOLLECTED") $modecompta = "RECETTES-DEPENSES";
+
+// Show report header
+if ($modecompta == "CREANCES-DETTES")
+{
+ $name = $langs->trans("PurchaseTurnover").', '.$langs->trans("ByThirdParties");
+ $calcmode = $langs->trans("CalcModeDebt");
+ //$calcmode.=' ('.$langs->trans("SeeReportInInputOutputMode",'',' ').')';
+ $description = $langs->trans("RulesPurchaseTurnoverDue");
+ $builddate = dol_now();
+ //$exportlink=$langs->trans("NotYetAvailable");
+}
+elseif ($modecompta == "RECETTES-DEPENSES")
+{
+ $name = $langs->trans("PurchaseTurnoverCollected").', '.$langs->trans("ByThirdParties");
+ $calcmode = $langs->trans("CalcModeEngagement");
+ //$calcmode.=' ('.$langs->trans("SeeReportInDueDebtMode",'',' ').')';
+ $description = $langs->trans("RulesPurchaseTurnoverIn");
+ $builddate = dol_now();
+ //$exportlink=$langs->trans("NotYetAvailable");
+}
+elseif ($modecompta == "BOOKKEEPING")
+{
+}
+elseif ($modecompta == "BOOKKEEPINGCOLLECTED")
+{
+}
+$period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0);
+if ($date_end == dol_time_plus_duree($date_start, 1, 'y') - 1) $periodlink = ''.img_previous().' '.img_next().' ';
+else $periodlink = '';
+
+report_header($name, $namelink, $period, $periodlink, $description, $builddate, $exportlink, $tableparams, $calcmode);
+
+if (!empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING')
+{
+ print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
+}
+
+
+$name = array();
+
+// Show Array
+$catotal = 0;
+if ($modecompta == 'CREANCES-DETTES') {
+ $sql = "SELECT DISTINCT s.rowid as socid, s.nom as name, s.zip, s.town, s.fk_pays,";
+ $sql .= " sum(f.total_ht) as amount, sum(f.total_ttc) as amount_ttc";
+ $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f, ".MAIN_DB_PREFIX."societe as s";
+ if ($selected_cat === -2) // Without any category
+ {
+ $sql .= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_soc";
+ }
+ elseif ($selected_cat) // Into a specific category
+ {
+ $sql .= ", ".MAIN_DB_PREFIX."categorie as c, ".MAIN_DB_PREFIX."categorie_societe as cs";
+ }
+ $sql .= " WHERE f.fk_statut in (1,2)";
+ $sql .= " AND f.type IN (0,2)";
+ $sql .= " AND f.fk_soc = s.rowid";
+ if ($date_start && $date_end) {
+ $sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
+ }
+ if ($selected_cat === -2) // Without any category
+ {
+ $sql .= " AND cs.fk_soc is null";
+ }
+ elseif ($selected_cat) { // Into a specific category
+ $sql .= " AND (c.rowid = ".$db->escape($selected_cat);
+ if ($subcat) $sql .= " OR c.fk_parent = ".$db->escape($selected_cat);
+ $sql .= ")";
+ $sql .= " AND cs.fk_categorie = c.rowid AND cs.fk_soc = s.rowid";
+ }
+} else {
+ $sql = "SELECT s.rowid as socid, s.nom as name, s.zip, s.town, s.fk_pays, sum(pf.amount) as amount_ttc";
+ $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
+ $sql .= ", ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf";
+ $sql .= ", ".MAIN_DB_PREFIX."paiementfourn as p";
+ $sql .= ", ".MAIN_DB_PREFIX."societe as s";
+ if ($selected_cat === -2) // Without any category
+ {
+ $sql .= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_soc";
+ }
+ elseif ($selected_cat) // Into a specific category
+ {
+ $sql .= ", ".MAIN_DB_PREFIX."categorie as c, ".MAIN_DB_PREFIX."categorie_societe as cs";
+ }
+ $sql .= " WHERE p.rowid = pf.fk_paiementfourn";
+ $sql .= " AND pf.fk_facturefourn = f.rowid";
+ $sql .= " AND f.fk_soc = s.rowid";
+ if ($date_start && $date_end) {
+ $sql .= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
+ }
+ if ($selected_cat === -2) // Without any category
+ {
+ $sql .= " AND cs.fk_soc is null";
+ }
+ elseif ($selected_cat) { // Into a specific category
+ $sql .= " AND (c.rowid = ".$selected_cat;
+ if ($subcat) $sql .= " OR c.fk_parent = ".$selected_cat;
+ $sql .= ")";
+ $sql .= " AND cs.fk_categorie = c.rowid AND cs.fk_soc = s.rowid";
+ }
+}
+if (!empty($search_societe)) $sql .= natural_search('s.nom', $search_societe);
+if (!empty($search_zip)) $sql .= natural_search('s.zip', $search_zip);
+if (!empty($search_town)) $sql .= natural_search('s.town', $search_town);
+if ($search_country > 0) $sql .= ' AND s.fk_pays = '.$search_country.'';
+$sql .= " AND f.entity IN (".getEntity('supplier_invoice').")";
+if ($socid) $sql .= " AND f.fk_soc = ".$socid;
+$sql .= " GROUP BY s.rowid, s.nom, s.zip, s.town, s.fk_pays";
+$sql .= " ORDER BY s.rowid";
+//echo $sql;
+
+dol_syslog("supplier_turnover_by_thirdparty", LOG_DEBUG);
+$result = $db->query($sql);
+if ($result) {
+ $num = $db->num_rows($result);
+ $i = 0;
+ while ($i < $num) {
+ $obj = $db->fetch_object($result);
+ $amount_ht[$obj->socid] = $obj->amount;
+ $amount[$obj->socid] = $obj->amount_ttc;
+ $name[$obj->socid] = $obj->name.' '.$obj->firstname;
+ $address_zip[$obj->socid] = $obj->zip;
+ $address_town[$obj->socid] = $obj->town;
+ $address_pays[$obj->socid] = getCountry($obj->fk_pays);
+ $catotal_ht += $obj->amount;
+ $catotal += $obj->amount_ttc;
+ $i++;
+ }
+} else {
+ dol_print_error($db);
+}
+
+// Show array
+$i = 0;
+print '';
+
+// End of page
+llxFooter();
+$db->close();
diff --git a/htdocs/core/lib/modulebuilder.lib.php b/htdocs/core/lib/modulebuilder.lib.php
index 6ea1d949833..b9a958160d4 100644
--- a/htdocs/core/lib/modulebuilder.lib.php
+++ b/htdocs/core/lib/modulebuilder.lib.php
@@ -39,165 +39,165 @@
*/
function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir = '', $addfieldentry = array(), $delfieldentry = '')
{
- global $db, $langs;
+ global $db, $langs;
- if (empty($objectname)) return -1;
- if (empty($readdir)) $readdir = $destdir;
+ if (empty($objectname)) return -1;
+ if (empty($readdir)) $readdir = $destdir;
- if (!empty($addfieldentry['arrayofkeyval']) && !is_array($addfieldentry['arrayofkeyval']))
- {
- dol_print_error('', 'Bad parameter addfieldentry with a property arrayofkeyval defined but that is not an array.');
- return -1;
- }
+ if (!empty($addfieldentry['arrayofkeyval']) && !is_array($addfieldentry['arrayofkeyval']))
+ {
+ dol_print_error('', 'Bad parameter addfieldentry with a property arrayofkeyval defined but that is not an array.');
+ return -1;
+ }
- // Check parameters
- if (count($addfieldentry) > 0)
- {
- if (empty($addfieldentry['name']))
- {
- setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Name")), null, 'errors');
- return -2;
- }
- if (empty($addfieldentry['label']))
- {
- setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Label")), null, 'errors');
- return -2;
- }
- if (!preg_match('/^(integer|price|sellist|varchar|double|text|html|duration)/', $addfieldentry['type'])
- && !preg_match('/^(boolean|real|date|datetime|timestamp)$/', $addfieldentry['type']))
- {
- setEventMessages($langs->trans('BadValueForType', $objectname), null, 'errors');
- return -2;
- }
- }
+ // Check parameters
+ if (count($addfieldentry) > 0)
+ {
+ if (empty($addfieldentry['name']))
+ {
+ setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Name")), null, 'errors');
+ return -2;
+ }
+ if (empty($addfieldentry['label']))
+ {
+ setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Label")), null, 'errors');
+ return -2;
+ }
+ if (!preg_match('/^(integer|price|sellist|varchar|double|text|html|duration)/', $addfieldentry['type'])
+ && !preg_match('/^(boolean|real|date|datetime|timestamp)$/', $addfieldentry['type']))
+ {
+ setEventMessages($langs->trans('BadValueForType', $objectname), null, 'errors');
+ return -2;
+ }
+ }
- $pathoffiletoeditsrc = $readdir.'/class/'.strtolower($objectname).'.class.php';
- $pathoffiletoedittarget = $destdir.'/class/'.strtolower($objectname).'.class.php'.($readdir != $destdir ? '.new' : '');
- if (!dol_is_file($pathoffiletoeditsrc))
- {
- $langs->load("errors");
- setEventMessages($langs->trans("ErrorFileNotFound", $pathoffiletoeditsrc), null, 'errors');
- return -3;
- }
+ $pathoffiletoeditsrc = $readdir.'/class/'.strtolower($objectname).'.class.php';
+ $pathoffiletoedittarget = $destdir.'/class/'.strtolower($objectname).'.class.php'.($readdir != $destdir ? '.new' : '');
+ if (!dol_is_file($pathoffiletoeditsrc))
+ {
+ $langs->load("errors");
+ setEventMessages($langs->trans("ErrorFileNotFound", $pathoffiletoeditsrc), null, 'errors');
+ return -3;
+ }
- //$pathoffiletoedittmp=$destdir.'/class/'.strtolower($objectname).'.class.php.tmp';
- //dol_delete_file($pathoffiletoedittmp, 0, 1, 1);
+ //$pathoffiletoedittmp=$destdir.'/class/'.strtolower($objectname).'.class.php.tmp';
+ //dol_delete_file($pathoffiletoedittmp, 0, 1, 1);
- try
- {
- include_once $pathoffiletoeditsrc;
- if (class_exists($objectname)) $object = new $objectname($db);
- else return -4;
+ try
+ {
+ include_once $pathoffiletoeditsrc;
+ if (class_exists($objectname)) $object = new $objectname($db);
+ else return -4;
- // Backup old file
- dol_copy($pathoffiletoedittarget, $pathoffiletoedittarget.'.back', $newmask, 1);
+ // Backup old file
+ dol_copy($pathoffiletoedittarget, $pathoffiletoedittarget.'.back', $newmask, 1);
- // Edit class files
- $contentclass = file_get_contents(dol_osencode($pathoffiletoeditsrc), 'r');
+ // Edit class files
+ $contentclass = file_get_contents(dol_osencode($pathoffiletoeditsrc), 'r');
- // Update ->fields (add or remove entries)
- if (count($object->fields))
- {
- if (is_array($addfieldentry) && count($addfieldentry))
- {
+ // Update ->fields (add or remove entries)
+ if (count($object->fields))
+ {
+ if (is_array($addfieldentry) && count($addfieldentry))
+ {
$name = $addfieldentry['name'];
- unset($addfieldentry['name']);
+ unset($addfieldentry['name']);
- $object->fields[$name] = $addfieldentry;
- }
- if (!empty($delfieldentry))
- {
- $name = $delfieldentry;
- unset($object->fields[$name]);
- }
- }
+ $object->fields[$name] = $addfieldentry;
+ }
+ if (!empty($delfieldentry))
+ {
+ $name = $delfieldentry;
+ unset($object->fields[$name]);
+ }
+ }
- dol_sort_array($object->fields, 'position');
+ dol_sort_array($object->fields, 'position');
- $i = 0;
- $texttoinsert = '// BEGIN MODULEBUILDER PROPERTIES'."\n";
- $texttoinsert .= "\t".'/**'."\n";
- $texttoinsert .= "\t".' * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.'."\n";
- $texttoinsert .= "\t".' */'."\n";
- $texttoinsert .= "\t".'public $fields=array('."\n";
+ $i = 0;
+ $texttoinsert = '// BEGIN MODULEBUILDER PROPERTIES'."\n";
+ $texttoinsert .= "\t".'/**'."\n";
+ $texttoinsert .= "\t".' * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.'."\n";
+ $texttoinsert .= "\t".' */'."\n";
+ $texttoinsert .= "\t".'public $fields=array('."\n";
- if (count($object->fields))
- {
- foreach ($object->fields as $key => $val)
- {
- $i++;
- $texttoinsert .= "\t\t'".$key."' => array('type'=>'".$val['type']."', 'label'=>'".$val['label']."',";
- $texttoinsert .= " 'enabled'=>".($val['enabled'] !== '' ? $val['enabled'] : 1).",";
- $texttoinsert .= " 'position'=>".($val['position'] !== '' ? $val['position'] : 50).",";
- $texttoinsert .= " 'notnull'=>".(empty($val['notnull']) ? 0 : $val['notnull']).",";
- $texttoinsert .= " 'visible'=>".($val['visible'] !== '' ? $val['visible'] : -1).",";
- if ($val['noteditable']) $texttoinsert .= " 'noteditable'=>'".$val['noteditable']."',";
- if ($val['default']) $texttoinsert .= " 'default'=>'".$val['default']."',";
- if ($val['index']) $texttoinsert .= " 'index'=>".$val['index'].",";
- if ($val['foreignkey']) $texttoinsert .= " 'foreignkey'=>'".$val['foreignkey']."',";
- if ($val['searchall']) $texttoinsert .= " 'searchall'=>".$val['searchall'].",";
- if ($val['isameasure']) $texttoinsert .= " 'isameasure'=>'".$val['isameasure']."',";
- if ($val['css']) $texttoinsert .= " 'css'=>'".$val['css']."',";
- if ($val['help']) $texttoinsert .= " 'help'=>\"".preg_replace('/"/', '', $val['help'])."\",";
- if ($val['showoncombobox']) $texttoinsert .= " 'showoncombobox'=>'".$val['showoncombobox']."',";
- if ($val['disabled']) $texttoinsert .= " 'disabled'=>'".$val['disabled']."',";
- if ($val['arrayofkeyval'])
- {
- $texttoinsert .= " 'arrayofkeyval'=>array(";
- $i = 0;
- foreach ($val['arrayofkeyval'] as $key2 => $val2)
- {
- if ($i) $texttoinsert .= ", ";
- $texttoinsert .= "'".$key2."'=>'".$val2."'";
- $i++;
- }
- $texttoinsert .= "),";
- }
- if ($val['comment']) $texttoinsert .= " 'comment'=>\"".preg_replace('/"/', '', $val['comment'])."\"";
+ if (count($object->fields))
+ {
+ foreach ($object->fields as $key => $val)
+ {
+ $i++;
+ $texttoinsert .= "\t\t'".$key."' => array('type'=>'".$val['type']."', 'label'=>'".$val['label']."',";
+ $texttoinsert .= " 'enabled'=>".($val['enabled'] !== '' ? $val['enabled'] : 1).",";
+ $texttoinsert .= " 'position'=>".($val['position'] !== '' ? $val['position'] : 50).",";
+ $texttoinsert .= " 'notnull'=>".(empty($val['notnull']) ? 0 : $val['notnull']).",";
+ $texttoinsert .= " 'visible'=>".($val['visible'] !== '' ? $val['visible'] : -1).",";
+ if ($val['noteditable']) $texttoinsert .= " 'noteditable'=>'".$val['noteditable']."',";
+ if ($val['default']) $texttoinsert .= " 'default'=>'".$val['default']."',";
+ if ($val['index']) $texttoinsert .= " 'index'=>".$val['index'].",";
+ if ($val['foreignkey']) $texttoinsert .= " 'foreignkey'=>'".$val['foreignkey']."',";
+ if ($val['searchall']) $texttoinsert .= " 'searchall'=>".$val['searchall'].",";
+ if ($val['isameasure']) $texttoinsert .= " 'isameasure'=>'".$val['isameasure']."',";
+ if ($val['css']) $texttoinsert .= " 'css'=>'".$val['css']."',";
+ if ($val['help']) $texttoinsert .= " 'help'=>\"".preg_replace('/"/', '', $val['help'])."\",";
+ if ($val['showoncombobox']) $texttoinsert .= " 'showoncombobox'=>'".$val['showoncombobox']."',";
+ if ($val['disabled']) $texttoinsert .= " 'disabled'=>'".$val['disabled']."',";
+ if ($val['arrayofkeyval'])
+ {
+ $texttoinsert .= " 'arrayofkeyval'=>array(";
+ $i = 0;
+ foreach ($val['arrayofkeyval'] as $key2 => $val2)
+ {
+ if ($i) $texttoinsert .= ", ";
+ $texttoinsert .= "'".$key2."'=>'".$val2."'";
+ $i++;
+ }
+ $texttoinsert .= "),";
+ }
+ if ($val['comment']) $texttoinsert .= " 'comment'=>\"".preg_replace('/"/', '', $val['comment'])."\"";
- $texttoinsert .= "),\n";
- }
- }
+ $texttoinsert .= "),\n";
+ }
+ }
- $texttoinsert .= "\t".');'."\n";
+ $texttoinsert .= "\t".');'."\n";
//print ($texttoinsert);exit;
- if (count($object->fields))
- {
- //$typetotypephp=array('integer'=>'integer', 'duration'=>'integer', 'varchar'=>'string');
+ if (count($object->fields))
+ {
+ //$typetotypephp=array('integer'=>'integer', 'duration'=>'integer', 'varchar'=>'string');
- foreach ($object->fields as $key => $val)
- {
- $i++;
- //$typephp=$typetotypephp[$val['type']];
- $texttoinsert .= "\t".'public $'.$key.";";
- //if ($key == 'rowid') $texttoinsert.= ' AUTO_INCREMENT PRIMARY KEY';
- //if ($key == 'entity') $texttoinsert.= ' DEFAULT 1';
- //$texttoinsert.= ($val['notnull']?' NOT NULL':'');
- //if ($i < count($object->fields)) $texttoinsert.=";";
- $texttoinsert .= "\n";
- }
- }
+ foreach ($object->fields as $key => $val)
+ {
+ $i++;
+ //$typephp=$typetotypephp[$val['type']];
+ $texttoinsert .= "\t".'public $'.$key.";";
+ //if ($key == 'rowid') $texttoinsert.= ' AUTO_INCREMENT PRIMARY KEY';
+ //if ($key == 'entity') $texttoinsert.= ' DEFAULT 1';
+ //$texttoinsert.= ($val['notnull']?' NOT NULL':'');
+ //if ($i < count($object->fields)) $texttoinsert.=";";
+ $texttoinsert .= "\n";
+ }
+ }
- $texttoinsert .= "\t".'// END MODULEBUILDER PROPERTIES';
+ $texttoinsert .= "\t".'// END MODULEBUILDER PROPERTIES';
- //print($texttoinsert);exit;
+ //print($texttoinsert);exit;
- $contentclass = preg_replace('/\/\/ BEGIN MODULEBUILDER PROPERTIES.*END MODULEBUILDER PROPERTIES/ims', $texttoinsert, $contentclass);
+ $contentclass = preg_replace('/\/\/ BEGIN MODULEBUILDER PROPERTIES.*END MODULEBUILDER PROPERTIES/ims', $texttoinsert, $contentclass);
- dol_mkdir(dirname($pathoffiletoedittarget));
+ dol_mkdir(dirname($pathoffiletoedittarget));
- //file_put_contents($pathoffiletoedittmp, $contentclass);
- file_put_contents(dol_osencode($pathoffiletoedittarget), $contentclass);
- @chmod($pathoffiletoedittarget, octdec($newmask));
+ //file_put_contents($pathoffiletoedittmp, $contentclass);
+ file_put_contents(dol_osencode($pathoffiletoedittarget), $contentclass);
+ @chmod($pathoffiletoedittarget, octdec($newmask));
- return $object;
- }
- catch (Exception $e)
- {
- print $e->getMessage();
- return -5;
- }
+ return $object;
+ }
+ catch (Exception $e)
+ {
+ print $e->getMessage();
+ return -5;
+ }
}
/**
@@ -214,134 +214,134 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir =
*/
function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir = '', $object = null)
{
- global $db, $langs;
+ global $db, $langs;
- $error = 0;
+ $error = 0;
- if (empty($objectname)) return -1;
- if (empty($readdir)) $readdir = $destdir;
+ if (empty($objectname)) return -1;
+ if (empty($readdir)) $readdir = $destdir;
- $pathoffiletoclasssrc = $readdir.'/class/'.strtolower($objectname).'.class.php';
+ $pathoffiletoclasssrc = $readdir.'/class/'.strtolower($objectname).'.class.php';
- // Edit .sql file
- $pathoffiletoeditsrc = $readdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql';
- $pathoffiletoedittarget = $destdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql'.($readdir != $destdir ? '.new' : '');
+ // Edit .sql file
+ $pathoffiletoeditsrc = $readdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql';
+ $pathoffiletoedittarget = $destdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql'.($readdir != $destdir ? '.new' : '');
if (!dol_is_file($pathoffiletoeditsrc))
- {
- $langs->load("errors");
- setEventMessages($langs->trans("ErrorFileNotFound", $pathoffiletoeditsrc), null, 'errors');
- return -1;
- }
+ {
+ $langs->load("errors");
+ setEventMessages($langs->trans("ErrorFileNotFound", $pathoffiletoeditsrc), null, 'errors');
+ return -1;
+ }
- // Load object from myobject.class.php
- try
- {
- if (!is_object($object))
- {
- include_once $pathoffiletoclasssrc;
- if (class_exists($objectname)) $object = new $objectname($db);
- else return -1;
- }
- }
- catch (Exception $e)
- {
- print $e->getMessage();
- }
+ // Load object from myobject.class.php
+ try
+ {
+ if (!is_object($object))
+ {
+ include_once $pathoffiletoclasssrc;
+ if (class_exists($objectname)) $object = new $objectname($db);
+ else return -1;
+ }
+ }
+ catch (Exception $e)
+ {
+ print $e->getMessage();
+ }
- // Backup old file
- dol_copy($pathoffiletoedittarget, $pathoffiletoedittarget.'.back', $newmask, 1);
+ // Backup old file
+ dol_copy($pathoffiletoedittarget, $pathoffiletoedittarget.'.back', $newmask, 1);
- $contentsql = file_get_contents(dol_osencode($pathoffiletoeditsrc), 'r');
+ $contentsql = file_get_contents(dol_osencode($pathoffiletoeditsrc), 'r');
- $i = 0;
- $texttoinsert = '-- BEGIN MODULEBUILDER FIELDS'."\n";
- if (count($object->fields))
- {
- foreach ($object->fields as $key => $val)
- {
- $i++;
+ $i = 0;
+ $texttoinsert = '-- BEGIN MODULEBUILDER FIELDS'."\n";
+ if (count($object->fields))
+ {
+ foreach ($object->fields as $key => $val)
+ {
+ $i++;
- $type = $val['type'];
- $type = preg_replace('/:.*$/', '', $type); // For case type = 'integer:Societe:societe/class/societe.class.php'
+ $type = $val['type'];
+ $type = preg_replace('/:.*$/', '', $type); // For case type = 'integer:Societe:societe/class/societe.class.php'
- if ($type == 'html') $type = 'text'; // html modulebuilder type is a text type in database
- elseif ($type == 'price') $type = 'double'; // html modulebuilder type is a text type in database
- elseif (in_array($type, array('link', 'sellist', 'duration'))) $type = 'integer';
- $texttoinsert .= "\t".$key." ".$type;
- if ($key == 'rowid') $texttoinsert .= ' AUTO_INCREMENT PRIMARY KEY';
- if ($key == 'entity') $texttoinsert .= ' DEFAULT 1';
- else
- {
- if ($val['default'] != '')
- {
- if (preg_match('/^null$/i', $val['default'])) $texttoinsert .= " DEFAULT NULL";
- elseif (preg_match('/varchar/', $type)) $texttoinsert .= " DEFAULT '".$db->escape($val['default'])."'";
- else $texttoinsert .= (($val['default'] > 0) ? ' DEFAULT '.$val['default'] : '');
- }
- }
- $texttoinsert .= (($val['notnull'] > 0) ? ' NOT NULL' : '');
- if ($i < count($object->fields)) $texttoinsert .= ", ";
- $texttoinsert .= "\n";
- }
- }
- $texttoinsert .= "\t".'-- END MODULEBUILDER FIELDS';
+ if ($type == 'html') $type = 'text'; // html modulebuilder type is a text type in database
+ elseif ($type == 'price') $type = 'double'; // html modulebuilder type is a text type in database
+ elseif (in_array($type, array('link', 'sellist', 'duration'))) $type = 'integer';
+ $texttoinsert .= "\t".$key." ".$type;
+ if ($key == 'rowid') $texttoinsert .= ' AUTO_INCREMENT PRIMARY KEY';
+ if ($key == 'entity') $texttoinsert .= ' DEFAULT 1';
+ else
+ {
+ if ($val['default'] != '')
+ {
+ if (preg_match('/^null$/i', $val['default'])) $texttoinsert .= " DEFAULT NULL";
+ elseif (preg_match('/varchar/', $type)) $texttoinsert .= " DEFAULT '".$db->escape($val['default'])."'";
+ else $texttoinsert .= (($val['default'] > 0) ? ' DEFAULT '.$val['default'] : '');
+ }
+ }
+ $texttoinsert .= (($val['notnull'] > 0) ? ' NOT NULL' : '');
+ if ($i < count($object->fields)) $texttoinsert .= ", ";
+ $texttoinsert .= "\n";
+ }
+ }
+ $texttoinsert .= "\t".'-- END MODULEBUILDER FIELDS';
- $contentsql = preg_replace('/-- BEGIN MODULEBUILDER FIELDS.*END MODULEBUILDER FIELDS/ims', $texttoinsert, $contentsql);
+ $contentsql = preg_replace('/-- BEGIN MODULEBUILDER FIELDS.*END MODULEBUILDER FIELDS/ims', $texttoinsert, $contentsql);
- $result = file_put_contents($pathoffiletoedittarget, $contentsql);
- if ($result)
- {
- @chmod($pathoffiletoedittarget, octdec($newmask));
- }
- else
- {
- $error++;
- }
+ $result = file_put_contents($pathoffiletoedittarget, $contentsql);
+ if ($result)
+ {
+ @chmod($pathoffiletoedittarget, octdec($newmask));
+ }
+ else
+ {
+ $error++;
+ }
- // Edit .key.sql file
- $pathoffiletoeditsrc = $destdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql';
- $pathoffiletoedittarget = $destdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql'.($readdir != $destdir ? '.new' : '');
+ // Edit .key.sql file
+ $pathoffiletoeditsrc = $destdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql';
+ $pathoffiletoedittarget = $destdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql'.($readdir != $destdir ? '.new' : '');
- $contentsql = file_get_contents(dol_osencode($pathoffiletoeditsrc), 'r');
+ $contentsql = file_get_contents(dol_osencode($pathoffiletoeditsrc), 'r');
- $i = 0;
- $texttoinsert = '-- BEGIN MODULEBUILDER INDEXES'."\n";
- if (count($object->fields))
- {
- foreach ($object->fields as $key => $val)
- {
- $i++;
- if (!empty($val['index']))
- {
- $texttoinsert .= "ALTER TABLE llx_".strtolower($module).'_'.strtolower($objectname)." ADD INDEX idx_".strtolower($module).'_'.strtolower($objectname)."_".$key." (".$key.");";
- $texttoinsert .= "\n";
- }
- if (!empty($val['foreignkey']))
- {
- $tmp = explode('.', $val['foreignkey']);
- if (!empty($tmp[0]) && !empty($tmp[1]))
- {
- $texttoinsert .= "ALTER TABLE llx_".strtolower($module).'_'.strtolower($objectname)." ADD CONSTRAINT llx_".strtolower($module).'_'.strtolower($objectname)."_".$key." FOREIGN KEY (".$key.") REFERENCES llx_".preg_replace('/^llx_/', '', $tmp[0])."(".$tmp[1].");";
- $texttoinsert .= "\n";
- }
- }
- }
- }
- $texttoinsert .= '-- END MODULEBUILDER INDEXES';
+ $i = 0;
+ $texttoinsert = '-- BEGIN MODULEBUILDER INDEXES'."\n";
+ if (count($object->fields))
+ {
+ foreach ($object->fields as $key => $val)
+ {
+ $i++;
+ if (!empty($val['index']))
+ {
+ $texttoinsert .= "ALTER TABLE llx_".strtolower($module).'_'.strtolower($objectname)." ADD INDEX idx_".strtolower($module).'_'.strtolower($objectname)."_".$key." (".$key.");";
+ $texttoinsert .= "\n";
+ }
+ if (!empty($val['foreignkey']))
+ {
+ $tmp = explode('.', $val['foreignkey']);
+ if (!empty($tmp[0]) && !empty($tmp[1]))
+ {
+ $texttoinsert .= "ALTER TABLE llx_".strtolower($module).'_'.strtolower($objectname)." ADD CONSTRAINT llx_".strtolower($module).'_'.strtolower($objectname)."_".$key." FOREIGN KEY (".$key.") REFERENCES llx_".preg_replace('/^llx_/', '', $tmp[0])."(".$tmp[1].");";
+ $texttoinsert .= "\n";
+ }
+ }
+ }
+ }
+ $texttoinsert .= '-- END MODULEBUILDER INDEXES';
- $contentsql = preg_replace('/-- BEGIN MODULEBUILDER INDEXES.*END MODULEBUILDER INDEXES/ims', $texttoinsert, $contentsql);
+ $contentsql = preg_replace('/-- BEGIN MODULEBUILDER INDEXES.*END MODULEBUILDER INDEXES/ims', $texttoinsert, $contentsql);
- dol_mkdir(dirname($pathoffiletoedittarget));
+ dol_mkdir(dirname($pathoffiletoedittarget));
- $result2 = file_put_contents($pathoffiletoedittarget, $contentsql);
- if ($result)
- {
- @chmod($pathoffiletoedittarget, octdec($newmask));
- }
- else
- {
- $error++;
- }
+ $result2 = file_put_contents($pathoffiletoedittarget, $contentsql);
+ if ($result)
+ {
+ @chmod($pathoffiletoedittarget, octdec($newmask));
+ }
+ else
+ {
+ $error++;
+ }
- return $error ? -1 : 1;
+ return $error ? -1 : 1;
}
diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php
index 42b15114379..ab95d5765ac 100644
--- a/htdocs/core/menus/standard/eldy.lib.php
+++ b/htdocs/core/menus/standard/eldy.lib.php
@@ -1376,6 +1376,27 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
//$newmenu->add("/compta/stats/byratecountry.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByVatRate"),3,$user->rights->accounting->comptarapport->lire);
}
}
+
+ $modecompta = 'CREANCES-DETTES';
+ if (!empty($conf->accounting->enabled) && !empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') $modecompta = 'BOOKKEEPING'; // Not yet implemented. Should be BOOKKEEPINGCOLLECTED
+ if ($modecompta && $conf->fournisseur->enabled)
+ {
+ if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/', $leftmenu)) {
+ $newmenu->add("/compta/stats/supplier_turnover.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportPurchaseTurnover"), 2, $user->rights->accounting->comptarapport->lire);
+ $newmenu->add("/compta/stats/supplier_turnover_by_thirdparty.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 3, $user->rights->accounting->comptarapport->lire);
+ $newmenu->add("/compta/stats/supplier_turnover_by_prodserv.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"), 3, $user->rights->accounting->comptarapport->lire);
+ }
+ }
+
+ $modecompta = 'RECETTES-DEPENSES';
+ //if (! empty($conf->accounting->enabled) && ! empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') $modecompta=''; // Not yet implemented. Should be BOOKKEEPINGCOLLECTED
+ if ($modecompta && $conf->fournisseur->enabled)
+ {
+ if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/', $leftmenu)) {
+ $newmenu->add("/compta/stats/supplier_turnover.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportPurchaseTurnoverCollected"), 2, $user->rights->accounting->comptarapport->lire);
+ $newmenu->add("/compta/stats/supplier_turnover_by_thirdparty.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 3, $user->rights->accounting->comptarapport->lire);
+ }
+ }
}
// Accountancy (simple)
diff --git a/htdocs/core/modules/bom/mod_bom_standard.php b/htdocs/core/modules/bom/mod_bom_standard.php
index 16df1dd0d92..40d082ace0f 100644
--- a/htdocs/core/modules/bom/mod_bom_standard.php
+++ b/htdocs/core/modules/bom/mod_bom_standard.php
@@ -30,9 +30,9 @@ require_once DOL_DOCUMENT_ROOT .'/core/modules/bom/modules_bom.php';
class mod_bom_standard extends ModeleNumRefboms
{
/**
- * Dolibarr version of the loaded document
- * @var string
- */
+ * Dolibarr version of the loaded document
+ * @var string
+ */
public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
public $prefix='BOM';
@@ -48,16 +48,16 @@ class mod_bom_standard extends ModeleNumRefboms
public $name='standard';
- /**
- * Return description of numbering module
- *
- * @return string Text with description
- */
- public function info()
- {
- global $langs;
- return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
- }
+ /**
+ * Return description of numbering module
+ *
+ * @return string Text with description
+ */
+ public function info()
+ {
+ global $langs;
+ return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
+ }
/**
@@ -72,8 +72,8 @@ class mod_bom_standard extends ModeleNumRefboms
/**
- * Checks if the numbers already in the database do not
- * cause conflicts that would prevent this numbering working.
+ * Checks if the numbers already in the database do not
+ * cause conflicts that would prevent this numbering working.
*
* @return boolean false if conflict, true if ok
*/
@@ -140,8 +140,8 @@ class mod_bom_standard extends ModeleNumRefboms
$date=$object->date_creation;
$yymm = strftime("%y%m", $date);
- if ($max >= (pow(10, 4) - 1)) $num=$max+1; // If counter > 9999, we do not format on 4 chars, we take number as it is
- else $num = sprintf("%04s", $max+1);
+ if ($max >= (pow(10, 4) - 1)) $num=$max+1; // If counter > 9999, we do not format on 4 chars, we take number as it is
+ else $num = sprintf("%04s", $max+1);
dol_syslog("mod_bom_standard::getNextValue return ".$this->prefix.$yymm."-".$num);
return $this->prefix.$yymm."-".$num;
diff --git a/htdocs/core/modules/bom/modules_bom.php b/htdocs/core/modules/bom/modules_bom.php
index 2b150402fb0..86e072633ec 100644
--- a/htdocs/core/modules/bom/modules_bom.php
+++ b/htdocs/core/modules/bom/modules_bom.php
@@ -39,17 +39,17 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // requir
abstract class ModelePDFBom extends CommonDocGenerator
{
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
- /**
- * Return list of active generation modules
- *
- * @param DoliDB $db Database handler
- * @param integer $maxfilenamelength Max length of value to show
- * @return array List of templates
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ /**
+ * Return list of active generation modules
+ *
+ * @param DoliDB $db Database handler
+ * @param integer $maxfilenamelength Max length of value to show
+ * @return array List of templates
*/
public static function liste_modeles($db, $maxfilenamelength = 0)
{
- // phpcs:enable
+ // phpcs:enable
global $conf;
$type = 'bom';
@@ -110,7 +110,7 @@ abstract class ModeleNumRefBoms
/**
* Checks if the numbers already in the database do not
- * cause conflicts that would prevent this numbering working.
+ * cause conflicts that would prevent this numbering working.
*
* @return boolean false if conflict, true if ok
*/
diff --git a/htdocs/core/modules/cheque/mod_chequereceipt_mint.php b/htdocs/core/modules/cheque/mod_chequereceipt_mint.php
index f4995962f90..15e95df561b 100644
--- a/htdocs/core/modules/cheque/mod_chequereceipt_mint.php
+++ b/htdocs/core/modules/cheque/mod_chequereceipt_mint.php
@@ -30,9 +30,9 @@ require_once DOL_DOCUMENT_ROOT .'/core/modules/cheque/modules_chequereceipts.php
class mod_chequereceipt_mint extends ModeleNumRefChequeReceipts
{
/**
- * Dolibarr version of the loaded document
- * @var string
- */
+ * Dolibarr version of the loaded document
+ * @var string
+ */
public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
public $prefix='CHK';
@@ -45,16 +45,16 @@ class mod_chequereceipt_mint extends ModeleNumRefChequeReceipts
public $name='Mint';
- /**
- * Return description of numbering module
- *
- * @return string Text with description
- */
- public function info()
- {
- global $langs;
- return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
- }
+ /**
+ * Return description of numbering module
+ *
+ * @return string Text with description
+ */
+ public function info()
+ {
+ global $langs;
+ return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
+ }
/**
@@ -69,8 +69,8 @@ class mod_chequereceipt_mint extends ModeleNumRefChequeReceipts
/**
- * Checks if the numbers already in the database do not
- * cause conflicts that would prevent this numbering working.
+ * Checks if the numbers already in the database do not
+ * cause conflicts that would prevent this numbering working.
*
* @return boolean false if conflict, true if ok
*/
@@ -137,15 +137,15 @@ class mod_chequereceipt_mint extends ModeleNumRefChequeReceipts
$date=$object->date_bordereau;
$yymm = strftime("%y%m", $date);
- if ($max >= (pow(10, 4) - 1)) $num=$max+1; // If counter > 9999, we do not format on 4 chars, we take number as it is
- else $num = sprintf("%04s", $max+1);
+ if ($max >= (pow(10, 4) - 1)) $num=$max+1; // If counter > 9999, we do not format on 4 chars, we take number as it is
+ else $num = sprintf("%04s", $max+1);
dol_syslog(__METHOD__." return ".$this->prefix.$yymm."-".$num);
return $this->prefix.$yymm."-".$num;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return next free value
*
@@ -155,7 +155,7 @@ class mod_chequereceipt_mint extends ModeleNumRefChequeReceipts
*/
public function chequereceipt_get_num($objsoc, $objforref)
{
- // phpcs:enable
+ // phpcs:enable
return $this->getNextValue($objsoc, $objforref);
}
}
diff --git a/htdocs/core/modules/cheque/modules_chequereceipts.php b/htdocs/core/modules/cheque/modules_chequereceipts.php
index 74de02bcd0f..92a0b139ea6 100644
--- a/htdocs/core/modules/cheque/modules_chequereceipts.php
+++ b/htdocs/core/modules/cheque/modules_chequereceipts.php
@@ -76,11 +76,11 @@ abstract class ModeleNumRefChequeReceipts
}
/**
- * Checks if the numbers already in the database do not
- * cause conflicts that would prevent this numbering working.
- *
- * @return boolean false if conflict, true if ok
- */
+ * Checks if the numbers already in the database do not
+ * cause conflicts that would prevent this numbering working.
+ *
+ * @return boolean false if conflict, true if ok
+ */
public function canBeActivated()
{
return true;
@@ -128,17 +128,17 @@ abstract class ModeleChequeReceipts extends CommonDocGenerator
*/
public $error='';
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active generation modules
*
- * @param DoliDB $db Database handler
- * @param integer $maxfilenamelength Max length of value to show
- * @return array List of templates
+ * @param DoliDB $db Database handler
+ * @param integer $maxfilenamelength Max length of value to show
+ * @return array List of templates
*/
public static function liste_modeles($db, $maxfilenamelength = 0)
{
- // phpcs:enable
+ // phpcs:enable
global $conf;
$type='chequereceipt';
diff --git a/htdocs/core/modules/commande/mod_commande_marbre.php b/htdocs/core/modules/commande/mod_commande_marbre.php
index 9dc07576797..380f54bbecf 100644
--- a/htdocs/core/modules/commande/mod_commande_marbre.php
+++ b/htdocs/core/modules/commande/mod_commande_marbre.php
@@ -30,9 +30,9 @@ require_once DOL_DOCUMENT_ROOT .'/core/modules/commande/modules_commande.php';
class mod_commande_marbre extends ModeleNumRefCommandes
{
/**
- * Dolibarr version of the loaded document
- * @var string
- */
+ * Dolibarr version of the loaded document
+ * @var string
+ */
public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
public $prefix='CO';
@@ -48,16 +48,16 @@ class mod_commande_marbre extends ModeleNumRefCommandes
public $name='Marbre';
- /**
- * Return description of numbering module
- *
- * @return string Text with description
- */
- public function info()
- {
- global $langs;
- return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
- }
+ /**
+ * Return description of numbering module
+ *
+ * @return string Text with description
+ */
+ public function info()
+ {
+ global $langs;
+ return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
+ }
/**
@@ -72,8 +72,8 @@ class mod_commande_marbre extends ModeleNumRefCommandes
/**
- * Checks if the numbers already in the database do not
- * cause conflicts that would prevent this numbering working.
+ * Checks if the numbers already in the database do not
+ * cause conflicts that would prevent this numbering working.
*
* @return boolean false if conflict, true if ok
*/
@@ -140,15 +140,15 @@ class mod_commande_marbre extends ModeleNumRefCommandes
$date=$object->date;
$yymm = strftime("%y%m", $date);
- if ($max >= (pow(10, 4) - 1)) $num=$max+1; // If counter > 9999, we do not format on 4 chars, we take number as it is
- else $num = sprintf("%04s", $max+1);
+ if ($max >= (pow(10, 4) - 1)) $num=$max+1; // If counter > 9999, we do not format on 4 chars, we take number as it is
+ else $num = sprintf("%04s", $max+1);
dol_syslog("mod_commande_marbre::getNextValue return ".$this->prefix.$yymm."-".$num);
return $this->prefix.$yymm."-".$num;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return next free value
*
@@ -158,7 +158,7 @@ class mod_commande_marbre extends ModeleNumRefCommandes
*/
public function commande_get_num($objsoc, $objforref)
{
- // phpcs:enable
+ // phpcs:enable
return $this->getNextValue($objsoc, $objforref);
}
}
diff --git a/htdocs/core/modules/commande/modules_commande.php b/htdocs/core/modules/commande/modules_commande.php
index 53b9a636d4b..b64275faeb6 100644
--- a/htdocs/core/modules/commande/modules_commande.php
+++ b/htdocs/core/modules/commande/modules_commande.php
@@ -40,17 +40,17 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
abstract class ModelePDFCommandes extends CommonDocGenerator
{
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
- /**
- * Return list of active generation modules
- *
- * @param DoliDB $db Database handler
- * @param integer $maxfilenamelength Max length of value to show
- * @return array List of templates
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ /**
+ * Return list of active generation modules
+ *
+ * @param DoliDB $db Database handler
+ * @param integer $maxfilenamelength Max length of value to show
+ * @return array List of templates
*/
public static function liste_modeles($db, $maxfilenamelength = 0)
{
- // phpcs:enable
+ // phpcs:enable
global $conf;
$type = 'order';
@@ -111,7 +111,7 @@ abstract class ModeleNumRefCommandes
/**
* Checks if the numbers already in the database do not
- * cause conflicts that would prevent this numbering working.
+ * cause conflicts that would prevent this numbering working.
*
* @return boolean false if conflict, true if ok
*/
diff --git a/htdocs/core/modules/dons/modules_don.php b/htdocs/core/modules/dons/modules_don.php
index 11538d8fff4..aea8493944f 100644
--- a/htdocs/core/modules/dons/modules_don.php
+++ b/htdocs/core/modules/dons/modules_don.php
@@ -34,32 +34,32 @@ require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
*/
abstract class ModeleDon extends CommonDocGenerator
{
- /**
+ /**
* @var string Error code (or message)
*/
public $error='';
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
- /**
- * Return list of active generation modules
- *
- * @param DoliDB $db Database handler
- * @param integer $maxfilenamelength Max length of value to show
- * @return array List of templates
- */
- public static function liste_modeles($db, $maxfilenamelength = 0)
- {
- // phpcs:enable
- global $conf;
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ /**
+ * Return list of active generation modules
+ *
+ * @param DoliDB $db Database handler
+ * @param integer $maxfilenamelength Max length of value to show
+ * @return array List of templates
+ */
+ public static function liste_modeles($db, $maxfilenamelength = 0)
+ {
+ // phpcs:enable
+ global $conf;
- $type='donation';
- $liste=array();
+ $type='donation';
+ $liste=array();
- include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
- $liste=getListOfModels($db, $type, $maxfilenamelength);
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
+ $liste=getListOfModels($db, $type, $maxfilenamelength);
- return $liste;
- }
+ return $liste;
+ }
}
@@ -68,81 +68,81 @@ abstract class ModeleDon extends CommonDocGenerator
*/
abstract class ModeleNumRefDons
{
- /**
+ /**
* @var string Error code (or message)
*/
public $error='';
- /**
- * Return if a module can be used or not
- *
- * @return boolean true if module can be used
- */
- public function isEnabled()
- {
- return true;
- }
+ /**
+ * Return if a module can be used or not
+ *
+ * @return boolean true if module can be used
+ */
+ public function isEnabled()
+ {
+ return true;
+ }
- /**
- * Renvoi la description par defaut du modele de numerotation
- *
- * @return string Texte descripif
- */
- public function info()
- {
- global $langs;
- $langs->load("bills");
- return $langs->trans("NoDescription");
- }
+ /**
+ * Renvoi la description par defaut du modele de numerotation
+ *
+ * @return string Texte descripif
+ */
+ public function info()
+ {
+ global $langs;
+ $langs->load("bills");
+ return $langs->trans("NoDescription");
+ }
- /**
- * Return an example of numbering
- *
- * @return string Example
- */
- public function getExample()
- {
- global $langs;
- $langs->load("bills");
- return $langs->trans("NoExample");
- }
+ /**
+ * Return an example of numbering
+ *
+ * @return string Example
+ */
+ public function getExample()
+ {
+ global $langs;
+ $langs->load("bills");
+ return $langs->trans("NoExample");
+ }
- /**
- * Checks if the numbers already in the database do not
- * cause conflicts that would prevent this numbering working.
- *
- * @return boolean false if conflict, true if ok
- */
- public function canBeActivated()
- {
- return true;
- }
+ /**
+ * Checks if the numbers already in the database do not
+ * cause conflicts that would prevent this numbering working.
+ *
+ * @return boolean false if conflict, true if ok
+ */
+ public function canBeActivated()
+ {
+ return true;
+ }
- /**
- * Renvoi prochaine valeur attribuee
- *
- * @return string Valeur
- */
- public function getNextValue()
- {
- global $langs;
- return $langs->trans("NotAvailable");
- }
+ /**
+ * Renvoi prochaine valeur attribuee
+ *
+ * @return string Valeur
+ */
+ public function getNextValue()
+ {
+ global $langs;
+ return $langs->trans("NotAvailable");
+ }
- /**
- * Renvoi version du module numerotation
- *
- * @return string Valeur
- */
- public function getVersion()
- {
- global $langs;
- $langs->load("admin");
+ /**
+ * Renvoi version du module numerotation
+ *
+ * @return string Valeur
+ */
+ public function getVersion()
+ {
+ global $langs;
+ $langs->load("admin");
- if ($this->version == 'development') return $langs->trans("VersionDevelopment");
- if ($this->version == 'experimental') return $langs->trans("VersionExperimental");
- if ($this->version == 'dolibarr') return DOL_VERSION;
- if ($this->version) return $this->version;
- return $langs->trans("NotAvailable");
- }
+ if ($this->version == 'development') return $langs->trans("VersionDevelopment");
+ if ($this->version == 'experimental') return $langs->trans("VersionExperimental");
+ if ($this->version == 'dolibarr') return DOL_VERSION;
+ if ($this->version) return $this->version;
+ return $langs->trans("NotAvailable");
+ }
}
diff --git a/htdocs/core/modules/expensereport/mod_expensereport_jade.php b/htdocs/core/modules/expensereport/mod_expensereport_jade.php
index 93d2ca15a48..d2b3ce0793a 100644
--- a/htdocs/core/modules/expensereport/mod_expensereport_jade.php
+++ b/htdocs/core/modules/expensereport/mod_expensereport_jade.php
@@ -29,9 +29,9 @@ require_once DOL_DOCUMENT_ROOT .'/core/modules/expensereport/modules_expenserepo
class mod_expensereport_jade extends ModeleNumRefExpenseReport
{
/**
- * Dolibarr version of the loaded document
- * @var string
- */
+ * Dolibarr version of the loaded document
+ * @var string
+ */
public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
public $prefix='ER';
@@ -54,16 +54,16 @@ class mod_expensereport_jade extends ModeleNumRefExpenseReport
public $name='Jade';
- /**
- * Return description of numbering model
- *
- * @return string Text with description
- */
- public function info()
- {
- global $langs;
- return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
- }
+ /**
+ * Return description of numbering model
+ *
+ * @return string Text with description
+ */
+ public function info()
+ {
+ global $langs;
+ return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
+ }
/**
@@ -71,19 +71,19 @@ class mod_expensereport_jade extends ModeleNumRefExpenseReport
*
* @return string Example
*/
- public function getExample()
+ public function getExample()
{
return $this->prefix."0501-0001";
}
/**
- * Checks if the numbers already in the database do not
- * cause conflicts that would prevent this numbering working.
+ * Checks if the numbers already in the database do not
+ * cause conflicts that would prevent this numbering working.
*
* @return boolean false if conflict, true if ok
*/
- public function canBeActivated()
+ public function canBeActivated()
{
global $conf,$langs,$db;
@@ -117,7 +117,7 @@ class mod_expensereport_jade extends ModeleNumRefExpenseReport
* @param Object $object Object we need next value for
* @return string Value if KO, <0 if KO
*/
- public function getNextValue($object)
+ public function getNextValue($object)
{
global $db,$conf;
@@ -139,19 +139,19 @@ class mod_expensereport_jade extends ModeleNumRefExpenseReport
$result = $db->query($sql);
- if ($db->num_rows($result) > 0) {
- $objp = $db->fetch_object($result);
- $newref = $objp->max;
- $newref++;
- while (strlen($newref) < $num_car) {
- $newref = "0".$newref;
- }
- } else {
- $newref = 1;
- while (strlen($newref) < $num_car) {
- $newref = "0".$newref;
- }
- }
+ if ($db->num_rows($result) > 0) {
+ $objp = $db->fetch_object($result);
+ $newref = $objp->max;
+ $newref++;
+ while (strlen($newref) < $num_car) {
+ $newref = "0".$newref;
+ }
+ } else {
+ $newref = 1;
+ while (strlen($newref) < $num_car) {
+ $newref = "0".$newref;
+ }
+ }
$ref_number_int = ($newref+1)-1;
@@ -202,8 +202,8 @@ class mod_expensereport_jade extends ModeleNumRefExpenseReport
$yymm = strftime("%y%m", $date);
- if ($max >= (pow(10, 4) - 1)) $num=$max+1; // If counter > 9999, we do not format on 4 chars, we take number as it is
- else $num = sprintf("%04s", $max+1);
+ if ($max >= (pow(10, 4) - 1)) $num=$max+1; // If counter > 9999, we do not format on 4 chars, we take number as it is
+ else $num = sprintf("%04s", $max+1);
dol_syslog("mod_expensereport_jade::getNextValue return ".$this->prefix.$yymm."-".$num);
return $this->prefix.$yymm."-".$num;
diff --git a/htdocs/core/modules/facture/modules_facture.php b/htdocs/core/modules/facture/modules_facture.php
index 871d29fca0d..775864eec52 100644
--- a/htdocs/core/modules/facture/modules_facture.php
+++ b/htdocs/core/modules/facture/modules_facture.php
@@ -46,17 +46,17 @@ abstract class ModelePDFFactures extends CommonDocGenerator
public $atleastoneratenotnull = 0;
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active generation modules
*
- * @param DoliDB $db Database handler
- * @param integer $maxfilenamelength Max length of value to show
- * @return array List of templates
+ * @param DoliDB $db Database handler
+ * @param integer $maxfilenamelength Max length of value to show
+ * @return array List of templates
*/
- public static function liste_modeles($db, $maxfilenamelength = 0)
+ public static function liste_modeles($db, $maxfilenamelength = 0)
{
- // phpcs:enable
+ // phpcs:enable
global $conf;
$type = 'invoice';
@@ -114,8 +114,8 @@ abstract class ModeleNumRefFactures
}
/**
- * Checks if the numbers already in the database do not
- * cause conflicts that would prevent this numbering working.
+ * Checks if the numbers already in the database do not
+ * cause conflicts that would prevent this numbering working.
*
* @return boolean false if conflict, true if ok
*/
diff --git a/htdocs/core/modules/fichinter/modules_fichinter.php b/htdocs/core/modules/fichinter/modules_fichinter.php
index 8db526da0a2..356ecf05081 100644
--- a/htdocs/core/modules/fichinter/modules_fichinter.php
+++ b/htdocs/core/modules/fichinter/modules_fichinter.php
@@ -40,17 +40,17 @@ abstract class ModelePDFFicheinter extends CommonDocGenerator
public $error='';
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active generation modules
*
- * @param DoliDB $db Database handler
- * @param integer $maxfilenamelength Max length of value to show
- * @return array List of templates
+ * @param DoliDB $db Database handler
+ * @param integer $maxfilenamelength Max length of value to show
+ * @return array List of templates
*/
public static function liste_modeles($db, $maxfilenamelength = 0)
{
- // phpcs:enable
+ // phpcs:enable
global $conf;
$type='ficheinter';
@@ -109,8 +109,8 @@ abstract class ModeleNumRefFicheinter
}
/**
- * Checks if the numbers already in the database do not
- * cause conflicts that would prevent this numbering working.
+ * Checks if the numbers already in the database do not
+ * cause conflicts that would prevent this numbering working.
*
* @return boolean false if conflict, true if ok
*/
@@ -164,7 +164,7 @@ abstract class ModeleNumRefFicheinter
*/
function fichinter_create($db, $object, $modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
- // phpcs:enable
+ // phpcs:enable
global $conf,$langs,$user;
$langs->load("ficheinter");
@@ -187,11 +187,11 @@ function fichinter_create($db, $object, $modele, $outputlangs, $hidedetails = 0,
// If selected modele is a filename template (then $modele="modelname:filename")
$tmp=explode(':', $modele, 2);
- if (! empty($tmp[1]))
- {
- $modele=$tmp[0];
- $srctemplatepath=$tmp[1];
- }
+ if (! empty($tmp[1]))
+ {
+ $modele=$tmp[0];
+ $srctemplatepath=$tmp[1];
+ }
// Search template files
$file=''; $classname=''; $filefound=0;
@@ -199,21 +199,21 @@ function fichinter_create($db, $object, $modele, $outputlangs, $hidedetails = 0,
if (is_array($conf->modules_parts['models'])) $dirmodels=array_merge($dirmodels, $conf->modules_parts['models']);
foreach($dirmodels as $reldir)
{
- foreach(array('doc','pdf') as $prefix)
- {
- $file = $prefix."_".$modele.".modules.php";
+ foreach(array('doc','pdf') as $prefix)
+ {
+ $file = $prefix."_".$modele.".modules.php";
- // On verifie l'emplacement du modele
- $file=dol_buildpath($reldir."core/modules/fichinter/doc/".$file, 0);
- if (file_exists($file))
- {
- $filefound=1;
- $classname=$prefix.'_'.$modele;
- break;
- }
- }
- if ($filefound) break;
- }
+ // On verifie l'emplacement du modele
+ $file=dol_buildpath($reldir."core/modules/fichinter/doc/".$file, 0);
+ if (file_exists($file))
+ {
+ $filefound=1;
+ $classname=$prefix.'_'.$modele;
+ break;
+ }
+ }
+ if ($filefound) break;
+ }
// Charge le modele
if ($filefound)
diff --git a/htdocs/core/modules/livraison/mod_livraison_jade.php b/htdocs/core/modules/livraison/mod_livraison_jade.php
index f27c1a8583f..840b6a6f0a6 100644
--- a/htdocs/core/modules/livraison/mod_livraison_jade.php
+++ b/htdocs/core/modules/livraison/mod_livraison_jade.php
@@ -35,9 +35,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/livraison/modules_livraison.php';
class mod_livraison_jade extends ModeleNumRefDeliveryOrder
{
/**
- * Dolibarr version of the loaded document
- * @var string
- */
+ * Dolibarr version of the loaded document
+ * @var string
+ */
public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
/**
@@ -57,7 +57,7 @@ class mod_livraison_jade extends ModeleNumRefDeliveryOrder
*/
public $name = 'Jade';
- public $prefix = 'BL';
+ public $prefix = 'BL';
/**
@@ -74,103 +74,103 @@ class mod_livraison_jade extends ModeleNumRefDeliveryOrder
/**
* Return an example of numbering
*
- * @return string Example
- */
- public function getExample()
- {
- return $this->prefix."0501-0001";
- }
+ * @return string Example
+ */
+ public function getExample()
+ {
+ return $this->prefix."0501-0001";
+ }
- /**
- * Checks if the numbers already in the database do not
- * cause conflicts that would prevent this numbering working.
- *
- * @return boolean false if conflict, true if ok
- */
- public function canBeActivated()
- {
- global $langs, $conf, $db;
+ /**
+ * Checks if the numbers already in the database do not
+ * cause conflicts that would prevent this numbering working.
+ *
+ * @return boolean false if conflict, true if ok
+ */
+ public function canBeActivated()
+ {
+ global $langs, $conf, $db;
- $langs->load("bills");
+ $langs->load("bills");
- // Check invoice num
- $fayymm = ''; $max = '';
+ // Check invoice num
+ $fayymm = ''; $max = '';
- $posindice = 8;
- $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL
- $sql .= " FROM ".MAIN_DB_PREFIX."livraison";
- $sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
- $sql .= " AND entity = ".$conf->entity;
+ $posindice = 8;
+ $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL
+ $sql .= " FROM ".MAIN_DB_PREFIX."livraison";
+ $sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
+ $sql .= " AND entity = ".$conf->entity;
- $resql = $db->query($sql);
- if ($resql)
- {
- $row = $db->fetch_row($resql);
- if ($row) { $fayymm = substr($row[0], 0, 6); $max = $row[0]; }
- }
- if ($fayymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $fayymm))
- {
- $langs->load("errors");
- $this->error = $langs->trans('ErrorNumRefModel', $max);
- return false;
- }
+ $resql = $db->query($sql);
+ if ($resql)
+ {
+ $row = $db->fetch_row($resql);
+ if ($row) { $fayymm = substr($row[0], 0, 6); $max = $row[0]; }
+ }
+ if ($fayymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $fayymm))
+ {
+ $langs->load("errors");
+ $this->error = $langs->trans('ErrorNumRefModel', $max);
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- /**
+ /**
* Return next free value
*
* @param Societe $objsoc Object thirdparty
* @param Object $object Object we need next value for
* @return string Value if KO, <0 if KO
*/
- public function getNextValue($objsoc, $object)
- {
- global $db, $conf;
+ public function getNextValue($objsoc, $object)
+ {
+ global $db, $conf;
- // D'abord on recupere la valeur max
- $posindice = 8;
- $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL
- $sql .= " FROM ".MAIN_DB_PREFIX."livraison";
- $sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
- $sql .= " AND entity = ".$conf->entity;
+ // D'abord on recupere la valeur max
+ $posindice = 8;
+ $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL
+ $sql .= " FROM ".MAIN_DB_PREFIX."livraison";
+ $sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
+ $sql .= " AND entity = ".$conf->entity;
- $resql = $db->query($sql);
- dol_syslog("mod_livraison_jade::getNextValue", LOG_DEBUG);
- if ($resql) {
- $obj = $db->fetch_object($resql);
- if ($obj) $max = intval($obj->max);
- else $max = 0;
- }
- else
- {
- return -1;
- }
+ $resql = $db->query($sql);
+ dol_syslog("mod_livraison_jade::getNextValue", LOG_DEBUG);
+ if ($resql) {
+ $obj = $db->fetch_object($resql);
+ if ($obj) $max = intval($obj->max);
+ else $max = 0;
+ }
+ else
+ {
+ return -1;
+ }
- $date = $object->date_delivery;
- if (empty($date)) $date = dol_now();
- $yymm = strftime("%y%m", $date);
+ $date = $object->date_delivery;
+ if (empty($date)) $date = dol_now();
+ $yymm = strftime("%y%m", $date);
- if ($max >= (pow(10, 4) - 1)) $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is
- else $num = sprintf("%04s", $max + 1);
+ if ($max >= (pow(10, 4) - 1)) $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is
+ else $num = sprintf("%04s", $max + 1);
- dol_syslog("mod_livraison_jade::getNextValue return ".$this->prefix.$yymm."-".$num);
- return $this->prefix.$yymm."-".$num;
- }
+ dol_syslog("mod_livraison_jade::getNextValue return ".$this->prefix.$yymm."-".$num);
+ return $this->prefix.$yymm."-".$num;
+ }
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
- /**
- * Return next free ref
- *
- * @param Societe $objsoc Object thirdparty
- * @param Object $object Object livraison
- * @return string Texte descriptif
- */
- public function livraison_get_num($objsoc = 0, $object = '')
- {
- // phpcs:enable
- return $this->getNextValue($objsoc, $object);
- }
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ /**
+ * Return next free ref
+ *
+ * @param Societe $objsoc Object thirdparty
+ * @param Object $object Object livraison
+ * @return string Texte descriptif
+ */
+ public function livraison_get_num($objsoc = 0, $object = '')
+ {
+ // phpcs:enable
+ return $this->getNextValue($objsoc, $object);
+ }
}
diff --git a/htdocs/core/modules/livraison/modules_livraison.php b/htdocs/core/modules/livraison/modules_livraison.php
index 9672f1f31cf..c108f65ac33 100644
--- a/htdocs/core/modules/livraison/modules_livraison.php
+++ b/htdocs/core/modules/livraison/modules_livraison.php
@@ -36,32 +36,32 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
*/
abstract class ModelePDFDeliveryOrder extends CommonDocGenerator
{
- /**
- * @var string Error code (or message)
- */
- public $error='';
+ /**
+ * @var string Error code (or message)
+ */
+ public $error='';
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
- /**
- * Return list of active generation modules
- *
- * @param DoliDB $db Database handler
- * @param integer $maxfilenamelength Max length of value to show
- * @return array List of templates
- */
- public static function liste_modeles($db, $maxfilenamelength = 0)
- {
- // phpcs:enable
- global $conf;
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ /**
+ * Return list of active generation modules
+ *
+ * @param DoliDB $db Database handler
+ * @param integer $maxfilenamelength Max length of value to show
+ * @return array List of templates
+ */
+ public static function liste_modeles($db, $maxfilenamelength = 0)
+ {
+ // phpcs:enable
+ global $conf;
- $type='delivery';
- $liste=array();
+ $type='delivery';
+ $liste=array();
- include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
- $liste=getListOfModels($db, $type, $maxfilenamelength);
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
+ $liste=getListOfModels($db, $type, $maxfilenamelength);
- return $liste;
- }
+ return $liste;
+ }
}
@@ -72,83 +72,83 @@ abstract class ModelePDFDeliveryOrder extends CommonDocGenerator
*/
abstract class ModeleNumRefDeliveryOrder
{
- /**
- * @var string Error code (or message)
- */
- public $error='';
+ /**
+ * @var string Error code (or message)
+ */
+ public $error='';
- /**
- * Return if a module can be used or not
- *
- * @return boolean true if module can be used
- */
- public function isEnabled()
- {
- return true;
- }
+ /**
+ * Return if a module can be used or not
+ *
+ * @return boolean true if module can be used
+ */
+ public function isEnabled()
+ {
+ return true;
+ }
- /**
- * Renvoi la description par defaut du modele de numerotation
- *
- * @return string Texte descripif
- */
- public function info()
- {
- global $langs;
- $langs->load("deliveries");
- return $langs->trans("NoDescription");
- }
+ /**
+ * Renvoi la description par defaut du modele de numerotation
+ *
+ * @return string Texte descripif
+ */
+ public function info()
+ {
+ global $langs;
+ $langs->load("deliveries");
+ return $langs->trans("NoDescription");
+ }
- /**
- * Return an example of numbering
- *
- * @return string Example
- */
- public function getExample()
- {
- global $langs;
- $langs->load("deliveries");
- return $langs->trans("NoExample");
- }
+ /**
+ * Return an example of numbering
+ *
+ * @return string Example
+ */
+ public function getExample()
+ {
+ global $langs;
+ $langs->load("deliveries");
+ return $langs->trans("NoExample");
+ }
- /**
- * Checks if the numbers already in the database do not
- * cause conflicts that would prevent this numbering working.
- *
- * @return boolean false if conflict, true if ok
- */
- public function canBeActivated()
- {
- return true;
- }
+ /**
+ * Checks if the numbers already in the database do not
+ * cause conflicts that would prevent this numbering working.
+ *
+ * @return boolean false if conflict, true if ok
+ */
+ public function canBeActivated()
+ {
+ return true;
+ }
- /**
- * Renvoi prochaine valeur attribuee
- *
- * @param Societe $objsoc Object third party
- * @param Object $object Object delivery
- * @return string Valeur
- */
- public function getNextValue($objsoc, $object)
- {
- global $langs;
- return $langs->trans("NotAvailable");
- }
+ /**
+ * Renvoi prochaine valeur attribuee
+ *
+ * @param Societe $objsoc Object third party
+ * @param Object $object Object delivery
+ * @return string Valeur
+ */
+ public function getNextValue($objsoc, $object)
+ {
+ global $langs;
+ return $langs->trans("NotAvailable");
+ }
- /**
- * Renvoi version du module numerotation
- *
- * @return string Valeur
- */
- public function getVersion()
- {
- global $langs;
- $langs->load("admin");
+ /**
+ * Renvoi version du module numerotation
+ *
+ * @return string Valeur
+ */
+ public function getVersion()
+ {
+ global $langs;
+ $langs->load("admin");
- if ($this->version == 'development') return $langs->trans("VersionDevelopment");
- elseif ($this->version == 'experimental') return $langs->trans("VersionExperimental");
- elseif ($this->version == 'dolibarr') return DOL_VERSION;
- elseif ($this->version) return $this->version;
- else return $langs->trans("NotAvailable");
- }
+ if ($this->version == 'development') return $langs->trans("VersionDevelopment");
+ elseif ($this->version == 'experimental') return $langs->trans("VersionExperimental");
+ elseif ($this->version == 'dolibarr') return DOL_VERSION;
+ elseif ($this->version) return $this->version;
+ else return $langs->trans("NotAvailable");
+ }
}
diff --git a/htdocs/core/modules/mrp/mod_mo_standard.php b/htdocs/core/modules/mrp/mod_mo_standard.php
index 04391d25fd7..3fd3b1ad87e 100644
--- a/htdocs/core/modules/mrp/mod_mo_standard.php
+++ b/htdocs/core/modules/mrp/mod_mo_standard.php
@@ -30,9 +30,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/mrp/modules_mo.php';
class mod_mo_standard extends ModeleNumRefMos
{
/**
- * Dolibarr version of the loaded document
- * @var string
- */
+ * Dolibarr version of the loaded document
+ * @var string
+ */
public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
public $prefix = 'MO';
@@ -48,16 +48,16 @@ class mod_mo_standard extends ModeleNumRefMos
public $name = 'standard';
- /**
- * Return description of numbering module
- *
- * @return string Text with description
- */
- public function info()
- {
- global $langs;
- return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
- }
+ /**
+ * Return description of numbering module
+ *
+ * @return string Text with description
+ */
+ public function info()
+ {
+ global $langs;
+ return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
+ }
/**
@@ -72,8 +72,8 @@ class mod_mo_standard extends ModeleNumRefMos
/**
- * Checks if the numbers already in the database do not
- * cause conflicts that would prevent this numbering working.
+ * Checks if the numbers already in the database do not
+ * cause conflicts that would prevent this numbering working.
*
* @return boolean false if conflict, true if ok
*/
@@ -140,8 +140,8 @@ class mod_mo_standard extends ModeleNumRefMos
$date = $object->date_creation;
$yymm = strftime("%y%m", $date);
- if ($max >= (pow(10, 4) - 1)) $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is
- else $num = sprintf("%04s", $max + 1);
+ if ($max >= (pow(10, 4) - 1)) $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is
+ else $num = sprintf("%04s", $max + 1);
dol_syslog("mod_mo_standard::getNextValue return ".$this->prefix.$yymm."-".$num);
return $this->prefix.$yymm."-".$num;
diff --git a/htdocs/core/modules/mrp/modules_mo.php b/htdocs/core/modules/mrp/modules_mo.php
index cd9b3ec51db..4a251e21788 100644
--- a/htdocs/core/modules/mrp/modules_mo.php
+++ b/htdocs/core/modules/mrp/modules_mo.php
@@ -39,17 +39,17 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // requir
abstract class ModelePDFMo extends CommonDocGenerator
{
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
- /**
- * Return list of active generation modules
- *
- * @param DoliDB $db Database handler
- * @param integer $maxfilenamelength Max length of value to show
- * @return array List of templates
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ /**
+ * Return list of active generation modules
+ *
+ * @param DoliDB $db Database handler
+ * @param integer $maxfilenamelength Max length of value to show
+ * @return array List of templates
*/
public static function liste_modeles($db, $maxfilenamelength = 0)
{
- // phpcs:enable
+ // phpcs:enable
global $conf;
$type = 'mo';
@@ -110,7 +110,7 @@ abstract class ModeleNumRefMos
/**
* Checks if the numbers already in the database do not
- * cause conflicts that would prevent this numbering working.
+ * cause conflicts that would prevent this numbering working.
*
* @return boolean false if conflict, true if ok
*/
diff --git a/htdocs/core/modules/payment/mod_payment_cicada.php b/htdocs/core/modules/payment/mod_payment_cicada.php
index 6addb1a5e31..c9d2dfc98a3 100644
--- a/htdocs/core/modules/payment/mod_payment_cicada.php
+++ b/htdocs/core/modules/payment/mod_payment_cicada.php
@@ -30,9 +30,9 @@ require_once DOL_DOCUMENT_ROOT .'/core/modules/payment/modules_payment.php';
class mod_payment_cicada extends ModeleNumRefPayments
{
/**
- * Dolibarr version of the loaded document
- * @var string
- */
+ * Dolibarr version of the loaded document
+ * @var string
+ */
public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
public $prefix='PAY';
@@ -55,16 +55,16 @@ class mod_payment_cicada extends ModeleNumRefPayments
public $name='Cicada';
- /**
- * Return description of numbering module
- *
- * @return string Text with description
- */
- public function info()
- {
- global $langs;
- return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
- }
+ /**
+ * Return description of numbering module
+ *
+ * @return string Text with description
+ */
+ public function info()
+ {
+ global $langs;
+ return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
+ }
/**
@@ -79,8 +79,8 @@ class mod_payment_cicada extends ModeleNumRefPayments
/**
- * Checks if the numbers already in the database do not
- * cause conflicts that would prevent this numbering working.
+ * Checks if the numbers already in the database do not
+ * cause conflicts that would prevent this numbering working.
*
* @return boolean false if conflict, true if ok
*/
@@ -147,15 +147,15 @@ class mod_payment_cicada extends ModeleNumRefPayments
$date=$object->datepaye;
$yymm = strftime("%y%m", $date);
- if ($max >= (pow(10, 4) - 1)) $num=$max+1; // If counter > 9999, we do not format on 4 chars, we take number as it is
- else $num = sprintf("%04s", $max+1);
+ if ($max >= (pow(10, 4) - 1)) $num=$max+1; // If counter > 9999, we do not format on 4 chars, we take number as it is
+ else $num = sprintf("%04s", $max+1);
dol_syslog(__METHOD__." return ".$this->prefix.$yymm."-".$num);
return $this->prefix.$yymm."-".$num;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return next free value
*
@@ -165,7 +165,7 @@ class mod_payment_cicada extends ModeleNumRefPayments
*/
public function payment_get_num($objsoc, $objforref)
{
- // phpcs:enable
+ // phpcs:enable
return $this->getNextValue($objsoc, $objforref);
}
}
diff --git a/htdocs/core/modules/payment/modules_payment.php b/htdocs/core/modules/payment/modules_payment.php
index 10d7a56164d..4effd51cc2d 100644
--- a/htdocs/core/modules/payment/modules_payment.php
+++ b/htdocs/core/modules/payment/modules_payment.php
@@ -63,11 +63,11 @@ abstract class ModeleNumRefPayments
}
/**
- * Checks if the numbers already in the database do not
- * cause conflicts that would prevent this numbering working.
- *
- * @return boolean false if conflict, true if ok
- */
+ * Checks if the numbers already in the database do not
+ * cause conflicts that would prevent this numbering working.
+ *
+ * @return boolean false if conflict, true if ok
+ */
public function canBeActivated()
{
return true;
diff --git a/htdocs/core/modules/product/modules_product.class.php b/htdocs/core/modules/product/modules_product.class.php
index 82a099a09fa..78974eaa4bc 100644
--- a/htdocs/core/modules/product/modules_product.class.php
+++ b/htdocs/core/modules/product/modules_product.class.php
@@ -33,226 +33,226 @@
*/
abstract class ModelePDFProduct extends CommonDocGenerator
{
- /**
- * @var string Error code (or message)
- */
- public $error='';
+ /**
+ * @var string Error code (or message)
+ */
+ public $error='';
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
- /**
- * Return list of active generation modules
- *
- * @param DoliDB $db Database handler
- * @param integer $maxfilenamelength Max length of value to show
- * @return array List of templates
- */
- public static function liste_modeles($db, $maxfilenamelength = 0)
- {
- // phpcs:enable
- global $conf;
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ /**
+ * Return list of active generation modules
+ *
+ * @param DoliDB $db Database handler
+ * @param integer $maxfilenamelength Max length of value to show
+ * @return array List of templates
+ */
+ public static function liste_modeles($db, $maxfilenamelength = 0)
+ {
+ // phpcs:enable
+ global $conf;
- $type='product';
- $liste=array();
+ $type='product';
+ $liste=array();
- include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
- $liste=getListOfModels($db, $type, $maxfilenamelength);
- return $liste;
- }
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
+ $liste=getListOfModels($db, $type, $maxfilenamelength);
+ return $liste;
+ }
}
abstract class ModeleProductCode
{
- /**
- * @var string Error code (or message)
- */
- public $error='';
+ /**
+ * @var string Error code (or message)
+ */
+ public $error='';
- /** Renvoi la description par defaut du modele de numerotation
- *
- * @param Translate $langs Object langs
- * @return string Texte descripif
- */
- public function info($langs)
- {
- $langs->load("bills");
- return $langs->trans("NoDescription");
- }
+ /** Renvoi la description par defaut du modele de numerotation
+ *
+ * @param Translate $langs Object langs
+ * @return string Texte descripif
+ */
+ public function info($langs)
+ {
+ $langs->load("bills");
+ return $langs->trans("NoDescription");
+ }
- /** Renvoi nom module
- *
- * @param Translate $langs Object langs
- * @return string Nom du module
- */
- public function getNom($langs)
- {
- return empty($this->name)?$this->nom:$this->name;
- }
+ /** Renvoi nom module
+ *
+ * @param Translate $langs Object langs
+ * @return string Nom du module
+ */
+ public function getNom($langs)
+ {
+ return empty($this->name)?$this->nom:$this->name;
+ }
- /** Return an example of numbering
- *
- * @param Translate $langs Object langs
- * @return string Example
- */
- public function getExample($langs)
- {
- $langs->load("bills");
- return $langs->trans("NoExample");
- }
+ /** Return an example of numbering
+ *
+ * @param Translate $langs Object langs
+ * @return string Example
+ */
+ public function getExample($langs)
+ {
+ $langs->load("bills");
+ return $langs->trans("NoExample");
+ }
- /**
- * Checks if the numbers already in the database do not
- * cause conflicts that would prevent this numbering working.
- *
- * @return boolean false if conflict, true if ok
- */
- public function canBeActivated()
- {
- return true;
- }
+ /**
+ * Checks if the numbers already in the database do not
+ * cause conflicts that would prevent this numbering working.
+ *
+ * @return boolean false if conflict, true if ok
+ */
+ public function canBeActivated()
+ {
+ return true;
+ }
- /**
- * Return next value available
- *
- * @param Product $objproduct Object product
- * @param int $type Type
- * @return string Value
- */
- public function getNextValue($objproduct = 0, $type = -1)
- {
- global $langs;
- return $langs->trans("Function_getNextValue_InModuleNotWorking");
- }
+ /**
+ * Return next value available
+ *
+ * @param Product $objproduct Object product
+ * @param int $type Type
+ * @return string Value
+ */
+ public function getNextValue($objproduct = 0, $type = -1)
+ {
+ global $langs;
+ return $langs->trans("Function_getNextValue_InModuleNotWorking");
+ }
- /** Return version of module
- *
- * @return string Version
- */
- public function getVersion()
- {
- global $langs;
- $langs->load("admin");
+ /** Return version of module
+ *
+ * @return string Version
+ */
+ public function getVersion()
+ {
+ global $langs;
+ $langs->load("admin");
- if ($this->version == 'development') return $langs->trans("VersionDevelopment");
- if ($this->version == 'experimental') return $langs->trans("VersionExperimental");
- if ($this->version == 'dolibarr') return DOL_VERSION;
- if ($this->version) return $this->version;
- return $langs->trans("NotAvailable");
- }
+ if ($this->version == 'development') return $langs->trans("VersionDevelopment");
+ if ($this->version == 'experimental') return $langs->trans("VersionExperimental");
+ if ($this->version == 'dolibarr') return DOL_VERSION;
+ if ($this->version) return $this->version;
+ return $langs->trans("NotAvailable");
+ }
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
- /**
- * Renvoi la liste des modeles de numérotation
- *
- * @param DoliDB $db Database handler
- * @param integer $maxfilenamelength Max length of value to show
- * @return array List of numbers
- */
- public static function liste_modeles($db, $maxfilenamelength = 0)
- {
- // phpcs:enable
- $liste=array();
- $sql ="";
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ /**
+ * Renvoi la liste des modeles de numérotation
+ *
+ * @param DoliDB $db Database handler
+ * @param integer $maxfilenamelength Max length of value to show
+ * @return array List of numbers
+ */
+ public static function liste_modeles($db, $maxfilenamelength = 0)
+ {
+ // phpcs:enable
+ $liste=array();
+ $sql ="";
- $resql = $db->query($sql);
- if ($resql)
- {
- $num = $db->num_rows($resql);
- $i = 0;
- while ($i < $num)
- {
- $row = $db->fetch_row($resql);
- $liste[$row[0]]=$row[1];
- $i++;
- }
- }
- else
- {
- return -1;
- }
- return $liste;
- }
+ $resql = $db->query($sql);
+ if ($resql)
+ {
+ $num = $db->num_rows($resql);
+ $i = 0;
+ while ($i < $num)
+ {
+ $row = $db->fetch_row($resql);
+ $liste[$row[0]]=$row[1];
+ $i++;
+ }
+ }
+ else
+ {
+ return -1;
+ }
+ return $liste;
+ }
- /**
- * Return description of module parameters
- *
- * @param Translate $langs Output language
- * @param Product $product Product object
- * @param int $type -1=Nothing, 0=Customer, 1=Supplier
- * @return string HTML translated description
- */
- public function getToolTip($langs, $product, $type)
- {
- global $conf;
+ /**
+ * Return description of module parameters
+ *
+ * @param Translate $langs Output language
+ * @param Product $product Product object
+ * @param int $type -1=Nothing, 0=Customer, 1=Supplier
+ * @return string HTML translated description
+ */
+ public function getToolTip($langs, $product, $type)
+ {
+ global $conf;
- $langs->load("admin");
+ $langs->load("admin");
- $s='';
- if ($type == -1) {
- $s.=$langs->trans("Name").': '.$this->getNom($langs).' ';
- $s.=$langs->trans("Version").': '.$this->getVersion().' ';
- }
- if ($type == 0) $s.=$langs->trans("ProductCodeDesc").' ';
- if ($type == 1) $s.=$langs->trans("ServiceCodeDesc").' ';
- if ($type != -1) $s.=$langs->trans("ValidityControledByModule").': '.$this->getNom($langs).' ';
- $s.=' ';
- $s.=''.$langs->trans("ThisIsModuleRules").': ';
- if ($type == 0)
- {
- $s.=$langs->trans("RequiredIfProduct").': ';
- if (! empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && ! empty($this->code_null)) $s.='';
- $s.=yn(!$this->code_null, 1, 2);
- if (! empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && ! empty($this->code_null)) $s.=' '.yn(1, 1, 2).' ('.$langs->trans("ForcedToByAModule", $langs->transnoentities("yes")).')';
- $s.=' ';
- }
- elseif ($type == 1)
- {
- $s.=$langs->trans("RequiredIfService").': ';
- if (! empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && ! empty($this->code_null)) $s.='';
- $s.=yn(!$this->code_null, 1, 2);
- if (! empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && ! empty($this->code_null)) $s.=' '.yn(1, 1, 2).' ('.$langs->trans("ForcedToByAModule", $langs->transnoentities("yes")).')';
- $s.=' ';
- }
- elseif ($type == -1)
- {
- $s.=$langs->trans("Required").': ';
- if (! empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && ! empty($this->code_null)) $s.='';
- $s.=yn(!$this->code_null, 1, 2);
- if (! empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && ! empty($this->code_null)) $s.=' '.yn(1, 1, 2).' ('.$langs->trans("ForcedToByAModule", $langs->transnoentities("yes")).')';
- $s.=' ';
- }
- $s.=$langs->trans("CanBeModifiedIfOk").': ';
- $s.=yn($this->code_modifiable, 1, 2);
- $s.=' ';
- $s.=$langs->trans("CanBeModifiedIfKo").': '.yn($this->code_modifiable_invalide, 1, 2).' ';
- $s.=$langs->trans("AutomaticCode").': '.yn($this->code_auto, 1, 2).' ';
- $s.=' ';
- if ($type == 0 || $type == -1)
- {
- $nextval=$this->getNextValue($product, 0);
- if (empty($nextval)) $nextval=$langs->trans("Undefined");
- $s.=$langs->trans("NextValue").($type == -1?' ('.$langs->trans("Product").')':'').': '.$nextval.' ';
- }
- if ($type == 1 || $type == -1)
- {
- $nextval=$this->getNextValue($product, 1);
- if (empty($nextval)) $nextval=$langs->trans("Undefined");
- $s.=$langs->trans("NextValue").($type == -1?' ('.$langs->trans("Service").')':'').': '.$nextval.' ';
- }
- return $s;
- }
+ $s='';
+ if ($type == -1) {
+ $s.=$langs->trans("Name").': '.$this->getNom($langs).' ';
+ $s.=$langs->trans("Version").': '.$this->getVersion().' ';
+ }
+ if ($type == 0) $s.=$langs->trans("ProductCodeDesc").' ';
+ if ($type == 1) $s.=$langs->trans("ServiceCodeDesc").' ';
+ if ($type != -1) $s.=$langs->trans("ValidityControledByModule").': '.$this->getNom($langs).' ';
+ $s.=' ';
+ $s.=''.$langs->trans("ThisIsModuleRules").': ';
+ if ($type == 0)
+ {
+ $s.=$langs->trans("RequiredIfProduct").': ';
+ if (! empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && ! empty($this->code_null)) $s.='';
+ $s.=yn(!$this->code_null, 1, 2);
+ if (! empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && ! empty($this->code_null)) $s.=' '.yn(1, 1, 2).' ('.$langs->trans("ForcedToByAModule", $langs->transnoentities("yes")).')';
+ $s.=' ';
+ }
+ elseif ($type == 1)
+ {
+ $s.=$langs->trans("RequiredIfService").': ';
+ if (! empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && ! empty($this->code_null)) $s.='';
+ $s.=yn(!$this->code_null, 1, 2);
+ if (! empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && ! empty($this->code_null)) $s.=' '.yn(1, 1, 2).' ('.$langs->trans("ForcedToByAModule", $langs->transnoentities("yes")).')';
+ $s.=' ';
+ }
+ elseif ($type == -1)
+ {
+ $s.=$langs->trans("Required").': ';
+ if (! empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && ! empty($this->code_null)) $s.='';
+ $s.=yn(!$this->code_null, 1, 2);
+ if (! empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && ! empty($this->code_null)) $s.=' '.yn(1, 1, 2).' ('.$langs->trans("ForcedToByAModule", $langs->transnoentities("yes")).')';
+ $s.=' ';
+ }
+ $s.=$langs->trans("CanBeModifiedIfOk").': ';
+ $s.=yn($this->code_modifiable, 1, 2);
+ $s.=' ';
+ $s.=$langs->trans("CanBeModifiedIfKo").': '.yn($this->code_modifiable_invalide, 1, 2).' ';
+ $s.=$langs->trans("AutomaticCode").': '.yn($this->code_auto, 1, 2).' ';
+ $s.=' ';
+ if ($type == 0 || $type == -1)
+ {
+ $nextval=$this->getNextValue($product, 0);
+ if (empty($nextval)) $nextval=$langs->trans("Undefined");
+ $s.=$langs->trans("NextValue").($type == -1?' ('.$langs->trans("Product").')':'').': '.$nextval.' ';
+ }
+ if ($type == 1 || $type == -1)
+ {
+ $nextval=$this->getNextValue($product, 1);
+ if (empty($nextval)) $nextval=$langs->trans("Undefined");
+ $s.=$langs->trans("NextValue").($type == -1?' ('.$langs->trans("Service").')':'').': '.$nextval.' ';
+ }
+ return $s;
+ }
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
- /**
- * Check if mask/numbering use prefix
- *
- * @return int 0=no, 1=yes
- */
- public function verif_prefixIsUsed()
- {
- // phpcs:enable
- return 0;
- }
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ /**
+ * Check if mask/numbering use prefix
+ *
+ * @return int 0=no, 1=yes
+ */
+ public function verif_prefixIsUsed()
+ {
+ // phpcs:enable
+ return 0;
+ }
}
diff --git a/htdocs/core/modules/project/mod_project_simple.php b/htdocs/core/modules/project/mod_project_simple.php
index 3d091658619..c5cc9c7bba3 100644
--- a/htdocs/core/modules/project/mod_project_simple.php
+++ b/htdocs/core/modules/project/mod_project_simple.php
@@ -32,14 +32,14 @@ require_once DOL_DOCUMENT_ROOT .'/core/modules/project/modules_project.php';
class mod_project_simple extends ModeleNumRefProjects
{
/**
- * Dolibarr version of the loaded document
- * @var string
- */
+ * Dolibarr version of the loaded document
+ * @var string
+ */
public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
public $prefix='PJ';
- /**
+ /**
* @var string Error code (or message)
*/
public $error='';
@@ -57,74 +57,74 @@ class mod_project_simple extends ModeleNumRefProjects
public $name='Simple';
- /**
- * Return description of numbering module
- *
- * @return string Text with description
- */
- public function info()
- {
- global $langs;
- return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
- }
+ /**
+ * Return description of numbering module
+ *
+ * @return string Text with description
+ */
+ public function info()
+ {
+ global $langs;
+ return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
+ }
- /**
- * Return an example of numbering module values
- *
- * @return string Example
- */
- public function getExample()
- {
- return $this->prefix."0501-0001";
- }
+ /**
+ * Return an example of numbering module values
+ *
+ * @return string Example
+ */
+ public function getExample()
+ {
+ return $this->prefix."0501-0001";
+ }
- /**
- * Checks if the numbers already in the database do not
- * cause conflicts that would prevent this numbering working.
- *
- * @return boolean false if conflict, true if ok
- */
- public function canBeActivated()
- {
- global $conf,$langs,$db;
+ /**
+ * Checks if the numbers already in the database do not
+ * cause conflicts that would prevent this numbering working.
+ *
+ * @return boolean false if conflict, true if ok
+ */
+ public function canBeActivated()
+ {
+ global $conf,$langs,$db;
- $coyymm=''; $max='';
+ $coyymm=''; $max='';
$posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
- $sql.= " FROM ".MAIN_DB_PREFIX."projet";
+ $sql.= " FROM ".MAIN_DB_PREFIX."projet";
$sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
- $sql.= " AND entity = ".$conf->entity;
- $resql=$db->query($sql);
- if ($resql)
- {
- $row = $db->fetch_row($resql);
- if ($row) { $coyymm = substr($row[0], 0, 6); $max=$row[0]; }
- }
- if (! $coyymm || preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm))
- {
- return true;
- }
- else
- {
+ $sql.= " AND entity = ".$conf->entity;
+ $resql=$db->query($sql);
+ if ($resql)
+ {
+ $row = $db->fetch_row($resql);
+ if ($row) { $coyymm = substr($row[0], 0, 6); $max=$row[0]; }
+ }
+ if (! $coyymm || preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm))
+ {
+ return true;
+ }
+ else
+ {
$langs->load("errors");
$this->error=$langs->trans('ErrorNumRefModel', $max);
- return false;
- }
- }
+ return false;
+ }
+ }
- /**
- * Return next value
- *
- * @param Societe $objsoc Object third party
- * @param Project $project Object project
- * @return string Value if OK, 0 if KO
- */
- public function getNextValue($objsoc, $project)
- {
+ /**
+ * Return next value
+ *
+ * @param Societe $objsoc Object third party
+ * @param Project $project Object project
+ * @return string Value if OK, 0 if KO
+ */
+ public function getNextValue($objsoc, $project)
+ {
global $db,$conf;
// D'abord on recupere la valeur max
@@ -157,20 +157,20 @@ class mod_project_simple extends ModeleNumRefProjects
dol_syslog("mod_project_simple::getNextValue return ".$this->prefix.$yymm."-".$num);
return $this->prefix.$yymm."-".$num;
- }
+ }
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
- /**
- * Return next reference not yet used as a reference
- *
- * @param Societe $objsoc Object third party
- * @param Project $project Object project
- * @return string Next not used reference
- */
- public function project_get_num($objsoc = 0, $project = '')
- {
- // phpcs:enable
- return $this->getNextValue($objsoc, $project);
- }
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ /**
+ * Return next reference not yet used as a reference
+ *
+ * @param Societe $objsoc Object third party
+ * @param Project $project Object project
+ * @return string Next not used reference
+ */
+ public function project_get_num($objsoc = 0, $project = '')
+ {
+ // phpcs:enable
+ return $this->getNextValue($objsoc, $project);
+ }
}
diff --git a/htdocs/core/modules/project/task/mod_task_simple.php b/htdocs/core/modules/project/task/mod_task_simple.php
index fbb5f2d4c5d..961b9a732f6 100644
--- a/htdocs/core/modules/project/task/mod_task_simple.php
+++ b/htdocs/core/modules/project/task/mod_task_simple.php
@@ -32,14 +32,14 @@ require_once DOL_DOCUMENT_ROOT .'/core/modules/project/task/modules_task.php';
class mod_task_simple extends ModeleNumRefTask
{
/**
- * Dolibarr version of the loaded document
- * @var string
- */
+ * Dolibarr version of the loaded document
+ * @var string
+ */
public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
public $prefix='TK';
- /**
+ /**
* @var string Error code (or message)
*/
public $error='';
@@ -57,40 +57,40 @@ class mod_task_simple extends ModeleNumRefTask
public $name='Simple';
- /**
- * Return description of numbering module
- *
- * @return string Text with description
- */
- public function info()
- {
- global $langs;
- return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
- }
+ /**
+ * Return description of numbering module
+ *
+ * @return string Text with description
+ */
+ public function info()
+ {
+ global $langs;
+ return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
+ }
- /**
- * Return an example of numbering module values
- *
- * @return string Example
- */
- public function getExample()
- {
- return $this->prefix."0501-0001";
- }
+ /**
+ * Return an example of numbering module values
+ *
+ * @return string Example
+ */
+ public function getExample()
+ {
+ return $this->prefix."0501-0001";
+ }
- /**
- * Checks if the numbers already in the database do not
- * cause conflicts that would prevent this numbering working.
- *
- * @return boolean false if conflict, true if ok
- */
- public function canBeActivated()
- {
- global $conf,$langs,$db;
+ /**
+ * Checks if the numbers already in the database do not
+ * cause conflicts that would prevent this numbering working.
+ *
+ * @return boolean false if conflict, true if ok
+ */
+ public function canBeActivated()
+ {
+ global $conf,$langs,$db;
- $coyymm=''; $max='';
+ $coyymm=''; $max='';
$posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(task.ref FROM " . $posindice . ") AS SIGNED)) as max";
@@ -98,34 +98,34 @@ class mod_task_simple extends ModeleNumRefTask
$sql .= MAIN_DB_PREFIX . "projet AS project WHERE task.fk_projet=project.rowid";
$sql .= " AND task.ref LIKE '" . $db->escape($this->prefix) . "____-%'";
$sql .= " AND project.entity = " . $conf->entity;
- $resql=$db->query($sql);
- if ($resql)
- {
- $row = $db->fetch_row($resql);
- if ($row) { $coyymm = substr($row[0], 0, 6); $max=$row[0]; }
- }
- if (! $coyymm || preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm))
- {
- return true;
- }
- else
- {
+ $resql=$db->query($sql);
+ if ($resql)
+ {
+ $row = $db->fetch_row($resql);
+ if ($row) { $coyymm = substr($row[0], 0, 6); $max=$row[0]; }
+ }
+ if (! $coyymm || preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm))
+ {
+ return true;
+ }
+ else
+ {
$langs->load("errors");
$this->error=$langs->trans('ErrorNumRefModel', $max);
- return false;
- }
- }
+ return false;
+ }
+ }
- /**
- * Return next value
- *
- * @param Societe $objsoc Object third party
- * @param Task $object Object Task
- * @return string Value if OK, 0 if KO
- */
- public function getNextValue($objsoc, $object)
- {
+ /**
+ * Return next value
+ *
+ * @param Societe $objsoc Object third party
+ * @param Task $object Object Task
+ * @return string Value if OK, 0 if KO
+ */
+ public function getNextValue($objsoc, $object)
+ {
global $db,$conf;
// D'abord on recupere la valeur max
@@ -157,19 +157,19 @@ class mod_task_simple extends ModeleNumRefTask
dol_syslog("mod_task_simple::getNextValue return ".$this->prefix.$yymm."-".$num);
return $this->prefix.$yymm."-".$num;
- }
+ }
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
- /**
- * Return next reference not yet used as a reference
- *
- * @param Societe $objsoc Object third party
- * @param Task $object Object task
- * @return string Next not used reference
- */
- public function task_get_num($objsoc = 0, $object = '')
- {
- return $this->getNextValue($objsoc, $object);
- }
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ /**
+ * Return next reference not yet used as a reference
+ *
+ * @param Societe $objsoc Object third party
+ * @param Task $object Object task
+ * @return string Next not used reference
+ */
+ public function task_get_num($objsoc = 0, $object = '')
+ {
+ return $this->getNextValue($objsoc, $object);
+ }
}
diff --git a/htdocs/core/modules/propale/mod_propale_marbre.php b/htdocs/core/modules/propale/mod_propale_marbre.php
index e8fa9970ef9..9a45ff647f0 100644
--- a/htdocs/core/modules/propale/mod_propale_marbre.php
+++ b/htdocs/core/modules/propale/mod_propale_marbre.php
@@ -32,9 +32,9 @@ require_once DOL_DOCUMENT_ROOT .'/core/modules/propale/modules_propale.php';
class mod_propale_marbre extends ModeleNumRefPropales
{
/**
- * Dolibarr version of the loaded document
- * @var string
- */
+ * Dolibarr version of the loaded document
+ * @var string
+ */
public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
public $prefix='PR';
@@ -57,16 +57,16 @@ class mod_propale_marbre extends ModeleNumRefPropales
public $name='Marbre';
- /**
- * Return description of numbering module
- *
- * @return string Text with description
- */
- public function info()
- {
- global $langs;
- return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
- }
+ /**
+ * Return description of numbering module
+ *
+ * @return string Text with description
+ */
+ public function info()
+ {
+ global $langs;
+ return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
+ }
/**
@@ -81,8 +81,8 @@ class mod_propale_marbre extends ModeleNumRefPropales
/**
- * Checks if the numbers already in the database do not
- * cause conflicts that would prevent this numbering working.
+ * Checks if the numbers already in the database do not
+ * cause conflicts that would prevent this numbering working.
*
* @return boolean false if conflict, true if ok
*/
diff --git a/htdocs/core/modules/societe/modules_societe.class.php b/htdocs/core/modules/societe/modules_societe.class.php
index f76aa6e20d3..d29b2f321fd 100644
--- a/htdocs/core/modules/societe/modules_societe.class.php
+++ b/htdocs/core/modules/societe/modules_societe.class.php
@@ -33,32 +33,32 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
*/
abstract class ModeleThirdPartyDoc extends CommonDocGenerator
{
- /**
+ /**
* @var string Error code (or message)
*/
public $error='';
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
- /**
- * Return list of active generation modules
- *
- * @param DoliDB $db Database handler
- * @param integer $maxfilenamelength Max length of value to show
- * @return array List of templates
- */
- public static function liste_modeles($db, $maxfilenamelength = 0)
- {
- // phpcs:enable
- global $conf;
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ /**
+ * Return list of active generation modules
+ *
+ * @param DoliDB $db Database handler
+ * @param integer $maxfilenamelength Max length of value to show
+ * @return array List of templates
+ */
+ public static function liste_modeles($db, $maxfilenamelength = 0)
+ {
+ // phpcs:enable
+ global $conf;
- $type='company';
- $liste=array();
+ $type='company';
+ $liste=array();
- include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
- $liste = getListOfModels($db, $type, $maxfilenamelength);
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
+ $liste = getListOfModels($db, $type, $maxfilenamelength);
- return $liste;
- }
+ return $liste;
+ }
}
/**
@@ -67,197 +67,197 @@ abstract class ModeleThirdPartyDoc extends CommonDocGenerator
*/
abstract class ModeleThirdPartyCode
{
- /**
- * @var string Error code (or message)
+ /**
+ * @var string Error code (or message)
*/
public $error='';
- /** Renvoi la description par defaut du modele de numerotation
- *
- * @param Translate $langs Object langs
- * @return string Texte descripif
- */
- public function info($langs)
- {
- $langs->load("bills");
- return $langs->trans("NoDescription");
- }
+ /** Renvoi la description par defaut du modele de numerotation
+ *
+ * @param Translate $langs Object langs
+ * @return string Texte descripif
+ */
+ public function info($langs)
+ {
+ $langs->load("bills");
+ return $langs->trans("NoDescription");
+ }
- /** Return name of module
- *
- * @param Translate $langs Object langs
- * @return string Nom du module
- */
- public function getNom($langs)
- {
- return $this->name;
- }
+ /** Return name of module
+ *
+ * @param Translate $langs Object langs
+ * @return string Nom du module
+ */
+ public function getNom($langs)
+ {
+ return $this->name;
+ }
- /** Return an example of numbering
- *
- * @param Translate $langs Object langs
- * @return string Example
- */
- public function getExample($langs)
- {
- $langs->load("bills");
- return $langs->trans("NoExample");
- }
+ /** Return an example of numbering
+ *
+ * @param Translate $langs Object langs
+ * @return string Example
+ */
+ public function getExample($langs)
+ {
+ $langs->load("bills");
+ return $langs->trans("NoExample");
+ }
- /**
- * Checks if the numbers already in the database do not
- * cause conflicts that would prevent this numbering working.
- *
- * @return boolean false if conflict, true if ok
- */
- public function canBeActivated()
- {
- return true;
- }
+ /**
+ * Checks if the numbers already in the database do not
+ * cause conflicts that would prevent this numbering working.
+ *
+ * @return boolean false if conflict, true if ok
+ */
+ public function canBeActivated()
+ {
+ return true;
+ }
- /**
- * Return next value available
- *
- * @param Societe $objsoc Object thirdparty
- * @param int $type Type
- * @return string Value
- */
- public function getNextValue($objsoc = 0, $type = -1)
- {
- global $langs;
- return $langs->trans("Function_getNextValue_InModuleNotWorking");
- }
+ /**
+ * Return next value available
+ *
+ * @param Societe $objsoc Object thirdparty
+ * @param int $type Type
+ * @return string Value
+ */
+ public function getNextValue($objsoc = 0, $type = -1)
+ {
+ global $langs;
+ return $langs->trans("Function_getNextValue_InModuleNotWorking");
+ }
- /**
- * Return version of module
- *
- * @return string Version
- */
- public function getVersion()
- {
- global $langs;
- $langs->load("admin");
+ /**
+ * Return version of module
+ *
+ * @return string Version
+ */
+ public function getVersion()
+ {
+ global $langs;
+ $langs->load("admin");
- if ($this->version == 'development') return $langs->trans("VersionDevelopment");
- if ($this->version == 'experimental') return $langs->trans("VersionExperimental");
- if ($this->version == 'dolibarr') return DOL_VERSION;
- if ($this->version) return $this->version;
- return $langs->trans("NotAvailable");
- }
+ if ($this->version == 'development') return $langs->trans("VersionDevelopment");
+ if ($this->version == 'experimental') return $langs->trans("VersionExperimental");
+ if ($this->version == 'dolibarr') return DOL_VERSION;
+ if ($this->version) return $this->version;
+ return $langs->trans("NotAvailable");
+ }
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
- /**
- * Renvoie la liste des modeles de numérotation
- *
- * @param DoliDB $db Database handler
- * @param integer $maxfilenamelength Max length of value to show
- * @return array List of numbers
- */
- public static function liste_modeles($db, $maxfilenamelength = 0)
- {
- // phpcs:enable
- $liste=array();
- $sql ="";
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ /**
+ * Renvoie la liste des modeles de numérotation
+ *
+ * @param DoliDB $db Database handler
+ * @param integer $maxfilenamelength Max length of value to show
+ * @return array List of numbers
+ */
+ public static function liste_modeles($db, $maxfilenamelength = 0)
+ {
+ // phpcs:enable
+ $liste=array();
+ $sql ="";
- $resql = $db->query($sql);
- if ($resql)
- {
- $num = $db->num_rows($resql);
- $i = 0;
- while ($i < $num)
- {
- $row = $db->fetch_row($resql);
- $liste[$row[0]]=$row[1];
- $i++;
- }
- }
- else
- {
- return -1;
- }
- return $liste;
- }
+ $resql = $db->query($sql);
+ if ($resql)
+ {
+ $num = $db->num_rows($resql);
+ $i = 0;
+ while ($i < $num)
+ {
+ $row = $db->fetch_row($resql);
+ $liste[$row[0]]=$row[1];
+ $i++;
+ }
+ }
+ else
+ {
+ return -1;
+ }
+ return $liste;
+ }
- /**
- * Return description of module parameters
- *
- * @param Translate $langs Output language
- * @param Societe $soc Third party object
- * @param int $type -1=Nothing, 0=Customer, 1=Supplier
- * @return string HTML translated description
- */
- public function getToolTip($langs, $soc, $type)
- {
- global $conf;
+ /**
+ * Return description of module parameters
+ *
+ * @param Translate $langs Output language
+ * @param Societe $soc Third party object
+ * @param int $type -1=Nothing, 0=Customer, 1=Supplier
+ * @return string HTML translated description
+ */
+ public function getToolTip($langs, $soc, $type)
+ {
+ global $conf;
- $langs->load("admin");
+ $langs->load("admin");
- $s='';
- if ($type == -1) $s.=$langs->trans("Name").': '.$this->getNom($langs).' ';
- if ($type == -1) $s.=$langs->trans("Version").': '.$this->getVersion().' ';
- if ($type == 0) $s.=$langs->trans("CustomerCodeDesc").' ';
- if ($type == 1) $s.=$langs->trans("SupplierCodeDesc").' ';
- if ($type != -1) $s.=$langs->trans("ValidityControledByModule").': '.$this->getNom($langs).' ';
- $s.=' ';
- $s.=''.$langs->trans("ThisIsModuleRules").': ';
- if ($type == 0)
- {
- $s.=$langs->trans("RequiredIfCustomer").': ';
- if (! empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && ! empty($this->code_null)) $s.='';
- $s.=yn(!$this->code_null, 1, 2);
- if (! empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && ! empty($this->code_null)) $s.=' '.yn(1, 1, 2).' ('.$langs->trans("ForcedToByAModule", $langs->transnoentities("yes")).')';
- $s.=' ';
- }
- if ($type == 1)
- {
- $s.=$langs->trans("RequiredIfSupplier").': ';
- if (! empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && ! empty($this->code_null)) $s.='';
- $s.=yn(!$this->code_null, 1, 2);
- if (! empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && ! empty($this->code_null)) $s.=' '.yn(1, 1, 2).' ('.$langs->trans("ForcedToByAModule", $langs->transnoentities("yes")).')';
- $s.=' ';
- }
- if ($type == -1)
- {
- $s.=$langs->trans("Required").': ';
- if (! empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && ! empty($this->code_null)) $s.='';
- $s.=yn(!$this->code_null, 1, 2);
- if (! empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && ! empty($this->code_null)) $s.=' '.yn(1, 1, 2).' ('.$langs->trans("ForcedToByAModule", $langs->transnoentities("yes")).')';
- $s.=' ';
- }
- $s.=$langs->trans("CanBeModifiedIfOk").': ';
- $s.=yn($this->code_modifiable, 1, 2);
- $s.=' ';
- $s.=$langs->trans("CanBeModifiedIfKo").': '.yn($this->code_modifiable_invalide, 1, 2).' ';
- $s.=$langs->trans("AutomaticCode").': '.yn($this->code_auto, 1, 2).' ';
- $s.=' ';
- if ($type == 0 || $type == -1)
- {
- $nextval=$this->getNextValue($soc, 0);
- if (empty($nextval)) $nextval=$langs->trans("Undefined");
- $s.=$langs->trans("NextValue").($type == -1?' ('.$langs->trans("Customer").')':'').': '.$nextval.' ';
- }
- if ($type == 1 || $type == -1)
- {
- $nextval=$this->getNextValue($soc, 1);
- if (empty($nextval)) $nextval=$langs->trans("Undefined");
- $s.=$langs->trans("NextValue").($type == -1?' ('.$langs->trans("Supplier").')':'').': '.$nextval.' ';
- }
- return $s;
- }
+ $s='';
+ if ($type == -1) $s.=$langs->trans("Name").': '.$this->getNom($langs).' ';
+ if ($type == -1) $s.=$langs->trans("Version").': '.$this->getVersion().' ';
+ if ($type == 0) $s.=$langs->trans("CustomerCodeDesc").' ';
+ if ($type == 1) $s.=$langs->trans("SupplierCodeDesc").' ';
+ if ($type != -1) $s.=$langs->trans("ValidityControledByModule").': '.$this->getNom($langs).' ';
+ $s.=' ';
+ $s.=''.$langs->trans("ThisIsModuleRules").': ';
+ if ($type == 0)
+ {
+ $s.=$langs->trans("RequiredIfCustomer").': ';
+ if (! empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && ! empty($this->code_null)) $s.='';
+ $s.=yn(!$this->code_null, 1, 2);
+ if (! empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && ! empty($this->code_null)) $s.=' '.yn(1, 1, 2).' ('.$langs->trans("ForcedToByAModule", $langs->transnoentities("yes")).')';
+ $s.=' ';
+ }
+ if ($type == 1)
+ {
+ $s.=$langs->trans("RequiredIfSupplier").': ';
+ if (! empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && ! empty($this->code_null)) $s.='';
+ $s.=yn(!$this->code_null, 1, 2);
+ if (! empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && ! empty($this->code_null)) $s.=' '.yn(1, 1, 2).' ('.$langs->trans("ForcedToByAModule", $langs->transnoentities("yes")).')';
+ $s.=' ';
+ }
+ if ($type == -1)
+ {
+ $s.=$langs->trans("Required").': ';
+ if (! empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && ! empty($this->code_null)) $s.='';
+ $s.=yn(!$this->code_null, 1, 2);
+ if (! empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && ! empty($this->code_null)) $s.=' '.yn(1, 1, 2).' ('.$langs->trans("ForcedToByAModule", $langs->transnoentities("yes")).')';
+ $s.=' ';
+ }
+ $s.=$langs->trans("CanBeModifiedIfOk").': ';
+ $s.=yn($this->code_modifiable, 1, 2);
+ $s.=' ';
+ $s.=$langs->trans("CanBeModifiedIfKo").': '.yn($this->code_modifiable_invalide, 1, 2).' ';
+ $s.=$langs->trans("AutomaticCode").': '.yn($this->code_auto, 1, 2).' ';
+ $s.=' ';
+ if ($type == 0 || $type == -1)
+ {
+ $nextval=$this->getNextValue($soc, 0);
+ if (empty($nextval)) $nextval=$langs->trans("Undefined");
+ $s.=$langs->trans("NextValue").($type == -1?' ('.$langs->trans("Customer").')':'').': '.$nextval.' ';
+ }
+ if ($type == 1 || $type == -1)
+ {
+ $nextval=$this->getNextValue($soc, 1);
+ if (empty($nextval)) $nextval=$langs->trans("Undefined");
+ $s.=$langs->trans("NextValue").($type == -1?' ('.$langs->trans("Supplier").')':'').': '.$nextval.' ';
+ }
+ return $s;
+ }
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Check if mask/numbering use prefix
*
* @return int 0=no, 1=yes
- */
- public function verif_prefixIsUsed()
- {
- // phpcs:enable
- return 0;
- }
+ */
+ public function verif_prefixIsUsed()
+ {
+ // phpcs:enable
+ return 0;
+ }
}
@@ -266,119 +266,119 @@ abstract class ModeleThirdPartyCode
*/
abstract class ModeleAccountancyCode
{
- /**
+ /**
* @var string Error code (or message)
*/
public $error='';
- /**
- * Return description of module
- *
- * @param Translate $langs Object langs
- * @return string Description of module
- */
- public function info($langs)
- {
- $langs->load("bills");
- return $langs->trans("NoDescription");
- }
+ /**
+ * Return description of module
+ *
+ * @param Translate $langs Object langs
+ * @return string Description of module
+ */
+ public function info($langs)
+ {
+ $langs->load("bills");
+ return $langs->trans("NoDescription");
+ }
- /**
- * Return an example of result returned by getNextValue
- *
- * @param Translate $langs Object langs
- * @param societe $objsoc Object thirdparty
- * @param int $type Type of third party (1:customer, 2:supplier, -1:autodetect)
- * @return string Example
- */
- public function getExample($langs, $objsoc = 0, $type = -1)
- {
- $langs->load("bills");
- return $langs->trans("NoExample");
- }
+ /**
+ * Return an example of result returned by getNextValue
+ *
+ * @param Translate $langs Object langs
+ * @param societe $objsoc Object thirdparty
+ * @param int $type Type of third party (1:customer, 2:supplier, -1:autodetect)
+ * @return string Example
+ */
+ public function getExample($langs, $objsoc = 0, $type = -1)
+ {
+ $langs->load("bills");
+ return $langs->trans("NoExample");
+ }
- /**
- * Checks if the numbers already in the database do not
- * cause conflicts that would prevent this numbering working.
- *
- * @return boolean false if conflict, true if ok
- */
- public function canBeActivated()
- {
- return true;
- }
+ /**
+ * Checks if the numbers already in the database do not
+ * cause conflicts that would prevent this numbering working.
+ *
+ * @return boolean false if conflict, true if ok
+ */
+ public function canBeActivated()
+ {
+ return true;
+ }
- /**
- * Return version of module
- *
- * @return string Version
- */
- public function getVersion()
- {
- global $langs;
- $langs->load("admin");
+ /**
+ * Return version of module
+ *
+ * @return string Version
+ */
+ public function getVersion()
+ {
+ global $langs;
+ $langs->load("admin");
- if ($this->version == 'development') return $langs->trans("VersionDevelopment");
- if ($this->version == 'experimental') return $langs->trans("VersionExperimental");
- if ($this->version == 'dolibarr') return DOL_VERSION;
- if ($this->version) return $this->version;
- return $langs->trans("NotAvailable");
- }
+ if ($this->version == 'development') return $langs->trans("VersionDevelopment");
+ if ($this->version == 'experimental') return $langs->trans("VersionExperimental");
+ if ($this->version == 'dolibarr') return DOL_VERSION;
+ if ($this->version) return $this->version;
+ return $langs->trans("NotAvailable");
+ }
- /**
- * Return description of module parameters
- *
- * @param Translate $langs Output language
- * @param Societe $soc Third party object
- * @param int $type -1=Nothing, 0=Customer, 1=Supplier
- * @return string HTML translated description
- */
- public function getToolTip($langs, $soc, $type)
- {
- global $conf,$db;
+ /**
+ * Return description of module parameters
+ *
+ * @param Translate $langs Output language
+ * @param Societe $soc Third party object
+ * @param int $type -1=Nothing, 0=Customer, 1=Supplier
+ * @return string HTML translated description
+ */
+ public function getToolTip($langs, $soc, $type)
+ {
+ global $conf,$db;
- $langs->load("admin");
+ $langs->load("admin");
- $s='';
- if ($type == -1) $s.=$langs->trans("Name").': '.$this->name.' ';
- if ($type == -1) $s.=$langs->trans("Version").': '.$this->getVersion().' ';
- //$s.=' ';
- //$s.=''.$langs->trans("ThisIsModuleRules").': ';
- $s.=' ';
- if ($type == 0 || $type == -1)
- {
- $result=$this->get_code($db, $soc, 'customer');
- $nextval=$this->code;
- if (empty($nextval)) $nextval=$langs->trans("Undefined");
- $s.=$langs->trans("NextValue").($type == -1?' ('.$langs->trans("Customer").')':'').': '.$nextval.' ';
- }
- if ($type == 1 || $type == -1)
- {
- $result=$this->get_code($db, $soc, 'supplier');
- $nextval=$this->code;
- if (empty($nextval)) $nextval=$langs->trans("Undefined");
- $s.=$langs->trans("NextValue").($type == -1?' ('.$langs->trans("Supplier").')':'').': '.$nextval.' ';
- }
- return $s;
- }
+ $s='';
+ if ($type == -1) $s.=$langs->trans("Name").': '.$this->name.' ';
+ if ($type == -1) $s.=$langs->trans("Version").': '.$this->getVersion().' ';
+ //$s.=' ';
+ //$s.=''.$langs->trans("ThisIsModuleRules").': ';
+ $s.=' ';
+ if ($type == 0 || $type == -1)
+ {
+ $result=$this->get_code($db, $soc, 'customer');
+ $nextval=$this->code;
+ if (empty($nextval)) $nextval=$langs->trans("Undefined");
+ $s.=$langs->trans("NextValue").($type == -1?' ('.$langs->trans("Customer").')':'').': '.$nextval.' ';
+ }
+ if ($type == 1 || $type == -1)
+ {
+ $result=$this->get_code($db, $soc, 'supplier');
+ $nextval=$this->code;
+ if (empty($nextval)) $nextval=$langs->trans("Undefined");
+ $s.=$langs->trans("NextValue").($type == -1?' ('.$langs->trans("Supplier").')':'').': '.$nextval.' ';
+ }
+ return $s;
+ }
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
- /**
- * Set accountancy account code for a third party into this->code
- *
- * @param DoliDB $db Database handler
- * @param Societe $societe Third party object
- * @param int $type 'customer' or 'supplier'
- * @return int >=0 if OK, <0 if KO
- */
- public function get_code($db, $societe, $type = '')
- {
- // phpcs:enable
- global $langs;
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ /**
+ * Set accountancy account code for a third party into this->code
+ *
+ * @param DoliDB $db Database handler
+ * @param Societe $societe Third party object
+ * @param int $type 'customer' or 'supplier'
+ * @return int >=0 if OK, <0 if KO
+ */
+ public function get_code($db, $societe, $type = '')
+ {
+ // phpcs:enable
+ global $langs;
- return $langs->trans("NotAvailable");
- }
+ return $langs->trans("NotAvailable");
+ }
}
@@ -399,7 +399,7 @@ abstract class ModeleAccountancyCode
*/
function thirdparty_doc_create(DoliDB $db, Societe $object, $message, $modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
- dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING);
+ dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING);
- return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
+ return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
diff --git a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php
index f6bf6480c0f..a4d75326395 100644
--- a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php
+++ b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php
@@ -32,15 +32,15 @@ require_once DOL_DOCUMENT_ROOT .'/core/modules/supplier_order/modules_commandefo
class mod_commande_fournisseur_muguet extends ModeleNumRefSuppliersOrders
{
/**
- * Dolibarr version of the loaded document
- * @var string
- */
+ * Dolibarr version of the loaded document
+ * @var string
+ */
public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
/**
- * @var string Error code (or message)
- */
- public $error = '';
+ * @var string Error code (or message)
+ */
+ public $error = '';
/**
* @var string Nom du modele
@@ -62,118 +62,118 @@ class mod_commande_fournisseur_muguet extends ModeleNumRefSuppliersOrders
*/
public function __construct()
{
- global $conf;
+ global $conf;
- if ((float) $conf->global->MAIN_VERSION_LAST_INSTALL >= 5.0) $this->prefix = 'PO'; // We use correct standard code "PO = Purchase Order"
+ if ((float) $conf->global->MAIN_VERSION_LAST_INSTALL >= 5.0) $this->prefix = 'PO'; // We use correct standard code "PO = Purchase Order"
}
- /**
- * Return description of numbering module
- *
- * @return string Text with description
- */
- public function info()
- {
- global $langs;
- return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
- }
+ /**
+ * Return description of numbering module
+ *
+ * @return string Text with description
+ */
+ public function info()
+ {
+ global $langs;
+ return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
+ }
- /**
- * Return an example of numbering
- *
- * @return string Example
- */
- public function getExample()
- {
- return $this->prefix."0501-0001";
- }
+ /**
+ * Return an example of numbering
+ *
+ * @return string Example
+ */
+ public function getExample()
+ {
+ return $this->prefix."0501-0001";
+ }
- /**
- * Checks if the numbers already in the database do not
- * cause conflicts that would prevent this numbering working.
- *
- * @return boolean false if conflict, true if ok
- */
- public function canBeActivated()
- {
- global $conf,$langs,$db;
+ /**
+ * Checks if the numbers already in the database do not
+ * cause conflicts that would prevent this numbering working.
+ *
+ * @return boolean false if conflict, true if ok
+ */
+ public function canBeActivated()
+ {
+ global $conf,$langs,$db;
- $coyymm=''; $max='';
+ $coyymm=''; $max='';
$posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
- $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur";
+ $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur";
$sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
- $sql.= " AND entity = ".$conf->entity;
- $resql=$db->query($sql);
- if ($resql)
- {
- $row = $db->fetch_row($resql);
- if ($row) { $coyymm = substr($row[0], 0, 6); $max=$row[0]; }
- }
- if (! $coyymm || preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm))
- {
- return true;
- }
- else
- {
+ $sql.= " AND entity = ".$conf->entity;
+ $resql=$db->query($sql);
+ if ($resql)
+ {
+ $row = $db->fetch_row($resql);
+ if ($row) { $coyymm = substr($row[0], 0, 6); $max=$row[0]; }
+ }
+ if (! $coyymm || preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm))
+ {
+ return true;
+ }
+ else
+ {
$langs->load("errors");
$this->error=$langs->trans('ErrorNumRefModel', $max);
- return false;
- }
- }
+ return false;
+ }
+ }
- /**
- * Return next value
+ /**
+ * Return next value
*
* @param Societe $objsoc Object third party
* @param Object $object Object
* @return string Value if OK, 0 if KO
- */
- public function getNextValue($objsoc = 0, $object = '')
- {
- global $db,$conf;
+ */
+ public function getNextValue($objsoc = 0, $object = '')
+ {
+ global $db,$conf;
- // D'abord on recupere la valeur max
- $posindice=8;
- $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
- $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur";
+ // D'abord on recupere la valeur max
+ $posindice=8;
+ $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
+ $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur";
$sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
- $sql.= " AND entity = ".$conf->entity;
+ $sql.= " AND entity = ".$conf->entity;
- $resql=$db->query($sql);
- if ($resql)
- {
- $obj = $db->fetch_object($resql);
- if ($obj) $max = intval($obj->max);
- else $max=0;
- }
+ $resql=$db->query($sql);
+ if ($resql)
+ {
+ $obj = $db->fetch_object($resql);
+ if ($obj) $max = intval($obj->max);
+ else $max=0;
+ }
//$date=time();
- $date=$object->date_commande; // Not always defined
- if (empty($date)) $date=$object->date; // Creation date is order date for suppliers orders
- $yymm = strftime("%y%m", $date);
+ $date=$object->date_commande; // Not always defined
+ if (empty($date)) $date=$object->date; // Creation date is order date for suppliers orders
+ $yymm = strftime("%y%m", $date);
- if ($max >= (pow(10, 4) - 1)) $num=$max+1; // If counter > 9999, we do not format on 4 chars, we take number as it is
- else $num = sprintf("%04s", $max+1);
+ if ($max >= (pow(10, 4) - 1)) $num=$max+1; // If counter > 9999, we do not format on 4 chars, we take number as it is
+ else $num = sprintf("%04s", $max+1);
- return $this->prefix.$yymm."-".$num;
- }
+ return $this->prefix.$yymm."-".$num;
+ }
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
- /**
- * Renvoie la reference de commande suivante non utilisee
- *
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ /**
+ * Renvoie la reference de commande suivante non utilisee
+ *
* @param Societe $objsoc Object third party
* @param Object $object Object
- * @return string Texte descripif
- */
- public function commande_get_num($objsoc = 0, $object = '')
- {
- // phpcs:enable
- return $this->getNextValue($objsoc, $object);
- }
+ * @return string Texte descripif
+ */
+ public function commande_get_num($objsoc = 0, $object = '')
+ {
+ // phpcs:enable
+ return $this->getNextValue($objsoc, $object);
+ }
}
diff --git a/htdocs/core/modules/supplier_payment/mod_supplier_payment_bronan.php b/htdocs/core/modules/supplier_payment/mod_supplier_payment_bronan.php
index c3499bdbf8d..b10a45dfa8b 100644
--- a/htdocs/core/modules/supplier_payment/mod_supplier_payment_bronan.php
+++ b/htdocs/core/modules/supplier_payment/mod_supplier_payment_bronan.php
@@ -30,9 +30,9 @@ require_once DOL_DOCUMENT_ROOT .'/core/modules/supplier_payment/modules_supplier
class mod_supplier_payment_bronan extends ModeleNumRefSupplierPayments
{
/**
- * Dolibarr version of the loaded document
- * @var string
- */
+ * Dolibarr version of the loaded document
+ * @var string
+ */
public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
public $prefix='SPAY';
@@ -55,16 +55,16 @@ class mod_supplier_payment_bronan extends ModeleNumRefSupplierPayments
public $name='Bronan';
- /**
- * Return description of numbering module
- *
- * @return string Text with description
- */
- public function info()
- {
- global $langs;
- return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
- }
+ /**
+ * Return description of numbering module
+ *
+ * @return string Text with description
+ */
+ public function info()
+ {
+ global $langs;
+ return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
+ }
/**
@@ -79,8 +79,8 @@ class mod_supplier_payment_bronan extends ModeleNumRefSupplierPayments
/**
- * Checks if the numbers already in the database do not
- * cause conflicts that would prevent this numbering working.
+ * Checks if the numbers already in the database do not
+ * cause conflicts that would prevent this numbering working.
*
* @return boolean false if conflict, true if ok
*/
@@ -147,15 +147,15 @@ class mod_supplier_payment_bronan extends ModeleNumRefSupplierPayments
$date=$object->datepaye;
$yymm = strftime("%y%m", $date);
- if ($max >= (pow(10, 4) - 1)) $num=$max+1; // If counter > 9999, we do not format on 4 chars, we take number as it is
- else $num = sprintf("%04s", $max+1);
+ if ($max >= (pow(10, 4) - 1)) $num=$max+1; // If counter > 9999, we do not format on 4 chars, we take number as it is
+ else $num = sprintf("%04s", $max+1);
dol_syslog(__METHOD__." return ".$this->prefix.$yymm."-".$num);
return $this->prefix.$yymm."-".$num;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return next free value
*
@@ -165,7 +165,7 @@ class mod_supplier_payment_bronan extends ModeleNumRefSupplierPayments
*/
public function payment_get_num($objsoc, $objforref)
{
- // phpcs:enable
+ // phpcs:enable
return $this->getNextValue($objsoc, $objforref);
}
}
diff --git a/htdocs/core/modules/supplier_payment/modules_supplier_payment.php b/htdocs/core/modules/supplier_payment/modules_supplier_payment.php
index f020e501c1e..88476330d13 100644
--- a/htdocs/core/modules/supplier_payment/modules_supplier_payment.php
+++ b/htdocs/core/modules/supplier_payment/modules_supplier_payment.php
@@ -28,17 +28,17 @@ abstract class ModelePDFSuppliersPayments extends CommonDocGenerator
public $error='';
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active generation models
*
- * @param DoliDB $db Database handler
- * @param integer $maxfilenamelength Max length of value to show
- * @return array List of numbers
- */
+ * @param DoliDB $db Database handler
+ * @param integer $maxfilenamelength Max length of value to show
+ * @return array List of numbers
+ */
public static function liste_modeles($db, $maxfilenamelength = 0)
{
- // phpcs:enable
+ // phpcs:enable
global $conf;
$type='supplier_payment';
@@ -98,11 +98,11 @@ abstract class ModeleNumRefSupplierPayments
}
/**
- * Checks if the numbers already in the database do not
- * cause conflicts that would prevent this numbering working.
- *
- * @return boolean false if conflict, true if ok
- */
+ * Checks if the numbers already in the database do not
+ * cause conflicts that would prevent this numbering working.
+ *
+ * @return boolean false if conflict, true if ok
+ */
public function canBeActivated()
{
return true;
diff --git a/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_marbre.php b/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_marbre.php
index a340f3eddd1..2af31145b94 100644
--- a/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_marbre.php
+++ b/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_marbre.php
@@ -32,9 +32,9 @@ require_once DOL_DOCUMENT_ROOT .'/core/modules/supplier_proposal/modules_supplie
class mod_supplier_proposal_marbre extends ModeleNumRefSupplierProposal
{
/**
- * Dolibarr version of the loaded document
- * @var string
- */
+ * Dolibarr version of the loaded document
+ * @var string
+ */
public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
public $prefix='RQ'; // RQ = Request for quotation
@@ -57,16 +57,16 @@ class mod_supplier_proposal_marbre extends ModeleNumRefSupplierProposal
public $name='Marbre';
- /**
- * Return description of numbering module
- *
- * @return string Text with description
- */
- public function info()
- {
- global $langs;
- return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
- }
+ /**
+ * Return description of numbering module
+ *
+ * @return string Text with description
+ */
+ public function info()
+ {
+ global $langs;
+ return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
+ }
/**
@@ -81,8 +81,8 @@ class mod_supplier_proposal_marbre extends ModeleNumRefSupplierProposal
/**
- * Checks if the numbers already in the database do not
- * cause conflicts that would prevent this numbering working.
+ * Checks if the numbers already in the database do not
+ * cause conflicts that would prevent this numbering working.
*
* @return boolean false if conflict, true if ok
*/
diff --git a/htdocs/core/modules/takepos/modules_takepos.php b/htdocs/core/modules/takepos/modules_takepos.php
index e077cda7b6b..28ac39c3f0f 100644
--- a/htdocs/core/modules/takepos/modules_takepos.php
+++ b/htdocs/core/modules/takepos/modules_takepos.php
@@ -47,21 +47,21 @@ abstract class ModeleNumRefTakepos
* @return boolean true if module can be used
*/
public function isEnabled()
- {
- return true;
- }
+ {
+ return true;
+ }
/**
* Renvoi la description par defaut du modele de numerotation
*
* @return string Texte descripif
*/
- public function info()
- {
- global $langs;
- $langs->load("cashdesk@cashdesk");
- return $langs->trans("NoDescription");
- }
+ public function info()
+ {
+ global $langs;
+ $langs->load("cashdesk@cashdesk");
+ return $langs->trans("NoDescription");
+ }
/**
* Return an example of numbering
@@ -69,11 +69,11 @@ abstract class ModeleNumRefTakepos
* @return string Example
*/
public function getExample()
- {
- global $langs;
- $langs->load('cashdesk@cashdesk');
- return $langs->trans('NoExample');
- }
+ {
+ global $langs;
+ $langs->load('cashdesk@cashdesk');
+ return $langs->trans('NoExample');
+ }
/**
* Checks if the numbers already in the database do not
@@ -82,20 +82,20 @@ abstract class ModeleNumRefTakepos
* @return boolean false if conflict, true if ok
*/
public function canBeActivated()
- {
- return true;
- }
+ {
+ return true;
+ }
- /**
- * Renvoi prochaine valeur attribuee
- *
- * @return string Valeur
- */
+ /**
+ * Renvoi prochaine valeur attribuee
+ *
+ * @return string Valeur
+ */
public function getNextValue()
- {
- global $langs;
- return $langs->trans('NotAvailable');
- }
+ {
+ global $langs;
+ return $langs->trans('NotAvailable');
+ }
/**
* Renvoi version du modele de numerotation
@@ -103,14 +103,14 @@ abstract class ModeleNumRefTakepos
* @return string Valeur
*/
public function getVersion()
- {
- global $langs;
- $langs->load("admin");
+ {
+ global $langs;
+ $langs->load("admin");
- if ($this->version == 'development') return $langs->trans('VersionDevelopment');
- if ($this->version == 'experimental') return $langs->trans('VersionExperimental');
- if ($this->version == 'dolibarr') return DOL_VERSION;
- if ($this->version) return $this->version;
- return $langs->trans('NotAvailable');
- }
+ if ($this->version == 'development') return $langs->trans('VersionDevelopment');
+ if ($this->version == 'experimental') return $langs->trans('VersionExperimental');
+ if ($this->version == 'dolibarr') return DOL_VERSION;
+ if ($this->version) return $this->version;
+ return $langs->trans('NotAvailable');
+ }
}
diff --git a/htdocs/core/modules/ticket/mod_ticket_simple.php b/htdocs/core/modules/ticket/mod_ticket_simple.php
index a6fbb6fde72..f5e5f025175 100644
--- a/htdocs/core/modules/ticket/mod_ticket_simple.php
+++ b/htdocs/core/modules/ticket/mod_ticket_simple.php
@@ -30,20 +30,20 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/ticket/modules_ticket.php';
*/
class mod_ticket_simple extends ModeleNumRefTicket
{
- /**
- * Dolibarr version of the loaded document
- * @var string
- */
+ /**
+ * Dolibarr version of the loaded document
+ * @var string
+ */
public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
- public $prefix = 'TS';
+ public $prefix = 'TS';
- /**
- * @var string Error code (or message)
- */
- public $error = '';
+ /**
+ * @var string Error code (or message)
+ */
+ public $error = '';
- /**
+ /**
* @var string Nom du modele
* @deprecated
* @see $name
@@ -55,108 +55,108 @@ class mod_ticket_simple extends ModeleNumRefTicket
*/
public $name='Simple';
- /**
- * Return description of numbering module
- *
- * @return string Text with description
- */
- public function info()
- {
- global $langs;
- return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
- }
+ /**
+ * Return description of numbering module
+ *
+ * @return string Text with description
+ */
+ public function info()
+ {
+ global $langs;
+ return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
+ }
- /**
- * Return an example of numbering module values
- *
- * @return string Example
- */
- public function getExample()
- {
- return $this->prefix . "0501-0001";
- }
+ /**
+ * Return an example of numbering module values
+ *
+ * @return string Example
+ */
+ public function getExample()
+ {
+ return $this->prefix . "0501-0001";
+ }
- /**
- * Checks if the numbers already in the database do not
- * cause conflicts that would prevent this numbering working.
- *
- * @return boolean false if conflict, true if ok
- */
- public function canBeActivated()
- {
- global $conf, $langs, $db;
+ /**
+ * Checks if the numbers already in the database do not
+ * cause conflicts that would prevent this numbering working.
+ *
+ * @return boolean false if conflict, true if ok
+ */
+ public function canBeActivated()
+ {
+ global $conf, $langs, $db;
- $coyymm = '';
- $max = '';
+ $coyymm = '';
+ $max = '';
- $posindice = 8;
- $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM " . $posindice . ") AS SIGNED)) as max";
- $sql .= " FROM " . MAIN_DB_PREFIX . "ticket";
- $search = $this->prefix . "____-%";
- $sql .= " WHERE ref LIKE '" . $search ."'";
- $sql .= " AND entity = " . $conf->entity;
- $resql = $db->query($sql);
- if ($resql) {
- $row = $db->fetch_row($resql);
- if ($row) {
- $coyymm = substr($row[0], 0, 6);
- $max = $row[0];
- }
- }
- if (!$coyymm || preg_match('/' . $this->prefix . '[0-9][0-9][0-9][0-9]/i', $coyymm)) {
- return true;
- } else {
- $langs->load("errors");
- $this->error = $langs->trans('ErrorNumRefModel', $max);
- return false;
- }
- }
+ $posindice = 8;
+ $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM " . $posindice . ") AS SIGNED)) as max";
+ $sql .= " FROM " . MAIN_DB_PREFIX . "ticket";
+ $search = $this->prefix . "____-%";
+ $sql .= " WHERE ref LIKE '" . $search ."'";
+ $sql .= " AND entity = " . $conf->entity;
+ $resql = $db->query($sql);
+ if ($resql) {
+ $row = $db->fetch_row($resql);
+ if ($row) {
+ $coyymm = substr($row[0], 0, 6);
+ $max = $row[0];
+ }
+ }
+ if (!$coyymm || preg_match('/' . $this->prefix . '[0-9][0-9][0-9][0-9]/i', $coyymm)) {
+ return true;
+ } else {
+ $langs->load("errors");
+ $this->error = $langs->trans('ErrorNumRefModel', $max);
+ return false;
+ }
+ }
- /**
- * Return next value
- *
- * @param Societe $objsoc Object third party
- * @param Project $ticket Object ticket
- * @return string Value if OK, 0 if KO
- */
- public function getNextValue($objsoc, $ticket)
- {
- global $db, $conf;
+ /**
+ * Return next value
+ *
+ * @param Societe $objsoc Object third party
+ * @param Project $ticket Object ticket
+ * @return string Value if OK, 0 if KO
+ */
+ public function getNextValue($objsoc, $ticket)
+ {
+ global $db, $conf;
- // D'abord on recupere la valeur max
- $posindice = 8;
- $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM " . $posindice . ") AS SIGNED)) as max";
- $sql .= " FROM " . MAIN_DB_PREFIX . "ticket";
- $search = $this->prefix . "____-%";
- $sql .= " WHERE ref LIKE '" . $search ."'";
- $sql .= " AND entity = " . $conf->entity;
+ // D'abord on recupere la valeur max
+ $posindice = 8;
+ $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM " . $posindice . ") AS SIGNED)) as max";
+ $sql .= " FROM " . MAIN_DB_PREFIX . "ticket";
+ $search = $this->prefix . "____-%";
+ $sql .= " WHERE ref LIKE '" . $search ."'";
+ $sql .= " AND entity = " . $conf->entity;
- $resql = $db->query($sql);
- if ($resql) {
- $obj = $db->fetch_object($resql);
- if ($obj) {
- $max = intval($obj->max);
- } else {
- $max = 0;
- }
- } else {
- dol_syslog("mod_ticket_simple::getNextValue", LOG_DEBUG);
- return -1;
- }
+ $resql = $db->query($sql);
+ if ($resql) {
+ $obj = $db->fetch_object($resql);
+ if ($obj) {
+ $max = intval($obj->max);
+ } else {
+ $max = 0;
+ }
+ } else {
+ dol_syslog("mod_ticket_simple::getNextValue", LOG_DEBUG);
+ return -1;
+ }
- $date = empty($ticket->datec) ? dol_now() : $ticket->datec;
+ $date = empty($ticket->datec) ? dol_now() : $ticket->datec;
- //$yymm = strftime("%y%m",time());
- $yymm = strftime("%y%m", $date);
+ //$yymm = strftime("%y%m",time());
+ $yymm = strftime("%y%m", $date);
- if ($max >= (pow(10, 4) - 1)) {
- $num = $max + 1;
- } // If counter > 9999, we do not format on 4 chars, we take number as it is
- else {
- $num = sprintf("%04s", $max + 1);
- }
+ if ($max >= (pow(10, 4) - 1)) {
+ $num = $max + 1;
+ } // If counter > 9999, we do not format on 4 chars, we take number as it is
+ else {
+ $num = sprintf("%04s", $max + 1);
+ }
- dol_syslog("mod_ticket_simple::getNextValue return " . $this->prefix . $yymm . "-" . $num);
- return $this->prefix . $yymm . "-" . $num;
- }
+ dol_syslog("mod_ticket_simple::getNextValue return " . $this->prefix . $yymm . "-" . $num);
+ return $this->prefix . $yymm . "-" . $num;
+ }
}
diff --git a/htdocs/core/modules/ticket/modules_ticket.php b/htdocs/core/modules/ticket/modules_ticket.php
index ee50071b591..ad8394fa91e 100644
--- a/htdocs/core/modules/ticket/modules_ticket.php
+++ b/htdocs/core/modules/ticket/modules_ticket.php
@@ -29,95 +29,95 @@
*/
abstract class ModeleNumRefTicket
{
- /**
- * @var string Error code (or message)
- */
- public $error = '';
+ /**
+ * @var string Error code (or message)
+ */
+ public $error = '';
- /**
- * Return if a module can be used or not
- *
- * @return boolean true if module can be used
- */
- public function isEnabled()
- {
- return true;
- }
+ /**
+ * Return if a module can be used or not
+ *
+ * @return boolean true if module can be used
+ */
+ public function isEnabled()
+ {
+ return true;
+ }
- /**
- * Renvoi la description par defaut du modele de numerotation
- *
- * @return string Texte descripif
- */
- public function info()
- {
- global $langs;
- $langs->load("ticket");
- return $langs->trans("NoDescription");
- }
+ /**
+ * Renvoi la description par defaut du modele de numerotation
+ *
+ * @return string Texte descripif
+ */
+ public function info()
+ {
+ global $langs;
+ $langs->load("ticket");
+ return $langs->trans("NoDescription");
+ }
- /**
- * Return an example of numbering
- *
- * @return string Example
- */
- public function getExample()
- {
- global $langs;
- $langs->load("ticket");
- return $langs->trans("NoExample");
- }
+ /**
+ * Return an example of numbering
+ *
+ * @return string Example
+ */
+ public function getExample()
+ {
+ global $langs;
+ $langs->load("ticket");
+ return $langs->trans("NoExample");
+ }
- /**
- * Checks if the numbers already in the database do not
- * cause conflicts that would prevent this numbering working.
- *
- * @return boolean false if conflict, true if ok
- */
- public function canBeActivated()
- {
- return true;
- }
+ /**
+ * Checks if the numbers already in the database do not
+ * cause conflicts that would prevent this numbering working.
+ *
+ * @return boolean false if conflict, true if ok
+ */
+ public function canBeActivated()
+ {
+ return true;
+ }
- /**
- * Renvoi prochaine valeur attribuee
- *
- * @param Societe $objsoc Object third party
- * @param Project $project Object project
- * @return string Valeur
- */
- public function getNextValue($objsoc, $project)
- {
- global $langs;
- return $langs->trans("NotAvailable");
- }
+ /**
+ * Renvoi prochaine valeur attribuee
+ *
+ * @param Societe $objsoc Object third party
+ * @param Project $project Object project
+ * @return string Valeur
+ */
+ public function getNextValue($objsoc, $project)
+ {
+ global $langs;
+ return $langs->trans("NotAvailable");
+ }
- /**
- * Renvoi version du module numerotation
- *
- * @return string Valeur
- */
- public function getVersion()
- {
- global $langs;
- $langs->load("admin");
+ /**
+ * Renvoi version du module numerotation
+ *
+ * @return string Valeur
+ */
+ public function getVersion()
+ {
+ global $langs;
+ $langs->load("admin");
- if ($this->version == 'development') {
- return $langs->trans("VersionDevelopment");
- }
+ if ($this->version == 'development') {
+ return $langs->trans("VersionDevelopment");
+ }
- if ($this->version == 'experimental') {
- return $langs->trans("VersionExperimental");
- }
+ if ($this->version == 'experimental') {
+ return $langs->trans("VersionExperimental");
+ }
- if ($this->version == 'dolibarr') {
- return DOL_VERSION;
- }
+ if ($this->version == 'dolibarr') {
+ return DOL_VERSION;
+ }
- if ($this->version) {
- return $this->version;
- }
+ if ($this->version) {
+ return $this->version;
+ }
- return $langs->trans("NotAvailable");
- }
+ return $langs->trans("NotAvailable");
+ }
}
diff --git a/htdocs/core/tpl/card_presend.tpl.php b/htdocs/core/tpl/card_presend.tpl.php
index 37920ed1ebc..f349251d654 100644
--- a/htdocs/core/tpl/card_presend.tpl.php
+++ b/htdocs/core/tpl/card_presend.tpl.php
@@ -28,8 +28,8 @@
// Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf)) {
- print "Error, template page can't be called as URL";
- exit;
+ print "Error, template page can't be called as URL";
+ exit;
}
@@ -54,7 +54,7 @@ if ($action == 'presend')
}
else
{
- $fileparams = dol_most_recent_file($diroutput . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
+ $fileparams = dol_most_recent_file($diroutput . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
}
$file = $fileparams['fullname'];
@@ -102,11 +102,11 @@ if ($action == 'presend')
}
if ($object->element == 'invoice_supplier')
{
- $fileparams = dol_most_recent_file($diroutput . '/' . get_exdir($object->id, 2, 0, 0, $object, $object->element).$ref, preg_quote($ref, '/').'([^\-])+');
+ $fileparams = dol_most_recent_file($diroutput . '/' . get_exdir($object->id, 2, 0, 0, $object, $object->element).$ref, preg_quote($ref, '/').'([^\-])+');
}
else
{
- $fileparams = dol_most_recent_file($diroutput . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
+ $fileparams = dol_most_recent_file($diroutput . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
}
$file = $fileparams['fullname'];
@@ -212,51 +212,51 @@ if ($action == 'presend')
complete_substitutions_array($substitutionarray, $outputlangs, $object, $parameters);
// Find the good contact address
- $tmpobject = $object;
- if (($object->element == 'shipping'|| $object->element == 'reception')) {
- $origin = $object->origin;
- $origin_id = $object->origin_id;
+ $tmpobject = $object;
+ if (($object->element == 'shipping'|| $object->element == 'reception')) {
+ $origin = $object->origin;
+ $origin_id = $object->origin_id;
- if (!empty($origin) && !empty($origin_id)) {
- $element = $subelement = $origin;
- $regs = array();
- if (preg_match('/^([^_]+)_([^_]+)/i', $origin, $regs)) {
- $element = $regs[1];
- $subelement = $regs[2];
- }
- // For compatibility
- if ($element == 'order') {
- $element = $subelement = 'commande';
- }
- if ($element == 'propal') {
- $element = 'comm/propal';
- $subelement = 'propal';
- }
- if ($element == 'contract') {
- $element = $subelement = 'contrat';
- }
- if ($element == 'inter') {
- $element = $subelement = 'ficheinter';
- }
- if ($element == 'shipping') {
- $element = $subelement = 'expedition';
- }
- if ($element == 'order_supplier') {
- $element = 'fourn';
- $subelement = 'fournisseur.commande';
- }
- if ($element == 'project') {
- $element = 'projet';
- }
+ if (!empty($origin) && !empty($origin_id)) {
+ $element = $subelement = $origin;
+ $regs = array();
+ if (preg_match('/^([^_]+)_([^_]+)/i', $origin, $regs)) {
+ $element = $regs[1];
+ $subelement = $regs[2];
+ }
+ // For compatibility
+ if ($element == 'order') {
+ $element = $subelement = 'commande';
+ }
+ if ($element == 'propal') {
+ $element = 'comm/propal';
+ $subelement = 'propal';
+ }
+ if ($element == 'contract') {
+ $element = $subelement = 'contrat';
+ }
+ if ($element == 'inter') {
+ $element = $subelement = 'ficheinter';
+ }
+ if ($element == 'shipping') {
+ $element = $subelement = 'expedition';
+ }
+ if ($element == 'order_supplier') {
+ $element = 'fourn';
+ $subelement = 'fournisseur.commande';
+ }
+ if ($element == 'project') {
+ $element = 'projet';
+ }
- dol_include_once('/' . $element . '/class/' . $subelement . '.class.php');
- $classname = ucfirst($origin);
- $objectsrc = new $classname($db);
- $objectsrc->fetch($origin_id);
+ dol_include_once('/' . $element . '/class/' . $subelement . '.class.php');
+ $classname = ucfirst($origin);
+ $objectsrc = new $classname($db);
+ $objectsrc->fetch($origin_id);
- $tmpobject = $objectsrc;
- }
- }
+ $tmpobject = $objectsrc;
+ }
+ }
$custcontact = '';
$contactarr = array();
@@ -264,11 +264,11 @@ if ($action == 'presend')
if (is_array($contactarr) && count($contactarr) > 0) {
require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
- $contactstatic = new Contact($db);
+ $contactstatic = new Contact($db);
foreach ($contactarr as $contact) {
- $contactstatic->fetch($contact['id']);
- $substitutionarray['__CONTACT_NAME_'.$contact['code'].'__'] = $contactstatic->getFullName($outputlangs, 1);
+ $contactstatic->fetch($contact['id']);
+ $substitutionarray['__CONTACT_NAME_'.$contact['code'].'__'] = $contactstatic->getFullName($outputlangs, 1);
}
}
diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php
index 05dd4a6a3ab..376be0afb08 100644
--- a/htdocs/expedition/list.php
+++ b/htdocs/expedition/list.php
@@ -33,6 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("sendings", "deliveries", 'companies', 'bills'));
@@ -89,6 +90,7 @@ $viewstatut = GETPOST('viewstatut');
$diroutputmassaction = $conf->expedition->dir_output.'/sending/temp/massgeneration/'.$user->id;
$object = new Expedition($db);
+$form = new Form($db);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('shipmentlist'));
@@ -118,6 +120,7 @@ $arrayfields = array(
'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>0),
'typent.code'=>array('label'=>$langs->trans("ThirdPartyType"), 'checked'=>$checkedtypetiers),
'e.date_delivery'=>array('label'=>$langs->trans("DateDeliveryPlanned"), 'checked'=>1),
+ 'e.weight'=>array('label'=>$langs->trans("Weight"), 'checked'=>0),
'e.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
'e.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
'e.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
@@ -183,13 +186,13 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
if (empty($reshook))
{
- $objectclass = 'Expedition';
- $objectlabel = 'Sendings';
- $permissiontoread = $user->rights->expedition->lire;
- $permissiontoadd = $user->rights->expedition->creer;
- $permissiontodelete = $user->rights->expedition->supprimer;
- $uploaddir = $conf->expedition->dir_output.'/sending';
- include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
+ $objectclass = 'Expedition';
+ $objectlabel = 'Sendings';
+ $permissiontoread = $user->rights->expedition->lire;
+ $permissiontoadd = $user->rights->expedition->creer;
+ $permissiontodelete = $user->rights->expedition->supprimer;
+ $uploaddir = $conf->expedition->dir_output.'/sending';
+ include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
}
@@ -211,7 +214,7 @@ llxHeader('', $langs->trans('ListOfSendings'), $helpurl);
$sql = 'SELECT';
if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT';
-$sql .= " e.rowid, e.ref, e.ref_customer, e.date_expedition as date_expedition, e.date_delivery as date_livraison, l.date_delivery as date_reception, e.fk_statut, e.billed,";
+$sql .= " e.rowid, e.ref, e.ref_customer, e.date_expedition as date_expedition, e.weight, e.weight_units, e.date_delivery as date_livraison, l.date_delivery as date_reception, e.fk_statut, e.billed,";
$sql .= " s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client, ";
$sql .= " typent.code as typent_code,";
$sql .= " state.code_departement as state_code, state.nom as state_name,";
@@ -313,7 +316,7 @@ if ($resql)
{
$num = $db->num_rows($resql);
- $arrayofselected = is_array($toselect) ? $toselect : array();
+ $arrayofselected = is_array($toselect) ? $toselect : array();
$expedition = new Expedition($db);
@@ -341,18 +344,18 @@ if ($resql)
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
- $arrayofmassactions = array(
- 'builddoc' => $langs->trans("PDFMerge"),
- //'classifyclose'=>$langs->trans("Close"), TODO massive close shipment ie: when truck is charged
- 'presend' => $langs->trans("SendByMail"),
- );
- if (in_array($massaction, array('presend'))) $arrayofmassactions = array();
- $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
+ $arrayofmassactions = array(
+ 'builddoc' => $langs->trans("PDFMerge"),
+ //'classifyclose'=>$langs->trans("Close"), TODO massive close shipment ie: when truck is charged
+ 'presend' => $langs->trans("SendByMail"),
+ );
+ if (in_array($massaction, array('presend'))) $arrayofmassactions = array();
+ $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
$newcardbutton = '';
if ($user->rights->expedition->creer)
{
- $newcardbutton .= dolGetButtonTitle($langs->trans('NewSending'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/expedition/card.php?action=create2');
+ $newcardbutton .= dolGetButtonTitle($langs->trans('NewSending'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/expedition/card.php?action=create2');
}
$i = 0;
@@ -367,11 +370,11 @@ if ($resql)
print_barre_liste($langs->trans('ListOfSendings'), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, '', 0, $newcardbutton, '', $limit);
- $topicmail = "SendShippingRef";
- $modelmail = "shipping_send";
- $objecttmp = new Expedition($db);
- $trackid = 'shi'.$object->id;
- include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
+ $topicmail = "SendShippingRef";
+ $modelmail = "shipping_send";
+ $objecttmp = new Expedition($db);
+ $trackid = 'shi'.$object->id;
+ include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
if ($sall)
{
@@ -483,6 +486,13 @@ if ($resql)
print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT));
print '';
}
+ // Weight
+ if (!empty($arrayfields['e.weight']['checked']))
+ {
+ print '';
+
+ print ' ';
+ }
// Date delivery planned
if (!empty($arrayfields['e.date_delivery']['checked']))
{
@@ -567,6 +577,7 @@ if ($resql)
if (!empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, '', $sortfield, $sortorder, 'center ');
if (!empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, '', $sortfield, $sortorder, 'center ');
+ if (!empty($arrayfields['e.weight']['checked'])) print_liste_field_titre($arrayfields['e.weight']['label'], $_SERVER["PHP_SELF"], "e.weight", "", $param, '', $sortfield, $sortorder, 'center ');
if (!empty($arrayfields['e.date_delivery']['checked'])) print_liste_field_titre($arrayfields['e.date_delivery']['label'], $_SERVER["PHP_SELF"], "e.date_delivery", "", $param, '', $sortfield, $sortorder, 'center ');
if (!empty($arrayfields['l.ref']['checked'])) print_liste_field_titre($arrayfields['l.ref']['label'], $_SERVER["PHP_SELF"], "l.ref", "", $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['l.date_delivery']['checked'])) print_liste_field_titre($arrayfields['l.date_delivery']['label'], $_SERVER["PHP_SELF"], "l.date_delivery", "", $param, '', $sortfield, $sortorder, 'center ');
@@ -583,7 +594,7 @@ if ($resql)
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
print "\n";
- $typenArray = $formcompany->typent_array(1);
+ $typenArray = $formcompany->typent_array(1);
$i = 0;
$totalarray = array();
while ($i < min($num, $limit))
@@ -597,7 +608,8 @@ if ($resql)
$companystatic->ref = $obj->name;
$companystatic->name = $obj->name;
-
+ $object = new Expedition($db);
+ $object->fetch($obj->rowid);
print '';
// Ref
@@ -665,7 +677,24 @@ if ($resql)
print '';
if (!$i) $totalarray['nbfield']++;
}
-
+ // Weight
+ if (!empty($arrayfields['e.weight']['checked']))
+ {
+ print '';
+ if (empty($object->trueWeight))
+ {
+ $tmparray = $object->getTotalWeightVolume();
+ print showDimensionInBestUnit($tmparray['weight'], 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND)?$conf->global->MAIN_WEIGHT_DEFAULT_ROUND:-1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT)?$conf->global->MAIN_WEIGHT_DEFAULT_UNIT:'no');
+ print $form->textwithpicto('', $langs->trans('EstimatedWeight'), 1);
+ }
+ else
+ {
+ print $object->trueWeight;
+ print ($object->trueWeight && $object->weight_units!='')?' '.measuringUnitString(0, "weight", $object->weight_units):'';
+ }
+ print ' ';
+ if (!$i) $totalarray['nbfield']++;
+ }
// Date delivery planed
if (!empty($arrayfields['e.date_delivery']['checked']))
{
@@ -736,48 +765,48 @@ if ($resql)
if (!$i) $totalarray['nbfield']++;
}
- // Action column
- print '';
- if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
- {
- $selected = 0;
- if (in_array($obj->rowid, $arrayofselected)) $selected = 1;
- print ' ';
- }
- print ' ';
+ // Action column
+ print '';
+ if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
+ {
+ $selected = 0;
+ if (in_array($obj->rowid, $arrayofselected)) $selected = 1;
+ print ' ';
+ }
+ print ' ';
if (!$i) $totalarray['nbfield']++;
print " \n";
$i++;
}
- $db->free($resql);
+ $db->free($resql);
- $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
- $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook
- print $hookmanager->resPrint;
+ $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
+ $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook
+ print $hookmanager->resPrint;
print "";
print "";
print '';
- $hidegeneratedfilelistifempty = 1;
- if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty = 0;
+ $hidegeneratedfilelistifempty = 1;
+ if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty = 0;
- // Show list of available documents
- $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
- $urlsource .= str_replace('&', '&', $param);
+ // Show list of available documents
+ $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
+ $urlsource .= str_replace('&', '&', $param);
- $filedir = $diroutputmassaction;
- $genallowed = $user->rights->expedition->lire;
- $delallowed = $user->rights->expedition->creer;
- $title = '';
+ $filedir = $diroutputmassaction;
+ $genallowed = $user->rights->expedition->lire;
+ $delallowed = $user->rights->expedition->creer;
+ $title = '';
- print $formfile->showdocuments('massfilesarea_sendings', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
+ print $formfile->showdocuments('massfilesarea_sendings', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
}
else
{
- dol_print_error($db);
+ dol_print_error($db);
}
// End of page
diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang
index 5865826dc73..7cce228ca48 100644
--- a/htdocs/langs/en_US/compta.lang
+++ b/htdocs/langs/en_US/compta.lang
@@ -159,7 +159,7 @@ SeeReportInBookkeepingMode=See %sBookeeping report%s for a calculation on
RulesAmountWithTaxIncluded=- Amounts shown are with all taxes included
RulesResultDue=- It includes outstanding invoices, expenses, VAT, donations whether they are paid or not. Is also includes paid salaries. - It is based on the validation date of invoices and VAT and on the due date for expenses. For salaries defined with Salary module, the value date of payment is used.
RulesResultInOut=- It includes the real payments made on invoices, expenses, VAT and salaries. - It is based on the payment dates of the invoices, expenses, VAT and salaries. The donation date for donation.
-RulesCADue=- It includes the customer's due invoices whether they are paid or not. - It is based on the validation date of these invoices.
+RulesCADue=- It includes the customer's due invoices whether they are paid or not. - It is based on the invoice date of these invoices.
RulesCAIn=- It includes all the effective payments of invoices received from customers. - It is based on the payment date of these invoices
RulesCATotalSaleJournal=It includes all credit lines from the Sale journal.
RulesAmountOnInOutBookkeepingRecord=It includes record in your Ledger with accounting accounts that has the group "EXPENSE" or "INCOME"
@@ -254,4 +254,11 @@ ByVatRate=By sale tax rate
TurnoverbyVatrate=Turnover invoiced by sale tax rate
TurnoverCollectedbyVatrate=Turnover collected by sale tax rate
PurchasebyVatrate=Purchase by sale tax rate
-LabelToShow=Short label
\ No newline at end of file
+LabelToShow=Short label
+PurchaseTurnover=Purchase turnover
+PurchaseTurnoverCollected=Purchase turnover collected
+RulesPurchaseTurnoverDue=- It includes the supplier's due invoices whether they are paid or not. - It is based on the invoice date of these invoices.
+RulesPurchaseTurnoverIn=- It includes all the effective payments of invoices done to suppliers. - It is based on the payment date of these invoices
+RulesPurchaseTurnoverTotalPurchaseJournal=It includes all debit lines from the purchase journal.
+ReportPurchaseTurnover=Purchase turnover invoiced
+ReportPurchaseTurnoverCollected=Purchase turnover collected
diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php
index 8cf2e17d804..f6ad3379caa 100644
--- a/htdocs/modulebuilder/index.php
+++ b/htdocs/modulebuilder/index.php
@@ -101,7 +101,7 @@ $error = 0;
if ($dirins && $action == 'initmodule' && $modulename)
{
- $modulename = ucfirst($modulename); // Force first letter in uppercase
+ $modulename = ucfirst($modulename); // Force first letter in uppercase
if (preg_match('/[^a-z0-9_]/i', $modulename))
{
@@ -115,8 +115,8 @@ if ($dirins && $action == 'initmodule' && $modulename)
$destdir = $dirins.'/'.strtolower($modulename);
$arrayreplacement = array(
- 'mymodule'=>strtolower($modulename),
- 'MyModule'=>$modulename
+ 'mymodule'=>strtolower($modulename),
+ 'MyModule'=>$modulename
);
$result = dolCopyDir($srcdir, $destdir, 0, 0, $arrayreplacement);
@@ -193,24 +193,24 @@ if ($dirins && $action == 'initmodule' && $modulename)
{
//var_dump($phpfileval['fullname']);
$arrayreplacement = array(
- 'mymodule'=>strtolower($modulename),
- 'MyModule'=>$modulename,
- 'MYMODULE'=>strtoupper($modulename),
- 'My module'=>$modulename,
- 'my module'=>$modulename,
- 'Mon module'=>$modulename,
- 'mon module'=>$modulename,
- 'htdocs/modulebuilder/template'=>strtolower($modulename),
- '---Put here your own copyright and developer email---'=>dol_print_date($now, '%Y').' '.$user->getFullName($langs).($user->email ? ' <'.$user->email.'>' : '')
+ 'mymodule'=>strtolower($modulename),
+ 'MyModule'=>$modulename,
+ 'MYMODULE'=>strtoupper($modulename),
+ 'My module'=>$modulename,
+ 'my module'=>$modulename,
+ 'Mon module'=>$modulename,
+ 'mon module'=>$modulename,
+ 'htdocs/modulebuilder/template'=>strtolower($modulename),
+ '---Put here your own copyright and developer email---'=>dol_print_date($now, '%Y').' '.$user->getFullName($langs).($user->email ? ' <'.$user->email.'>' : '')
);
- if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
- if (!empty($conf->global->MODULEBUILDER_SPECIFIC_EDITOR_NAME)) $arrayreplacement['Editor name'] = $conf->global->MODULEBUILDER_SPECIFIC_EDITOR_NAME;
- if (!empty($conf->global->MODULEBUILDER_SPECIFIC_EDITOR_URL)) $arrayreplacement['https://www.example.com'] = $conf->global->MODULEBUILDER_SPECIFIC_EDITOR_URL;
- if (!empty($conf->global->MODULEBUILDER_SPECIFIC_AUTHOR)) $arrayreplacement['---Put here your own copyright and developer email---'] = dol_print_date($now, '%Y').' '.$conf->global->MODULEBUILDER_SPECIFIC_AUTHOR;
- if (!empty($conf->global->MODULEBUILDER_SPECIFIC_VERSION)) $arrayreplacement['1.0'] = $conf->global->MODULEBUILDER_SPECIFIC_VERSION;
- if (!empty($conf->global->MODULEBUILDER_SPECIFIC_FAMILY)) $arrayreplacement['other'] = $conf->global->MODULEBUILDER_SPECIFIC_FAMILY;
- }
+ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
+ if (!empty($conf->global->MODULEBUILDER_SPECIFIC_EDITOR_NAME)) $arrayreplacement['Editor name'] = $conf->global->MODULEBUILDER_SPECIFIC_EDITOR_NAME;
+ if (!empty($conf->global->MODULEBUILDER_SPECIFIC_EDITOR_URL)) $arrayreplacement['https://www.example.com'] = $conf->global->MODULEBUILDER_SPECIFIC_EDITOR_URL;
+ if (!empty($conf->global->MODULEBUILDER_SPECIFIC_AUTHOR)) $arrayreplacement['---Put here your own copyright and developer email---'] = dol_print_date($now, '%Y').' '.$conf->global->MODULEBUILDER_SPECIFIC_AUTHOR;
+ if (!empty($conf->global->MODULEBUILDER_SPECIFIC_VERSION)) $arrayreplacement['1.0'] = $conf->global->MODULEBUILDER_SPECIFIC_VERSION;
+ if (!empty($conf->global->MODULEBUILDER_SPECIFIC_FAMILY)) $arrayreplacement['other'] = $conf->global->MODULEBUILDER_SPECIFIC_FAMILY;
+ }
$result = dolReplaceInFile($phpfileval['fullname'], $arrayreplacement);
@@ -239,78 +239,78 @@ if ($dirins && $action == 'initmodule' && $modulename)
if ($dirins && $action == 'initapi' && !empty($module))
{
- $modulename = ucfirst($module); // Force first letter in uppercase
- $objectname = $tabobj;
+ $modulename = ucfirst($module); // Force first letter in uppercase
+ $objectname = $tabobj;
- dol_mkdir($dirins.'/'.strtolower($module).'/class');
- $srcdir = DOL_DOCUMENT_ROOT.'/modulebuilder/template';
- $srcfile = $srcdir.'/class/api_mymodule.class.php';
- $destfile = $dirins.'/'.strtolower($module).'/class/api_'.strtolower($module).'.class.php';
- //var_dump($srcfile);var_dump($destfile);
- $result = dol_copy($srcfile, $destfile, 0, 0);
+ dol_mkdir($dirins.'/'.strtolower($module).'/class');
+ $srcdir = DOL_DOCUMENT_ROOT.'/modulebuilder/template';
+ $srcfile = $srcdir.'/class/api_mymodule.class.php';
+ $destfile = $dirins.'/'.strtolower($module).'/class/api_'.strtolower($module).'.class.php';
+ //var_dump($srcfile);var_dump($destfile);
+ $result = dol_copy($srcfile, $destfile, 0, 0);
- if ($result > 0)
- {
- //var_dump($phpfileval['fullname']);
- $arrayreplacement = array(
- 'mymodule'=>strtolower($modulename),
- 'MyModule'=>$modulename,
- 'MYMODULE'=>strtoupper($modulename),
- 'My module'=>$modulename,
- 'my module'=>$modulename,
- 'Mon module'=>$modulename,
- 'mon module'=>$modulename,
- 'htdocs/modulebuilder/template'=>strtolower($modulename),
- 'myobject'=>strtolower($objectname),
- 'MyObject'=>$objectname,
- 'MYOBJECT'=>strtoupper($objectname),
- '---Put here your own copyright and developer email---'=>dol_print_date($now, '%Y').' '.$user->getFullName($langs).($user->email ? ' <'.$user->email.'>' : '')
- );
+ if ($result > 0)
+ {
+ //var_dump($phpfileval['fullname']);
+ $arrayreplacement = array(
+ 'mymodule'=>strtolower($modulename),
+ 'MyModule'=>$modulename,
+ 'MYMODULE'=>strtoupper($modulename),
+ 'My module'=>$modulename,
+ 'my module'=>$modulename,
+ 'Mon module'=>$modulename,
+ 'mon module'=>$modulename,
+ 'htdocs/modulebuilder/template'=>strtolower($modulename),
+ 'myobject'=>strtolower($objectname),
+ 'MyObject'=>$objectname,
+ 'MYOBJECT'=>strtoupper($objectname),
+ '---Put here your own copyright and developer email---'=>dol_print_date($now, '%Y').' '.$user->getFullName($langs).($user->email ? ' <'.$user->email.'>' : '')
+ );
- dolReplaceInFile($destfile, $arrayreplacement);
- }
- else
- {
- $langs->load("errors");
- setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors');
- }
+ dolReplaceInFile($destfile, $arrayreplacement);
+ }
+ else
+ {
+ $langs->load("errors");
+ setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors');
+ }
}
if ($dirins && $action == 'initphpunit' && !empty($module))
{
- $modulename = ucfirst($module); // Force first letter in uppercase
- $objectname = $tabobj;
+ $modulename = ucfirst($module); // Force first letter in uppercase
+ $objectname = $tabobj;
- dol_mkdir($dirins.'/'.strtolower($module).'/class');
- $srcdir = DOL_DOCUMENT_ROOT.'/modulebuilder/template';
- $srcfile = $srcdir.'/test/phpunit/MyObjectTest.php';
- $destfile = $dirins.'/'.strtolower($module).'/test/phpunit/'.strtolower($objectname).'Test.php';
- $result = dol_copy($srcfile, $destfile, 0, 0);
+ dol_mkdir($dirins.'/'.strtolower($module).'/class');
+ $srcdir = DOL_DOCUMENT_ROOT.'/modulebuilder/template';
+ $srcfile = $srcdir.'/test/phpunit/MyObjectTest.php';
+ $destfile = $dirins.'/'.strtolower($module).'/test/phpunit/'.strtolower($objectname).'Test.php';
+ $result = dol_copy($srcfile, $destfile, 0, 0);
- if ($result > 0)
- {
- //var_dump($phpfileval['fullname']);
- $arrayreplacement = array(
- 'mymodule'=>strtolower($modulename),
- 'MyModule'=>$modulename,
- 'MYMODULE'=>strtoupper($modulename),
- 'My module'=>$modulename,
- 'my module'=>$modulename,
- 'Mon module'=>$modulename,
- 'mon module'=>$modulename,
- 'htdocs/modulebuilder/template'=>strtolower($modulename),
- 'myobject'=>strtolower($objectname),
- 'MyObject'=>$objectname,
- 'MYOBJECT'=>strtoupper($objectname),
- '---Put here your own copyright and developer email---'=>dol_print_date($now, '%Y').' '.$user->getFullName($langs).($user->email ? ' <'.$user->email.'>' : '')
- );
+ if ($result > 0)
+ {
+ //var_dump($phpfileval['fullname']);
+ $arrayreplacement = array(
+ 'mymodule'=>strtolower($modulename),
+ 'MyModule'=>$modulename,
+ 'MYMODULE'=>strtoupper($modulename),
+ 'My module'=>$modulename,
+ 'my module'=>$modulename,
+ 'Mon module'=>$modulename,
+ 'mon module'=>$modulename,
+ 'htdocs/modulebuilder/template'=>strtolower($modulename),
+ 'myobject'=>strtolower($objectname),
+ 'MyObject'=>$objectname,
+ 'MYOBJECT'=>strtoupper($objectname),
+ '---Put here your own copyright and developer email---'=>dol_print_date($now, '%Y').' '.$user->getFullName($langs).($user->email ? ' <'.$user->email.'>' : '')
+ );
- dolReplaceInFile($destfile, $arrayreplacement);
- }
- else
- {
- $langs->load("errors");
- setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors');
- }
+ dolReplaceInFile($destfile, $arrayreplacement);
+ }
+ else
+ {
+ $langs->load("errors");
+ setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors');
+ }
}
if ($dirins && $action == 'initsqlextrafields' && !empty($module))
{
@@ -361,105 +361,105 @@ if ($dirins && $action == 'initsqlextrafields' && !empty($module))
}
if ($dirins && $action == 'inithook' && !empty($module))
{
- dol_mkdir($dirins.'/'.strtolower($module).'/class');
- $srcdir = DOL_DOCUMENT_ROOT.'/modulebuilder/template';
- $srcfile = $srcdir.'/class/actions_mymodule.class.php';
- $destfile = $dirins.'/'.strtolower($module).'/class/actions_'.strtolower($module).'.class.php';
- //var_dump($srcfile);var_dump($destfile);
- $result = dol_copy($srcfile, $destfile, 0, 0);
+ dol_mkdir($dirins.'/'.strtolower($module).'/class');
+ $srcdir = DOL_DOCUMENT_ROOT.'/modulebuilder/template';
+ $srcfile = $srcdir.'/class/actions_mymodule.class.php';
+ $destfile = $dirins.'/'.strtolower($module).'/class/actions_'.strtolower($module).'.class.php';
+ //var_dump($srcfile);var_dump($destfile);
+ $result = dol_copy($srcfile, $destfile, 0, 0);
- if ($result > 0)
- {
- $modulename = ucfirst($module); // Force first letter in uppercase
+ if ($result > 0)
+ {
+ $modulename = ucfirst($module); // Force first letter in uppercase
- //var_dump($phpfileval['fullname']);
- $arrayreplacement = array(
- 'mymodule'=>strtolower($modulename),
- 'MyModule'=>$modulename,
- 'MYMODULE'=>strtoupper($modulename),
- 'My module'=>$modulename,
- 'my module'=>$modulename,
- 'Mon module'=>$modulename,
- 'mon module'=>$modulename,
- 'htdocs/modulebuilder/template'=>strtolower($modulename),
- '---Put here your own copyright and developer email---'=>dol_print_date($now, '%Y').' '.$user->getFullName($langs).($user->email ? ' <'.$user->email.'>' : '')
- );
+ //var_dump($phpfileval['fullname']);
+ $arrayreplacement = array(
+ 'mymodule'=>strtolower($modulename),
+ 'MyModule'=>$modulename,
+ 'MYMODULE'=>strtoupper($modulename),
+ 'My module'=>$modulename,
+ 'my module'=>$modulename,
+ 'Mon module'=>$modulename,
+ 'mon module'=>$modulename,
+ 'htdocs/modulebuilder/template'=>strtolower($modulename),
+ '---Put here your own copyright and developer email---'=>dol_print_date($now, '%Y').' '.$user->getFullName($langs).($user->email ? ' <'.$user->email.'>' : '')
+ );
- dolReplaceInFile($destfile, $arrayreplacement);
- }
- else
- {
- $langs->load("errors");
- setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors');
- }
+ dolReplaceInFile($destfile, $arrayreplacement);
+ }
+ else
+ {
+ $langs->load("errors");
+ setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors');
+ }
}
if ($dirins && $action == 'inittrigger' && !empty($module))
{
- dol_mkdir($dirins.'/'.strtolower($module).'/core/triggers');
- $srcdir = DOL_DOCUMENT_ROOT.'/modulebuilder/template';
- $srcfile = $srcdir.'/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php';
- $destfile = $dirins.'/'.strtolower($module).'/core/triggers/interface_99_mod'.$module.'_'.$module.'Triggers.class.php';
- //var_dump($srcfile);var_dump($destfile);
- $result = dol_copy($srcfile, $destfile, 0, 0);
+ dol_mkdir($dirins.'/'.strtolower($module).'/core/triggers');
+ $srcdir = DOL_DOCUMENT_ROOT.'/modulebuilder/template';
+ $srcfile = $srcdir.'/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php';
+ $destfile = $dirins.'/'.strtolower($module).'/core/triggers/interface_99_mod'.$module.'_'.$module.'Triggers.class.php';
+ //var_dump($srcfile);var_dump($destfile);
+ $result = dol_copy($srcfile, $destfile, 0, 0);
- if ($result > 0)
- {
- $modulename = ucfirst($module); // Force first letter in uppercase
+ if ($result > 0)
+ {
+ $modulename = ucfirst($module); // Force first letter in uppercase
- //var_dump($phpfileval['fullname']);
- $arrayreplacement = array(
- 'mymodule'=>strtolower($modulename),
- 'MyModule'=>$modulename,
- 'MYMODULE'=>strtoupper($modulename),
- 'My module'=>$modulename,
- 'my module'=>$modulename,
- 'Mon module'=>$modulename,
- 'mon module'=>$modulename,
- 'htdocs/modulebuilder/template'=>strtolower($modulename),
- '---Put here your own copyright and developer email---'=>dol_print_date($now, '%Y').' '.$user->getFullName($langs).($user->email ? ' <'.$user->email.'>' : '')
- );
+ //var_dump($phpfileval['fullname']);
+ $arrayreplacement = array(
+ 'mymodule'=>strtolower($modulename),
+ 'MyModule'=>$modulename,
+ 'MYMODULE'=>strtoupper($modulename),
+ 'My module'=>$modulename,
+ 'my module'=>$modulename,
+ 'Mon module'=>$modulename,
+ 'mon module'=>$modulename,
+ 'htdocs/modulebuilder/template'=>strtolower($modulename),
+ '---Put here your own copyright and developer email---'=>dol_print_date($now, '%Y').' '.$user->getFullName($langs).($user->email ? ' <'.$user->email.'>' : '')
+ );
- dolReplaceInFile($destfile, $arrayreplacement);
- }
- else
- {
- $langs->load("errors");
- setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors');
- }
+ dolReplaceInFile($destfile, $arrayreplacement);
+ }
+ else
+ {
+ $langs->load("errors");
+ setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors');
+ }
}
if ($dirins && $action == 'initwidget' && !empty($module))
{
- dol_mkdir($dirins.'/'.strtolower($module).'/core/boxes');
- $srcdir = DOL_DOCUMENT_ROOT.'/modulebuilder/template';
- $srcfile = $srcdir.'/core/boxes/mymodulewidget1.php';
- $destfile = $dirins.'/'.strtolower($module).'/core/boxes/'.strtolower($module).'widget1.php';
- //var_dump($srcfile);var_dump($destfile);
- $result = dol_copy($srcfile, $destfile, 0, 0);
+ dol_mkdir($dirins.'/'.strtolower($module).'/core/boxes');
+ $srcdir = DOL_DOCUMENT_ROOT.'/modulebuilder/template';
+ $srcfile = $srcdir.'/core/boxes/mymodulewidget1.php';
+ $destfile = $dirins.'/'.strtolower($module).'/core/boxes/'.strtolower($module).'widget1.php';
+ //var_dump($srcfile);var_dump($destfile);
+ $result = dol_copy($srcfile, $destfile, 0, 0);
- if ($result > 0)
- {
- $modulename = ucfirst($module); // Force first letter in uppercase
+ if ($result > 0)
+ {
+ $modulename = ucfirst($module); // Force first letter in uppercase
- //var_dump($phpfileval['fullname']);
- $arrayreplacement = array(
- 'mymodule'=>strtolower($modulename),
- 'MyModule'=>$modulename,
- 'MYMODULE'=>strtoupper($modulename),
- 'My module'=>$modulename,
- 'my module'=>$modulename,
- 'Mon module'=>$modulename,
- 'mon module'=>$modulename,
- 'htdocs/modulebuilder/template'=>strtolower($modulename),
- '---Put here your own copyright and developer email---'=>dol_print_date($now, '%Y').' '.$user->getFullName($langs).($user->email ? ' <'.$user->email.'>' : '')
- );
+ //var_dump($phpfileval['fullname']);
+ $arrayreplacement = array(
+ 'mymodule'=>strtolower($modulename),
+ 'MyModule'=>$modulename,
+ 'MYMODULE'=>strtoupper($modulename),
+ 'My module'=>$modulename,
+ 'my module'=>$modulename,
+ 'Mon module'=>$modulename,
+ 'mon module'=>$modulename,
+ 'htdocs/modulebuilder/template'=>strtolower($modulename),
+ '---Put here your own copyright and developer email---'=>dol_print_date($now, '%Y').' '.$user->getFullName($langs).($user->email ? ' <'.$user->email.'>' : '')
+ );
- dolReplaceInFile($destfile, $arrayreplacement);
- }
- else
- {
- $langs->load("errors");
- setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors');
- }
+ dolReplaceInFile($destfile, $arrayreplacement);
+ }
+ else
+ {
+ $langs->load("errors");
+ setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors');
+ }
}
if ($dirins && $action == 'initcss' && !empty($module))
{
@@ -490,9 +490,9 @@ if ($dirins && $action == 'initcss' && !empty($module))
dolReplaceInFile($destfile, $arrayreplacement);
// Update descriptor file to uncomment file
- $srcfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php';
- $arrayreplacement = array('/\/\/\s*\''.preg_quote('/'.strtolower($module).'/css/'.strtolower($module).'.css.php', '/').'\'/' => '\'/'.strtolower($module).'/css/'.strtolower($module).'.css.php\'');
- dolReplaceInFile($srcfile, $arrayreplacement, '', 0, 0, 1);
+ $srcfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php';
+ $arrayreplacement = array('/\/\/\s*\''.preg_quote('/'.strtolower($module).'/css/'.strtolower($module).'.css.php', '/').'\'/' => '\'/'.strtolower($module).'/css/'.strtolower($module).'.css.php\'');
+ dolReplaceInFile($srcfile, $arrayreplacement, '', 0, 0, 1);
}
else
{
@@ -541,93 +541,93 @@ if ($dirins && $action == 'initjs' && !empty($module))
}
if ($dirins && $action == 'initcli' && !empty($module))
{
- dol_mkdir($dirins.'/'.strtolower($module).'/scripts');
- $srcdir = DOL_DOCUMENT_ROOT.'/modulebuilder/template';
- $srcfile = $srcdir.'/scripts/mymodule.php';
- $destfile = $dirins.'/'.strtolower($module).'/scripts/'.strtolower($module).'.php';
- //var_dump($srcfile);var_dump($destfile);
- $result = dol_copy($srcfile, $destfile, 0, 0);
+ dol_mkdir($dirins.'/'.strtolower($module).'/scripts');
+ $srcdir = DOL_DOCUMENT_ROOT.'/modulebuilder/template';
+ $srcfile = $srcdir.'/scripts/mymodule.php';
+ $destfile = $dirins.'/'.strtolower($module).'/scripts/'.strtolower($module).'.php';
+ //var_dump($srcfile);var_dump($destfile);
+ $result = dol_copy($srcfile, $destfile, 0, 0);
- if ($result > 0)
- {
- $modulename = ucfirst($module); // Force first letter in uppercase
+ if ($result > 0)
+ {
+ $modulename = ucfirst($module); // Force first letter in uppercase
- //var_dump($phpfileval['fullname']);
- $arrayreplacement = array(
- 'mymodule'=>strtolower($modulename),
- 'MyModule'=>$modulename,
- 'MYMODULE'=>strtoupper($modulename),
- 'My module'=>$modulename,
- 'my module'=>$modulename,
- 'Mon module'=>$modulename,
- 'mon module'=>$modulename,
- 'htdocs/modulebuilder/template'=>strtolower($modulename),
- '__MYCOMPANY_NAME__'=>$mysoc->name,
- '__KEYWORDS__'=>$modulename,
- '__USER_FULLNAME__'=>$user->getFullName($langs),
- '__USER_EMAIL__'=>$user->email,
- '__YYYY-MM-DD__'=>dol_print_date($now, 'dayrfc'),
- '---Put here your own copyright and developer email---'=>dol_print_date($now, 'dayrfc').' '.$user->getFullName($langs).($user->email ? ' <'.$user->email.'>' : '')
- );
+ //var_dump($phpfileval['fullname']);
+ $arrayreplacement = array(
+ 'mymodule'=>strtolower($modulename),
+ 'MyModule'=>$modulename,
+ 'MYMODULE'=>strtoupper($modulename),
+ 'My module'=>$modulename,
+ 'my module'=>$modulename,
+ 'Mon module'=>$modulename,
+ 'mon module'=>$modulename,
+ 'htdocs/modulebuilder/template'=>strtolower($modulename),
+ '__MYCOMPANY_NAME__'=>$mysoc->name,
+ '__KEYWORDS__'=>$modulename,
+ '__USER_FULLNAME__'=>$user->getFullName($langs),
+ '__USER_EMAIL__'=>$user->email,
+ '__YYYY-MM-DD__'=>dol_print_date($now, 'dayrfc'),
+ '---Put here your own copyright and developer email---'=>dol_print_date($now, 'dayrfc').' '.$user->getFullName($langs).($user->email ? ' <'.$user->email.'>' : '')
+ );
- dolReplaceInFile($destfile, $arrayreplacement);
- }
- else
- {
- $langs->load("errors");
- setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors');
- }
+ dolReplaceInFile($destfile, $arrayreplacement);
+ }
+ else
+ {
+ $langs->load("errors");
+ setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors');
+ }
}
if ($dirins && $action == 'initdoc' && !empty($module))
{
- dol_mkdir($dirins.'/'.strtolower($module).'/doc');
- $srcdir = DOL_DOCUMENT_ROOT.'/modulebuilder/template';
- $srcfile = $srcdir.'/doc/Documentation.asciidoc';
- $destfile = $dirins.'/'.strtolower($module).'/doc/Documentation.asciidoc';
- //var_dump($srcfile);var_dump($destfile);
- $result = dol_copy($srcfile, $destfile, 0, 0);
+ dol_mkdir($dirins.'/'.strtolower($module).'/doc');
+ $srcdir = DOL_DOCUMENT_ROOT.'/modulebuilder/template';
+ $srcfile = $srcdir.'/doc/Documentation.asciidoc';
+ $destfile = $dirins.'/'.strtolower($module).'/doc/Documentation.asciidoc';
+ //var_dump($srcfile);var_dump($destfile);
+ $result = dol_copy($srcfile, $destfile, 0, 0);
- if ($result > 0)
- {
- $modulename = ucfirst($module); // Force first letter in uppercase
- $modulelowercase = strtolower($module);
+ if ($result > 0)
+ {
+ $modulename = ucfirst($module); // Force first letter in uppercase
+ $modulelowercase = strtolower($module);
- //var_dump($phpfileval['fullname']);
- $arrayreplacement = array(
- 'mymodule'=>strtolower($modulename),
- 'MyModule'=>$modulename,
- 'MYMODULE'=>strtoupper($modulename),
- 'My module'=>$modulename,
- 'my module'=>$modulename,
- 'Mon module'=>$modulename,
- 'mon module'=>$modulename,
- 'htdocs/modulebuilder/template'=>strtolower($modulename),
- '__MYCOMPANY_NAME__'=>$mysoc->name,
- '__KEYWORDS__'=>$modulename,
- '__USER_FULLNAME__'=>$user->getFullName($langs),
- '__USER_EMAIL__'=>$user->email,
- '__YYYY-MM-DD__'=>dol_print_date($now, 'dayrfc'),
- '---Put here your own copyright and developer email---'=>dol_print_date($now, 'dayrfc').' '.$user->getFullName($langs).($user->email ? ' <'.$user->email.'>' : '')
- );
+ //var_dump($phpfileval['fullname']);
+ $arrayreplacement = array(
+ 'mymodule'=>strtolower($modulename),
+ 'MyModule'=>$modulename,
+ 'MYMODULE'=>strtoupper($modulename),
+ 'My module'=>$modulename,
+ 'my module'=>$modulename,
+ 'Mon module'=>$modulename,
+ 'mon module'=>$modulename,
+ 'htdocs/modulebuilder/template'=>strtolower($modulename),
+ '__MYCOMPANY_NAME__'=>$mysoc->name,
+ '__KEYWORDS__'=>$modulename,
+ '__USER_FULLNAME__'=>$user->getFullName($langs),
+ '__USER_EMAIL__'=>$user->email,
+ '__YYYY-MM-DD__'=>dol_print_date($now, 'dayrfc'),
+ '---Put here your own copyright and developer email---'=>dol_print_date($now, 'dayrfc').' '.$user->getFullName($langs).($user->email ? ' <'.$user->email.'>' : '')
+ );
- dolReplaceInFile($destfile, $arrayreplacement);
+ dolReplaceInFile($destfile, $arrayreplacement);
- // Delete old documentation files
- $FILENAMEDOC = $modulelowercase.'.html';
- $FILENAMEDOCPDF = $modulelowercase.'.pdf';
- $outputfiledoc = dol_buildpath($modulelowercase, 0).'/doc/'.$FILENAMEDOC;
- $outputfiledocurl = dol_buildpath($modulelowercase, 1).'/doc/'.$FILENAMEDOC;
- $outputfiledocpdf = dol_buildpath($modulelowercase, 0).'/doc/'.$FILENAMEDOCPDF;
- $outputfiledocurlpdf = dol_buildpath($modulelowercase, 1).'/doc/'.$FILENAMEDOCPDF;
+ // Delete old documentation files
+ $FILENAMEDOC = $modulelowercase.'.html';
+ $FILENAMEDOCPDF = $modulelowercase.'.pdf';
+ $outputfiledoc = dol_buildpath($modulelowercase, 0).'/doc/'.$FILENAMEDOC;
+ $outputfiledocurl = dol_buildpath($modulelowercase, 1).'/doc/'.$FILENAMEDOC;
+ $outputfiledocpdf = dol_buildpath($modulelowercase, 0).'/doc/'.$FILENAMEDOCPDF;
+ $outputfiledocurlpdf = dol_buildpath($modulelowercase, 1).'/doc/'.$FILENAMEDOCPDF;
- dol_delete_file($outputfiledoc, 0, 0, 0, null, false, 0);
- dol_delete_file($outputfiledocpdf, 0, 0, 0, null, false, 0);
- }
- else
- {
- $langs->load("errors");
- setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors');
- }
+ dol_delete_file($outputfiledoc, 0, 0, 0, null, false, 0);
+ dol_delete_file($outputfiledocpdf, 0, 0, 0, null, false, 0);
+ }
+ else
+ {
+ $langs->load("errors");
+ setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors');
+ }
}
if ($dirins && $action == 'addlanguage' && !empty($module))
@@ -640,24 +640,24 @@ if ($dirins && $action == 'addlanguage' && !empty($module))
if ($dirins && $action == 'confirm_removefile' && !empty($module))
{
- $relativefilename = dol_sanitizePathName(GETPOST('file', 'none'));
- if ($relativefilename)
- {
- $dirnametodelete = dirname($relativefilename);
- $filetodelete = $dirins.'/'.$relativefilename;
- $dirtodelete = $dirins.'/'.$dirnametodelete;
+ $relativefilename = dol_sanitizePathName(GETPOST('file', 'none'));
+ if ($relativefilename)
+ {
+ $dirnametodelete = dirname($relativefilename);
+ $filetodelete = $dirins.'/'.$relativefilename;
+ $dirtodelete = $dirins.'/'.$dirnametodelete;
- $result = dol_delete_file($filetodelete);
- if (dol_is_dir_empty($dirtodelete)) dol_delete_dir($dirtodelete);
+ $result = dol_delete_file($filetodelete);
+ if (dol_is_dir_empty($dirtodelete)) dol_delete_dir($dirtodelete);
- // Update descriptor file to comment file
- if (in_array($tab, array('css', 'js')))
- {
- $srcfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php';
- $arrayreplacement = array('/^\s*\''.preg_quote('/'.$relativefilename, '/').'\',*/m'=>' // \'/'.$relativefilename.'\',');
- dolReplaceInFile($srcfile, $arrayreplacement, '', 0, 0, 1);
- }
- }
+ // Update descriptor file to comment file
+ if (in_array($tab, array('css', 'js')))
+ {
+ $srcfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php';
+ $arrayreplacement = array('/^\s*\''.preg_quote('/'.$relativefilename, '/').'\',*/m'=>' // \'/'.$relativefilename.'\',');
+ dolReplaceInFile($srcfile, $arrayreplacement, '', 0, 0, 1);
+ }
+ }
}
// Build the $fields array from SQL table (initfromtablename)
@@ -1001,17 +1001,17 @@ if ($dirins && $action == 'initobject' && $module && $objectname)
//var_dump($phpfileval['fullname']);
$arrayreplacement = array(
- 'mymodule'=>strtolower($module),
- 'MyModule'=>$module,
- 'MYMODULE'=>strtoupper($module),
- 'My module'=>$module,
- 'my module'=>$module,
- 'mon module'=>$module,
- 'Mon module'=>$module,
- 'htdocs/modulebuilder/template/'=>strtolower($modulename),
- 'myobject'=>strtolower($objectname),
- 'MyObject'=>$objectname,
- 'MYOBJECT'=>strtoupper($objectname)
+ 'mymodule'=>strtolower($module),
+ 'MyModule'=>$module,
+ 'MYMODULE'=>strtoupper($module),
+ 'My module'=>$module,
+ 'my module'=>$module,
+ 'mon module'=>$module,
+ 'Mon module'=>$module,
+ 'htdocs/modulebuilder/template/'=>strtolower($modulename),
+ 'myobject'=>strtolower($objectname),
+ 'MyObject'=>$objectname,
+ 'MYOBJECT'=>strtoupper($objectname)
);
$result = dolReplaceInFile($phpfileval['fullname'], $arrayreplacement);
@@ -1378,7 +1378,7 @@ if ($dirins && $action == 'generatedoc')
if ($result > 0)
{
- setEventMessages($langs->trans("DocFileGeneratedInto", $dirofmodule), null);
+ setEventMessages($langs->trans("DocFileGeneratedInto", $dirofmodule), null);
}
else
{
@@ -1415,13 +1415,13 @@ if ($action == 'savefile' && empty($cancel))
$result = file_put_contents($pathoffile, $content);
if ($result)
{
- @chmod($pathoffile, octdec($newmask));
+ @chmod($pathoffile, octdec($newmask));
- setEventMessages($langs->trans("FileSaved"), null);
+ setEventMessages($langs->trans("FileSaved"), null);
}
else
{
- setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors');
+ setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors');
}
}
else
@@ -1524,65 +1524,65 @@ $listofmodules = array();
$i = 0;
foreach ($dirsrootforscan as $dirread)
{
- $dirsincustom = dol_dir_list($dirread, 'directories');
- if (is_array($dirsincustom) && count($dirsincustom) > 0) {
- foreach ($dirsincustom as $dircustomcursor) {
- $fullname = $dircustomcursor['fullname'];
- if (dol_is_file($fullname.'/'.$FILEFLAG))
- {
- // Get real name of module (MyModule instead of mymodule)
- $dirtoscanrel = basename($fullname).'/core/modules/';
+ $dirsincustom = dol_dir_list($dirread, 'directories');
+ if (is_array($dirsincustom) && count($dirsincustom) > 0) {
+ foreach ($dirsincustom as $dircustomcursor) {
+ $fullname = $dircustomcursor['fullname'];
+ if (dol_is_file($fullname.'/'.$FILEFLAG))
+ {
+ // Get real name of module (MyModule instead of mymodule)
+ $dirtoscanrel = basename($fullname).'/core/modules/';
- $descriptorfiles = dol_dir_list(dirname($fullname).'/'.$dirtoscanrel, 'files', 0, 'mod.*\.class\.php$');
- if (empty($descriptorfiles)) // If descriptor not found into module dir, we look into main module dir.
- {
- $dirtoscanrel = 'core/modules/';
- $descriptorfiles = dol_dir_list($fullname.'/../'.$dirtoscanrel, 'files', 0, 'mod'.strtoupper(basename($fullname)).'\.class\.php$');
- }
- $modulenamewithcase = '';
- $moduledescriptorrelpath = '';
- $moduledescriptorfullpath = '';
+ $descriptorfiles = dol_dir_list(dirname($fullname).'/'.$dirtoscanrel, 'files', 0, 'mod.*\.class\.php$');
+ if (empty($descriptorfiles)) // If descriptor not found into module dir, we look into main module dir.
+ {
+ $dirtoscanrel = 'core/modules/';
+ $descriptorfiles = dol_dir_list($fullname.'/../'.$dirtoscanrel, 'files', 0, 'mod'.strtoupper(basename($fullname)).'\.class\.php$');
+ }
+ $modulenamewithcase = '';
+ $moduledescriptorrelpath = '';
+ $moduledescriptorfullpath = '';
- foreach ($descriptorfiles as $descriptorcursor) {
- $modulenamewithcase = preg_replace('/^mod/', '', $descriptorcursor['name']);
- $modulenamewithcase = preg_replace('/\.class\.php$/', '', $modulenamewithcase);
- $moduledescriptorrelpath = $dirtoscanrel.$descriptorcursor['name'];
- $moduledescriptorfullpath = $descriptorcursor['fullname'];
- //var_dump($descriptorcursor);
- }
- if ($modulenamewithcase)
- {
- $listofmodules[$dircustomcursor['name']] = array(
- 'modulenamewithcase'=>$modulenamewithcase,
- 'moduledescriptorrelpath'=> $moduledescriptorrelpath,
- 'moduledescriptorfullpath'=>$moduledescriptorfullpath,
- 'moduledescriptorrootpath'=>$dirread
- );
- }
- //var_dump($listofmodules);
- }
- }
- }
+ foreach ($descriptorfiles as $descriptorcursor) {
+ $modulenamewithcase = preg_replace('/^mod/', '', $descriptorcursor['name']);
+ $modulenamewithcase = preg_replace('/\.class\.php$/', '', $modulenamewithcase);
+ $moduledescriptorrelpath = $dirtoscanrel.$descriptorcursor['name'];
+ $moduledescriptorfullpath = $descriptorcursor['fullname'];
+ //var_dump($descriptorcursor);
+ }
+ if ($modulenamewithcase)
+ {
+ $listofmodules[$dircustomcursor['name']] = array(
+ 'modulenamewithcase'=>$modulenamewithcase,
+ 'moduledescriptorrelpath'=> $moduledescriptorrelpath,
+ 'moduledescriptorfullpath'=>$moduledescriptorfullpath,
+ 'moduledescriptorrootpath'=>$dirread
+ );
+ }
+ //var_dump($listofmodules);
+ }
+ }
+ }
- if ($forceddirread && empty($listofmodules)) // $forceddirread is 1 if we forced dir to read with dirins=... or with module=...@mydir
- {
- $listofmodules[strtolower($module)] = array(
- 'modulenamewithcase'=>$module,
- 'moduledescriptorrelpath'=> 'notyetimplemented',
- 'moduledescriptorfullpath'=> 'notyetimplemented',
- 'moduledescriptorrootpath'=> 'notyetimplemented',
- );
- }
+ if ($forceddirread && empty($listofmodules)) // $forceddirread is 1 if we forced dir to read with dirins=... or with module=...@mydir
+ {
+ $listofmodules[strtolower($module)] = array(
+ 'modulenamewithcase'=>$module,
+ 'moduledescriptorrelpath'=> 'notyetimplemented',
+ 'moduledescriptorfullpath'=> 'notyetimplemented',
+ 'moduledescriptorrootpath'=> 'notyetimplemented',
+ );
+ }
- // Show description of content
- $newdircustom = $dirins;
- if (empty($newdircustom)) $newdircustom = img_warning();
- // If dirread was forced to somewhere else, by using URL
- // htdocs/modulebuilder/index.php?module=Inventory@/home/ldestailleur/git/dolibarr/htdocs/product
- if (empty($i)) print $langs->trans("DirScanned").' : ';
- else print ', ';
- print ''.$dirread.' ';
- $i++;
+ // Show description of content
+ $newdircustom = $dirins;
+ if (empty($newdircustom)) $newdircustom = img_warning();
+ // If dirread was forced to somewhere else, by using URL
+ // htdocs/modulebuilder/index.php?module=Inventory@/home/ldestailleur/git/dolibarr/htdocs/product
+ if (empty($i)) print $langs->trans("DirScanned").' : ';
+ else print ', ';
+ print ''.$dirread.' ';
+ $i++;
}
print ' ';
//var_dump($listofmodules);
@@ -1792,7 +1792,7 @@ elseif (!empty($module))
// Tabs for module
if (!$error)
{
- $dirread = $listofmodules[strtolower($module)]['moduledescriptorrootpath'];
+ $dirread = $listofmodules[strtolower($module)]['moduledescriptorrootpath'];
$head2 = array();
$h = 0;
@@ -2341,7 +2341,7 @@ elseif (!empty($module))
{ // tabobj = module
if ($action == 'deleteproperty')
{
- $formconfirm = $form->formconfirm(
+ $formconfirm = $form->formconfirm(
$_SERVER["PHP_SELF"].'?propertykey='.urlencode(GETPOST('propertykey', 'alpha')).'&objectname='.urlencode($objectname).'&tab='.urlencode($tab).'&module='.urlencode($module).'&tabobj='.urlencode($tabobj),
$langs->trans('Delete'), $langs->trans('ConfirmDeleteProperty', GETPOST('propertykey', 'alpha')), 'confirm_deleteproperty', '', 0, 1
);
@@ -2403,23 +2403,23 @@ elseif (!empty($module))
print ' '.$langs->trans("ApiClassFile").' : '.($realpathtoapi ? '' : '').$pathtoapi.($realpathtoapi ? '' : ' ').' ';
if ($realpathtoapi)
{
- print ' '.img_picto($langs->trans("Edit"), 'edit').' ';
- print ' ';
- print ''.img_picto($langs->trans("Delete"), 'delete').' ';
- print ' ';
- if (empty($conf->global->$const_name)) // If module is not activated
- {
- print ''.$langs->trans("GoToApiExplorer").' ';
- }
- else
- {
- print ''.$langs->trans("GoToApiExplorer").' ';
- }
+ print ' '.img_picto($langs->trans("Edit"), 'edit').' ';
+ print ' ';
+ print ''.img_picto($langs->trans("Delete"), 'delete').' ';
+ print ' ';
+ if (empty($conf->global->$const_name)) // If module is not activated
+ {
+ print ''.$langs->trans("GoToApiExplorer").' ';
+ }
+ else
+ {
+ print ''.$langs->trans("GoToApiExplorer").' ';
+ }
}
else
{
- //print ''.$langs->trans("FileNotYetGenerated").' ';
- print ' ';
+ //print ''.$langs->trans("FileNotYetGenerated").' ';
+ print ' ';
}
// PHPUnit
print ' ';
@@ -2427,14 +2427,14 @@ elseif (!empty($module))
if ($realpathtophpunit)
{
- print ' '.img_picto($langs->trans("Edit"), 'edit').' ';
- print ' ';
- print ''.img_picto($langs->trans("Delete"), 'delete').' ';
+ print ' '.img_picto($langs->trans("Edit"), 'edit').' ';
+ print ' ';
+ print ''.img_picto($langs->trans("Delete"), 'delete').' ';
}
else
{
- //print ''.$langs->trans("FileNotYetGenerated").' ';
- print ' ';
+ //print ''.$langs->trans("FileNotYetGenerated").' ';
+ print ' ';
}
print ' ';
@@ -2748,56 +2748,56 @@ elseif (!empty($module))
}
else
{
- if ($tab == 'specifications')
- {
- if ($action != 'editfile' || empty($file))
- {
- print ''.$langs->trans("SpecDefDesc").' ';
- print ' ';
+ if ($tab == 'specifications')
+ {
+ if ($action != 'editfile' || empty($file))
+ {
+ print ''.$langs->trans("SpecDefDesc").' ';
+ print ' ';
- $specs = dol_dir_list(dol_buildpath($modulelowercase.'/doc', 0), 'files', 1, '(\.md|\.asciidoc)$', array('\/temp\/'));
+ $specs = dol_dir_list(dol_buildpath($modulelowercase.'/doc', 0), 'files', 1, '(\.md|\.asciidoc)$', array('\/temp\/'));
- foreach ($specs as $spec)
- {
- $pathtofile = $modulelowercase.'/doc/'.$spec['relativename'];
- $format = 'asciidoc';
- if (preg_match('/\.md$/i', $spec['name'])) $format = 'markdown';
- print ' '.$langs->trans("SpecificationFile").' : '.$pathtofile.' ';
- print ' '.img_picto($langs->trans("Edit"), 'edit').' ';
- print ' ';
- }
- }
- else
- {
- // Use MD or asciidoc
+ foreach ($specs as $spec)
+ {
+ $pathtofile = $modulelowercase.'/doc/'.$spec['relativename'];
+ $format = 'asciidoc';
+ if (preg_match('/\.md$/i', $spec['name'])) $format = 'markdown';
+ print ' '.$langs->trans("SpecificationFile").' : '.$pathtofile.' ';
+ print ' '.img_picto($langs->trans("Edit"), 'edit').' ';
+ print ' ';
+ }
+ }
+ else
+ {
+ // Use MD or asciidoc
- //print $langs->trans("UseAsciiDocFormat").' ';
+ //print $langs->trans("UseAsciiDocFormat").' ';
- $fullpathoffile = dol_buildpath($file, 0);
+ $fullpathoffile = dol_buildpath($file, 0);
- $content = file_get_contents($fullpathoffile);
+ $content = file_get_contents($fullpathoffile);
- // New module
- print '';
- }
- }
- print ''.$langs->trans('Property $field not found into the class. The class was probably not generated by modulebuilder.').' ';
+ print '';
+ }
+ }
+ print ''.$langs->trans('Property $field not found into the class. The class was probably not generated by modulebuilder.').' ';
}
print '';
print '';
@@ -2860,10 +2860,10 @@ elseif (!empty($module))
if ($action != 'editfile' || empty($file))
{
- print '';
- $htmlhelp = $langs->trans("MenusDefDescTooltip", ''.$langs->trans('Setup').' - '.$langs->trans('Menus').' ');
- print $form->textwithpicto($langs->trans("MenusDefDesc"), $htmlhelp, 1, 'help', '', 0, 2, 'helpondesc').' ';
- print ' ';
+ print '';
+ $htmlhelp = $langs->trans("MenusDefDescTooltip", ''.$langs->trans('Setup').' - '.$langs->trans('Menus').' ');
+ print $form->textwithpicto($langs->trans("MenusDefDesc"), $htmlhelp, 1, 'help', '', 0, 2, 'helpondesc').' ';
+ print ' ';
print ' ';
print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.' ';
@@ -3000,10 +3000,10 @@ elseif (!empty($module))
if ($action != 'editfile' || empty($file))
{
- print '';
- $htmlhelp = $langs->trans("PermissionsDefDescTooltip", ''.$langs->trans('DefaultPermissions').' ');
- print $form->textwithpicto($langs->trans("PermissionsDefDesc"), $htmlhelp, 1, 'help', '', 0, 2, 'helpondesc').' ';
- print ' ';
+ print '';
+ $htmlhelp = $langs->trans("PermissionsDefDescTooltip", ''.$langs->trans('DefaultPermissions').' ');
+ print $form->textwithpicto($langs->trans("PermissionsDefDesc"), $htmlhelp, 1, 'help', '', 0, 2, 'helpondesc').' ';
+ print ' ';
print ' ';
print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.' ';
@@ -3096,7 +3096,7 @@ elseif (!empty($module))
{
if ($action != 'editfile' || empty($file))
{
- print ''.$langs->trans("HooksDefDesc").' ';
+ print ''.$langs->trans("HooksDefDesc").' ';
print ' ';
print '';
@@ -3112,14 +3112,14 @@ elseif (!empty($module))
print ' '.$langs->trans("HooksFile").' : ';
if (dol_is_file($dirins.'/'.$pathtohook))
{
- print ''.$pathtohook.' ';
- print ' '.img_picto($langs->trans("Edit"), 'edit').' ';
- print ''.img_picto($langs->trans("Delete"), 'delete').' ';
+ print ''.$pathtohook.' ';
+ print ''.img_picto($langs->trans("Edit"), 'edit').' ';
+ print ''.img_picto($langs->trans("Delete"), 'delete').' ';
}
else
{
- print ''.$langs->trans("FileNotYetGenerated").' ';
- print ' ';
+ print ''.$langs->trans("FileNotYetGenerated").' ';
+ print ' ';
}
print ' ';
}
@@ -3159,7 +3159,7 @@ elseif (!empty($module))
if ($action != 'editfile' || empty($file))
{
- print ''.$langs->trans("TriggerDefDesc").' ';
+ print ''.$langs->trans("TriggerDefDesc").' ';
print ' ';
print '';
@@ -3324,11 +3324,11 @@ elseif (!empty($module))
if ($action != 'editfile' || empty($file))
{
- print ''.$langs->trans("WidgetDesc").' ';
- print ' ';
+ print ''.$langs->trans("WidgetDesc").' ';
+ print ' ';
- print '';
- if (!empty($widgets))
+ print '';
}
@@ -3377,88 +3377,88 @@ elseif (!empty($module))
if ($tab == 'cli')
{
- $clifiles = array();
- $i = 0;
+ $clifiles = array();
+ $i = 0;
- $dircli = array('/'.strtolower($module).'/scripts');
+ $dircli = array('/'.strtolower($module).'/scripts');
- foreach ($dircli as $reldir)
- {
- $dir = dol_buildpath($reldir, 0);
- $newdir = dol_osencode($dir);
+ foreach ($dircli as $reldir)
+ {
+ $dir = dol_buildpath($reldir, 0);
+ $newdir = dol_osencode($dir);
- // Check if directory exists (we do not use dol_is_dir to avoid loading files.lib.php at each call)
- if (!is_dir($newdir)) continue;
+ // Check if directory exists (we do not use dol_is_dir to avoid loading files.lib.php at each call)
+ if (!is_dir($newdir)) continue;
- $handle = opendir($newdir);
- if (is_resource($handle))
- {
- while (($tmpfile = readdir($handle)) !== false)
- {
- if (is_readable($newdir.'/'.$file) && preg_match('/^(.+)\.php/', $tmpfile, $reg))
- {
- if (preg_match('/\.back$/', $tmpfile)) continue;
+ $handle = opendir($newdir);
+ if (is_resource($handle))
+ {
+ while (($tmpfile = readdir($handle)) !== false)
+ {
+ if (is_readable($newdir.'/'.$file) && preg_match('/^(.+)\.php/', $tmpfile, $reg))
+ {
+ if (preg_match('/\.back$/', $tmpfile)) continue;
- $clifiles[$i]['relpath'] = preg_replace('/^\//', '', $reldir).'/'.$tmpfile;
+ $clifiles[$i]['relpath'] = preg_replace('/^\//', '', $reldir).'/'.$tmpfile;
- $i++;
- }
- }
- closedir($handle);
- }
- }
+ $i++;
+ }
+ }
+ closedir($handle);
+ }
+ }
- if ($action != 'editfile' || empty($file))
- {
- print ''.$langs->trans("CLIDesc").' ';
- print ' ';
+ if ($action != 'editfile' || empty($file))
+ {
+ print ''.$langs->trans("CLIDesc").' ';
+ print ' ';
- print '';
+ }
+ else
+ {
+ $fullpathoffile = dol_buildpath($file, 0);
- $content = file_get_contents($fullpathoffile);
+ $content = file_get_contents($fullpathoffile);
- // New module
- print '';
- }
+ print '';
+ }
}
if ($tab == 'cron')
@@ -3469,7 +3469,7 @@ elseif (!empty($module))
if ($action != 'editfile' || empty($file))
{
- print ''.$langs->trans("CronJobDefDesc", ''.$langs->transnoentities('CronList').' ').' ';
+ print ''.$langs->trans("CronJobDefDesc", ''.$langs->transnoentities('CronList').' ').' ';
print ' ';
print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.' ';
@@ -3585,119 +3585,119 @@ elseif (!empty($module))
if ($tab == 'specifications')
{
- $specs = dol_dir_list(dol_buildpath($modulelowercase.'/doc', 0), 'files', 1, '(\.md|\.asciidoc)$', array('\/temp\/'));
+ $specs = dol_dir_list(dol_buildpath($modulelowercase.'/doc', 0), 'files', 1, '(\.md|\.asciidoc)$', array('\/temp\/'));
- if ($action != 'editfile' || empty($file))
- {
- print ''.$langs->trans("SpecDefDesc").' ';
- print ' ';
+ if ($action != 'editfile' || empty($file))
+ {
+ print ''.$langs->trans("SpecDefDesc").' ';
+ print ' ';
- print '';
- }
- else
- {
- // Use MD or asciidoc
+ print '';
+ }
+ else
+ {
+ // Use MD or asciidoc
- //print $langs->trans("UseAsciiDocFormat").' ';
+ //print $langs->trans("UseAsciiDocFormat").' ';
- $fullpathoffile = dol_buildpath($file, 0);
+ $fullpathoffile = dol_buildpath($file, 0);
- $content = file_get_contents($fullpathoffile);
+ $content = file_get_contents($fullpathoffile);
- // New module
- print '';
- }
+ print '';
+ }
- print ' ';
+ print ' ';
- $FILENAMEDOC = $modulelowercase.'.html';
- $FILENAMEDOCPDF = $modulelowercase.'.pdf';
- $outputfiledoc = dol_buildpath($modulelowercase, 0).'/doc/'.$FILENAMEDOC;
- $outputfiledocurl = dol_buildpath($modulelowercase, 1).'/doc/'.$FILENAMEDOC;
- $outputfiledocpdf = dol_buildpath($modulelowercase, 0).'/doc/'.$FILENAMEDOCPDF;
- $outputfiledocurlpdf = dol_buildpath($modulelowercase, 1).'/doc/'.$FILENAMEDOCPDF;
+ $FILENAMEDOC = $modulelowercase.'.html';
+ $FILENAMEDOCPDF = $modulelowercase.'.pdf';
+ $outputfiledoc = dol_buildpath($modulelowercase, 0).'/doc/'.$FILENAMEDOC;
+ $outputfiledocurl = dol_buildpath($modulelowercase, 1).'/doc/'.$FILENAMEDOC;
+ $outputfiledocpdf = dol_buildpath($modulelowercase, 0).'/doc/'.$FILENAMEDOCPDF;
+ $outputfiledocurlpdf = dol_buildpath($modulelowercase, 1).'/doc/'.$FILENAMEDOCPDF;
- // HTML
- print ' '.$langs->trans("PathToModuleDocumentation", "HTML").' : ';
- if (!dol_is_file($outputfiledoc)) print ''.$langs->trans("FileNotYetGenerated").' ';
- else {
- print '';
- print '';
- print $outputfiledoc;
- print ' ';
- print ' ';
- print ' ('.$langs->trans("GeneratedOn").' '.dol_print_date(dol_filemtime($outputfiledoc), 'dayhour').')';
- }
- print ' ';
+ // HTML
+ print ' '.$langs->trans("PathToModuleDocumentation", "HTML").' : ';
+ if (!dol_is_file($outputfiledoc)) print ''.$langs->trans("FileNotYetGenerated").' ';
+ else {
+ print '';
+ print '';
+ print $outputfiledoc;
+ print ' ';
+ print ' ';
+ print ' ('.$langs->trans("GeneratedOn").' '.dol_print_date(dol_filemtime($outputfiledoc), 'dayhour').')';
+ }
+ print ' ';
- // PDF
- print ' '.$langs->trans("PathToModuleDocumentation", "PDF").' : ';
- if (!dol_is_file($outputfiledocpdf)) print ''.$langs->trans("FileNotYetGenerated").' ';
- else {
- print '';
- print '';
- print $outputfiledocpdf;
- print ' ';
- print ' ';
- print ' ('.$langs->trans("GeneratedOn").' '.dol_print_date(dol_filemtime($outputfiledocpdf), 'dayhour').')';
- }
- print ' ';
+ // PDF
+ print ' '.$langs->trans("PathToModuleDocumentation", "PDF").' : ';
+ if (!dol_is_file($outputfiledocpdf)) print ''.$langs->trans("FileNotYetGenerated").' ';
+ else {
+ print '';
+ print '';
+ print $outputfiledocpdf;
+ print ' ';
+ print ' ';
+ print ' ('.$langs->trans("GeneratedOn").' '.dol_print_date(dol_filemtime($outputfiledocpdf), 'dayhour').')';
+ }
+ print ' ';
- print ' ';
+ print ' ';
- print '';
+ print '';
}
if ($tab == 'buildpackage')
{
- print ''.$langs->trans("BuildPackageDesc").' ';
- print ' ';
+ print ''.$langs->trans("BuildPackageDesc").' ';
+ print ' ';
if (!class_exists('ZipArchive') && !defined('ODTPHP_PATHTOPCLZIP'))
{
diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_advanced.php b/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_advanced.php
index 42ede9ba800..f621d332003 100644
--- a/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_advanced.php
+++ b/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_advanced.php
@@ -35,9 +35,9 @@ dol_include_once('/mymodule/core/modules/mymodule/modules_myobject.php');
class mod_myobject_advanced extends ModeleNumRefMyObject
{
/**
- * Dolibarr version of the loaded document
- * @var string
- */
+ * Dolibarr version of the loaded document
+ * @var string
+ */
public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
/**
@@ -51,14 +51,14 @@ class mod_myobject_advanced extends ModeleNumRefMyObject
public $name = 'advanced';
- /**
- * Returns the description of the numbering model
- *
- * @return string Texte descripif
- */
- public function info()
- {
- global $conf, $langs, $db;
+ /**
+ * Returns the description of the numbering model
+ *
+ * @return string Texte descripif
+ */
+ public function info()
+ {
+ global $conf, $langs, $db;
$langs->load("bills");
@@ -89,28 +89,28 @@ class mod_myobject_advanced extends ModeleNumRefMyObject
$texte .= '';
return $texte;
- }
+ }
- /**
- * Return an example of numbering
- *
- * @return string Example
- */
- public function getExample()
- {
- global $conf, $langs, $mysoc;
+ /**
+ * Return an example of numbering
+ *
+ * @return string Example
+ */
+ public function getExample()
+ {
+ global $conf, $langs, $mysoc;
- $object = new MyObject($this->db);
- $object->initAsSpecimen();
+ $object = new MyObject($this->db);
+ $object->initAsSpecimen();
- /*$old_code_client = $mysoc->code_client;
+ /*$old_code_client = $mysoc->code_client;
$old_code_type = $mysoc->typent_code;
$mysoc->code_client = 'CCCCCCCCCC';
$mysoc->typent_code = 'TTTTTTTTTT';*/
- $numExample = $this->getNextValue($object);
+ $numExample = $this->getNextValue($object);
- /*$mysoc->code_client = $old_code_client;
+ /*$mysoc->code_client = $old_code_client;
$mysoc->typent_code = $old_code_type;*/
if (!$numExample)
@@ -118,7 +118,7 @@ class mod_myobject_advanced extends ModeleNumRefMyObject
$numExample = $langs->trans('NotConfigured');
}
return $numExample;
- }
+ }
/**
* Return next free value
@@ -126,8 +126,8 @@ class mod_myobject_advanced extends ModeleNumRefMyObject
* @param Object $object Object we need next value for
* @return string Value if KO, <0 if KO
*/
- public function getNextValue($object)
- {
+ public function getNextValue($object)
+ {
global $db, $conf;
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_standard.php b/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_standard.php
index 13beaadab95..d3990b562ec 100644
--- a/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_standard.php
+++ b/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_standard.php
@@ -31,9 +31,9 @@ dol_include_once('/mymodule/core/modules/mymodule/modules_myobject.php');
class mod_myobject_standard extends ModeleNumRefMyObject
{
/**
- * Dolibarr version of the loaded document
- * @var string
- */
+ * Dolibarr version of the loaded document
+ * @var string
+ */
public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
public $prefix = 'MYOBJECT';
@@ -49,16 +49,16 @@ class mod_myobject_standard extends ModeleNumRefMyObject
public $name = 'standard';
- /**
- * Return description of numbering module
- *
- * @return string Text with description
- */
- public function info()
- {
- global $langs;
- return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
- }
+ /**
+ * Return description of numbering module
+ *
+ * @return string Text with description
+ */
+ public function info()
+ {
+ global $langs;
+ return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
+ }
/**
@@ -73,8 +73,8 @@ class mod_myobject_standard extends ModeleNumRefMyObject
/**
- * Checks if the numbers already in the database do not
- * cause conflicts that would prevent this numbering working.
+ * Checks if the numbers already in the database do not
+ * cause conflicts that would prevent this numbering working.
*
* @param Object $object Object we need next value for
* @return boolean false if conflict, true if ok
@@ -151,8 +151,8 @@ class mod_myobject_standard extends ModeleNumRefMyObject
$date = $object->date_creation;
$yymm = strftime("%y%m", $date);
- if ($max >= (pow(10, 4) - 1)) $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is
- else $num = sprintf("%04s", $max + 1);
+ if ($max >= (pow(10, 4) - 1)) $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is
+ else $num = sprintf("%04s", $max + 1);
dol_syslog("mod_myobject_standard::getNextValue return ".$this->prefix.$yymm."-".$num);
return $this->prefix.$yymm."-".$num;
diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/modules_myobject.php b/htdocs/modulebuilder/template/core/modules/mymodule/modules_myobject.php
index b052d4538bd..7e22d5d6ca4 100644
--- a/htdocs/modulebuilder/template/core/modules/mymodule/modules_myobject.php
+++ b/htdocs/modulebuilder/template/core/modules/mymodule/modules_myobject.php
@@ -38,17 +38,17 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // requir
abstract class ModelePDFMyObject extends CommonDocGenerator
{
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
- /**
- * Return list of active generation modules
- *
- * @param DoliDB $db Database handler
- * @param integer $maxfilenamelength Max length of value to show
- * @return array List of templates
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ /**
+ * Return list of active generation modules
+ *
+ * @param DoliDB $db Database handler
+ * @param integer $maxfilenamelength Max length of value to show
+ * @return array List of templates
*/
public static function liste_modeles($db, $maxfilenamelength = 0)
{
- // phpcs:enable
+ // phpcs:enable
global $conf;
$type = 'mymodule_myobject';
@@ -109,7 +109,7 @@ abstract class ModeleNumRefMyObject
/**
* Checks if the numbers already in the database do not
- * cause conflicts that would prevent this numbering working.
+ * cause conflicts that would prevent this numbering working.
*
* @param Object $object Object we need next value for
* @return boolean false if conflict, true if ok
diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php
index 1012e62f65d..4f5ef29bc70 100644
--- a/htdocs/takepos/index.php
+++ b/htdocs/takepos/index.php
@@ -870,11 +870,13 @@ if ($conf->global->TAKEPOS_BAR_RESTAURANT)
{
$menus[$r++] = array('title'=>$langs->trans("Order"), 'action'=>'TakeposPrintingOrder();');
}
- //add temp ticket button
+ //Button to print receipt before payment
if ($conf->global->TAKEPOS_BAR_RESTAURANT)
{
if ($conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector") {
$menus[$r++] = array('title'=>''.$langs->trans("Receipt").'
', 'action'=>'TakeposPrinting(placeid);');
+ } elseif ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter") {
+ $menus[$r++] = array('title'=>''.$langs->trans("Receipt").'
', 'action'=>'DolibarrTakeposPrinting(placeid);');
} else {
$menus[$r++] = array('title'=>''.$langs->trans("Receipt").'
', 'action'=>'Print(placeid);');
}
diff --git a/htdocs/user/list.php b/htdocs/user/list.php
index c82420c3337..f779818140f 100644
--- a/htdocs/user/list.php
+++ b/htdocs/user/list.php
@@ -201,7 +201,7 @@ $sql = "SELECT DISTINCT u.rowid, u.lastname, u.firstname, u.admin, u.fk_soc, u.l
$sql .= " u.datelastlogin, u.datepreviouslogin,";
$sql .= " u.ldap_sid, u.statut, u.entity,";
$sql .= " u.tms as date_update, u.datec as date_creation,";
-$sql .= " u2.rowid as id2, u2.login as login2, u2.firstname as firstname2, u2.lastname as lastname2, u2.admin as admin2, u2.fk_soc as fk_soc2, u2.email as email2, u2.gender as gender2, u2.photo as photo2, u2.entity as entity2,";
+$sql .= " u2.rowid as id2, u2.login as login2, u2.firstname as firstname2, u2.lastname as lastname2, u2.admin as admin2, u2.fk_soc as fk_soc2, u2.email as email2, u2.gender as gender2, u2.photo as photo2, u2.entity as entity2, u2.statut as statut2,";
$sql .= " s.nom as name, s.canvas";
// Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
@@ -625,6 +625,7 @@ while ($i < min($num, $limit))
$user2->admin = $obj->admin2;
$user2->email = $obj->email2;
$user2->socid = $obj->fk_soc2;
+ $user2->statut = $obj->statut2;
print $user2->getNomUrl(-1, '', 0, 0, 24, 0, '', '', 1);
if (!empty($conf->multicompany->enabled) && $obj->admin2 && !$obj->entity2)
{