| '.$langs->trans("CurrentVersion").' ('.$langs->trans("Programs").') | '.DOL_VERSION;
// If current version differs from last upgrade
if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE))
@@ -139,7 +139,7 @@ print ' ';
// Session
print '';
print ' ';
-print '| '.$langs->trans("Session").' | '.$langs->trans("Value").' | '."\n";
+print '| '.$langs->trans("Session").' | '.$langs->trans("Value").' | '."\n";
print '| '.$langs->trans("SessionSavePath").' | '.session_save_path().' | '."\n";
print '| '.$langs->trans("SessionName").' | '.session_name().' | '."\n";
print '| '.$langs->trans("SessionId").' | '.session_id().' | '."\n";
@@ -180,7 +180,7 @@ if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_S
print '';
print ' ';
print '';
- print '| '.$langs->trans("LanguageFilesCachedIntoShmopSharedMemory").' | ';
+ print ''.$langs->trans("LanguageFilesCachedIntoShmopSharedMemory").' | ';
print ''.$langs->trans("NbOfEntries").' | ';
print ''.$langs->trans("Address").' | ';
print ' '."\n";
@@ -202,7 +202,7 @@ if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_S
// Localisation
print '';
print ' ';
-print '| '.$langs->trans("LocalisationDolibarrParameters").' | '.$langs->trans("Value").' | '."\n";
+print '| '.$langs->trans("LocalisationDolibarrParameters").' | '.$langs->trans("Value").' | '."\n";
print '| '.$langs->trans("LanguageBrowserParameter", "HTTP_ACCEPT_LANGUAGE").' | '.$_SERVER["HTTP_ACCEPT_LANGUAGE"].' | '."\n";
print '| '.$langs->trans("CurrentUserLanguage").' | '.$langs->getDefaultLang().' | '."\n";
// Thousands
@@ -222,7 +222,22 @@ if (($thousand != ',' && $thousand != '.') || ($thousand != ' '))
print "\n";
}
print '| => price(1234.56) | '.price(1234.56).' | '."\n";
-// Timezone
+
+// Timezones
+
+// Database timezone
+if ($conf->db->type == 'mysql' || $conf->db->type == 'mysqli')
+{
+ print '| '.$langs->trans("MySQLTimeZone").' (database) | '; // Timezone server base
+ $sql = "SHOW VARIABLES where variable_name = 'system_time_zone'";
+ $resql = $db->query($sql);
+ if ($resql)
+ {
+ $obj = $db->fetch_object($resql);
+ print $form->textwithtooltip($obj->Value, $langs->trans('TZHasNoEffect'), 2, 1, img_info(''));
+ }
+ print ' | '."\n";
+}
$txt = $langs->trans("OSTZ").' (variable system TZ): '.(!empty($_ENV["TZ"]) ? $_ENV["TZ"] : $langs->trans("NotDefined")).' '."\n";
$txt .= $langs->trans("PHPTZ").' (date_default_timezone_get() / php.ini date.timezone): '.(getServerTimeZoneString()." / ".(ini_get("date.timezone") ? ini_get("date.timezone") : $langs->trans("NotDefined")))." \n"; // date.timezone must be in valued defined in http://fr3.php.net/manual/en/timezones.europe.php
$txt .= $langs->trans("Dolibarr constant MAIN_SERVER_TZ").': '.(empty($conf->global->MAIN_SERVER_TZ) ? $langs->trans("NotDefined") : $conf->global->MAIN_SERVER_TZ);
@@ -238,23 +253,10 @@ $val .= ' '.getServerTimeZoneString();
$val .= ' '.$langs->trans("DaylingSavingTime").': '.($daylight === 'unknown' ? 'unknown' : ($a == $c ?yn($daylight) : yn(0).($daylight ? ' ('.$langs->trans('YesInSummer').')' : '')));
print $form->textwithtooltip($val, $txt, 2, 1, img_info(''));
print ''."\n"; // value defined in http://fr3.php.net/manual/en/timezones.europe.php
-print '| => '.$langs->trans("CurrentHour").' | '.dol_print_date(dol_now(), 'dayhour', 'tzserver').' | '."\n";
+print '| => '.$langs->trans("CurrentHour").' | '.dol_print_date(dol_now('gmt'), 'dayhour', 'tzserver').' | '."\n";
print '| => dol_print_date(0,"dayhourtext") | '.dol_print_date(0, "dayhourtext").' | ';
print ' | => dol_get_first_day(1970,1,false) | '.dol_get_first_day(1970, 1, false).' (=> dol_print_date() or idate() of this value = '.dol_print_date(dol_get_first_day(1970, 1, false), 'dayhour').') | ';
print ' | => dol_get_first_day(1970,1,true) | '.dol_get_first_day(1970, 1, true).' (=> dol_print_date() or idate() of this value = '.dol_print_date(dol_get_first_day(1970, 1, true), 'dayhour').') | ';
-// Database timezone
-if ($conf->db->type == 'mysql' || $conf->db->type == 'mysqli')
-{
- print ' | '.$langs->trans("MySQLTimeZone").' (database) | '; // Timezone server base
- $sql = "SHOW VARIABLES where variable_name = 'system_time_zone'";
- $resql = $db->query($sql);
- if ($resql)
- {
- $obj = $db->fetch_object($resql);
- print $form->textwithtooltip($obj->Value, $langs->trans('TZHasNoEffect'), 2, 1, img_info(''));
- }
- print ' | '."\n";
-}
// Client
$tz = (int) $_SESSION['dol_tz'] + (int) $_SESSION['dol_dst'];
print '| '.$langs->trans("ClientTZ").' | '.($tz ? ($tz >= 0 ? '+' : '').$tz : '').' ('.($tz >= 0 ? '+' : '').($tz * 60 * 60).')';
@@ -265,7 +267,7 @@ else print yn(0);
if (!empty($_SESSION['dol_dst_first'])) print ' ('.dol_print_date(dol_stringtotime($_SESSION['dol_dst_first']), 'dayhour', 'gmt').' - '.dol_print_date(dol_stringtotime($_SESSION['dol_dst_second']), 'dayhour', 'gmt').')';
print ' | '."\n";
print ''."\n";
-print '| => '.$langs->trans("ClientHour").' | '.dol_print_date(dol_now(), 'dayhour', 'tzuser').' | '."\n";
+print '| => '.$langs->trans("ClientHour").' | '.dol_print_date(dol_now('gmt'), 'dayhour', 'tzuser').' | '."\n";
$filesystemencoding = ini_get("unicode.filesystem_encoding"); // Disponible avec PHP 6.0
print '| '.$langs->trans("File encoding").' (php.ini unicode.filesystem_encoding) | '.$filesystemencoding.' | '."\n";
@@ -340,7 +342,7 @@ $configfileparameters = array(
print '';
print ' ';
print '';
-print '| '.$langs->trans("Parameters").' ';
+print ' | '.$langs->trans("Parameters").' ';
print $langs->trans("ConfigurationFile").' ('.$conffiletoshowshort.')';
print ' | ';
print ''.$langs->trans("Parameter").' | ';
diff --git a/htdocs/admin/system/filecheck.php b/htdocs/admin/system/filecheck.php
index 4ed21144346..42ebe6b97e5 100644
--- a/htdocs/admin/system/filecheck.php
+++ b/htdocs/admin/system/filecheck.php
@@ -374,14 +374,6 @@ if (!$error && $xml)
}
$out .= ' ';
$out .= ' ';
-
- // Show warning
- if (empty($tmpfilelist) && empty($tmpfilelist2) && empty($tmpfilelist3))
- {
- setEventMessages($langs->trans("FileIntegrityIsStrictlyConformedWithReference"), null, 'mesgs');
- } else {
- setEventMessages($langs->trans("FileIntegritySomeFilesWereRemovedOrModified"), null, 'warnings');
- }
} else {
print 'Error: Failed to found dolibarr_htdocs_dir into XML file '.$xmlfile;
$error++;
@@ -407,6 +399,8 @@ if (!$error && $xml)
var_dump($checksumtoget);
var_dump($checksumget == $checksumtoget);*/
+ $resultcomment = '';
+
$outexpectedchecksum = ($checksumtoget ? $checksumtoget : $langs->trans("Unknown"));
if ($checksumget == $checksumtoget)
{
@@ -414,7 +408,7 @@ if (!$error && $xml)
{
$resultcode = 'warning';
$resultcomment = 'FileIntegrityIsOkButFilesWereAdded';
- $outcurrentchecksum = $checksumget.' - '.$langs->trans("FileIntegrityIsOkButFilesWereAdded").'';
+ $outcurrentchecksum = $checksumget.' - '.$langs->trans($resultcomment).'';
} else {
$resultcode = 'ok';
$resultcomment = 'Success';
@@ -426,7 +420,18 @@ if (!$error && $xml)
$outcurrentchecksum = ''.$checksumget.'';
}
- print load_fiche_titre($langs->trans("GlobalChecksum")).' ';
+ // Show warning
+ if (empty($tmpfilelist) && empty($tmpfilelist2) && empty($tmpfilelist3) && $resultcode == 'ok') {
+ setEventMessages($langs->trans("FileIntegrityIsStrictlyConformedWithReference"), null, 'mesgs');
+ } else {
+ if ($resultcode == 'warning') {
+ setEventMessages($langs->trans($resultcomment), null, 'warnings');
+ } else {
+ setEventMessages($langs->trans("FileIntegritySomeFilesWereRemovedOrModified"), null, 'errors');
+ }
+ }
+
+ print load_fiche_titre($langs->trans("GlobalChecksum"));
print $langs->trans("ExpectedChecksum").' = '.$outexpectedchecksum.' ';
print $langs->trans("CurrentChecksum").' = '.$outcurrentchecksum;
diff --git a/htdocs/admin/system/phpinfo.php b/htdocs/admin/system/phpinfo.php
index cf38687f66f..b6160d2d2e9 100644
--- a/htdocs/admin/system/phpinfo.php
+++ b/htdocs/admin/system/phpinfo.php
@@ -69,13 +69,13 @@ if ($maxphp > 0 && $maxphp2 > 0 && $maxphp > $maxphp2)
print '';
-print '| '.$langs->trans("Parameter").' | '.$langs->trans("Value").' | ';
+print '| '.$langs->trans("Parameter").' | '.$langs->trans("Value").' | ';
$ErrorPicturePath = "../../theme/eldy/img/error.png";
$WarningPicturePath = "../../theme/eldy/img/warning.png";
$OkayPicturePath = "../../theme/eldy/img/tick.png";
-print '| '.$langs->trans("Version").' | ';
+print ' | | '.$langs->trans("Version").' | ';
$arrayphpminversionerror = array(5, 5, 0);
$arrayphpminversionwarning = array(5, 6, 0);
@@ -129,11 +129,8 @@ $loadedExtensions = array_map('strtolower', get_loaded_extensions(false));
print '';
print '';
-print '| '.$langs->trans("Extension").' | ';
-//print ''.$langs->trans("EnabledInSetup").' | ';
-print ''.$langs->trans("Loaded").' | ';
-print ''.$langs->trans("FunctionTest").' | ';
-print ''.$langs->trans("Result").' | ';
+print ''.$langs->trans("Extension").' | ';
+print ''.$langs->trans("Test").' | ';
print ' ';
$functions = ["mb_check_encoding"];
@@ -141,9 +138,6 @@ $name = "MBString";
print "";
print "| ".$name." | ";
-//print getTableColumn($name, $activatedExtensions);
-print getTableColumn($name, $loadedExtensions);
-print getTableColumnFunction($functions);
print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
print " ";
@@ -152,9 +146,6 @@ $name = "JSON";
print "";
print "| ".$name." | ";
-//print getTableColumn($name, $activatedExtensions);
-print getTableColumn($name, $loadedExtensions);
-print getTableColumnFunction($functions);
print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
print " ";
@@ -163,8 +154,6 @@ $name = "GD";
print "";
print "| ".$name." | ";
-print getTableColumn($name, $loadedExtensions);
-print getTableColumnFunction($functions);
print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
print " ";
@@ -173,8 +162,6 @@ $name = "Curl";
print "";
print "| ".$name." | ";
-print getTableColumn($name, $loadedExtensions);
-print getTableColumnFunction($functions);
print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
print " ";
@@ -185,8 +172,6 @@ if (empty($_SERVER["SERVER_ADMIN"]) || $_SERVER["SERVER_ADMIN"] != 'doliwamp@loc
print "";
print "| ".$name." | ";
- print getTableColumn($name, $loadedExtensions);
- print getTableColumnFunction($functions);
print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
print " ";
}
@@ -196,8 +181,6 @@ $name = "IMAP";
print "";
print "| ".$name." | ";
-print getTableColumn($name, $loadedExtensions);
-print getTableColumnFunction($functions);
print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
print " ";
@@ -206,8 +189,6 @@ $name = "xDebug";
print "";
print "| ".$name." | ";
-print getTableColumn($name, $loadedExtensions);
-print getTableColumnFunction($functions);
print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
print " ";
@@ -222,7 +203,7 @@ foreach ($phparray as $key => $value)
print '';
print ' ';
print '';
- print '| '.$key.' | ';
+ print ''.$key.' | ';
print ''.$langs->trans("Value").' | ';
print " \n";
@@ -269,69 +250,6 @@ llxFooter();
$db->close();
-/**
- * Return a table column with a indicator (okay or warning), based on the given name and list
- *
- * @param string $name The name to check inside the given list
- * @param array $list A list that should contains the given name
- *
- * @return string
- */
-function getTableColumn($name, array $list)
-{
- global $langs;
-
- $name = strtolower($name);
- $html = "";
-
- if (in_array($name, $list))
- {
- if ($name == 'xdebug') $html .= ' ';
- else $html .= ' ';
- } else {
- if ($name == 'xdebug') $html .= yn(0);
- else $html .= ' ';
- }
-
- $html .= " | ";
-
- return $html;
-}
-
-/**
- * Return a table column with a indicator (okay or warning), based on the given functions to check
- *
- * @param array $functions A list with functions to check
- *
- * @return string
- */
-function getTableColumnFunction(array $functions)
-{
- if (count($functions) < 1)
- {
- return "- | ";
- }
-
- $result = true;
- $html = "";
-
- foreach ($functions as $function)
- {
- $result = $result && function_exists($function);
- }
-
- if ($result)
- {
- $html .= ' ';
- } else {
- $html .= ' ';
- }
-
- $html .= " | ";
-
- return $html;
-}
-
/**
* Return a result column with a translated result text
*
@@ -339,7 +257,6 @@ function getTableColumnFunction(array $functions)
* @param array $activated A list with all activated PHP extensions. Deprecated.
* @param array $loaded A list with all loaded PHP extensions
* @param array $functions A list with all PHP functions to check
- *
* @return string
*/
function getResultColumn($name, array $activated, array $loaded, array $functions)
@@ -347,6 +264,7 @@ function getResultColumn($name, array $activated, array $loaded, array $function
global $langs;
$result = true;
+
//$result = $result && in_array(strtolower($name), $activated);
$result = $result && in_array(strtolower($name), $loaded);
@@ -356,7 +274,29 @@ function getResultColumn($name, array $activated, array $loaded, array $function
}
$html = "";
- $html .= $result ? $langs->trans("PHPSupport", $name) : $langs->trans("ErrorPHPDoesNotSupport", $name);
+ if ($result) {
+ if (strtolower($name) == 'xdebug') $html .= img_warning($langs->trans("ModuleActivated", "xdebug"));
+ else $html .= img_picto($langs->trans("Ok"), 'tick');
+ if (in_array(strtolower($name), $loaded)) {
+ $html .= ' '.$langs->trans("Loaded").' - ';
+ } else {
+ //$html .= ' '.$langs->trans("NotLoaded").' - ';
+ }
+ if (strtolower($name) == 'xdebug') {
+ $html .= ' '.$langs->trans("ModuleActivated", "xdebug");
+ } else {
+ $html .= ' '.$langs->trans("PHPSupport", $name);
+ }
+ } else {
+ if (strtolower($name) == 'xdebug') $html .= yn(0).' - ';
+ else $html .= img_warning($langs->trans("ModuleActivated", "xdebug"));
+ if (in_array(strtolower($name), $loaded)) {
+ $html .= ' '.$langs->trans("Loaded").' - ';
+ } else {
+ //$html .= ' '.$langs->trans("NotLoaded").' - ';
+ }
+ $html .= ' '.$langs->trans("ErrorPHPDoesNotSupport", $name);
+ }
$html .= " | ";
return $html;
diff --git a/htdocs/admin/system/security.php b/htdocs/admin/system/security.php
index f978c0dcd81..f0ada86a393 100644
--- a/htdocs/admin/system/security.php
+++ b/htdocs/admin/system/security.php
@@ -43,9 +43,6 @@ if (GETPOST('action', 'aZ09') == 'donothing')
* View
*/
-$form = new Form($db);
-$nowstring = dol_print_date(dol_now(), 'dayhourlog');
-
llxHeader();
print load_fiche_titre($langs->trans("Security"), '', 'title_setup');
@@ -78,7 +75,7 @@ else {
print ' ';
print ' ';
-print load_fiche_titre($langs->trans("ConfigFile"), '', 'folder');
+print load_fiche_titre($langs->trans("ConfigurationFile"), '', 'folder');
print ''.$langs->trans("dolibarr_main_prod").': '.$dolibarr_main_prod;
if (empty($dolibarr_main_prod)) {
@@ -90,7 +87,12 @@ print ''.$langs->trans("dolibarr_nocsrfcheck").': '.$dolibarr_n
if (!empty($dolibarr_nocsrfcheck)) {
print img_picto('', 'warning').' '.$langs->trans("IfYouAreOnAProductionSetThis", 0);
}
+print ' ';
+print ''.$langs->trans("dolibarr_main_restrict_ip").': '.$dolibarr_main_restrict_ip;
+/*if (empty($dolibarr_main_restrict_ip)) {
+ print ' '.img_picto('', 'warning').' '.$langs->trans("IfYouAreOnAProductionSetThis", 1);
+}*/
print ' ';
print ' ';
@@ -102,9 +104,17 @@ print ''.$langs->trans("PermissionsOnFilesInWebRoot").': ';
print 'TODO';
print ' ';
-print ''.$langs->trans("PermissionsOnFile", 'conf.php').': ';
-// TODO Check permission on file conf.php (read only for the web user)
-print 'TODO';
+print ''.$langs->trans("PermissionsOnFile", $conffile).': '; // $conffile is defined into filefunc.inc.php
+$perms = fileperms($dolibarr_main_document_root.'/'.$conffile);
+if ($perms) {
+ if (($perms & 0x0004) || ($perms & 0x0002)) {
+ print img_warning().' '.$langs->trans("ConfFileIsReadableOrWritableByAnyUsers");
+ } else {
+ print img_picto('', 'tick');
+ }
+} else {
+ print img_warning().' '.$langs->trans("FailedToReadFile", $conffile);
+}
print ' ';
print ' ';
@@ -137,14 +147,15 @@ print ' ';
print load_fiche_titre($langs->trans("Menu").' '.$langs->trans("SecuritySetup"), '', 'folder');
//print ''.$langs->trans("PasswordEncryption").': ';
-print 'MAIN_SECURITY_HASH_ALGO = '.(empty($conf->global->MAIN_SECURITY_HASH_ALGO) ? 'unset' : '')." ";
+print 'MAIN_SECURITY_HASH_ALGO = '.(empty($conf->global->MAIN_SECURITY_HASH_ALGO) ? $langs->trans("Undefined") : '')." ";
print ' If unset: \'md5\' ';
print ' - Recommanded value: \'password_hash\' ';
-print 'MAIN_SECURITY_SALT = '.$conf->global->MAIN_SECURITY_SALT.' ';
+print 'MAIN_SECURITY_SALT = '.(empty($conf->global->MAIN_SECURITY_SALT) ? $langs->trans("Undefined") : '').' ';
print ' ';
// TODO
print ''.$langs->trans("AntivirusEnabledOnUpload").': ';
+print empty($conf->global->MAIN_ANTIVIRUS_COMMAND) ? '' : img_picto('', 'tick').' ';
print yn($conf->global->MAIN_ANTIVIRUS_COMMAND ? 1 : 0);
if (!empty($conf->global->MAIN_ANTIVIRUS_COMMAND)) {
print ' - '.$conf->global->MAIN_ANTIVIRUS_COMMAND;
diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php
index 84d4ddc3679..85a45e9ff45 100644
--- a/htdocs/api/class/api_setup.class.php
+++ b/htdocs/api/class/api_setup.class.php
@@ -643,7 +643,7 @@ class Setup extends DolibarrApi
public function getListOfShipmentMethods($sortfield = "rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
{
$list = array();
- $sql = "SELECT t.rowid, t.code, t.libelle, t.description, t.tracking";
+ $sql = "SELECT t.rowid, t.code, t.libelle as label, t.description, t.tracking";
$sql .= " FROM ".MAIN_DB_PREFIX."c_shipment_mode as t";
$sql .= " WHERE t.active = ".$active;
// Add sql filters
diff --git a/htdocs/asset/card.php b/htdocs/asset/card.php
index 58307781cf2..96cb7baff73 100644
--- a/htdocs/asset/card.php
+++ b/htdocs/asset/card.php
@@ -125,38 +125,18 @@ if (empty($reshook))
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
}
-
-
-
/*
* View
*
- * Put here all code to build page
*/
$form = new Form($db);
$formfile = new FormFile($db);
-$title = $langs->trans("Assets").' - '.$langs->trans("Card");
+$title = $langs->trans("Asset").' - '.$langs->trans("Card");
$help_url = '';
llxHeader('', $title, $help_url);
-// Example : Adding jquery code
-print '';
-
-
// Part to create
if ($action == 'create')
{
@@ -240,14 +220,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Confirmation to delete
if ($action == 'delete')
{
- $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteAssets'), $langs->trans('ConfirmDeleteAssets'), 'confirm_delete', '', 0, 1);
- }
-
- // Confirmation of action xxxx
- if ($action == 'xxx')
- {
- $formquestion = array();
- $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220);
+ $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteAssets'), $langs->trans('ConfirmDeleteAsset'), 'confirm_delete', '', 0, 1);
}
// Call Hook formConfirm
@@ -292,28 +265,24 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print ' ';
print ' ';
- print '';
- print '';
print '';
print dol_get_fiche_end();
- // Buttons for actions
- if ($action != 'presend' && $action != 'editline') {
- print ''."\n";
+ /*
+ * Buttons
+ */
+ if ($user->socid == 0)
+ {
+ print ' '."\n";
- }
-
-
- // Select mail models is same action as presend
- if (GETPOST('modelselected')) {
- $action = 'presend';
+ print " ";
}
if ($action != 'presend')
@@ -343,27 +306,23 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print ''; // ancre
// Documents
- /*$objref = dol_sanitizeFileName($object->ref);
- $relativepath = $comref . '/' . $comref . '.pdf';
- $filedir = $conf->asset->dir_output . '/' . $objref;
- $urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id;
+ $filename = dol_sanitizeFileName($object->ref);
+ $filedir = $conf->contrat->dir_output."/".dol_sanitizeFileName($object->ref);
+ $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
$genallowed = $user->rights->asset->read; // If you can read, you can build the PDF to read content
- $delallowed = $user->rights->asset->create; // If you can create/edit, you can remove a file on card
- print $formfile->showdocuments('asset', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang);
- */
+ $delallowed = $user->rights->asset->write; // If you can create/edit, you can remove a file on card
+
+ print $formfile->showdocuments('asset', $filename, $filedir, $urlsource, 0, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang);
// Show links to link elements
$linktoelem = $form->showLinkToObjectBlock($object, null, array('asset'));
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
-
print '';
$MAXEVENT = 10;
- $morehtmlright = ' ';
- $morehtmlright .= $langs->trans("SeeAll");
- $morehtmlright .= '';
+ $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-list-alt imgforviewmode', DOL_URL_ROOT.'/asset/info.php?id='.$object->id);
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
@@ -372,19 +331,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print ' ';
}
-
- //Select mail models is same action as presend
- if (GETPOST('modelselected')) $action = 'presend';
-
- // Presend form
- /*
- $modelmail='asset';
- $defaulttopic='InformationMessage';
- $diroutput = $conf->asset->dir_output.'/asset';
- $trackid = 'asset'.$object->id;
-
- include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
- */
}
diff --git a/htdocs/asset/document.php b/htdocs/asset/document.php
index 4c2e36aed9a..32a4163dd12 100644
--- a/htdocs/asset/document.php
+++ b/htdocs/asset/document.php
@@ -1,6 +1,6 @@
- * Copyright (C) 2018 Alexandre Spangaro
+ * Copyright (C) 2018-2021 Alexandre Spangaro
*
* 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
@@ -19,7 +19,7 @@
/**
* \file htdocs/asset/document.php
* \ingroup asset
- * \brief Tab for documents linked to Assets
+ * \brief Page for attached files on assets
*/
require '../main.inc.php';
@@ -31,18 +31,21 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
// Load translation files required by the page
-$langs->loadLangs(array("assets", "companies"));
+$langs->loadLangs(array('assets', 'companies', 'other'));
-$action = GETPOST('action', 'aZ09');
-$confirm = GETPOST('confirm');
-$id = (GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int'));
+$id = (GETPOST('id', 'int') ?GETPOST('id', 'int') : GETPOST('facid', 'int')); // For backward compatibility
$ref = GETPOST('ref', 'alpha');
+$socid = GETPOST('socid', 'int');
+$action = GETPOST('action', 'aZ09');
+$confirm = GETPOST('confirm', 'alpha');
-// Security check - Protection if external user
-//if ($user->socid > 0) accessforbidden();
-//if ($user->socid > 0) $socid = $user->socid;
-//$result = restrictedArea($user, 'asset', $id);
+// Security check
+if ($user->socid)
+{
+ $socid = $user->socid;
+}
+$result=restrictedArea($user, 'asset', $id, '');
// Get parameters
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
@@ -56,100 +59,79 @@ $pagenext = $page + 1;
if (!$sortorder) $sortorder = "ASC";
if (!$sortfield) $sortfield = "name";
-// Initialize technical objects
$object = new Asset($db);
-$extrafields = new ExtraFields($db);
-$diroutputmassaction = $conf->assets->dir_output.'/temp/massgeneration/'.$user->id;
-$hookmanager->initHooks(array('assetdocument')); // Note that conf->hooks_modules contains array
-
-// Fetch optionals attributes and labels
-$extrafields->fetch_name_optionals_label($object->table_element);
-
-// Load object
-include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
-
-// Security check
-if (!empty($user->socid)) $socid = $user->socid;
-$result = restrictedArea($user, 'asset', $id);
-
-//if ($id > 0 || ! empty($ref)) $upload_dir = $conf->sellyoursaas->multidir_output[$object->entity] . "/packages/" . dol_sanitizeFileName($object->id);
-if ($id > 0 || !empty($ref)) $upload_dir = $conf->sellyoursaas->multidir_output[$object->entity]."/packages/".dol_sanitizeFileName($object->ref);
-
+if ($object->fetch($id))
+{
+ $upload_dir = $conf->asset->dir_output."/".dol_sanitizeFileName($object->ref);
+}
/*
* Actions
*/
-include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
+include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
/*
* View
*/
+$title = $langs->trans('Assets')." - ".$langs->trans('Documents');
+$helpurl = '';
+llxHeader('', $title, $helpurl);
+
$form = new Form($db);
-$title = $langs->trans("Assets").' - '.$langs->trans("Files");
-$help_url = '';
-//$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
-llxHeader('', $title, $help_url);
-if ($object->id)
+
+if ($id > 0 || !empty($ref))
{
- /*
- * Show tabs
- */
- if (!empty($conf->notification->enabled)) $langs->load("mails");
- $head = asset_prepare_head($object);
-
- print dol_get_fiche_head($head, 'document', $langs->trans("Asset"), -1, 'generic');
-
-
- // Build file list
- $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
- $totalsize = 0;
- foreach ($filearray as $key => $file)
+ if ($object->fetch($id, $ref) > 0)
{
- $totalsize += $file['size'];
+ $upload_dir = $conf->asset->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref);
+
+ $head = asset_prepare_head($object);
+ print dol_get_fiche_head($head, 'documents', $langs->trans('Asset'), -1, 'accounting');
+
+ // Build file list
+ $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
+ $totalsize = 0;
+ foreach ($filearray as $key => $file)
+ {
+ $totalsize += $file['size'];
+ }
+
+ // Asset content
+
+ $linkback = ''.$langs->trans("BackToList").'';
+
+ $morehtmlref = '';
+ dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0);
+
+ print '';
+ print ' ';
+
+ print ' ';
+
+ print '| '.$langs->trans("NbOfAttachedFiles").' | '.count($filearray).' | ';
+ print '| '.$langs->trans("TotalSizeOfAttachedFiles").' | '.dol_print_size($totalsize, 1, 1).' | ';
+ print " \n";
+
+ print " \n";
+
+ print dol_get_fiche_end();
+
+ $modulepart = 'asset';
+ $permission = $user->rights->asset->write;
+ $permtoedit = $user->rights->asset->write;
+ $param = '&id='.$object->id;
+ include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
+ } else {
+ dol_print_error($db);
}
-
- // Object card
- // ------------------------------------------------------------
- $linkback = ''.$langs->trans("BackToList").'';
-
- dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
-
- print '';
-
- print ' ';
- print ' ';
-
- // Number of files
- print '| '.$langs->trans("NbOfAttachedFiles").' | '.count($filearray).' | ';
-
- // Total size
- print '| '.$langs->trans("TotalSizeOfAttachedFiles").' | '.$totalsize.' '.$langs->trans("bytes").' | ';
-
- print ' ';
-
- print ' ';
-
- print dol_get_fiche_end();
-
- $modulepart = 'asset';
- //$permission = $user->rights->asset->create;
- $permission = 1;
- //$permtoedit = $user->rights->asset->create;
- $permtoedit = 1;
- $param = '&id='.$object->id;
-
- //$relativepathwithnofile='asset/' . dol_sanitizeFileName($object->id).'/';
- $relativepathwithnofile = 'asset/'.dol_sanitizeFileName($object->ref).'/';
-
- include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
} else {
- accessforbidden('', 0, 1);
+ print $langs->trans("ErrorUnknown");
}
// End of page
diff --git a/htdocs/asset/type.php b/htdocs/asset/type.php
index fecebb676a8..38969d65182 100644
--- a/htdocs/asset/type.php
+++ b/htdocs/asset/type.php
@@ -157,7 +157,7 @@ if ($action == 'update' && $user->rights->asset->write)
if ($ret >= 0 && !count($object->errors))
{
- setEventMessages($langs->trans("AssetsTypeModified"), null, 'mesgs');
+ setEventMessages($langs->trans("AssetTypeModified"), null, 'mesgs');
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
diff --git a/htdocs/barcode/printsheet.php b/htdocs/barcode/printsheet.php
index 8a513034a4a..2a3a13cca69 100644
--- a/htdocs/barcode/printsheet.php
+++ b/htdocs/barcode/printsheet.php
@@ -22,6 +22,11 @@
* \ingroup member
* \brief Page to print sheets with barcodes using the document templates into core/modules/printsheets
*/
+
+if (!empty($_POST['mode']) && $_POST['mode'] === 'label') { // Page is called to build a PDF and output, we must ne renew the token.
+ if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
+}
+
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/format_cards.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@@ -237,16 +242,22 @@ if ($action == 'builddoc')
$outfile = $langs->trans("BarCode").'_sheets_'.dol_print_date(dol_now(), 'dayhourlog').'.pdf';
- if (!$mesg) $result = doc_label_pdf_create($db, $arrayofrecords, $modellabel, $outputlangs, $diroutput, $template, dol_sanitizeFileName($outfile));
+ if (!$mesg) {
+ $outputlangs = $langs;
+
+ // This generates and send PDF to output
+ // TODO Move
+ $result = doc_label_pdf_create($db, $arrayofrecords, $modellabel, $outputlangs, $diroutput, $template, dol_sanitizeFileName($outfile));
+ }
}
- if ($result <= 0)
- {
- dol_print_error('', $result);
- }
+ if ($result <= 0 || $mesg) {
+ if (empty($mesg)) {
+ $mesg = 'Error '.$result;
+ }
- if (!$mesg)
- {
+ setEventMessages($mesg, null, 'errors');
+ } else {
$db->close();
exit;
}
@@ -275,10 +286,10 @@ dol_htmloutput_errors($mesg);
//print img_picto('','puce').' '.$langs->trans("PrintsheetForOneBarCode").' ';
//print ' ';
-print ' | |