Merge remote-tracking branch 'Dolibarr/develop' into develop_mo_pmp

This commit is contained in:
Francis Appels 2021-02-09 10:51:34 +01:00
commit d29fa04930
285 changed files with 5295 additions and 2212 deletions

View File

@ -105,8 +105,8 @@ if (empty($includecustom)) {
}
}
print "Release : ".$release."\n";
print "Working on files into : ".DOL_DOCUMENT_ROOT."\n";
print "Release : ".$release."\n";
print "Include custom in signature : ".$includecustom."\n";
print "Include constants in signature : ";
foreach ($includeconstants as $countrycode => $tmp) {

View File

@ -400,7 +400,7 @@ if ($conf->product->enabled)
print img_picto($langs->trans("Activated"), 'switch_on');
print '</a></td>';
} else {
print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setbarcodeproducto&amp;token='.newToken().'&amp;value='.urlencode($file).'">';
print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setbarcodeproducton&amp;token='.newToken().'&amp;value='.urlencode($file).'">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>';
}

View File

@ -668,7 +668,7 @@ Whet is definition of "shippable" according to all different STOCK_CALCULATE_...
print '<tr class="oddeven">';
print '<td>'.$langs->trans("ShippableOrderIconInList").'</td>';
print '<td>&nbsp</td>';
print '<td>&nbsp;</td>';
print '<td class="center">';
if (!empty($conf->global->SHIPPABLE_ORDER_ICON_IN_LIST)) {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=setshippableiconinlist&amp;token='.newToken().'&amp;value=0">';
@ -687,7 +687,7 @@ if ($conf->banque->enabled)
{
print '<tr class="oddeven"><td>';
print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_ORDER").'</td><td>&nbsp</td><td class="center">';
print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_ORDER").'</td><td>&nbsp;</td><td class="center">';
if (! empty($conf->use_javascript_ajax))
{
print ajax_constantonoff('BANK_ASK_PAYMENT_BANK_DURING_ORDER');
@ -717,7 +717,7 @@ if ($conf->stock->enabled)
{
print '<tr class="oddeven"><td>';
print $langs->trans("WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER").'</td><td>&nbsp</td><td class="center">';
print $langs->trans("WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER").'</td><td>&nbsp;</td><td class="center">';
if (! empty($conf->use_javascript_ajax))
{
print ajax_constantonoff('WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER');

View File

@ -215,8 +215,7 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha'))
if ($_POST["optionlocaltax1"] == "localtax1on")
{
if (!isset($_REQUEST['lt1']))
{
if (!GETPOSTISSET('lt1')) {
dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX1", 0, 'chaine', 0, '', $conf->entity);
} else {
dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX1", GETPOST('lt1', 'aZ09'), 'chaine', 0, '', $conf->entity);
@ -225,8 +224,7 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha'))
}
if ($_POST["optionlocaltax2"] == "localtax2on")
{
if (!isset($_REQUEST['lt2']))
{
if (!GETPOSTISSET('lt2')) {
dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX2", 0, 'chaine', 0, '', $conf->entity);
} else {
dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX2", GETPOST('lt2', 'aZ09'), 'chaine', 0, '', $conf->entity);
@ -236,7 +234,9 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha'))
if (!$error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
if (GETPOST('save')) { // To avoid to show message when we juste switch the country that resubmit the form.
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
$db->commit();
} else {
$db->rollback();

View File

@ -33,7 +33,9 @@ $langs->load("admin");
if (!$user->admin) accessforbidden();
$action = GETPOST('action', 'aZ09');
if (empty($action)) $action = 'edit';
// Define list of managed delays
$modules = array(
'agenda' => array(
array(
@ -190,6 +192,10 @@ if ($action == 'update')
for ($i = 0; $i < 4; $i++) {
if (GETPOSTISSET('MAIN_METEO'.$plus.'_LEVEL'.$i)) dolibarr_set_const($db, 'MAIN_METEO'.$plus.'_LEVEL'.$i, GETPOST('MAIN_METEO'.$plus.'_LEVEL'.$i, 'int'), 'chaine', 0, '', $conf->entity);
}
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
$action = 'edit';
}

View File

@ -799,11 +799,15 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$keycode = $listfieldvalue[$i];
if (empty($keycode)) $keycode = $value;
if ($value == 'price' || preg_match('/^amount/i', $value) || $value == 'taux') {
$_POST[$keycode] = price2num($_POST[$keycode], 'MU');
} elseif ($value == 'entity') {
$_POST[$keycode] = getEntity($tabname[$id]);
}
if ($value == 'price' || preg_match('/^amount/i', $value)) {
$_POST[$keycode] = price2num(GETPOST($keycode), 'MU');
}
elseif ($value == 'taux' || $value == 'localtax1' || $value == 'localtax2') {
$_POST[$keycode] = price2num(GETPOST($keycode), 8);
}
elseif ($value == 'entity') {
$_POST[$keycode] = getEntity($tabname[$id]);
}
if ($i) $sql .= ",";
@ -823,11 +827,11 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
}
$sql .= ",1)";
dol_syslog("actionadd", LOG_DEBUG);
$result = $db->query($sql);
if ($result) // Add is ok
{
setEventMessages($langs->transnoentities("RecordCreatedSuccessfully"), null, 'mesgs');
dol_syslog("actionadd", LOG_DEBUG);
$result = $db->query($sql);
if ($result) // Add is ok
{
setEventMessages($langs->transnoentities("RecordCreatedSuccessfully"), null, 'mesgs');
// Clean $_POST array, we keep only id of dictionary
if ($id == 10 && GETPOST('country', 'int') > 0) {
@ -862,11 +866,15 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$keycode = $listfieldvalue[$i];
if (empty($keycode)) $keycode = $field;
if ($field == 'price' || preg_match('/^amount/i', $field) || $field == 'taux') {
$_POST[$keycode] = price2num($_POST[$keycode], 'MU');
} elseif ($field == 'entity') {
$_POST[$keycode] = getEntity($tabname[$id]);
}
if ($field == 'price' || preg_match('/^amount/i', $field)) {
$_POST[$keycode] = price2num(GETPOST($keycode), 'MU');
}
elseif ($field == 'taux' || $field == 'localtax1' || $field == 'localtax2') {
$_POST[$keycode] = price2num(GETPOST($keycode), 8);
}
elseif ($field == 'entity') {
$_POST[$keycode] = getEntity($tabname[$id]);
}
if ($i) $sql .= ",";
$sql .= $field."=";

View File

@ -416,7 +416,10 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if (function_exists('imap_open'))
{
$connectstringserver = $object->getConnectStringIMAP();
// Note: $object->host has been loaded by the fetch
$usessl = 1;
$connectstringserver = $object->getConnectStringIMAP($usessl);
try {
if ($sourcedir) {

View File

@ -472,22 +472,22 @@ if ($nbofactivatedmodules <= 1) {
print load_fiche_titre($langs->trans("ModulesSetup"), '', 'title_setup');
// Start to show page
$deschelp = '';
if ($mode == 'common' || $mode == 'commonkanban') {
$desc = $langs->trans("ModulesDesc", '{picto}');
$desc = str_replace('{picto}', img_picto('', 'switch_off'), $desc);
print '<span class="opacitymedium hideonsmartphone">'.$desc."<br><br></span>\n";
$deschelp = '<span class="opacitymedium hideonsmartphone">'.$desc."<br><br></span>\n";
}
if ($mode == 'marketplace') {
print '<span class="opacitymedium hideonsmartphone">'.$langs->trans("ModulesMarketPlaceDesc")."<br><br></span>\n";
$deschelp = '<span class="opacitymedium hideonsmartphone">'.$langs->trans("ModulesMarketPlaceDesc")."<br><br></span>\n";
}
if ($mode == 'deploy') {
print '<span class="opacitymedium hideonsmartphone">'.$langs->trans("ModulesDeployDesc", $langs->transnoentitiesnoconv("AvailableModules"))."<br><br></span>\n";
$deschelp = '<span class="opacitymedium hideonsmartphone">'.$langs->trans("ModulesDeployDesc", $langs->transnoentitiesnoconv("AvailableModules"))."<br><br></span>\n";
}
if ($mode == 'develop') {
print '<span class="opacitymedium hideonsmartphone">'.$langs->trans("ModulesDevelopDesc")."<br><br></span>\n";
$deschelp = '<span class="opacitymedium hideonsmartphone">'.$langs->trans("ModulesDevelopDesc")."<br><br></span>\n";
}
$head = modules_prepare_head();
@ -512,6 +512,8 @@ if ($mode == 'common' || $mode == 'commonkanban') {
print dol_get_fiche_head($head, 'modules', '', -1);
print $deschelp;
$moreforfilter = '<div class="valignmiddle">';
$moreforfilter .= '<div class="floatright right pagination"><ul><li>';
@ -937,6 +939,8 @@ if ($mode == 'common' || $mode == 'commonkanban') {
if ($mode == 'marketplace') {
print dol_get_fiche_head($head, $mode, '', -1);
print $deschelp;
print '<br>';
// Marketplace
@ -1022,6 +1026,8 @@ if ($mode == 'marketplace') {
if ($mode == 'deploy') {
print dol_get_fiche_head($head, $mode, '', -1);
print $deschelp;
$dolibarrdataroot = preg_replace('/([\\/]+)$/i', '', DOL_DATA_ROOT);
$allowonlineinstall = true;
$allowfromweb = 1;
@ -1192,6 +1198,8 @@ if ($mode == 'deploy') {
if ($mode == 'develop') {
print dol_get_fiche_head($head, $mode, '', -1);
print $deschelp;
print '<br>';
// Marketplace

View File

@ -157,9 +157,7 @@ foreach ($dirmodels as $reldir)
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
if ($module->isEnabled())
{
$var = !$var;
if ($module->isEnabled()) {
print '<tr class="oddeven"><td width="100">';
echo preg_replace('/\-.*$/', '', preg_replace('/mod_payment_/', '', preg_replace('/\.php$/', '', $file)));
print "</td><td>\n";

View File

@ -281,9 +281,7 @@ foreach ($dirmodels as $reldir)
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0;
if ($modulequalified)
{
$var = !$var;
if ($modulequalified) {
print '<tr class="oddeven"><td width="100">';
print (empty($module->name)?$name:$module->name);
print "</td><td>\n";

View File

@ -287,9 +287,7 @@ foreach ($dirmodels as $reldir)
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0;
if ($modulequalified)
{
$var = !$var;
if ($modulequalified) {
print '<tr class="oddeven"><td width="100">';
print (empty($module->name)?$name:$module->name);
print "</td><td>\n";

View File

@ -383,9 +383,7 @@ foreach ($dirmodels as $reldir)
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0;
if ($modulequalified)
{
$var = !$var;
if ($modulequalified) {
print '<tr class="oddeven"><td width="100">';
print (empty($module->name) ? $name : $module->name);
print "</td><td>\n";
@ -654,7 +652,7 @@ if ($conf->banque->enabled)
{
print '<tr class="oddeven"><td>';
print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL").'</td><td>&nbsp</td><td class="right">';
print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL").'</td><td>&nbsp;</td><td class="right">';
if (! empty($conf->use_javascript_ajax))
{
print ajax_constantonoff('BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL');

View File

@ -485,7 +485,7 @@ if ($conf->banque->enabled)
{
print '<tr class="oddeven"><td>';
print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER").'</td><td>&nbsp</td><td align="center">';
print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER").'</td><td>&nbsp;</td><td align="center">';
if (! empty($conf->use_javascript_ajax))
{
print ajax_constantonoff('BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER');

View File

@ -511,7 +511,7 @@ print '</form>';
if ($conf->banque->enabled)
{
print '<tr class="oddeven"><td>';
print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL").'</td><td>&nbsp</td><td class="right">';
print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL").'</td><td>&nbsp;</td><td class="right">';
if (!empty($conf->use_javascript_ajax))
{
print ajax_constantonoff('BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL');

View File

@ -73,7 +73,7 @@ print load_fiche_titre($title, '', 'title_setup');
// Version
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Version").'</td><td>'.$langs->trans("Value").'</td></tr>'."\n";
print '<tr class="liste_titre"><td class="titlefieldcreate">'.$langs->trans("Version").'</td><td>'.$langs->trans("Value").'</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("CurrentVersion").' ('.$langs->trans("Programs").')</td><td>'.DOL_VERSION;
// If current version differs from last upgrade
if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE))
@ -139,7 +139,7 @@ print '<br>';
// Session
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Session").'</td><td colspan="2">'.$langs->trans("Value").'</td></tr>'."\n";
print '<tr class="liste_titre"><td class="titlefieldcreate">'.$langs->trans("Session").'</td><td colspan="2">'.$langs->trans("Value").'</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("SessionSavePath").'</td><td colspan="2">'.session_save_path().'</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("SessionName").'</td><td colspan="2">'.session_name().'</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("SessionId").'</td><td colspan="2">'.session_id().'</td></tr>'."\n";
@ -180,7 +180,7 @@ if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_S
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td class="titlefield">'.$langs->trans("LanguageFilesCachedIntoShmopSharedMemory").'</td>';
print '<td class="titlefieldcreate">'.$langs->trans("LanguageFilesCachedIntoShmopSharedMemory").'</td>';
print '<td>'.$langs->trans("NbOfEntries").'</td>';
print '<td class="right">'.$langs->trans("Address").'</td>';
print '</tr>'."\n";
@ -202,7 +202,7 @@ if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_S
// Localisation
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>'.$langs->trans("LocalisationDolibarrParameters").'</td><td>'.$langs->trans("Value").'</td></tr>'."\n";
print '<tr class="liste_titre"><td class="titlefieldcreate">'.$langs->trans("LocalisationDolibarrParameters").'</td><td>'.$langs->trans("Value").'</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("LanguageBrowserParameter", "HTTP_ACCEPT_LANGUAGE").'</td><td>'.$_SERVER["HTTP_ACCEPT_LANGUAGE"].'</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("CurrentUserLanguage").'</td><td>'.$langs->getDefaultLang().'</td></tr>'."\n";
// Thousands
@ -342,7 +342,7 @@ $configfileparameters = array(
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td class="titlefield">'.$langs->trans("Parameters").' ';
print '<td class="titlefieldcreate">'.$langs->trans("Parameters").' ';
print $langs->trans("ConfigurationFile").' ('.$conffiletoshowshort.')';
print '</td>';
print '<td>'.$langs->trans("Parameter").'</td>';

View File

@ -93,13 +93,13 @@ if ($maxphp > 0 && $maxphp2 > 0 && $maxphp > $maxphp2)
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
$ErrorPicturePath = "../../theme/eldy/img/error.png";
$WarningPicturePath = "../../theme/eldy/img/warning.png";
$OkayPicturePath = "../../theme/eldy/img/tick.png";
print '<tr><td width="220">'.$langs->trans("Version").'</td><td>';
print '<tr><td>'.$langs->trans("Version").'</td><td>';
$arrayphpminversionerror = array(5, 5, 0);
$arrayphpminversionwarning = array(5, 6, 0);
@ -153,11 +153,8 @@ $loadedExtensions = array_map('strtolower', get_loaded_extensions(false));
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td width="200">'.$langs->trans("Extension").'</td>';
//print '<td align="center">'.$langs->trans("EnabledInSetup").'</td>';
print '<td align="center">'.$langs->trans("Loaded").'</td>';
print '<td align="center">'.$langs->trans("FunctionTest").'</td>';
print '<td>'.$langs->trans("Result").'</td>';
print '<td class="titlefield">'.$langs->trans("Extension").'</td>';
print '<td>'.$langs->trans("Test").'</td>';
print '</tr>';
$functions = ["mb_check_encoding"];
@ -165,9 +162,6 @@ $name = "MBString";
print "<tr>";
print "<td>".$name."</td>";
//print getTableColumn($name, $activatedExtensions);
print getTableColumn($name, $loadedExtensions);
print getTableColumnFunction($functions);
print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
print "</tr>";
@ -176,9 +170,6 @@ $name = "JSON";
print "<tr>";
print "<td>".$name."</td>";
//print getTableColumn($name, $activatedExtensions);
print getTableColumn($name, $loadedExtensions);
print getTableColumnFunction($functions);
print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
print "</tr>";
@ -187,8 +178,6 @@ $name = "GD";
print "<tr>";
print "<td>".$name."</td>";
print getTableColumn($name, $loadedExtensions);
print getTableColumnFunction($functions);
print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
print "</tr>";
@ -197,8 +186,6 @@ $name = "Curl";
print "<tr>";
print "<td>".$name."</td>";
print getTableColumn($name, $loadedExtensions);
print getTableColumnFunction($functions);
print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
print "</tr>";
@ -209,8 +196,6 @@ if (empty($_SERVER["SERVER_ADMIN"]) || $_SERVER["SERVER_ADMIN"] != 'doliwamp@loc
print "<tr>";
print "<td>".$name."</td>";
print getTableColumn($name, $loadedExtensions);
print getTableColumnFunction($functions);
print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
print "</tr>";
}
@ -220,8 +205,6 @@ $name = "IMAP";
print "<tr>";
print "<td>".$name."</td>";
print getTableColumn($name, $loadedExtensions);
print getTableColumnFunction($functions);
print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
print "</tr>";
@ -230,8 +213,6 @@ $name = "xDebug";
print "<tr>";
print "<td>".$name."</td>";
print getTableColumn($name, $loadedExtensions);
print getTableColumnFunction($functions);
print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
print "</tr>";
@ -246,7 +227,7 @@ foreach ($phparray as $key => $value)
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder">';
print '<tr class="liste_titre">';
print '<td width="220px">'.$key.'</td>';
print '<td class="titlefield">'.$key.'</td>';
print '<td colspan="2">'.$langs->trans("Value").'</td>';
print "</tr>\n";
@ -293,69 +274,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 = "<td align='center'>";
if (in_array($name, $list))
{
if ($name == 'xdebug') $html .= '<img src="../../theme/eldy/img/warning.png" title="'.$langs->trans("ModuleActivated", "xdebug").'">';
else $html .= '<img src="../../theme/eldy/img/tick.png" title="Ok">';
} else {
if ($name == 'xdebug') $html .= yn(0);
else $html .= '<img src="../../theme/eldy/img/warning.png" title="Warning">';
}
$html .= "</td>";
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 "<td align='center'>-</td>";
}
$result = true;
$html = "<td align='center'>";
foreach ($functions as $function)
{
$result = $result && function_exists($function);
}
if ($result)
{
$html .= '<img src="../../theme/eldy/img/tick.png" alt="Ok">';
} else {
$html .= '<img src="../../theme/eldy/img/warning.png" alt="Warning">';
}
$html .= "</td>";
return $html;
}
/**
* Return a result column with a translated result text
*
@ -363,7 +281,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)
@ -371,6 +288,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);
@ -380,7 +298,29 @@ function getResultColumn($name, array $activated, array $loaded, array $function
}
$html = "<td>";
$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 .= "</td>";
return $html;

View File

@ -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 '<br>';
print '<br>';
print load_fiche_titre($langs->trans("ConfigFile"), '', 'folder');
print load_fiche_titre($langs->trans("ConfigurationFile"), '', 'folder');
print '<strong>'.$langs->trans("dolibarr_main_prod").'</strong>: '.$dolibarr_main_prod;
if (empty($dolibarr_main_prod)) {
@ -90,7 +87,12 @@ print '<strong>'.$langs->trans("dolibarr_nocsrfcheck").'</strong>: '.$dolibarr_n
if (!empty($dolibarr_nocsrfcheck)) {
print img_picto('', 'warning').' &nbsp; '.$langs->trans("IfYouAreOnAProductionSetThis", 0);
}
print '<br>';
print '<strong>'.$langs->trans("dolibarr_main_restrict_ip").'</strong>: '.$dolibarr_main_restrict_ip;
/*if (empty($dolibarr_main_restrict_ip)) {
print ' &nbsp; '.img_picto('', 'warning').' '.$langs->trans("IfYouAreOnAProductionSetThis", 1);
}*/
print '<br>';
print '<br>';
@ -102,9 +104,17 @@ print '<strong>'.$langs->trans("PermissionsOnFilesInWebRoot").'</strong>: ';
print 'TODO';
print '<br>';
print '<strong>'.$langs->trans("PermissionsOnFile", 'conf.php').'</strong>: ';
// TODO Check permission on file conf.php (read only for the web user)
print 'TODO';
print '<strong>'.$langs->trans("PermissionsOnFile", $conffile).'</strong>: '; // $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 '<br>';
print '<br>';
@ -137,14 +147,15 @@ print '<br>';
print load_fiche_titre($langs->trans("Menu").' '.$langs->trans("SecuritySetup"), '', 'folder');
//print '<strong>'.$langs->trans("PasswordEncryption").'</strong>: ';
print '<strong>MAIN_SECURITY_HASH_ALGO</strong> = '.(empty($conf->global->MAIN_SECURITY_HASH_ALGO) ? 'unset' : '')." &nbsp; ";
print '<strong>MAIN_SECURITY_HASH_ALGO</strong> = '.(empty($conf->global->MAIN_SECURITY_HASH_ALGO) ? $langs->trans("Undefined") : '')." &nbsp; ";
print '<span class="opacitymedium"> &nbsp; If unset: \'md5\'</span> ';
print '<span class="opacitymedium"> - Recommanded value: \'password_hash\'</span><br>';
print '<strong>MAIN_SECURITY_SALT</strong> = '.$conf->global->MAIN_SECURITY_SALT.'<br>';
print '<strong>MAIN_SECURITY_SALT</strong> = '.(empty($conf->global->MAIN_SECURITY_SALT) ? $langs->trans("Undefined") : '').'<br>';
print '<br>';
// TODO
print '<strong>'.$langs->trans("AntivirusEnabledOnUpload").'</strong>: ';
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 ' &nbsp; - '.$conf->global->MAIN_ANTIVIRUS_COMMAND;

View File

@ -75,7 +75,7 @@ $tablib[1] = "Websites";
// Requests to extract data
$tabsql = array();
$tabsql[1] = "SELECT f.rowid as rowid, f.entity, f.ref, f.description, f.virtualhost, f.position, f.status FROM ".MAIN_DB_PREFIX.'website as f WHERE f.entity IN ('.getEntity('website').')';
$tabsql[1] = "SELECT f.rowid as rowid, f.entity, f.ref, f.description, f.virtualhost, f.position, f.status, f.date_creation FROM ".MAIN_DB_PREFIX.'website as f WHERE f.entity IN ('.getEntity('website').')';
// Criteria to sort dictionaries
$tabsqlsort = array();
@ -83,7 +83,7 @@ $tabsqlsort[1] = "ref ASC";
// Nom des champs en resultat de select pour affichage du dictionnaire
$tabfield = array();
$tabfield[1] = "ref,description,virtualhost,position";
$tabfield[1] = "ref,description,virtualhost,position,date_creation";
// Nom des champs d'edition pour modification d'un enregistrement
$tabfieldvalue = array();
@ -139,8 +139,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
$fieldnamekey = $listfield[$f];
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
break;
} elseif ($value == 'ref' && !preg_match('/^[a-z0-9_\-\.]+$/i', $_POST[$value]))
{
} elseif ($value == 'ref' && !preg_match('/^[a-z0-9_\-\.]+$/i', GETPOST($value))) {
$ok = 0;
$fieldnamekey = $listfield[$f];
setEventMessages($langs->transnoentities("ErrorFieldCanNotContainSpecialCharacters", $langs->transnoentities($fieldnamekey)), null, 'errors');
@ -149,9 +148,8 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
}
// Clean parameters
if (!empty($_POST['ref']))
{
$websitekey = strtolower($_POST['ref']);
if (GETPOST('ref')) {
$websitekey = strtolower(GETPOST('ref'));
}
// Si verif ok et action add, on ajoute la ligne
@ -441,6 +439,8 @@ if ($id)
print '<tr class="liste_titre">';
foreach ($fieldlist as $field => $value)
{
if ($fieldlist[$field] == 'date_creation') continue;
// Determine le nom du champ par rapport aux noms possibles
// dans les dictionnaires de donnees
$valuetoshow = ucfirst($fieldlist[$field]); // Par defaut
@ -534,6 +534,7 @@ if ($id)
if ($fieldlist[$field] == 'lang') { $valuetoshow = $langs->trans("Language"); }
if ($fieldlist[$field] == 'type') { $valuetoshow = $langs->trans("Type"); }
if ($fieldlist[$field] == 'code') { $valuetoshow = $langs->trans("Code"); }
if ($fieldlist[$field] == 'date_creation') { $valuetoshow = $langs->trans("DateCreation"); }
// Affiche nom du champ
if ($showfield)
@ -597,7 +598,7 @@ if ($id)
print "</td>";
// Modify link
print '<td align="center"><a class="reposition" href="'.$url.'action=edit&token='.newToken().'">'.img_edit().'</a></td>';
print '<td align="center"><a class="reposition editfielda" href="'.$url.'action=edit&token='.newToken().'">'.img_edit().'</a></td>';
// Delete link
if ($iserasable) print '<td align="center"><a class="reposition" href="'.$url.'action=delete&token='.newToken().'">'.img_delete().'</a></td>';
@ -646,6 +647,7 @@ function fieldListWebsites($fieldlist, $obj = '', $tabname = '', $context = '')
foreach ($fieldlist as $field => $value)
{
$fieldname = $fieldlist[$field];
if ($fieldlist[$field] == 'lang')
{
print '<td>';
@ -654,6 +656,8 @@ function fieldListWebsites($fieldlist, $obj = '', $tabname = '', $context = '')
} elseif ($fieldlist[$field] == 'code' && isset($obj->$fieldname)) {
print '<td><input type="text" class="flat" value="'.(!empty($obj->$fieldname) ? $obj->$fieldname : '').'" size="10" name="'.$fieldlist[$field].'"></td>';
} else {
if ($fieldlist[$field] == 'date_creation') continue;
print '<td>';
$size = '';
if ($fieldlist[$field] == 'code') $size = 'size="8" ';

View File

@ -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

View File

@ -77,6 +77,7 @@ if (preg_match('/del_(.*)/', $action, $reg))
$form = new Form($db);
$block_static = new BlockedLog($db);
$block_static->loadTrackedEvents();
llxHeader('', $langs->trans("BlockedLogSetup"));

View File

@ -43,6 +43,7 @@ $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '
$search_showonlyerrors = GETPOST('search_showonlyerrors', 'int');
if ($search_showonlyerrors < 0) $search_showonlyerrors = 0;
$search_id = GETPOST('search_id', 'alpha');
$search_fk_user = GETPOST('search_fk_user', 'intcomma');
$search_start = -1;
if (GETPOST('search_startyear') != '') $search_start = dol_mktime(0, 0, 0, GETPOST('search_startmonth'), GETPOST('search_startday'), GETPOST('search_startyear'));
@ -68,11 +69,20 @@ if (empty($sortfield)) $sortfield = 'rowid';
if (empty($sortorder)) $sortorder = 'DESC';
$block_static = new BlockedLog($db);
$block_static->loadTrackedEvents();
$result = restrictedArea($user, 'blockedlog', 0, '');
$max_execution_time_for_importexport = (empty($conf->global->EXPORT_MAX_EXECUTION_TIME) ? 300 : $conf->global->EXPORT_MAX_EXECUTION_TIME); // 5mn if not defined
$max_time = @ini_get("max_execution_time");
if ($max_time && $max_time < $max_execution_time_for_importexport)
{
dol_syslog("max_execution_time=".$max_time." is lower than max_execution_time_for_importexport=".$max_execution_time_for_importexport.". We try to increase it dynamically.");
@ini_set("max_execution_time", $max_execution_time_for_importexport); // This work only if safe mode is off. also web servers has timeout of 300
}
/*
* Actions
*/
@ -80,6 +90,7 @@ $result = restrictedArea($user, 'blockedlog', 0, '');
// Purge search criteria
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
{
$search_id = '';
$search_fk_user = '';
$search_start = -1;
$search_end = -1;
@ -263,7 +274,7 @@ llxHeader('', $langs->trans("BrowseBlockedLog"));
$MAXLINES = 10000;
$blocks = $block_static->getLog('all', 0, $MAXLINES, $sortfield, $sortorder, $search_fk_user, $search_start, $search_end, $search_ref, $search_amount, $search_code);
$blocks = $block_static->getLog('all', $search_id, $MAXLINES, $sortfield, $sortorder, $search_fk_user, $search_start, $search_end, $search_ref, $search_amount, $search_code);
if (!is_array($blocks))
{
if ($blocks == -2)
@ -296,6 +307,7 @@ print '<br>';
$param = '';
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
if ($search_id != '') $param .= '&search_id='.urlencode($search_id);
if ($search_fk_user > 0) $param .= '&search_fk_user='.urlencode($search_fk_user);
if ($search_startyear > 0) $param .= '&search_startyear='.urlencode(GETPOST('search_startyear', 'int'));
if ($search_startmonth > 0) $param .= '&search_startmonth='.urlencode(GETPOST('search_startmonth', 'int'));
@ -355,7 +367,7 @@ print '<table class="noborder centpercent">';
// Line of filters
print '<tr class="liste_titre_filter">';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre"><input type="text" class="maxwidth50" name="search_id" value="'.dol_escape_htmltag($search_id).'"></td>';
print '<td class="liste_titre">';
//print $langs->trans("from").': ';
@ -433,12 +445,18 @@ if (!empty($conf->global->BLOCKEDLOG_SCAN_ALL_FOR_LOWERIDINERROR)) {
// This is version that optimize the memory (but will not report errors that are outside the filter range)
$loweridinerror = 0;
$checkresult = array();
$checkdetail = array();
if (is_array($blocks))
{
foreach ($blocks as &$block)
{
$checksignature = $block->checkSignature(); // Note: this make a sql request at each call, we can't avoid this as the sorting order is various
$tmpcheckresult = $block->checkSignature('', 1); // Note: this make a sql request at each call, we can't avoid this as the sorting order is various
$checksignature = $tmpcheckresult['checkresult'];
$checkresult[$block->id] = $checksignature; // false if error
$checkdetail[$block->id] = $tmpcheckresult;
if (!$checksignature)
{
if (empty($loweridinerror)) $loweridinerror = $block->id;
@ -450,13 +468,23 @@ if (!empty($conf->global->BLOCKEDLOG_SCAN_ALL_FOR_LOWERIDINERROR)) {
if (is_array($blocks))
{
$nbshown = 0;
$MAXFORSHOWLINK = 100;
$object_link = '';
foreach ($blocks as &$block)
{
$object_link = $block->getObjectLink();
//if (empty($search_showonlyerrors) || ! $checkresult[$block->id] || ($loweridinerror && $block->id >= $loweridinerror))
if (empty($search_showonlyerrors) || !$checkresult[$block->id])
{
$nbshown++;
if ($nbshown < $MAXFORSHOWLINK) { // For performance and memory purpose, we get/show the link of objects only for the 100 first output
$object_link = $block->getObjectLink();
} else {
$object_link = $block->element.'/'.$block->fk_object;
}
print '<tr class="oddeven">';
// ID
@ -475,7 +503,9 @@ if (is_array($blocks))
print '<td>'.$langs->trans('log'.$block->action).'</td>';
// Ref
print '<td class="nowrap">'.$block->ref_object.'</td>';
print '<td class="nowraponall">';
print $block->ref_object;
print '</td>';
// Link to source object
print '<td'.(preg_match('/<a/', $object_link) ? ' class="nowrap"' : '').'><!-- object_link -->'.$object_link.'</td>';
@ -488,19 +518,26 @@ if (is_array($blocks))
// Fingerprint
print '<td class="nowrap">';
print $form->textwithpicto(dol_trunc($block->signature, '8'), $block->signature, 1, 'help', '', 0, 2, 'fingerprint'.$block->id);
$texttoshow = $langs->trans("Fingerprint").' - '.$langs->trans("Saved").':<br>'.$block->signature;
$texttoshow .= '<br><br>'.$langs->trans("Fingerprint").' - Recalculated sha256(previoushash * data):<br>'.$checkdetail[$block->id]['calculatedsignature'];
$texttoshow .= '<br><span class="opacitymedium">'.$langs->trans("PreviousHash").'='.$checkdetail[$block->id]['previoushash'].'</span>';
//$texttoshow .= '<br>keyforsignature='.$checkdetail[$block->id]['keyforsignature'];
print $form->textwithpicto(dol_trunc($block->signature, '8'), $texttoshow, 1, 'help', '', 0, 2, 'fingerprint'.$block->id);
print '</td>';
// Status
print '<td class="center">';
if (!$checkresult[$block->id] || ($loweridinerror && $block->id >= $loweridinerror)) // If error
{
if ($checkresult[$block->id]) print img_picto($langs->trans('OkCheckFingerprintValidityButChainIsKo'), 'statut4');
else print img_picto($langs->trans('KoCheckFingerprintValidity'), 'statut8');
if ($checkresult[$block->id]) {
print '<span class="badge badge-status4 badge-status" title="'.$langs->trans('OkCheckFingerprintValidityButChainIsKo').'">OK</span>';
}
else {
print '<span class="badge badge-status8 badge-status" title="'.$langs->trans('KoCheckFingerprintValidity').'">KO</span>';
}
} else {
print img_picto($langs->trans('OkCheckFingerprintValidity'), 'statut4');
print '<span class="badge badge-status4 badge-status" title="'.$langs->trans('OkCheckFingerprintValidity').'">OK</span>';
}
print '</td>';
// Note
@ -520,6 +557,10 @@ if (is_array($blocks))
print '</tr>';
}
}
if ($nbshown == 0) {
print '<tr><td colspan="12"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
}
}
print '</table>';

View File

@ -124,69 +124,114 @@ class BlockedLog
*/
public function __construct(DoliDB $db)
{
global $conf;
$this->db = $db;
}
/**
* Load list of tracked events into $this->trackedevents.
*
* @return int Always 1
*/
public function loadTrackedEvents()
{
global $conf;
$this->trackedevents = array();
if ($conf->facture->enabled) $this->trackedevents['BILL_VALIDATE'] = 'logBILL_VALIDATE';
if ($conf->facture->enabled) $this->trackedevents['BILL_DELETE'] = 'logBILL_DELETE';
if ($conf->facture->enabled) $this->trackedevents['BILL_SENTBYMAIL'] = 'logBILL_SENTBYMAIL';
if ($conf->facture->enabled) $this->trackedevents['DOC_DOWNLOAD'] = 'BlockedLogBillDownload';
if ($conf->facture->enabled) $this->trackedevents['DOC_PREVIEW'] = 'BlockedLogBillPreview';
if ($conf->facture->enabled) $this->trackedevents['PAYMENT_CUSTOMER_CREATE'] = 'logPAYMENT_CUSTOMER_CREATE';
if ($conf->facture->enabled) $this->trackedevents['PAYMENT_CUSTOMER_DELETE'] = 'logPAYMENT_CUSTOMER_DELETE';
if ($conf->facture->enabled) {
$this->trackedevents['BILL_VALIDATE'] = 'logBILL_VALIDATE';
}
if ($conf->facture->enabled) {
$this->trackedevents['BILL_DELETE'] = 'logBILL_DELETE';
}
if ($conf->facture->enabled) {
$this->trackedevents['BILL_SENTBYMAIL'] = 'logBILL_SENTBYMAIL';
}
if ($conf->facture->enabled) {
$this->trackedevents['DOC_DOWNLOAD'] = 'BlockedLogBillDownload';
}
if ($conf->facture->enabled) {
$this->trackedevents['DOC_PREVIEW'] = 'BlockedLogBillPreview';
}
if ($conf->facture->enabled) {
$this->trackedevents['PAYMENT_CUSTOMER_CREATE'] = 'logPAYMENT_CUSTOMER_CREATE';
}
if ($conf->facture->enabled) {
$this->trackedevents['PAYMENT_CUSTOMER_DELETE'] = 'logPAYMENT_CUSTOMER_DELETE';
}
/* Supplier
if ($conf->fournisseur->enabled) $this->trackedevents['BILL_SUPPLIER_VALIDATE']='BlockedLogSupplierBillValidate';
if ($conf->fournisseur->enabled) $this->trackedevents['BILL_SUPPLIER_DELETE']='BlockedLogSupplierBillDelete';
if ($conf->fournisseur->enabled) $this->trackedevents['BILL_SUPPLIER_SENTBYMAIL']='BlockedLogSupplierBillSentByEmail'; // Trigger key does not exists, we want just into array to list it as done
if ($conf->fournisseur->enabled) $this->trackedevents['SUPPLIER_DOC_DOWNLOAD']='BlockedLogSupplierBillDownload'; // Trigger key does not exists, we want just into array to list it as done
if ($conf->fournisseur->enabled) $this->trackedevents['SUPPLIER_DOC_PREVIEW']='BlockedLogSupplierBillPreview'; // Trigger key does not exists, we want just into array to list it as done
if ($conf->fournisseur->enabled) $this->trackedevents['BILL_SUPPLIER_VALIDATE']='BlockedLogSupplierBillValidate';
if ($conf->fournisseur->enabled) $this->trackedevents['BILL_SUPPLIER_DELETE']='BlockedLogSupplierBillDelete';
if ($conf->fournisseur->enabled) $this->trackedevents['BILL_SUPPLIER_SENTBYMAIL']='BlockedLogSupplierBillSentByEmail'; // Trigger key does not exists, we want just into array to list it as done
if ($conf->fournisseur->enabled) $this->trackedevents['SUPPLIER_DOC_DOWNLOAD']='BlockedLogSupplierBillDownload'; // Trigger key does not exists, we want just into array to list it as done
if ($conf->fournisseur->enabled) $this->trackedevents['SUPPLIER_DOC_PREVIEW']='BlockedLogSupplierBillPreview'; // Trigger key does not exists, we want just into array to list it as done
if ($conf->fournisseur->enabled) $this->trackedevents['PAYMENT_SUPPLIER_CREATE']='BlockedLogSupplierBillPaymentCreate';
if ($conf->fournisseur->enabled) $this->trackedevents['PAYMENT_SUPPLIER_DELETE']='BlockedLogsupplierBillPaymentCreate';
*/
if ($conf->fournisseur->enabled) $this->trackedevents['PAYMENT_SUPPLIER_CREATE']='BlockedLogSupplierBillPaymentCreate';
if ($conf->fournisseur->enabled) $this->trackedevents['PAYMENT_SUPPLIER_DELETE']='BlockedLogsupplierBillPaymentCreate';
*/
if ($conf->don->enabled) $this->trackedevents['DON_VALIDATE'] = 'logDON_VALIDATE';
if ($conf->don->enabled) $this->trackedevents['DON_DELETE'] = 'logDON_DELETE';
if ($conf->don->enabled) {
$this->trackedevents['DON_VALIDATE'] = 'logDON_VALIDATE';
}
if ($conf->don->enabled) {
$this->trackedevents['DON_DELETE'] = 'logDON_DELETE';
}
//if ($conf->don->enabled) $this->trackedevents['DON_SENTBYMAIL']='logDON_SENTBYMAIL';
if ($conf->don->enabled) $this->trackedevents['DONATION_PAYMENT_CREATE'] = 'logDONATION_PAYMENT_CREATE';
if ($conf->don->enabled) $this->trackedevents['DONATION_PAYMENT_DELETE'] = 'logDONATION_PAYMENT_DELETE';
if ($conf->don->enabled) {
$this->trackedevents['DONATION_PAYMENT_CREATE'] = 'logDONATION_PAYMENT_CREATE';
}
if ($conf->don->enabled) {
$this->trackedevents['DONATION_PAYMENT_DELETE'] = 'logDONATION_PAYMENT_DELETE';
}
/*
if ($conf->salary->enabled) $this->trackedevents['PAYMENT_SALARY_CREATE']='BlockedLogSalaryPaymentCreate';
if ($conf->salary->enabled) $this->trackedevents['PAYMENT_SALARY_MODIFY']='BlockedLogSalaryPaymentCreate';
if ($conf->salary->enabled) $this->trackedevents['PAYMENT_SALARY_DELETE']='BlockedLogSalaryPaymentCreate';
*/
if ($conf->adherent->enabled) $this->trackedevents['MEMBER_SUBSCRIPTION_CREATE'] = 'logMEMBER_SUBSCRIPTION_CREATE';
if ($conf->adherent->enabled) $this->trackedevents['MEMBER_SUBSCRIPTION_MODIFY'] = 'logMEMBER_SUBSCRIPTION_MODIFY';
if ($conf->adherent->enabled) $this->trackedevents['MEMBER_SUBSCRIPTION_DELETE'] = 'logMEMBER_SUBSCRIPTION_DELETE';
if ($conf->banque->enabled) $this->trackedevents['PAYMENT_VARIOUS_CREATE'] = 'logPAYMENT_VARIOUS_CREATE';
if ($conf->banque->enabled) $this->trackedevents['PAYMENT_VARIOUS_MODIFY'] = 'logPAYMENT_VARIOUS_MODIFY';
if ($conf->banque->enabled) $this->trackedevents['PAYMENT_VARIOUS_DELETE'] = 'logPAYMENT_VARIOUS_DELETE';
if ($conf->salary->enabled) $this->trackedevents['PAYMENT_SALARY_CREATE']='BlockedLogSalaryPaymentCreate';
if ($conf->salary->enabled) $this->trackedevents['PAYMENT_SALARY_MODIFY']='BlockedLogSalaryPaymentCreate';
if ($conf->salary->enabled) $this->trackedevents['PAYMENT_SALARY_DELETE']='BlockedLogSalaryPaymentCreate';
*/
if ($conf->adherent->enabled) {
$this->trackedevents['MEMBER_SUBSCRIPTION_CREATE'] = 'logMEMBER_SUBSCRIPTION_CREATE';
}
if ($conf->adherent->enabled) {
$this->trackedevents['MEMBER_SUBSCRIPTION_MODIFY'] = 'logMEMBER_SUBSCRIPTION_MODIFY';
}
if ($conf->adherent->enabled) {
$this->trackedevents['MEMBER_SUBSCRIPTION_DELETE'] = 'logMEMBER_SUBSCRIPTION_DELETE';
}
if ($conf->banque->enabled) {
$this->trackedevents['PAYMENT_VARIOUS_CREATE'] = 'logPAYMENT_VARIOUS_CREATE';
}
if ($conf->banque->enabled) {
$this->trackedevents['PAYMENT_VARIOUS_MODIFY'] = 'logPAYMENT_VARIOUS_MODIFY';
}
if ($conf->banque->enabled) {
$this->trackedevents['PAYMENT_VARIOUS_DELETE'] = 'logPAYMENT_VARIOUS_DELETE';
}
// $conf->global->BANK_ENABLE_POS_CASHCONTROL must be set to 1 by all external POS modules
$moduleposenabled = (!empty($conf->cashdesk->enabled) || !empty($conf->takepos->enabled) || !empty($conf->global->BANK_ENABLE_POS_CASHCONTROL));
if ($moduleposenabled) $this->trackedevents['CASHCONTROL_VALIDATE'] = 'logCASHCONTROL_VALIDATE';
if ($moduleposenabled) {
$this->trackedevents['CASHCONTROL_VALIDATE'] = 'logCASHCONTROL_VALIDATE';
}
// Add more action to track from a conf variable
if (!empty($conf->global->BLOCKEDLOG_ADD_ACTIONS_SUPPORTED)) {
$tmparrayofmoresupportedevents = explode(',', $conf->global->BLOCKEDLOG_ADD_ACTIONS_SUPPORTED);
foreach ($tmparrayofmoresupportedevents as $val) {
$this->trackedevents[$val] = 'log'.$val;
}
}
return 1;
}
/**
* Try to retrieve source object (it it still exists)
* @return string
* Try to retrieve source object (it it still exists).
*
* @return string URL string of source object
*/
public function getObjectLink()
{
@ -396,7 +441,7 @@ class BlockedLog
'name', 'name_alias', 'ref_ext', 'address', 'zip', 'town', 'state_code', 'country_code', 'idprof1', 'idprof2', 'idprof3', 'idprof4', 'idprof5', 'idprof6', 'phone', 'fax', 'email', 'barcode',
'tva_intra', 'localtax1_assuj', 'localtax1_value', 'localtax2_assuj', 'localtax2_value', 'managers', 'capital', 'typent_code', 'forme_juridique_code', 'code_client', 'code_fournisseur'
))) continue; // Discard if not into a dedicated list
if (!is_object($value)) $this->object_data->thirdparty->{$key} = $value;
if (!is_object($value) && !is_null($value) && $value !== '') $this->object_data->thirdparty->{$key} = $value;
}
}
@ -412,7 +457,7 @@ class BlockedLog
'name', 'name_alias', 'ref_ext', 'address', 'zip', 'town', 'state_code', 'country_code', 'idprof1', 'idprof2', 'idprof3', 'idprof4', 'idprof5', 'idprof6', 'phone', 'fax', 'email', 'barcode',
'tva_intra', 'localtax1_assuj', 'localtax1_value', 'localtax2_assuj', 'localtax2_value', 'managers', 'capital', 'typent_code', 'forme_juridique_code', 'code_client', 'code_fournisseur'
))) continue; // Discard if not into a dedicated list
if (!is_object($value)) $this->object_data->mycompany->{$key} = $value;
if (!is_object($value) && !is_null($value) && $value !== '') $this->object_data->mycompany->{$key} = $value;
}
}
@ -448,10 +493,12 @@ class BlockedLog
$this->object_data->invoiceline[$lineid] = new stdClass();
}
$this->object_data->invoiceline[$lineid]->{$keyline} = $valueline;
if (!is_object($valueline) && !is_null($valueline) && $valueline !== '') {
$this->object_data->invoiceline[$lineid]->{$keyline} = $valueline;
}
}
}
} elseif (!is_object($value)) $this->object_data->{$key} = $value;
} elseif (!is_object($value) && !is_null($value) && $value !== '') $this->object_data->{$key} = $value;
}
if (!empty($object->newref)) $this->object_data->ref = $object->newref;
@ -463,7 +510,7 @@ class BlockedLog
if (!in_array($key, array(
'ref', 'ref_client', 'ref_supplier', 'date', 'datef', 'type', 'total_ht', 'total_tva', 'total_ttc', 'localtax1', 'localtax2', 'revenuestamp', 'datepointoftax', 'note_public'
))) continue; // Discard if not into a dedicated list
if (!is_object($value)) $this->object_data->{$key} = $value;
if (!is_object($value) && !is_null($value) && $value !== '') $this->object_data->{$key} = $value;
}
if (!empty($object->newref)) $this->object_data->ref = $object->newref;
@ -475,9 +522,10 @@ class BlockedLog
$this->object_data->ref = $object->ref;
$this->object_data->date = $datepayment;
$this->object_data->type_code = dol_getIdFromCode($this->db, $paymenttypeid, 'c_paiement', 'id', 'code');
$this->object_data->payment_num = $object->num_payment;
if (!empty($object->num_payment)) $this->object_data->payment_num = $object->num_payment;
if (!empty($object->note_private)) $this->object_data->note_private = $object->note_private;
//$this->object_data->fk_account = $object->fk_account;
$this->object_data->note = $object->note;
//var_dump($this->object_data);exit;
$totalamount = 0;
@ -555,7 +603,7 @@ class BlockedLog
'name', 'name_alias', 'ref_ext', 'address', 'zip', 'town', 'state_code', 'country_code', 'idprof1', 'idprof2', 'idprof3', 'idprof4', 'idprof5', 'idprof6', 'phone', 'fax', 'email', 'barcode',
'tva_intra', 'localtax1_assuj', 'localtax1_value', 'localtax2_assuj', 'localtax2_value', 'managers', 'capital', 'typent_code', 'forme_juridique_code', 'code_client', 'code_fournisseur'
))) continue; // Discard if not into a dedicated list
if (!is_object($value)) $paymentpart->thirdparty->{$key} = $value;
if (!is_object($value) && !is_null($value) && $value !== '') $paymentpart->thirdparty->{$key} = $value;
}
}
@ -571,8 +619,7 @@ class BlockedLog
if (!in_array($key, array(
'ref', 'ref_client', 'ref_supplier', 'date', 'datef', 'type', 'total_ht', 'total_tva', 'total_ttc', 'localtax1', 'localtax2', 'revenuestamp', 'datepointoftax', 'note_public'
))) continue; // Discard if not into a dedicated list
if (!is_object($value))
{
if (!is_object($value) && !is_null($value) && $value !== '') {
if ($this->element == 'payment_donation') $paymentpart->donation->{$key} = $value;
elseif ($this->element == 'payment_various') $paymentpart->various->{$key} = $value;
else $paymentpart->invoice->{$key} = $value;
@ -600,7 +647,7 @@ class BlockedLog
if (!in_array($key, array(
'id', 'datec', 'dateh', 'datef', 'fk_adherent', 'amount', 'import_key', 'statut', 'note'
))) continue; // Discard if not into a dedicated list
if (!is_object($value)) $this->object_data->{$key} = $value;
if (!is_object($value) && !is_null($value) && $value !== '') $this->object_data->{$key} = $value;
}
if (!empty($object->newref)) $this->object_data->ref = $object->newref;
@ -609,7 +656,7 @@ class BlockedLog
foreach ($object as $key=>$value)
{
if (in_array($key, $arrayoffieldstoexclude)) continue; // Discard some properties
if (!is_object($value)) $this->object_data->{$key} = $value;
if (!is_object($value) && !is_null($value) && $value !== '') $this->object_data->{$key} = $value;
}
if (!empty($object->newref)) $this->object_data->ref = $object->newref;
@ -626,31 +673,24 @@ class BlockedLog
*/
public function fetch($id)
{
global $langs;
dol_syslog(get_class($this)."::fetch id=".$id, LOG_DEBUG);
if (empty($id))
{
$this->error = 'BadParameter';
return -1;
}
$langs->load("blockedlog");
$sql = "SELECT b.rowid, b.date_creation, b.signature, b.signature_line, b.amounts, b.action, b.element, b.fk_object, b.entity,";
$sql .= " b.certified, b.tms, b.fk_user, b.user_fullname, b.date_object, b.ref_object, b.object_data, b.object_version";
$sql .= " FROM ".MAIN_DB_PREFIX."blockedlog as b";
if ($id) $sql .= " WHERE b.rowid = ".$id;
if ($id) $sql .= " WHERE b.rowid = ".((int) $id);
$resql = $this->db->query($sql);
if ($resql)
{
if ($this->db->num_rows($resql))
{
$obj = $this->db->fetch_object($resql);
$obj = $this->db->fetch_object($resql);
if ($obj) {
$this->id = $obj->rowid;
$this->entity = $obj->entity;
$this->ref = $obj->rowid;
@ -678,6 +718,7 @@ class BlockedLog
return 1;
} else {
$langs->load("blockedlog");
$this->error = $langs->trans("RecordNotFound");
return 0;
}
@ -840,10 +881,11 @@ class BlockedLog
/**
* Check if current signature still correct compared to the value in chain
*
* @param string $previoushash If previous signature hash is known, we can provide it to avoid to make a search of it in database.
* @return boolean True if OK, False if KO
* @param string $previoushash If previous signature hash is known, we can provide it to avoid to make a search of it in database.
* @param int $returnarray 1=Return array of details, 2=Return array of details including keyforsignature, 0=Boolean
* @return boolean|array True if OK, False if KO
*/
public function checkSignature($previoushash = '')
public function checkSignature($previoushash = '', $returnarray = 0)
{
if (empty($previoushash))
{
@ -852,7 +894,7 @@ class BlockedLog
// Recalculate hash
$keyforsignature = $this->buildKeyForSignature();
$signature_line = dol_hash($keyforsignature, '5'); // Not really usefull
//$signature_line = dol_hash($keyforsignature, '5'); // Not really usefull
$signature = dol_hash($previoushash.$keyforsignature, '5');
//var_dump($previoushash); var_dump($keyforsignature); var_dump($signature_line); var_dump($signature);
@ -862,7 +904,17 @@ class BlockedLog
$this->error = 'Signature KO';
}
return $res;
if ($returnarray) {
if ($returnarray == 1) {
unset($keyforsignature);
return array('checkresult' => $res, 'calculatedsignature' => $signature, 'previoushash' => $previoushash);
} else { // Consume much memory ($keyforsignature is a large var)
return array('checkresult' => $res, 'calculatedsignature' => $signature, 'previoushash' => $previoushash, 'keyforsignature'=>$keyforsignature);
}
} else {
unset($keyforsignature);
return $res;
}
}
/**
@ -941,25 +993,27 @@ class BlockedLog
*/
public function getLog($element, $fk_object, $limit = 0, $sortfield = '', $sortorder = '', $search_fk_user = -1, $search_start = -1, $search_end = -1, $search_ref = '', $search_amount = '', $search_code = '')
{
global $conf, $cachedlogs;
global $conf;
//global $cachedlogs;
/* $cachedlogs allow fastest search */
if (empty($cachedlogs)) $cachedlogs = array();
//if (empty($cachedlogs)) $cachedlogs = array();
if ($element == 'all') {
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."blockedlog
WHERE entity=".$conf->entity;
WHERE entity=".$conf->entity;
} elseif ($element == 'not_certified') {
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."blockedlog
WHERE entity=".$conf->entity." AND certified = 0";
WHERE entity=".$conf->entity." AND certified = 0";
} elseif ($element == 'just_certified') {
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."blockedlog
WHERE entity=".$conf->entity." AND certified = 1";
WHERE entity=".$conf->entity." AND certified = 1";
} else {
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."blockedlog
WHERE entity=".$conf->entity." AND element='".$element."' AND fk_object=".(int) $fk_object;
WHERE entity=".$conf->entity." AND element='".$this->db->escape($element)."'";
}
if ($fk_object) $sql .= natural_search("rowid", $fk_object, 1);
if ($search_fk_user > 0) $sql .= natural_search("fk_user", $search_fk_user, 2);
if ($search_start > 0) $sql .= " AND date_creation >= '".$this->db->idate($search_start)."'";
if ($search_end > 0) $sql .= " AND date_creation <= '".$this->db->idate($search_end)."'";
@ -984,15 +1038,16 @@ class BlockedLog
return -2;
}
if (!isset($cachedlogs[$obj->rowid]))
{
$b = new BlockedLog($this->db);
$b->fetch($obj->rowid);
//if (!isset($cachedlogs[$obj->rowid]))
//{
$b = new BlockedLog($this->db);
$b->fetch($obj->rowid);
//$b->loadTrackedEvents();
//$cachedlogs[$obj->rowid] = $b;
//}
$cachedlogs[$obj->rowid] = $b;
}
$results[] = $cachedlogs[$obj->rowid];
//$results[] = $cachedlogs[$obj->rowid];
$results[] = $b;
}
return $results;

View File

@ -318,7 +318,7 @@ switch ($action)
if ($invoice->total_ttc == $obj_facturation->amountWithTax()
&& $obj_facturation->getSetPaymentMode() != 'DIFF')
{
// We set status to payed
// We set status to paid
$result = $invoice->set_paid($user);
//print 'set paid';exit;
}

View File

@ -210,7 +210,7 @@ llxHeader("", $langs->trans("Categories"), $helpurl);
if ($user->rights->categorie->creer)
{
// Create or add
if ($action == 'create' || $_POST["addcat"] == 'addcat')
if ($action == 'create' || GETPOST("addcat") == 'addcat')
{
dol_set_focus('#label');

View File

@ -287,16 +287,19 @@ print dol_get_fiche_end();
*/
print "<div class='tabsAction'>\n";
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook)) {
if ($user->rights->categorie->creer)
{
$socid = ($object->socid ? "&socid=".$object->socid : "");
print '<a class="butAction" href="edit.php?id='.$object->id.$socid.'&type='.$type.'">'.$langs->trans("Modify").'</a>';
}
if ($user->rights->categorie->creer)
{
$socid = ($object->socid ? "&socid=".$object->socid : "");
print '<a class="butAction" href="edit.php?id='.$object->id.$socid.'&type='.$type.'">'.$langs->trans("Modify").'</a>';
}
if ($user->rights->categorie->supprimer)
{
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id.'&type='.$type.'&backtolist='.urlencode($backtolist).'">'.$langs->trans("Delete").'</a>';
if ($user->rights->categorie->supprimer)
{
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id.'&type='.$type.'&backtolist='.urlencode($backtolist).'">'.$langs->trans("Delete").'</a>';
}
}
print "</div>";

View File

@ -280,10 +280,10 @@ if (empty($action) || $action == 'show_month')
$tmpday += ((isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : 1) - 1);
if ($tmpday >= 1) $tmpday -= 7; // If tmpday is 0 we start with sunday, if -6, we start with monday of previous week.
// Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1)
$firstdaytoshow = dol_mktime(0, 0, 0, $prev_month, $max_day_in_prev_month + $tmpday, $prev_year, 'gmt');
$firstdaytoshow = dol_mktime(0, 0, 0, $prev_month, $max_day_in_prev_month + $tmpday, $prev_year, 'tzuserrel');
$next_day = 7 - ($max_day_in_month + 1 - $tmpday) % 7;
if ($next_day < 6) $next_day += 7;
$lastdaytoshow = dol_mktime(0, 0, 0, $next_month, $next_day, $next_year, 'gmt');
$lastdaytoshow = dol_mktime(0, 0, 0, $next_month, $next_day, $next_year, 'tzuserrel');
}
if ($action == 'show_week')
{
@ -304,10 +304,10 @@ if ($action == 'show_week')
$next_day = $next['day'];
// Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1)
$firstdaytoshow = dol_mktime(0, 0, 0, $first_month, $first_day, $first_year, 'gmt');
$firstdaytoshow = dol_mktime(0, 0, 0, $first_month, $first_day, $first_year, 'tzuserrel');
$lastdaytoshow = dol_time_plus_duree($firstdaytoshow, 7, 'd');
$max_day_in_month = date("t", dol_mktime(0, 0, 0, $month, 1, $year));
$max_day_in_month = date("t", dol_mktime(0, 0, 0, $month, 1, $year, 'gmt'));
$tmpday = $first_day;
}
@ -323,8 +323,8 @@ if ($action == 'show_day')
$next_day = $next['day'];
// Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1)
$firstdaytoshow = dol_mktime(0, 0, 0, $prev_month, $prev_day, $prev_year, 'gmt');
$lastdaytoshow = dol_mktime(0, 0, 0, $next_month, $next_day, $next_year, 'gmt');
$firstdaytoshow = dol_mktime(0, 0, 0, $prev_month, $prev_day, $prev_year, 'tzuserrel');
$lastdaytoshow = dol_mktime(0, 0, 0, $next_month, $next_day, $next_year, 'tzuserrel');
}
//print 'xx'.$prev_year.'-'.$prev_month.'-'.$prev_day;
//print 'xx'.$next_year.'-'.$next_month.'-'.$next_day;
@ -514,7 +514,7 @@ if (!empty($conf->use_javascript_ajax)) // If javascript on
{
$s .= '<script type="text/javascript">'."\n";
$s .= 'jQuery(document).ready(function () {
jQuery("table input[name^=\"check_ext\"]").click(function() {
jQuery("div input[name^=\"check_ext\"]").click(function() {
var name = $(this).attr("name");
jQuery(".family_ext" + name.replace("check_ext", "")).toggle();
});
@ -524,7 +524,7 @@ if (!empty($conf->use_javascript_ajax)) // If javascript on
foreach ($showextcals as $val)
{
$htmlname = md5($val['name']);
$s .= '<div class="nowrap inline-block"><input type="checkbox" id="check_ext'.$htmlname.'" name="check_ext'.$htmlname.'" checked> '.$val['name'].' &nbsp; </div>';
$s .= '<div class="nowrap inline-block"><input type="checkbox" id="check_ext'.$htmlname.'" name="check_ext'.$htmlname.'" checked> <label for="check_ext'.$htmlname.'">'.$val['name'].'</label> &nbsp; </div>';
}
}
@ -607,17 +607,18 @@ if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND (a.fk_soc IS
if ($socid > 0) $sql .= ' AND a.fk_soc = '.$socid;
// We must filter on assignement table
if ($filtert > 0 || $usergroup > 0) $sql .= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'";
//var_dump($day.' '.$month.' '.$year);
if ($action == 'show_day')
{
$sql .= " AND (";
$sql .= " (a.datep BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."'";
$sql .= " AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."')";
$sql .= " (a.datep BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year, 'tzuserrel'))."'";
$sql .= " AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year, 'tzuserrel'))."')";
$sql .= " OR ";
$sql .= " (a.datep2 BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."'";
$sql .= " AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."')";
$sql .= " (a.datep2 BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year, 'tzuserrel'))."'";
$sql .= " AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year, 'tzuserrel'))."')";
$sql .= " OR ";
$sql .= " (a.datep < '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."'";
$sql .= " AND a.datep2 > '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."')";
$sql .= " (a.datep < '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year, 'tzuserrel'))."'";
$sql .= " AND a.datep2 > '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year, 'tzuserrel'))."')";
$sql .= ')';
} else {
// To limit array
@ -723,9 +724,9 @@ if ($resql)
// Add an entry in actionarray for each day
$daycursor = $event->date_start_in_calendar;
$annee = dol_print_date($daycursor, '%Y');
$mois = dol_print_date($daycursor, '%m');
$jour = dol_print_date($daycursor, '%d');
$annee = dol_print_date($daycursor, '%Y', 'tzuserrel');
$mois = dol_print_date($daycursor, '%m', 'tzuserrel');
$jour = dol_print_date($daycursor, '%d', 'tzuserrel');
//var_dump(dol_print_date($event->date_start_in_calendar, 'dayhour', 'gmt'));
//var_dump($annee.'-'.$mois.'-'.$jour);
@ -1231,11 +1232,11 @@ if (empty($action) || $action == 'show_month') // View by month
print '<table width="100%" class="noborder nocellnopadd cal_pannel cal_month">';
print ' <tr class="liste_titre">';
// Column title of weeks numbers
echo ' <td align="center">#</td>';
echo ' <td class="center">#</td>';
$i = 0;
while ($i < 7)
{
print ' <td class="center bold uppercase tdfordaytitle">';
print ' <td class="center bold uppercase tdfordaytitle'.($i == 0 ? ' borderleft' : '').'">';
$numdayinweek = (($i + (isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : 1)) % 7);
if (!empty($conf->dol_optimize_smallscreen))
{
@ -1539,9 +1540,9 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
foreach ($eventarray as $daykey => $notused)
{
$annee = date('Y', $daykey);
$mois = date('m', $daykey);
$jour = date('d', $daykey);
$annee = dol_print_date($daykey, '%Y');
$mois = dol_print_date($daykey, '%m');
$jour = dol_print_date($daykey, '%d');
if ($day == $jour && $month == $mois && $year == $annee)
{
@ -1703,20 +1704,17 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
if (empty($event->fulldayevent))
{
// Show hours (start ... end)
$tmpyearstart = date('Y', $event->date_start_in_calendar);
$tmpmonthstart = date('m', $event->date_start_in_calendar);
$tmpdaystart = date('d', $event->date_start_in_calendar);
$tmpyearend = date('Y', $event->date_end_in_calendar);
$tmpmonthend = date('m', $event->date_end_in_calendar);
$tmpdayend = date('d', $event->date_end_in_calendar);
/*var_dump($tmpyearstart.' '.$tmpmonthstart.' '.$tmpdaystart);
var_dump($tmpyearend.' '.$tmpmonthend.' '.$tmpdayend);
var_dump($annee.' '.$mois.' '.$jour);*/
$tmpyearstart = dol_print_date($event->date_start_in_calendar, '%Y', 'tzuserrel');
$tmpmonthstart = dol_print_date($event->date_start_in_calendar, '%m', 'tzuserrel');
$tmpdaystart = dol_print_date($event->date_start_in_calendar, '%d', 'tzuserrel');
$tmpyearend = dol_print_date($event->date_end_in_calendar, '%Y', 'tzuserrel');
$tmpmonthend = dol_print_date($event->date_end_in_calendar, '%m', 'tzuserrel');
$tmpdayend = dol_print_date($event->date_end_in_calendar, '%d', 'tzuserrel');
// Hour start
if ($tmpyearstart == $annee && $tmpmonthstart == $mois && $tmpdaystart == $jour)
{
$daterange .= dol_print_date($event->date_start_in_calendar, 'hour'); // Il faudrait utiliser ici tzuser, mais si on ne peut pas car qd on rentre un date dans fiche action, en input la conversion local->gmt se base sur le TZ server et non user
$daterange .= dol_print_date($event->date_start_in_calendar, 'hour', 'tzuserrel');
if ($event->date_end_in_calendar && $event->date_start_in_calendar != $event->date_end_in_calendar)
{
if ($tmpyearstart == $tmpyearend && $tmpmonthstart == $tmpmonthend && $tmpdaystart == $tmpdayend)
@ -1736,7 +1734,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
if ($event->date_end_in_calendar && $event->date_start_in_calendar != $event->date_end_in_calendar)
{
if ($tmpyearend == $annee && $tmpmonthend == $mois && $tmpdayend == $jour)
$daterange .= dol_print_date($event->date_end_in_calendar, 'hour'); // Il faudrait utiliser ici tzuser, mais si on ne peut pas car qd on rentre un date dans fiche action, en input la conversion local->gmt se base sur le TZ server et non user
$daterange .= dol_print_date($event->date_end_in_calendar, 'hour', 'tzuserrel');
}
} else {
if ($showinfo)

View File

@ -67,9 +67,9 @@ $search_id = GETPOST('search_id', 'alpha');
$search_title = GETPOST('search_title', 'alpha');
$search_note = GETPOST('search_note', 'alpha');
$dateselect = dol_mktime(0, 0, 0, GETPOST('dateselectmonth', 'int'), GETPOST('dateselectday', 'int'), GETPOST('dateselectyear', 'int'));
$datestart = dol_mktime(0, 0, 0, GETPOST('datestartmonth', 'int'), GETPOST('datestartday', 'int'), GETPOST('datestartyear', 'int'));
$dateend = dol_mktime(0, 0, 0, GETPOST('dateendmonth', 'int'), GETPOST('dateendday', 'int'), GETPOST('dateendyear', 'int'));
$dateselect = dol_mktime(0, 0, 0, GETPOST('dateselectmonth', 'int'), GETPOST('dateselectday', 'int'), GETPOST('dateselectyear', 'int'), 'tzuserrel');
$datestart = dol_mktime(0, 0, 0, GETPOST('datestartmonth', 'int'), GETPOST('datestartday', 'int'), GETPOST('datestartyear', 'int'), 'tzuserrel');
$dateend = dol_mktime(0, 0, 0, GETPOST('dateendmonth', 'int'), GETPOST('dateendday', 'int'), GETPOST('dateendyear', 'int'), 'tzuserrel');
if ($search_status == '' && !GETPOSTISSET('search_status')) $search_status = (empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS);
if (empty($action) && !GETPOSTISSET('action')) $action = (empty($conf->global->AGENDA_DEFAULT_VIEW) ? 'show_month' : $conf->global->AGENDA_DEFAULT_VIEW);
@ -566,12 +566,12 @@ if ($resql)
if (!empty($arrayfields['a.note']['checked'])) print '<td class="liste_titre"><input type="text" class="maxwidth75" name="search_note" value="'.$search_note.'"></td>';
if (!empty($arrayfields['a.datep']['checked'])) {
print '<td class="liste_titre nowraponall" align="center">';
print $form->selectDate($datestart, 'datestart', 0, 0, 1, '', 1, 0);
print $form->selectDate($datestart, 'datestart', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzuserrel');
print '</td>';
}
if (!empty($arrayfields['a.datep2']['checked'])) {
print '<td class="liste_titre nowraponall" align="center">';
print $form->selectDate($dateend, 'dateend', 0, 0, 1, '', 1, 0);
print $form->selectDate($dateend, 'dateend', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzuserrel');
print '</td>';
}
if (!empty($arrayfields['s.nom']['checked'])) {

View File

@ -265,7 +265,7 @@ $next_month = $month;
$next_day = $day;
// Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1)
$firstdaytoshow = dol_mktime(0, 0, 0, $first_month, $first_day, $first_year, 'gmt');
$firstdaytoshow = dol_mktime(0, 0, 0, $first_month, $first_day, $first_year, 'tzuserrel');
$lastdaytoshow = dol_time_plus_duree($firstdaytoshow, 7, 'd');
//print $firstday.'-'.$first_month.'-'.$first_year;
//print dol_print_date($firstdaytoshow,'dayhour');
@ -482,14 +482,14 @@ if ($filtert > 0 || $usergroup > 0) $sql .= " AND ar.fk_actioncomm = a.id AND ar
if ($action == 'show_day')
{
$sql .= " AND (";
$sql .= " (a.datep BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."'";
$sql .= " (a.datep BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year, 'tzuserrel'))."'";
$sql .= " AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."')";
$sql .= " OR ";
$sql .= " (a.datep2 BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."'";
$sql .= " (a.datep2 BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year, 'tzuserrel'))."'";
$sql .= " AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."')";
$sql .= " OR ";
$sql .= " (a.datep < '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."'";
$sql .= " AND a.datep2 > '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."')";
$sql .= " AND a.datep2 > '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year, 'tzuserrel'))."')";
$sql .= ')';
} else {
// To limit array
@ -599,9 +599,9 @@ if ($resql)
// Add an entry in actionarray for each day
$daycursor = $event->date_start_in_calendar;
$annee = dol_print_date($daycursor, '%Y');
$mois = dol_print_date($daycursor, '%m');
$jour = dol_print_date($daycursor, '%d');
$annee = dol_print_date($daycursor, '%Y', 'tzuserrel');
$mois = dol_print_date($daycursor, '%m', 'tzuserrel');
$jour = dol_print_date($daycursor, '%d', 'tzuserrel');
// Loop on each day covered by action to prepare an index to show on calendar
$loop = true; $j = 0;
@ -858,9 +858,9 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s
// We are in a particular day for $username, now we scan all events
foreach ($eventarray as $daykey => $notused)
{
$annee = dol_print_date($daykey, '%Y', 'gmt');
$mois = dol_print_date($daykey, '%m', 'gmt');
$jour = dol_print_date($daykey, '%d', 'gmt');
$annee = dol_print_date($daykey, '%Y');
$mois = dol_print_date($daykey, '%m');
$jour = dol_print_date($daykey, '%d');
if ($day == $jour && $month == $mois && $year == $annee) // Is it the day we are looking for when calling function ?
{
@ -931,9 +931,9 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s
$newcolor = ''; //init
if (empty($event->fulldayevent))
{
$a = dol_mktime((int) $h, 0, 0, $month, $day, $year, 'auto', 0);
$b = dol_mktime((int) $h, 30, 0, $month, $day, $year, 'auto', 0);
$c = dol_mktime((int) $h + 1, 0, 0, $month, $day, $year, 'auto', 0);
$a = dol_mktime((int) $h, 0, 0, $month, $day, $year, 'tzuserrel', 0);
$b = dol_mktime((int) $h, 30, 0, $month, $day, $year, 'tzuserrel', 0);
$c = dol_mktime((int) $h + 1, 0, 0, $month, $day, $year, 'tzuserrel', 0);
$dateendtouse = $event->date_end_in_calendar;
if ($dateendtouse == $event->date_start_in_calendar) $dateendtouse++;
@ -944,13 +944,13 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s
{
$busy = $event->transparency;
$cases1[$h][$event->id]['busy'] = $busy;
$cases1[$h][$event->id]['string'] = dol_print_date($event->date_start_in_calendar, 'dayhour');
$cases1[$h][$event->id]['string'] = dol_print_date($event->date_start_in_calendar, 'dayhour', 'tzuserrel');
if ($event->date_end_in_calendar && $event->date_end_in_calendar != $event->date_start_in_calendar)
{
$tmpa = dol_getdate($event->date_start_in_calendar, true);
$tmpb = dol_getdate($event->date_end_in_calendar, true);
if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year']) $cases1[$h][$event->id]['string'] .= '-'.dol_print_date($event->date_end_in_calendar, 'hour');
else $cases1[$h][$event->id]['string'] .= '-'.dol_print_date($event->date_end_in_calendar, 'dayhour');
if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year']) $cases1[$h][$event->id]['string'] .= '-'.dol_print_date($event->date_end_in_calendar, 'hour', 'tzuserrel');
else $cases1[$h][$event->id]['string'] .= '-'.dol_print_date($event->date_end_in_calendar, 'dayhour', 'tzuserrel');
}
if ($event->label) $cases1[$h][$event->id]['string'] .= ' - '.$event->label;
$cases1[$h][$event->id]['typecode'] = $event->type_code;
@ -990,13 +990,13 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s
{
$busy = $event->transparency;
$cases2[$h][$event->id]['busy'] = $busy;
$cases2[$h][$event->id]['string'] = dol_print_date($event->date_start_in_calendar, 'dayhour');
$cases2[$h][$event->id]['string'] = dol_print_date($event->date_start_in_calendar, 'dayhour', 'tzuserrel');
if ($event->date_end_in_calendar && $event->date_end_in_calendar != $event->date_start_in_calendar)
{
$tmpa = dol_getdate($event->date_start_in_calendar, true);
$tmpb = dol_getdate($event->date_end_in_calendar, true);
if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year']) $cases2[$h][$event->id]['string'] .= '-'.dol_print_date($event->date_end_in_calendar, 'hour');
else $cases2[$h][$event->id]['string'] .= '-'.dol_print_date($event->date_end_in_calendar, 'dayhour');
if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year']) $cases2[$h][$event->id]['string'] .= '-'.dol_print_date($event->date_end_in_calendar, 'hour', 'tzuserrel');
else $cases2[$h][$event->id]['string'] .= '-'.dol_print_date($event->date_end_in_calendar, 'dayhour', 'tzuserrel');
}
if ($event->label) $cases2[$h][$event->id]['string'] .= ' - '.$event->label;
$cases2[$h][$event->id]['typecode'] = $event->type_code;

View File

@ -404,7 +404,11 @@ if ($user->rights->agenda->myactions->create || $user->rights->agenda->allaction
{
$tmpforcreatebutton = dol_getdate(dol_now(), true);
$newparam .= '&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$tmpforcreatebutton['year'];
$newparam .= '&month='.urlencode(str_pad($month, 2, "0", STR_PAD_LEFT)).'&year='.urlencode($tmpforcreatebutton['year']);
if ($begin_h !== '') $newparam .= '&begin_h='.urlencode($begin_h);
if ($end_h !== '') $newparam .= '&end_h='.urlencode($end_h);
if ($begin_d !== '') $newparam .= '&begin_d='.urlencode($begin_d);
if ($end_d !== '') $newparam .= '&end_d='.urlencode($end_d);
//$param='month='.$monthshown.'&year='.$year;
$hourminsec = '100000';
@ -487,14 +491,14 @@ if ($filtert > 0 || $usergroup > 0) $sql .= " AND ar.fk_actioncomm = a.id AND ar
if ($action == 'show_day')
{
$sql .= " AND (";
$sql .= " (a.datep BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."'";
$sql .= " AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."')";
$sql .= " (a.datep BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year, 'tzuserrel'))."'";
$sql .= " AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year, 'tzuserrel'))."')";
$sql .= " OR ";
$sql .= " (a.datep2 BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."'";
$sql .= " AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."')";
$sql .= " (a.datep2 BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year, 'tzuserrel'))."'";
$sql .= " AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year, 'tzuserrel'))."')";
$sql .= " OR ";
$sql .= " (a.datep < '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."'";
$sql .= " AND a.datep2 > '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."')";
$sql .= " (a.datep < '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year, 'tzuserrel'))."'";
$sql .= " AND a.datep2 > '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year, 'tzuserrel'))."')";
$sql .= ')';
} else {
// To limit array
@ -605,9 +609,10 @@ if ($resql)
// Add an entry in actionarray for each day
$daycursor = $event->date_start_in_calendar;
$annee = dol_print_date($daycursor, '%Y');
$mois = dol_print_date($daycursor, '%m');
$jour = dol_print_date($daycursor, '%d');
$annee = dol_print_date($daycursor, '%Y', 'tzuserrel');
$mois = dol_print_date($daycursor, '%m', 'tzuserrel');
$jour = dol_print_date($daycursor, '%d', 'tzuserrel');
//print $daycursor.' '.dol_print_date($daycursor, 'dayhour', 'gmt').' '.$event->id.' -> '.$annee.'-'.$mois.'-'.$jour.'<br>';
// Loop on each day covered by action to prepare an index to show on calendar
$loop = true; $j = 0;
@ -920,7 +925,7 @@ jQuery(document).ready(function() {
if (ids == \'none\') /* No event */
{
/* alert(\'no event\'); */
url = "'.DOL_URL_ROOT.'/comm/action/card.php?action=create&assignedtouser="+userid+"&datep="+year+month+day+hour+min+"00&backtopage='.urlencode($_SERVER["PHP_SELF"].'?year='.$year.'&month='.$month.'&day='.$day).'"
url = "'.DOL_URL_ROOT.'/comm/action/card.php?action=create&assignedtouser="+userid+"&datep="+year+month+day+hour+min+"00&backtopage='.urlencode($_SERVER["PHP_SELF"].'?year='.$year.'&month='.$month.'&day='.$day.($begin_h !== '' ? '&begin_h='.$begin_h : '').($end_h !== '' ? '&end_h='.$end_h : '').($begin_d !== '' ? '&begin_d='.$begin_d : '').($end_d !== '' ? '&end_d='.$end_d : '')).'"
window.location.href = url;
}
else if (ids.indexOf(",") > -1) /* There is several events */
@ -979,7 +984,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
$cases2 = array(); // Color second half hour
$i = 0; $numother = 0; $numbirthday = 0; $numical = 0; $numicals = array();
$ymd = sprintf("%04d", $year).sprintf("%02d", $month).sprintf("%02d", $day);
//$ymd = sprintf("%04d", $year).sprintf("%02d", $month).sprintf("%02d", $day);
$colorindexused[$user->id] = 0; // Color index for current user (user->id) is always 0
$nextindextouse = count($colorindexused); // At first run this is 0, so first user has 0, next 1, ...
@ -988,16 +993,16 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
// We are in a particular day for $username, now we scan all events
foreach ($eventarray as $daykey => $notused)
{
$annee = dol_print_date($daykey, '%Y', 'gmt');
$mois = dol_print_date($daykey, '%m', 'gmt');
$jour = dol_print_date($daykey, '%d', 'gmt');
$annee = dol_print_date($daykey, '%Y');
$mois = dol_print_date($daykey, '%m');
$jour = dol_print_date($daykey, '%d');
if ($day == $jour && $month == $mois && $year == $annee) // Is it the day we are looking for when calling function ?
{
// Scan all event for this date
foreach ($eventarray[$daykey] as $index => $event)
{
//print $daykey.' '.$year.'-'.$month.'-'.$day.' -> '.$event->id.' '.$index.' '.$annee.'-'.$mois.'-'.$jour."<br>\n";
//print $daykey.' '.dol_print_date($daykey, 'dayhour', 'gmt').' '.$year.'-'.$month.'-'.$day.' -> '.$event->id.' '.$index.' '.$annee.'-'.$mois.'-'.$jour."<br>\n";
//var_dump($event);
$keysofuserassigned = array_keys($event->userassigned);
@ -1078,7 +1083,6 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
// Define color
$color = sprintf("%02x%02x%02x", $theme_datacolor[$colorindex][0], $theme_datacolor[$colorindex][1], $theme_datacolor[$colorindex][2]);
}
//$cssclass=$cssclass.' '.$cssclass.'_day_'.$ymd;
// Define all rects with event (cases1 is first half hour, cases2 is second half hour)
for ($h = $begin_h; $h < $end_h; $h++)
@ -1087,9 +1091,9 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
$newcolor = ''; //init
if (empty($event->fulldayevent))
{
$a = dol_mktime((int) $h, 0, 0, $month, $day, $year, 'auto', 0);
$b = dol_mktime((int) $h, 30, 0, $month, $day, $year, 'auto', 0);
$c = dol_mktime((int) $h + 1, 0, 0, $month, $day, $year, 'auto', 0);
$a = dol_mktime((int) $h, 0, 0, $month, $day, $year, 'tzuserrel', 0);
$b = dol_mktime((int) $h, 30, 0, $month, $day, $year, 'tzuserrel', 0);
$c = dol_mktime((int) $h + 1, 0, 0, $month, $day, $year, 'tzuserrel', 0);
$dateendtouse = $event->date_end_in_calendar;
if ($dateendtouse == $event->date_start_in_calendar) $dateendtouse++;
@ -1100,13 +1104,13 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
{
$busy = $event->transparency;
$cases1[$h][$event->id]['busy'] = $busy;
$cases1[$h][$event->id]['string'] = dol_print_date($event->date_start_in_calendar, 'dayhour');
$cases1[$h][$event->id]['string'] = dol_print_date($event->date_start_in_calendar, 'dayhour', 'tzuserrel');
if ($event->date_end_in_calendar && $event->date_end_in_calendar != $event->date_start_in_calendar)
{
$tmpa = dol_getdate($event->date_start_in_calendar, true);
$tmpb = dol_getdate($event->date_end_in_calendar, true);
if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year']) $cases1[$h][$event->id]['string'] .= '-'.dol_print_date($event->date_end_in_calendar, 'hour');
else $cases1[$h][$event->id]['string'] .= '-'.dol_print_date($event->date_end_in_calendar, 'dayhour');
if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year']) $cases1[$h][$event->id]['string'] .= '-'.dol_print_date($event->date_end_in_calendar, 'hour', 'tzuserrel');
else $cases1[$h][$event->id]['string'] .= '-'.dol_print_date($event->date_end_in_calendar, 'dayhour', 'tzuserrel');
}
if ($event->label) $cases1[$h][$event->id]['string'] .= ' - '.$event->label;
$cases1[$h][$event->id]['typecode'] = $event->type_code;
@ -1146,13 +1150,13 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
{
$busy = $event->transparency;
$cases2[$h][$event->id]['busy'] = $busy;
$cases2[$h][$event->id]['string'] = dol_print_date($event->date_start_in_calendar, 'dayhour');
$cases2[$h][$event->id]['string'] = dol_print_date($event->date_start_in_calendar, 'dayhour', 'tzuserrel');
if ($event->date_end_in_calendar && $event->date_end_in_calendar != $event->date_start_in_calendar)
{
$tmpa = dol_getdate($event->date_start_in_calendar, true);
$tmpb = dol_getdate($event->date_end_in_calendar, true);
if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year']) $cases2[$h][$event->id]['string'] .= '-'.dol_print_date($event->date_end_in_calendar, 'hour');
else $cases2[$h][$event->id]['string'] .= '-'.dol_print_date($event->date_end_in_calendar, 'dayhour');
if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year']) $cases2[$h][$event->id]['string'] .= '-'.dol_print_date($event->date_end_in_calendar, 'hour', 'tzuserrel');
else $cases2[$h][$event->id]['string'] .= '-'.dol_print_date($event->date_end_in_calendar, 'dayhour', 'tzuserrel');
}
if ($event->label) $cases2[$h][$event->id]['string'] .= ' - '.$event->label;
$cases2[$h][$event->id]['typecode'] = $event->type_code;

View File

@ -273,9 +273,9 @@ if ($object->id > 0)
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent tableforfield">';
// Prospect/Customer
print '<tr><td class="titlefield">'.$langs->trans('ProspectCustomer').'</td><td>';
print $object->getLibCustProspStatut();
// Type Prospect/Customer/Supplier
print '<tr><td class="titlefield">'.$langs->trans('NatureOfThirdParty').'</td><td>';
print $object->getTypeUrl(1);
print '</td></tr>';
// Prefix

View File

@ -212,7 +212,6 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire) {
print '</td>';
print "</tr>\n";
}
}
addSummaryTableLine(3, $num, $nbofloop, $total, "NoProposal");
@ -303,7 +302,6 @@ if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposa
print '</td>';
print "</tr>\n";
}
}
addSummaryTableLine(3, $num, $nbofloop, $total, "NoProposal");
@ -395,7 +393,6 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
print '</td>';
print "</tr>\n";
}
}
addSummaryTableLine(3, $num, $nbofloop, $total, "NoProposal");
@ -487,7 +484,6 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
print '</td>';
print "</tr>\n";
}
}
addSummaryTableLine(3, $num, $nbofloop, $total, "NoProposal");

View File

@ -575,17 +575,17 @@ if ($object->fetch($id) >= 0)
print '</td>';
// Source
print '<td class="liste_titre">';
print '&nbsp';
print '&nbsp;';
print '</td>';
// Date last update
print '<td class="liste_titre">';
print '&nbsp';
print '&nbsp;';
print '</td>';
// Date sending
print '<td class="liste_titre">';
print '&nbsp';
print '&nbsp;';
print '</td>';
//Statut

View File

@ -271,6 +271,98 @@ if (empty($reshook))
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
}
if ($action == 'validate') {
if (GETPOST('confirm') == 'yes') {
$tmpproposal = new Propal($db);
$db->begin();
$error = 0;
foreach ($toselect as $checked) {
if ($tmpproposal->fetch($checked)) {
if ($tmpproposal->statut == 0) {
if ($tmpproposal->valid($user)) {
setEventMessage($tmpproposal->ref." ".$langs->trans('PassedInOpenStatus'), 'mesgs');
} else {
setEventMessage($langs->trans('CantBeValidated'), 'errors');
$error++;
}
} else {
setEventMessage($tmpproposal->ref." ".$langs->trans('IsNotADraft'), 'errors');
$error++;
}
}
dol_print_error($db);
$error++;
}
if ($error) {
$db->rollback();
} else {
$db->commit();
}
}
}
if ($action == "sign") {
if (GETPOST('confirm') == 'yes') {
$tmpproposal = new Propal($db);
$db->begin();
$error = 0;
foreach ($toselect as $checked) {
if ($tmpproposal->fetch($checked)) {
if ($tmpproposal->statut == 1) {
$tmpproposal->statut = 2;
if ($tmpproposal->update($user)) {
setEventMessage($tmpproposal->ref." ".$langs->trans('Signed'), 'mesgs');
} else {
dol_print_error($db);
$error++;
}
} else {
setEventMessage($tmpproposal->ref." ".$langs->trans('CantBeSign'), 'errors');
$error++;
}
} else {
dol_print_error($db);
$error++;
}
}
if ($error) {
$db->rollback();
} else {
$db->commit();
}
}
}
if ($action == "nosign") {
if (GETPOST('confirm') == 'yes') {
$tmpproposal = new Propal($db);
$db->begin();
$error = 0;
foreach ($toselect as $checked) {
if ($tmpproposal->fetch($checked)) {
if ($tmpproposal->statut == 1) {
$tmpproposal->statut = 3;
if ($tmpproposal->update($user)) {
setEventMessage($tmpproposal->ref." ".$langs->trans('NoSigned'), 'mesgs');
} else {
dol_print_error($db);
$error++;
}
} else {
setEventMessage($tmpproposal->ref." ".$langs->trans('CantBeClosed'), 'errors');
$error++;
}
} else {
dol_print_error($db);
$error++;
}
}
if ($error) {
$db->rollback();
} else {
$db->commit();
}
}
}
/*
@ -344,13 +436,12 @@ if ($search_town) $sql .= natural_search('s.town', $search_town);
if ($search_zip) $sql .= natural_search("s.zip", $search_zip);
if ($search_state) $sql .= natural_search("state.nom", $search_state);
if ($search_country) $sql .= " AND s.fk_pays IN (".$db->sanitize($db->escape($search_country)).')';
if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).')';
if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) $sql .= " AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).')';
if ($search_ref) $sql .= natural_search('p.ref', $search_ref);
if ($search_refcustomer) $sql .= natural_search('p.ref_client', $search_refcustomer);
if ($search_refproject) $sql .= natural_search('pr.ref', $search_refproject);
if ($search_project) $sql .= natural_search('pr.title', $search_project);
if ($search_availability) $sql .= " AND p.fk_availability IN (".$db->sanitize($db->escape($search_availability)).')';
if ($search_societe) $sql .= natural_search('s.nom', $search_societe);
if ($search_societe_alias) $sql .= natural_search('s.name_alias', $search_societe_alias);
if ($search_login) $sql .= natural_search("u.login", $search_login);
@ -482,6 +573,12 @@ if ($resql)
if ($search_fk_cond_reglement > 0) $param .= '&search_fk_cond_reglement='.$search_fk_cond_reglement;
if ($search_fk_shipping_method > 0) $param .= '&search_fk_shipping_method='.$search_fk_shipping_method;
if ($search_fk_mode_reglement > 0) $param .= '&search_fk_mode_reglement='.$search_fk_mode_reglement;
if ($search_type_thirdparty > 0) $param .= '&search_type_thirdparty='.$search_type_thirdparty;
if ($search_town) $param .= '&search_town='.$search_town;
if ($search_zip) $param .= '&search_zip='.$search_zip;
if ($search_state) $param .= '&search_state='.$search_state;
if ($search_town) $param .= '&search_town='.$search_town;
if ($search_country) $param .= '&search_country='.$search_country;
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
@ -493,6 +590,7 @@ if ($resql)
'presend'=>$langs->trans("SendByMail"),
'prevalidate'=>$langs->trans("Validate"),
'presign'=>$langs->trans("Sign"),
'nopresign'=>$langs->trans("NoSign"),
);
if ($user->rights->propal->supprimer) $arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
if ($user->rights->propal->cloturer) $arrayofmassactions['closed'] = $langs->trans("Close");
@ -531,6 +629,11 @@ if ($resql)
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassSignature"), $langs->trans("ConfirmMassSignatureQuestion"), "sign", null, '', 0, 200, 500, 1);
}
if ($massaction == 'nopresign')
{
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassNoSignature"), $langs->trans("ConfirmMassNoSignatureQuestion"), "nosign", null, '', 0, 200, 500, 1);
}
if ($sall)
{
foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val);
@ -652,7 +755,7 @@ if ($resql)
if (!empty($arrayfields['typent.code']['checked']))
{
print '<td class="liste_titre maxwidth100onsmartphone" align="center">';
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 $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT), '', 1);
print ajax_combobox('search_type_thirdparty');
print '</td>';
}
@ -1288,7 +1391,7 @@ if ($resql)
}
//else print $langs->trans("NoSalesRepresentativeAffected");
} else {
print '&nbsp';
print '&nbsp;';
}
print '</td>';
if (!$i) $totalarray['nbfield']++;
@ -1388,72 +1491,10 @@ if ($resql)
$delallowed = $user->rights->propal->creer;
print $formfile->showdocuments('massfilesarea_proposals', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
if ($action == 'validate') {
if (GETPOST('confirm') == 'yes') {
$tmpproposal = new Propal($db);
$db->begin();
$error = 0;
foreach ($toselect as $checked) {
if ($tmpproposal->fetch($checked)) {
if ($tmpproposal->statut == 0) {
if ($tmpproposal->valid($user)) {
setEventMessage($tmpproposal->ref." ".$langs->trans('PassedInOpenStatus'), 'mesgs');
} else {
setEventMessage($langs->trans('CantBeValidated'), 'errors');
$error++;
}
} else {
setEventMessage($tmpproposal->ref." ".$langs->trans('IsNotADraft'), 'errors');
$error++;
}
}
dol_print_error($db);
$error++;
}
if ($error) {
$db->rollback();
} else {
$db->commit();
}
}
}
if ($action == "sign") {
if (GETPOST('confirm') == 'yes') {
$tmpproposal = new Propal($db);
$db->begin();
$error = 0;
foreach ($toselect as $checked) {
if ($tmpproposal->fetch($checked)) {
if ($tmpproposal->statut == 1) {
$tmpproposal->statut = 2;
if ($tmpproposal->update($user)) {
setEventMessage($tmpproposal->ref." ".$langs->trans('Signed'), 'mesgs');
} else {
dol_print_error($db);
$error++;
}
} else {
setEventMessage($tmpproposal->ref." ".$langs->trans('CantBeSign'), 'errors');
$error++;
}
} else {
dol_print_error($db);
$error++;
}
}
if ($error) {
$db->rollback();
} else {
$db->commit();
}
}
}
} else {
dol_print_error($db);
}
// End of page
llxFooter();
$db->close();
// End of page
llxFooter();
$db->close();

View File

@ -263,7 +263,7 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
// ThirdParty Type
print '<tr><td>'.$langs->trans("ThirdPartyType").'</td><td>';
$sortparam_typent = (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT); // NONE means we keep sort of original array, so we sort on position. ASC, means next function will sort on label.
print $form->selectarray("typent_id", $formcompany->typent_array(0), $typent_id, 0, 0, 0, '', 0, 0, 0, $sortparam_typent);
print $form->selectarray("typent_id", $formcompany->typent_array(0), $typent_id, 1, 0, 0, '', 0, 0, 0, $sortparam_typent, '', 1);
if ($user->admin) print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
print '</td></tr>';
// Category

View File

@ -610,7 +610,7 @@ if (empty($reshook))
$result = $object->set_remise($user, price2num(GETPOST('remise_percent'), 2));
} elseif ($action == 'setremiseabsolue' && $usercancreate) {
$result = $object->set_remise_absolue($user, price2num(GETPOST('remise_absolue'), 'MU'));
} elseif ($action == 'addline' && GETPOST('submitforalllines', 'aZ09') && GETPOST('vatforalllines', 'alpha')) {
} elseif ($action == 'addline' && GETPOST('submitforalllines', 'alpha') && GETPOST('vatforalllines', 'alpha')) {
// Define vat_rate
$vat_rate = (GETPOST('vatforalllines') ? GETPOST('vatforalllines') : 0);
$vat_rate = str_replace('*', '', $vat_rate);
@ -640,7 +640,11 @@ if (empty($reshook))
}
$qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS');
$remise_percent = (GETPOSTISSET('remise_percent'.$predef) ? price2num(GETPOST('remise_percent'.$predef), 2) : 0);
$remise_percent = (GETPOSTISSET('remise_percent'.$predef) ? price2num(GETPOST('remise_percent'.$predef, 'alpha')) : 0);
if (empty($remise_percent)) {
$remise_percent = 0;
}
// Extrafields
$extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);

View File

@ -1821,6 +1821,8 @@ class Commande extends CommonOrder
$this->project = null; // Clear if another value was already set by fetch_projet
$this->statut = $obj->fk_statut;
$this->status = $obj->fk_statut;
$this->user_author_id = $obj->fk_user_author;
$this->user_valid = $obj->fk_user_valid;
$this->total_ht = $obj->total_ht;

View File

@ -489,7 +489,7 @@ if ($resql)
if ($search_zip != '') $param .= '&search_zip='.urlencode($search_zip);
if ($search_state != '') $param .= '&search_state='.urlencode($search_state);
if ($search_country != '') $param .= '&search_country='.urlencode($search_country);
if ($search_type_thirdparty != '') $param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty);
if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) $param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty);
if ($search_product_category != '') $param .= '&search_product_category='.urlencode($search_product_category);
if ($search_categ_cus > 0) $param .= '&search_categ_cus='.urlencode($search_categ_cus);
if ($show_files) $param .= '&show_files='.urlencode($show_files);
@ -727,7 +727,7 @@ if ($resql)
if (!empty($arrayfields['typent.code']['checked']))
{
print '<td class="liste_titre maxwidthonsmartphone" align="center">';
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 $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT), '', 1);
print '</td>';
}
// Date order

View File

@ -271,7 +271,7 @@ print '</td></tr>';
// ThirdParty Type
print '<tr><td>'.$langs->trans("ThirdPartyType").'</td><td>';
$sortparam_typent = (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT); // NONE means we keep sort of original array, so we sort on position. ASC, means next function will sort on label.
print $form->selectarray("typent_id", $formcompany->typent_array(0), $typent_id, 0, 0, 0, '', 0, 0, 0, $sortparam_typent);
print $form->selectarray("typent_id", $formcompany->typent_array(0), $typent_id, 1, 0, 0, '', 0, 0, 0, $sortparam_typent, '', 1);
if ($user->admin) print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
print '</td></tr>';
// Category

View File

@ -9,6 +9,8 @@
* Copyright (C) 2017-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
*
* 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
@ -41,6 +43,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/paymentvat.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/paymentsocialcontribution.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
@ -367,7 +370,7 @@ $donstatic = new Don($db);
$paymentstatic = new Paiement($db);
$paymentsupplierstatic = new PaiementFourn($db);
$paymentscstatic = new PaymentSocialContribution($db);
$paymentvatstatic = new Tva($db);
$paymentvatstatic = new PaymentVAT($db);
$paymentsalstatic = new PaymentSalary($db);
$paymentdonationstatic = new PaymentDonation($db);
$paymentvariousstatic = new PaymentVarious($db);
@ -443,13 +446,32 @@ if ($id > 0 || !empty($ref))
{
if ($object->canBeConciliated() > 0)
{
$allowautomaticconciliation = false; // TODO
$titletoconciliatemanual = $langs->trans("Conciliate");
$titletoconciliateauto = $langs->trans("Conciliate");
if ($allowautomaticconciliation) {
$titletoconciliatemanual .= ' ('.$langs->trans("Manual").')';
$titletoconciliateauto .= ' ('.$langs->trans("Auto").')';
}
// If not cash account and can be reconciliate
if ($user->rights->banque->consolidate) {
$newparam = $param;
$newparam = preg_replace('/search_conciliated=\d+/i', '', $newparam);
$buttonreconcile = '<a class="butAction" style="margin-bottom: 5px !important; margin-top: 5px !important" href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?action=reconcile&sortfield=b.datev,b.dateo,b.rowid&amp;sortorder=asc,asc,asc&search_conciliated=0'.$newparam.'">'.$langs->trans("Conciliate").'</a>';
$buttonreconcile = '<a class="butAction" style="margin-bottom: 5px !important; margin-top: 5px !important" href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?action=reconcile&sortfield=b.datev,b.dateo,b.rowid&amp;sortorder=asc,asc,asc&search_conciliated=0'.$newparam.'">'.$titletoconciliatemanual.'</a>';
} else {
$buttonreconcile = '<a class="butActionRefused" style="margin-bottom: 5px !important; margin-top: 5px !important" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("Conciliate").'</a>';
$buttonreconcile = '<a class="butActionRefused" style="margin-bottom: 5px !important; margin-top: 5px !important" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$titletoconciliatemanual.'</a>';
}
if ($allowautomaticconciliation) {
// If not cash account and can be reconciliate
if ($user->rights->banque->consolidate) {
$newparam = $param;
$newparam = preg_replace('/search_conciliated=\d+/i', '', $newparam);
$buttonreconcile .= ' <a class="butAction" style="margin-bottom: 5px !important; margin-top: 5px !important" href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?action=reconcile&sortfield=b.datev,b.dateo,b.rowid&amp;sortorder=asc,asc,asc&search_conciliated=0'.$newparam.'">'.$titletoconciliateauto.'</a>';
} else {
$buttonreconcile .= ' <a class="butActionRefused" style="margin-bottom: 5px !important; margin-top: 5px !important" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$titletoconciliateauto.'</a>';
}
}
}
}
@ -1211,7 +1233,8 @@ if ($resql)
$paymentvatstatic->id = $links[$key]['url_id'];
$paymentvatstatic->ref = $links[$key]['url_id'];
print ' '.$paymentvatstatic->getNomUrl(2);
} elseif ($links[$key]['type'] == 'payment_salary')
}
elseif ($links[$key]['type'] == 'payment_salary')
{
$paymentsalstatic->id = $links[$key]['url_id'];
$paymentsalstatic->ref = $links[$key]['url_id'];
@ -1273,7 +1296,10 @@ if ($resql)
{
} elseif ($links[$key]['type'] == 'sc')
{
} else {
}
elseif ($links[$key]['type'] == 'vat')
{
} else {
// Show link with label $links[$key]['label']
if (!empty($objp->label) && !empty($links[$key]['label'])) print ' - ';
print '<a href="'.$links[$key]['url'].$links[$key]['url_id'].'">';

View File

@ -8,6 +8,7 @@
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
*
* 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
@ -355,14 +356,22 @@ if ($result)
print img_object($langs->trans('SocialContribution'), 'bill').' ';
print $langs->trans("SocialContribution").($links[$key]['label'] ? ' - '.$links[$key]['label'] : '');
print '</a>';
} elseif ($links[$key]['type'] == 'payment_sc') {
}
elseif ($links[$key]['type'] == 'vat') {
print '<a href="'.DOL_URL_ROOT.'/compta/tva/card.php?id='.$links[$key]['url_id'].'">';
print img_object($langs->trans('VATDeclaration'), 'bill').' ';
print $langs->trans("VATDeclaration").($links[$key]['label'] ? '&nbsp;'.$links[$key]['label'] : '');
print '</a>';
}
elseif ($links[$key]['type'] == 'payment_sc') {
print '<a href="'.DOL_URL_ROOT.'/compta/payment_sc/card.php?id='.$links[$key]['url_id'].'">';
print img_object($langs->trans('Payment'), 'payment').' ';
print $langs->trans("SocialContributionPayment");
print '</a>';
} elseif ($links[$key]['type'] == 'payment_vat') {
print '<a href="'.DOL_URL_ROOT.'/compta/tva/card.php?id='.$links[$key]['url_id'].'">';
print img_object($langs->trans('VAT'), 'payment').' ';
}
elseif ($links[$key]['type'] == 'payment_vat') {
print '<a href="'.DOL_URL_ROOT.'/compta/payment_vat/card.php?id='.$links[$key]['url_id'].'">';
print img_object($langs->trans('VATPayment'), 'payment').' ';
print $langs->trans("VATPayment");
print '</a>';
} elseif ($links[$key]['type'] == 'payment_salary') {

View File

@ -257,12 +257,34 @@ if (empty($numref))
print '<div class="tabsAction">';
if ($object->canBeConciliated() > 0) {
$allowautomaticconciliation = false; // TODO
$titletoconciliatemanual = $langs->trans("Conciliate");
$titletoconciliateauto = $langs->trans("Conciliate");
if ($allowautomaticconciliation) {
$titletoconciliatemanual .= ' ('.$langs->trans("Manual").')';
$titletoconciliateauto .= ' ('.$langs->trans("Auto").')';
}
// If not cash account and can be reconciliate
if ($user->rights->banque->consolidate) {
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?action=reconcile&sortfield=b.datev,b.dateo,b.rowid&sortorder=asc,asc,asc&search_conciliated=0&search_account='.$id.$param.'">'.$langs->trans("Conciliate").'</a>';
$buttonreconcile = '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?action=reconcile&sortfield=b.datev,b.dateo,b.rowid&sortorder=asc,asc,asc&search_conciliated=0&search_account='.$id.$param.'">'.$titletoconciliatemanual.'</a>';
} else {
print '<a class="butActionRefused classfortooltip" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("Conciliate").'</a>';
$buttonreconcile = '<a class="butActionRefused classfortooltip" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$titletoconciliatemanual.'</a>';
}
if ($allowautomaticconciliation) {
// If not cash account and can be reconciliate
if ($user->rights->banque->consolidate) {
$newparam = $param;
$newparam = preg_replace('/search_conciliated=\d+/i', '', $newparam);
$buttonreconcile .= ' <a class="butAction" style="margin-bottom: 5px !important; margin-top: 5px !important" href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?action=reconcile&sortfield=b.datev,b.dateo,b.rowid&amp;sortorder=asc,asc,asc&search_conciliated=0'.$newparam.'">'.$titletoconciliateauto.'</a>';
} else {
$buttonreconcile .= ' <a class="butActionRefused" style="margin-bottom: 5px !important; margin-top: 5px !important" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$titletoconciliateauto.'</a>';
}
}
print $buttonreconcile;
}
print '</div>';

View File

@ -424,6 +424,10 @@ if ($result)
{
$obj = $db->fetch_object($result);
$variousstatic->id = $obj->rowid;
$variousstatic->ref = $obj->rowid;
$variousstatic->label = $obj->label;
print '<tr class="oddeven">';
// No
@ -433,15 +437,13 @@ if ($result)
// Ref
if ($arrayfields['ref']['checked']) {
$variousstatic->id = $obj->rowid;
$variousstatic->ref = $obj->rowid;
print "<td>".$variousstatic->getNomUrl(1)."</td>";
print '<td>'.$variousstatic->getNomUrl(1)."</td>";
if (!$i) $totalarray['nbfield']++;
}
// Label payment
if ($arrayfields['label']['checked']) {
print "<td>".dol_trunc($obj->label, 40)."</td>";
print '<td class="tdoverflowmax150" title="'.$variousstatic->label.'">'.$variousstatic->label."</td>";
if (!$i) $totalarray['nbfield']++;
}
@ -460,7 +462,13 @@ if ($result)
// Type
if ($arrayfields['type']['checked']) {
print '<td>'.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.'</td>';
print '<td>';
if ($obj->payment_code) {
print $langs->trans("PaymentTypeShort".$obj->payment_code);
print ' ';
}
print $obj->num_payment;
print '</td>';
if (!$i) $totalarray['nbfield']++;
}

View File

@ -933,8 +933,7 @@ $companystatic = new Societe($db);
$invoicerectmp = new FactureRec($db);
$now = dol_now();
$tmparray = dol_getdate($now);
$today = dol_mktime(23, 59, 59, $tmparray['mon'], $tmparray['mday'], $tmparray['year']); // Today is last second of current day
$nowlasthour = dol_get_last_hour($now);
/*
@ -1246,7 +1245,9 @@ if ($action == 'create')
print '<table class="border centpercent tableforfield">';
print '<tr><td class="titlefield">'.$langs->trans("Author").'</td><td>'.$author->getFullName($langs)."</td></tr>";
print '<tr><td class="titlefield">'.$langs->trans("Author").'</td><td>';
print $author->getNomUrl(-1);
print "</td></tr>";
print '<tr><td>'.$langs->trans("AmountHT").'</td>';
print '<td>'.price($object->total_ht, '', $langs, 1, -1, -1, $conf->currency).'</td>';
@ -1668,8 +1669,7 @@ if ($action == 'create')
{
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("MaxGenerationReached")).'">'.$langs->trans("CreateBill").'</a></div>';
} else {
if (empty($object->frequency) || $object->date_when <= $today)
{
if (empty($object->frequency) || $object->date_when <= $nowlasthour) {
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture/card.php?action=create&socid='.$object->thirdparty->id.'&fac_rec='.$object->id.'">'.$langs->trans("CreateBill").'</a></div>';
} else {
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("DateIsNotEnough")).'">'.$langs->trans("CreateBill").'</a></div>';

View File

@ -970,7 +970,7 @@ if (empty($reshook))
if ($ret < 0) $error++;
// Replacement invoice
if ($_POST['type'] == Facture::TYPE_REPLACEMENT)
if (GETPOST('type') == Facture::TYPE_REPLACEMENT)
{
$dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
if (empty($dateinvoice)) {
@ -1253,7 +1253,7 @@ if (empty($reshook))
}
// Standard invoice or Deposit invoice, created from a Predefined template invoice
if (($_POST['type'] == Facture::TYPE_STANDARD || $_POST['type'] == Facture::TYPE_DEPOSIT) && GETPOST('fac_rec', 'int') > 0)
if ((GETPOST('type') == Facture::TYPE_STANDARD || GETPOST('type') == Facture::TYPE_DEPOSIT) && GETPOST('fac_rec', 'int') > 0)
{
$dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
if (empty($dateinvoice)) {
@ -1299,7 +1299,7 @@ if (empty($reshook))
}
// Standard or deposit or proforma invoice, not from a Predefined template invoice
if (($_POST['type'] == Facture::TYPE_STANDARD || $_POST['type'] == Facture::TYPE_DEPOSIT || $_POST['type'] == Facture::TYPE_PROFORMA || ($_POST['type'] == Facture::TYPE_SITUATION && empty($_POST['situations']))) && GETPOST('fac_rec') <= 0)
if ((GETPOST('type') == Facture::TYPE_STANDARD || GETPOST('type') == Facture::TYPE_DEPOSIT || GETPOST('type') == Facture::TYPE_PROFORMA || (GETPOST('type') == Facture::TYPE_SITUATION && !GETPOST('situations'))) && GETPOST('fac_rec') <= 0)
{
if (GETPOST('socid', 'int') < 1)
{
@ -1319,7 +1319,7 @@ if (empty($reshook))
$action = 'create';
}
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
$date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'));
if (!$error)
{
@ -1717,12 +1717,12 @@ if (empty($reshook))
$id = $object->create($user);
for ($i = 1; $i <= $NBLINES; $i++) {
if ($_POST['idprod'.$i]) {
if (GETPOST('idprod'.$i, 'int')) {
$product = new Product($db);
$product->fetch($_POST['idprod'.$i]);
$startday = dol_mktime(12, 0, 0, $_POST['date_start'.$i.'month'], $_POST['date_start'.$i.'day'], $_POST['date_start'.$i.'year']);
$endday = dol_mktime(12, 0, 0, $_POST['date_end'.$i.'month'], $_POST['date_end'.$i.'day'], $_POST['date_end'.$i.'year']);
$result = $object->addline($product->description, $product->price, $_POST['qty'.$i], $product->tva_tx, $product->localtax1_tx, $product->localtax2_tx, $_POST['idprod'.$i], $_POST['remise_percent'.$i], $startday, $endday, 0, 0, '', $product->price_base_type, $product->price_ttc, $product->type, -1, 0, '', 0, 0, null, 0, '', 0, 100, '', $product->fk_unit);
$product->fetch(GETPOST('idprod'.$i, 'int'));
$startday = dol_mktime(12, 0, 0, GETPOST('date_start'.$i.'month'), GETPOST('date_start'.$i.'day'), GETPOST('date_start'.$i.'year'));
$endday = dol_mktime(12, 0, 0, GETPOST('date_end'.$i.'month'), GETPOST('date_end'.$i.'day'), GETPOST('date_end'.$i.'year'));
$result = $object->addline($product->description, $product->price, price2num(GETPOST('qty'.$i), 'MS'), $product->tva_tx, $product->localtax1_tx, $product->localtax2_tx, $_POST['idprod'.$i], $_POST['remise_percent'.$i], $startday, $endday, 0, 0, '', $product->price_base_type, $product->price_ttc, $product->type, -1, 0, '', 0, 0, null, 0, '', 0, 100, '', $product->fk_unit);
}
}
}
@ -1730,7 +1730,7 @@ if (empty($reshook))
}
// Situation invoices
if (GETPOST('type') == Facture::TYPE_SITUATION && (!empty($_POST['situations'])))
if (GETPOST('type') == Facture::TYPE_SITUATION && GETPOST('situations'))
{
$dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
if (empty($dateinvoice)) {
@ -1743,9 +1743,9 @@ if (empty($reshook))
$action = 'create';
}
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
$date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'));
if (!($_POST['situations'] > 0)) {
if (!(GETPOST('situations', 'int') > 0)) {
$error++;
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("InvoiceSituation"));
setEventMessages($mesg, null, 'errors');
@ -1753,8 +1753,8 @@ if (empty($reshook))
}
if (!$error) {
$result = $object->fetch($_POST['situations']);
$object->fk_facture_source = $_POST['situations'];
$result = $object->fetch(GETPOST('situations', 'int'));
$object->fk_facture_source = GETPOST('situations', 'int');
$object->type = Facture::TYPE_SITUATION;
if (!empty($origin) && !empty($originid))

View File

@ -1051,7 +1051,7 @@ class Invoices extends DolibarrApi
}
if ($this->invoice->paye) {
throw new RestException(500, 'Alreay payed');
throw new RestException(500, 'Alreay paid');
}
$this->invoice->fetch($id);

View File

@ -1165,6 +1165,7 @@ class Facture extends CommonInvoice
$object->id = 0;
$object->statut = self::STATUS_DRAFT;
$object->status = self::STATUS_DRAFT;
// Clear fields
$object->date = (empty($this->date) ? dol_now() : $this->date);
@ -1594,6 +1595,8 @@ class Facture extends CommonInvoice
$this->project = null; // Clear if another value was already set by fetch_projet
$this->statut = $obj->fk_statut;
$this->status = $obj->fk_statut;
$this->date_lim_reglement = $this->db->jdate($obj->dlr);
$this->mode_reglement_id = $obj->fk_mode_reglement;
$this->mode_reglement_code = $obj->mode_reglement_code;

View File

@ -494,7 +494,7 @@ if ($search_town) $sql .= natural_search('s.town', $search_town);
if ($search_zip) $sql .= natural_search("s.zip", $search_zip);
if ($search_state) $sql .= natural_search("state.nom", $search_state);
if ($search_country) $sql .= " AND s.fk_pays IN (".$db->sanitize($db->escape($search_country)).')';
if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).')';
if ($search_type_thirdparty != '' && $search_type_thirdparty != '-1') $sql .= " AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).')';
if ($search_company) $sql .= natural_search('s.nom', $search_company);
if ($search_company_alias) $sql .= natural_search('s.name_alias', $search_company_alias);
if ($search_montant_ht != '') $sql .= natural_search('f.total', $search_montant_ht, 1);
@ -894,7 +894,7 @@ if ($resql)
if (!empty($arrayfields['typent.code']['checked']))
{
print '<td class="liste_titre maxwidthonsmartphone" align="center">';
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), 'maxwidth100');
print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT), 'maxwidth100', 1);
print '</td>';
}
// Payment mode

View File

@ -287,7 +287,9 @@ if ($object->id > 0)
// Type
print '<tr><td class="titlefield">'.$langs->trans('Type').'</td><td colspan="3">';
print '<span class="badgeneutral">';
print $object->getLibType();
print '</span>';
if ($object->module_source) {
print ' <span class="opacitymediumbycolor">('.$langs->trans("POS").' '.$object->module_source.' - '.$langs->trans("Terminal").' '.$object->pos_source.')</span>';
}

View File

@ -264,7 +264,7 @@ print '</td></tr>';
// ThirdParty Type
print '<tr><td>'.$langs->trans("ThirdPartyType").'</td><td>';
$sortparam_typent = (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT); // NONE means we keep sort of original array, so we sort on position. ASC, means next function will sort on label.
print $form->selectarray("typent_id", $formcompany->typent_array(0), $typent_id, 0, 0, 0, '', 0, 0, 0, $sortparam_typent);
print $form->selectarray("typent_id", $formcompany->typent_array(0), $typent_id, 1, 0, 0, '', 0, 0, 0, $sortparam_typent, '', 1);
if ($user->admin) print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
print '</td></tr>';

View File

@ -1122,7 +1122,7 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
}
/*
* Unpayed supplier invoices
* Unpaid supplier invoices
*/
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)) && $user->rights->fournisseur->facture->lire)
{

View File

@ -381,7 +381,7 @@ class Localtax extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* localtax payed
* Total of localtax paid in invoice
*
* @param int $year Year
* @return int ???
@ -419,8 +419,7 @@ class Localtax extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* localtax payed
* Total de la localtax payed
* Total of localtax paid
*
* @param int $year Year
* @return int ???

View File

@ -565,7 +565,7 @@ print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
/*
* Payed
* Paid
*/
print load_fiche_titre($langs->transcountry($LTPaid, $mysoc->country_code), '', '');

View File

@ -373,6 +373,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
function setPaiementCode()
{
var code = $("#selectpaiementcode option:selected").val();
console.log("setPaiementCode code="+code);
if (code == \'CHQ\' || code == \'VIR\')
{

View File

@ -749,7 +749,7 @@ if ($action != 'new')
if ($object->statut == 1)
{
$filename = dol_sanitizeFileName($object->ref);
$filedir = $dir.get_exdir($object->ref, 0, 1, 0, $object, 'cheque').dol_sanitizeFileName($object->ref);
$filedir = $dir.get_exdir($object->ref, 0, 1, 0, $object, 'checkdeposits');
$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
print $formfile->showdocuments('remisecheque', $filename, $filedir, $urlsource, 1, 1);

View File

@ -192,6 +192,7 @@ class Paiement extends CommonObject
$this->amount = $obj->amount;
$this->multicurrency_amount = $obj->multicurrency_amount;
$this->note = $obj->note;
$this->note_private = $obj->note;
$this->type_label = $obj->type_label;
$this->type_code = $obj->type_code;
$this->statut = $obj->statut;

View File

@ -148,7 +148,7 @@ llxHeader('', $langs->trans('ListPayment'));
if (GETPOST("orphelins", "alpha")) {
// Payments not linked to an invoice. Should not happend. For debug only.
$sql = "SELECT p.ref, p.datep, p.amount, p.statut, p.num_paiement";
$sql = "SELECT p.rowid, p.ref, p.datep, p.amount, p.statut, p.num_paiement";
$sql .= ", c.code as paiement_code";
// Add fields from hooks
@ -166,7 +166,7 @@ if (GETPOST("orphelins", "alpha")) {
$sql .= $hookmanager->resPrint;
} else {
// DISTINCT is to avoid duplicate when there is a link to sales representatives
$sql = "SELECT DISTINCT p.ref, p.datep, p.fk_bank, p.amount, p.statut, p.num_paiement";
$sql = "SELECT DISTINCT p.rowid, p.ref, p.datep, p.fk_bank, p.amount, p.statut, p.num_paiement";
$sql .= ", c.code as paiement_code";
$sql .= ", ba.rowid as bid, ba.ref as bref, ba.label as blabel, ba.number, ba.account_number as account_number, ba.fk_accountancy_journal as accountancy_journal";
$sql .= ", s.rowid as socid, s.nom as name, s.email";
@ -390,7 +390,7 @@ while ($i < min($num, $limit)) {
$objp = $db->fetch_object($resql);
$object->id = $objp->rowid;
$object->ref = $objp->ref;
$object->ref = ($objp->ref ? $objp->ref : $objp->rowid);
$companystatic->id = $objp->socid;
$companystatic->name = $objp->name;
@ -497,6 +497,14 @@ while ($i < min($num, $limit)) {
// Show total line
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
// If no record found
if ($num == 0)
{
$colspan = 1;
foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; }
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
}
print "</table>";
print "</div>";
print "</form>";

View File

@ -0,0 +1,342 @@
<?php
/* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2016-2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
*
* 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 <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/compta/paiement_charge.php
* \ingroup tax
* \brief Page to add payment of a tax
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/paymentvat.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
// Load translation files required by the page
$langs->loadLangs(array("banks", "bills"));
$chid = GETPOST("id", 'int');
$action = GETPOST('action', 'alpha');
$amounts = array();
// Security check
$socid = 0;
if ($user->socid > 0)
{
$socid = $user->socid;
}
/*
* Actions
*/
if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm == 'yes'))
{
$error = 0;
if ($_POST["cancel"])
{
$loc = DOL_URL_ROOT.'/compta/tva/card.php?id='.$chid;
header("Location: ".$loc);
exit;
}
$datepaye = dol_mktime(12, 0, 0, GETPOST("remonth", 'int'), GETPOST("reday", 'int'), GETPOST("reyear", 'int'));
if (!(GETPOST("paiementtype", 'int') > 0))
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("PaymentMode")), null, 'errors');
$error++;
$action = 'create';
}
if ($datepaye == '')
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Date")), null, 'errors');
$error++;
$action = 'create';
}
if (!empty($conf->banque->enabled) && !(GETPOST("accountid", 'int') > 0))
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("AccountToDebit")), null, 'errors');
$error++;
$action = 'create';
}
if (!$error)
{
$paymentid = 0;
// Read possible payments
foreach ($_POST as $key => $value)
{
if (substr($key, 0, 7) == 'amount_')
{
$other_chid = substr($key, 7);
$amounts[$other_chid] = price2num(GETPOST($key));
}
}
if (count($amounts) <= 0)
{
$error++;
setEventMessages($langs->trans("ErrorNoPaymentDefined"), null, 'errors');
$action = 'create';
}
if (!$error)
{
$db->begin();
// Create a line of payments
$paiement = new PaymentVAT($db);
$paiement->chid = $chid;
$paiement->datepaye = $datepaye;
$paiement->amounts = $amounts; // Tableau de montant
$paiement->paiementtype = GETPOST("paiementtype", 'alphanohtml');
$paiement->num_payment = GETPOST("num_payment", 'alphanohtml');
$paiement->note = GETPOST("note", 'restricthtml');
$paiement->note_private = GETPOST("note", 'restricthtml');
if (!$error)
{
$paymentid = $paiement->create($user, (GETPOST('closepaidvat') == 'on' ? 1 : 0));
if ($paymentid < 0)
{
$error++;
setEventMessages($paiement->error, null, 'errors');
$action = 'create';
}
}
if (!$error)
{
$result = $paiement->addPaymentToBank($user, 'payment_vat', '(VATPayment)', GETPOST('accountid', 'int'), '', '');
if (!($result > 0))
{
$error++;
setEventMessages($paiement->error, null, 'errors');
$action = 'create';
}
}
if (!$error)
{
$db->commit();
$loc = DOL_URL_ROOT.'/compta/tva/card.php?id='.$chid;
header('Location: '.$loc);
exit;
}
else {
$db->rollback();
}
}
}
}
/*
* View
*/
llxHeader();
$form = new Form($db);
// Formulaire de creation d'un paiement de charge
if ($action == 'create')
{
$tva = new Tva($db);
$tva->fetch($chid);
$tva->accountid = $tva->fk_account ? $tva->fk_account : $tva->accountid;
$tva->paiementtype = $tva->type_payment;
$total = $tva->amount;
if (!empty($conf->use_javascript_ajax))
{
print "\n".'<script type="text/javascript" language="javascript">';
//Add js for AutoFill
print ' $(document).ready(function () {';
print ' $(".AutoFillAmount").on(\'click touchstart\', function(){
var amount = $(this).data("value");
document.getElementById($(this).data(\'rowid\')).value = amount ;
});';
print ' });'."\n";
print ' </script>'."\n";
}
print load_fiche_titre($langs->trans("DoPayment"));
print "<br>\n";
print '<form name="add_payment" action="'.$_SERVER['PHP_SELF'].'" method="post">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="id" value="'.$chid.'">';
print '<input type="hidden" name="chid" value="'.$chid.'">';
print '<input type="hidden" name="action" value="add_payment">';
dol_fiche_head('', '');
print '<table class="border centpercent">';
print '<tr><td class="titlefieldcreate">'.$langs->trans("Ref").'</td><td><a href="'.DOL_URL_ROOT.'/compta/tva/card.php?id='.$chid.'">'.$chid.'</a></td></tr>';
//print '<tr><td>'.$langs->trans("Type")."</td><td>".$tva->type_label."</td></tr>\n";
print '<tr><td>'.$langs->trans("Period")."</td><td>".dol_print_date($tva->datev, 'day')."</td></tr>\n";
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$tva->label."</td></tr>\n";
/*print '<tr><td>'.$langs->trans("DateDue")."</td><td>".dol_print_date($tva->date_ech,'day')."</td></tr>\n";
print '<tr><td>'.$langs->trans("Amount")."</td><td>".price($tva->amount,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';*/
$sql = "SELECT sum(p.amount) as total";
$sql .= " FROM ".MAIN_DB_PREFIX."payment_vat as p";
$sql .= " WHERE p.fk_tva = ".$chid;
$resql = $db->query($sql);
if ($resql)
{
$obj = $db->fetch_object($resql);
$sumpaid = $obj->total;
$db->free();
}
/*print '<tr><td>'.$langs->trans("AlreadyPaid").'</td><td>'.price($sumpaid,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';
print '<tr><td class="tdtop">'.$langs->trans("RemainderToPay").'</td><td>'.price($total-$sumpaid,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';*/
print '<tr><td class="fieldrequired">'.$langs->trans("Date").'</td><td>';
$datepaye = dol_mktime(12, 0, 0, GETPOST("remonth", 'int'), GETPOST("reday", 'int'), GETPOST("reyear", 'int'));
$datepayment = empty($conf->global->MAIN_AUTOFILL_DATE) ? (GETPOST("remonth", 'int') ? $datepaye : -1) : 0;
print $form->selectDate($datepayment, '', '', '', '', "add_payment", 1, 1);
print "</td>";
print '</tr>';
print '<tr><td class="fieldrequired">'.$langs->trans("PaymentMode").'</td><td>';
$form->select_types_paiements(GETPOSTISSET("paiementtype") ? GETPOST("paiementtype", "int") : $tva->paiementtype, "paiementtype");
print "</td>\n";
print '</tr>';
print '<tr>';
print '<td class="fieldrequired">'.$langs->trans('AccountToDebit').'</td>';
print '<td>';
$form->select_comptes(GETPOST("accountid") ? GETPOST("accountid", "int") : $tva->accountid, "accountid", 0, '', 1); // Show opend bank account list
print '</td></tr>';
// Number
print '<tr><td>'.$langs->trans('Numero');
print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
print '</td>';
print '<td><input name="num_payment" type="text" value="'.GETPOST('num_payment', 'alphanohtml').'"></td></tr>'."\n";
print '<tr>';
print '<td class="tdtop">'.$langs->trans("Comments").'</td>';
print '<td class="tdtop"><textarea name="note" wrap="soft" cols="60" rows="'.ROWS_3.'"></textarea></td>';
print '</tr>';
print '</table>';
dol_fiche_end();
/*
* Autres charges impayees
*/
$num = 1;
$i = 0;
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
//print '<td>'.$langs->trans("SocialContribution").'</td>';
print '<td class="left">'.$langs->trans("DateDue").'</td>';
print '<td class="right">'.$langs->trans("Amount").'</td>';
print '<td class="right">'.$langs->trans("AlreadyPaid").'</td>';
print '<td class="right">'.$langs->trans("RemainderToPay").'</td>';
print '<td class="center">'.$langs->trans("Amount").'</td>';
print "</tr>\n";
$total = 0;
$totalrecu = 0;
while ($i < $num)
{
$objp = $tva;
print '<tr class="oddeven">';
if ($objp->datev > 0)
{
print '<td class="left">'.dol_print_date($objp->datev, 'day').'</td>'."\n";
}
else {
print "<td align=\"center\"><b>!!!</b></td>\n";
}
print '<td class="right">'.price($objp->amount)."</td>";
print '<td class="right">'.price($sumpaid)."</td>";
print '<td class="right">'.price($objp->amount - $sumpaid)."</td>";
print '<td class="center">';
if ($sumpaid <> $objp->amount)
{
$namef = "amount_".$objp->id;
$nameRemain = "remain_".$objp->id;
/* Disabled, we autofil the amount with remain to pay by default
if (!empty($conf->use_javascript_ajax)) {
print img_picto("Auto fill", 'rightarrow', "class='AutoFillAmount' data-rowid='".$namef."' data-value='".($objp->amount - $sumpaid)."'");
} */
$remaintopay = $objp->amount - $sumpaid;
print '<input type=hidden class="sum_remain" name="'.$nameRemain.'" value="'.$remaintopay.'">';
print '<input type="text" class="right width100" name="'.$namef.'" id="'.$namef.'" value="'.$remaintopay.'">';
}
else {
print '-';
}
print "</td>";
print "</tr>\n";
$total += $objp->total;
$total_ttc += $objp->total_ttc;
$totalrecu += $objp->am;
$i++;
}
if ($i > 1)
{
// Print total
print '<tr class="oddeven">';
print '<td colspan="2" class="left">'.$langs->trans("Total").':</td>';
print '<td class="right"><b>'.price($total_ttc).'</b></td>';
print '<td class="right"><b>'.price($totalrecu).'</b></td>';
print '<td class="right"><b>'.price($total_ttc - $totalrecu).'</b></td>';
print '<td align="center">&nbsp;</td>';
print "</tr>\n";
}
print "</table>";
// Bouton Save payment
print '<br><div class="center"><input type="checkbox" checked name="closepaidvat"> '.$langs->trans("ClosePaidVATAutomatically");
print '<br><input type="submit" class="button" name="save" value="'.$langs->trans('ToMakePayment').'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</div>';
print "</form>\n";
}
llxFooter();
$db->close();

View File

@ -162,7 +162,7 @@ print dol_get_fiche_end();
/*
* List of social contributions payed
* List of social contributions paid
*/
$disable_delete = 0;
@ -213,7 +213,7 @@ if ($resql)
print '<td class="right">'.price($objp->sc_amount).'</td>';
// Status
print '<td class="center">'.$socialcontrib->getLibStatut(4, $objp->amount).'</td>';
// Amount payed
// Amount paid
print '<td class="right">'.price($objp->amount).'</td>';
print "</tr>\n";
if ($objp->paye == 1) // If at least one invoice is paid, disable delete

View File

@ -0,0 +1,331 @@
<?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
*
* 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 <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/compta/payment_vat/card.php
* \ingroup facture
* \brief Onglet payment of a social contribution
* \remarks Fichier presque identique a fournisseur/paiement/card.php
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/paymentvat.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/modules/facture/modules_facture.php';
if (!empty($conf->banque->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
// Load translation files required by the page
$langs->loadLangs(array('bills', 'banks', 'companies'));
// Security check
$id = GETPOST("id", 'int');
$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm');
if ($user->socid) $socid = $user->socid;
// TODO ajouter regle pour restreindre acces paiement
//$result = restrictedArea($user, 'facture', $id,'');
$object = new PaymentVAT($db);
if ($id > 0)
{
$result = $object->fetch($id);
if (!$result) dol_print_error($db, 'Failed to get payment id '.$id);
}
/*
* Actions
*/
// Delete payment
if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->tax->charges->supprimer)
{
$db->begin();
$result = $object->delete($user);
if ($result > 0)
{
$db->commit();
header("Location: ".DOL_URL_ROOT."/compta/tva/payments.php?mode=tvaonly");
exit;
}
else {
setEventMessages($object->error, $object->errors, 'errors');
$db->rollback();
}
}
// Validate social contribution
/*
if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->tax->charges->creer)
{
$db->begin();
$result=$object->valide();
if ($result > 0)
{
$db->commit();
$factures=array(); // TODO Get all id of invoices linked to this payment
foreach($factures as $id)
{
$fac = new Facture($db);
$fac->fetch($id);
$outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
}
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
$fac->generateDocument($fac->modelpdf, $outputlangs);
}
}
header('Location: card.php?id='.$object->id);
exit;
}
else
{
setEventMessages($object->error, $object->errors, 'errors');
$db->rollback();
}
}
*/
/*
* View
*/
llxHeader();
$tva = new TVA($db);
$form = new Form($db);
$h = 0;
$head[$h][0] = DOL_URL_ROOT.'/compta/payment_vat/card.php?id='.$id;
$head[$h][1] = $langs->trans("VATPayment");
$hselected = $h;
$h++;
/*$head[$h][0] = DOL_URL_ROOT.'/compta/payment_sc/info.php?id='.$id;
$head[$h][1] = $langs->trans("Info");
$h++;
*/
dol_fiche_head($head, $hselected, $langs->trans("VATPayment"), -1, 'payment');
/*
* Deletion confirmation of payment
*/
if ($action == 'delete')
{
print $form->formconfirm('card.php?id='.$object->id, $langs->trans("DeletePayment"), $langs->trans("ConfirmDeletePayment"), 'confirm_delete', '', 0, 2);
}
/*
* Validation confirmation of payment
*/
/*
if ($action == 'valide')
{
$facid = $_GET['facid'];
print $form->formconfirm('card.php?id='.$object->id.'&amp;facid='.$facid, $langs->trans("ValidatePayment"), $langs->trans("ConfirmValidatePayment"), 'confirm_valide','',0,2);
}
*/
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/tva/payments.php">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'id', '');
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">';
// Ref
/*print '<tr><td class="titlefield">'.$langs->trans('Ref').'</td>';
print '<td colspan="3">';
print $form->showrefnav($object,'id','',1,'rowid','id');
print '</td></tr>';*/
// Date
print '<tr><td>'.$langs->trans('Date').'</td><td colspan="3">'.dol_print_date($object->datep, 'day').'</td></tr>';
// Mode
print '<tr><td>'.$langs->trans('Mode').'</td><td colspan="3">'.$langs->trans("PaymentType".$object->type_code).'</td></tr>';
// Numero
print '<tr><td>'.$langs->trans('Numero').'</td><td colspan="3">'.$object->num_paiement.'</td></tr>';
// Montant
print '<tr><td>'.$langs->trans('Amount').'</td><td colspan="3">'.price($object->amount, 0, $outputlangs, 1, -1, -1, $conf->currency).'</td></tr>';
// Note
print '<tr><td>'.$langs->trans('Note').'</td><td colspan="3">'.nl2br($object->note).'</td></tr>';
// Bank account
if (!empty($conf->banque->enabled))
{
if ($object->bank_account)
{
$bankline = new AccountLine($db);
$bankline->fetch($object->bank_line);
print '<tr>';
print '<td>'.$langs->trans('BankTransactionLine').'</td>';
print '<td colspan="3">';
print $bankline->getNomUrl(1, 0, 'showall');
print '</td>';
print '</tr>';
}
}
print '</table>';
print '</div>';
dol_fiche_end();
/*
* List of social contributions payed
*/
$disable_delete = 0;
$sql = 'SELECT f.rowid as scid, f.label as label, f.paye, f.amount as tva_amount, pf.amount';
//$sql .= ', pc.libelle as sc_type';
$sql .= ' FROM '.MAIN_DB_PREFIX.'payment_vat as pf,'.MAIN_DB_PREFIX.'tva as f';
//$sql .= ', '.MAIN_DB_PREFIX.'c_chargesociales as pc';
$sql .= ' WHERE pf.fk_tva = f.rowid';
//$sql .= ' AND f.fk_type = pc.id';
$sql .= ' AND f.entity = '.$conf->entity;
$sql .= ' AND pf.rowid = '.$object->id;
dol_syslog("compta/payment_vat/card.php", LOG_DEBUG);
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
$total = 0;
print '<br><table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans('VATDeclaration').'</td>';
//print '<td>'.$langs->trans('Type').'</td>';
print '<td>'.$langs->trans('Label').'</td>';
print '<td class="right">'.$langs->trans('ExpectedToPay').'</td>';
print '<td class="center">'.$langs->trans('Status').'</td>';
print '<td class="right">'.$langs->trans('PayedByThisPayment').'</td>';
print "</tr>\n";
if ($num > 0)
{
while ($i < $num)
{
$objp = $db->fetch_object($resql);
print '<tr class="oddeven">';
// Ref
print '<td>';
$tva->fetch($objp->scid);
print $tva->getNomUrl(1);
print "</td>\n";
// Type
/* print '<td>';
print $tva->type_label;4
print "</td>\n";*/
// Label
print '<td>'.$objp->label.'</td>';
// Expected to pay
print '<td class="right">'.price($objp->tva_amount).'</td>';
// Status
print '<td class="center">'.$tva->getLibStatut(4, $objp->amount).'</td>';
// Amount payed
print '<td class="right">'.price($objp->amount).'</td>';
print "</tr>\n";
if ($objp->paye == 1) // If at least one invoice is paid, disable delete
{
$disable_delete = 1;
}
$total = $total + $objp->amount;
$i++;
}
}
print "</table>\n";
$db->free($resql);
}
else {
dol_print_error($db);
}
/*
* Boutons Actions
*/
print '<div class="tabsAction">';
/*
if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION))
{
if ($user->socid == 0 && $object->statut == 0 && $_GET['action'] == '')
{
if ($user->rights->facture->paiement)
{
print '<a class="butAction" href="card.php?id='.$_GET['id'].'&amp;facid='.$objp->facid.'&amp;action=valide">'.$langs->trans('Valid').'</a>';
}
}
}
*/
if ($action == '')
{
if ($user->rights->tax->charges->supprimer)
{
if (!$disable_delete)
{
print '<a class="butActionDelete" href="card.php?id='.$_GET['id'].'&amp;action=delete">'.$langs->trans('Delete').'</a>';
}
else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("CantRemovePaymentVATPaid")).'">'.$langs->trans('Delete').'</a>';
}
}
}
print '</div>';
// End of page
llxFooter();
$db->close();

View File

@ -98,7 +98,13 @@ if (empty($reshook))
// Seems to no be used and replaced with $action == 'infocredit'
if ($action == 'confirm_credite' && GETPOST('confirm', 'alpha') == 'yes')
{
$res = $object->set_credite();
if ($object->statut == 2) {
$res = -1;
setEventMessages('WithdrawalCantBeCreditedTwice', array(), 'errors');
} else {
$res = $object->set_credite();
}
if ($res >= 0)
{
header("Location: card.php?id=".$id);
@ -145,10 +151,16 @@ if (empty($reshook))
{
$dt = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
$error = $object->set_infocredit($user, $dt);
if ($object->statut == 2) {
$error = 1;
setEventMessages('WithdrawalCantBeCreditedTwice', array(), 'errors');
} else {
$error = $object->set_infocredit($user, $dt);
}
if ($error)
{
setEventMessages($object->error, $object->errors, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}
}

View File

@ -371,7 +371,7 @@ class BonPrelevement extends CommonObject
$num = count($facs);
for ($i = 0; $i < $num; $i++)
{
/* Tag invoice as payed */
/* Tag invoice as paid */
dol_syslog(get_class($this)."::set_credite set_paid fac ".$facs[$i]);
$fac = new Facture($this->db);
$fac->fetch($facs[$i]);
@ -1704,7 +1704,7 @@ class BonPrelevement extends CommonObject
fputs($this->file, ' <Id>'.$CrLf);
fputs($this->file, ' <PrvtId>'.$CrLf);
fputs($this->file, ' <Othr>'.$CrLf);
fputs($this->file, ' <Id>'.$conf->global->PAYMENTBYBANKTRANSFER_ICS.'</Id>'.$CrLf);
fputs($this->file, ' <Id>'.$this->emetteur_ics.'</Id>'.$CrLf);
fputs($this->file, ' </Othr>'.$CrLf);
fputs($this->file, ' </PrvtId>'.$CrLf);
fputs($this->file, ' </Id>'.$CrLf);

View File

@ -430,7 +430,7 @@ class ChargeSociales extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Tag social contribution as payed completely
* Tag social contribution as paid completely
*
* @param User $user Object user making change
* @return int <0 if KO, >0 if OK
@ -448,7 +448,7 @@ class ChargeSociales extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Remove tag payed on social contribution
* Remove tag paid on social contribution
*
* @param User $user Object user making change
* @return int <0 if KO, >0 if OK
@ -468,7 +468,7 @@ class ChargeSociales extends CommonObject
* Retourne le libelle du statut d'une charge (impaye, payee)
*
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto
* @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise)
* @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount paid if you have it, 1 otherwise)
* @return string Label
*/
public function getLibStatut($mode = 0, $alreadypaid = -1)
@ -482,7 +482,7 @@ class ChargeSociales extends CommonObject
*
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto
* @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise)
* @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount paid if you have it, 1 otherwise)
* @return string Label
*/
public function LibStatut($status, $mode = 0, $alreadypaid = -1)

View File

@ -115,7 +115,7 @@ class PaymentSocialContribution extends CommonObject
* Use this->amounts to have list of lines for the payment
*
* @param User $user User making payment
* @param int $closepaidcontrib 1=Also close payed contributions to paid, 0=Do nothing more
* @param int $closepaidcontrib 1=Also close paid contributions to paid, 0=Do nothing more
* @return int <0 if KO, id of payment if OK
*/
public function create($user, $closepaidcontrib = 0)
@ -183,7 +183,7 @@ class PaymentSocialContribution extends CommonObject
{
$amount = price2num($amount);
// If we want to closed payed invoices
// If we want to closed paid invoices
if ($closepaidcontrib)
{
$contrib = new ChargeSociales($this->db);

View File

@ -148,7 +148,7 @@ if (!empty($conf->projet->enabled)) $projectstatic = new Project($db);
llxHeader('', $langs->trans("SocialContributions"));
$sql = "SELECT cs.rowid, cs.fk_type as type, cs.fk_user, ";
$sql = "SELECT cs.rowid, cs.fk_type as type, cs.fk_user,";
$sql .= " cs.amount, cs.date_ech, cs.libelle as label, cs.paye, cs.periode,";
if (!empty($conf->projet->enabled)) $sql .= " p.rowid as project_id, p.ref as project_ref, p.title as project_label,";
$sql .= " c.libelle as type_label,";
@ -185,7 +185,7 @@ if ($filtre) {
if ($search_typeid) {
$sql .= " AND cs.fk_type=".$db->escape($search_typeid);
}
$sql .= " GROUP BY cs.rowid, cs.fk_type, cs.amount, cs.date_ech, cs.libelle, cs.paye, cs.periode, c.libelle";
$sql .= " GROUP BY cs.rowid, cs.fk_type, cs.fk_user, cs.amount, cs.date_ech, cs.libelle, cs.paye, cs.periode, c.libelle";
if (!empty($conf->projet->enabled)) $sql .= ", p.rowid, p.ref, p.title";
$sql .= $db->order($sortfield, $sortorder);

View File

@ -4,6 +4,7 @@
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015-2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
*
* 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
@ -27,15 +28,23 @@
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/paymentvat.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/vat.lib.php';
if (!empty($conf->accounting->enabled)) {
include_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
}
// Load translation files required by the page
$langs->loadLangs(array('compta', 'banks', 'bills'));
$id = GETPOST("id", 'int');
$action = GETPOST("action", "alpha");
$confirm = GETPOST('confirm');
$refund = GETPOST("refund", "int");
$auto_create_payment = GETPOST("auto_create_paiement", "int");
if (empty($refund)) $refund = 0;
$datev = dol_mktime(12, 0, 0, GETPOST("datevmonth", 'int'), GETPOST("datevday", 'int'), GETPOST("datevyear", 'int'));
@ -73,32 +82,71 @@ if ($action == 'setlib' && $user->rights->tax->charges->creer)
if ($action == 'setdatev' && $user->rights->tax->charges->creer)
{
$object->fetch($id);
$object->datev = $datev;
$result = $object->update($user);
if ($result < 0) dol_print_error($db, $object->error);
$object->fetch($id);
$object->datev = $datev;
$result = $object->update($user);
if ($result < 0) dol_print_error($db, $object->error);
$action = '';
$action = '';
}
// payment mode
if ($action == 'setmode' && $user->rights->tax->charges->creer) {
$object->fetch($id);
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
if ($result < 0)
setEventMessages($object->error, $object->errors, 'errors');
}
// Bank account
if ($action == 'setbankaccount' && $user->rights->tax->charges->creer) {
$object->fetch($id);
$result = $object->setBankAccount(GETPOST('fk_account', 'int'));
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
}
// Classify paid
if ($action == 'confirm_paid' && $user->rights->tax->charges->creer && $confirm == 'yes')
{
$object->fetch($id);
$result = $object->set_paid($user);
}
if ($action == 'reopen' && $user->rights->tax->charges->creer) {
$result = $object->fetch($id);
if ($object->paye)
{
$result = $object->set_unpaid($user);
if ($result > 0)
{
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
exit();
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
}
}
if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel"))
{
$error = 0;
$error = 0;
$object->accountid = GETPOST("accountid", 'int');
$object->type_payment = GETPOST("type_payment", 'alphanohtml');
$object->fk_account = GETPOST("accountid", 'int');
$object->type_payment = GETPOST("type_payment", 'alphanohtml');
$object->num_payment = GETPOST("num_payment", 'alphanohtml');
$object->datev = $datev;
$object->datep = $datep;
$object->datep = $datep;
$amount = price2num(GETPOST("amount", 'alpha'));
if ($refund == 1) {
$amount = -$amount;
}
$object->amount = $amount;
$object->amount = $amount;
$object->label = GETPOST("label", 'alpha');
$object->note_private = GETPOST("note", 'restricthtml');
$object->note = GETPOST("note", 'none');
if (empty($object->datep))
{
@ -110,7 +158,7 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel"))
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("PeriodEndDate")), null, 'errors');
$error++;
}
if (empty($object->type_payment) || $object->type_payment < 0)
if (!empty($auto_create_payment) && (empty($object->type_payment) || $object->type_payment < 0))
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("PaymentMode")), null, 'errors');
$error++;
@ -120,38 +168,81 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel"))
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Amount")), null, 'errors');
$error++;
}
if (!empty($auto_create_payment) && ($object->fk_account <= 0))
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("AccountToCredit")), null, 'errors');
$error++;
}
if (!$error)
{
$db->begin();
$ret = $object->create($user);
if ($ret < 0) $error++;
$ret = $object->addPayment($user);
if ($ret > 0)
// Auto create payment
if (!empty($auto_create_payment) && !$error)
{
$db->commit();
header("Location: list.php");
$db->begin();
// Create a line of payments
$paiement = new PaymentVAT($db);
$paiement->chid = $object->id;
$paiement->datepaye = $datep;
$paiement->amounts = array($object->id=>$amount); // Tableau de montant
$paiement->paiementtype = GETPOST("type_payment", 'alphanohtml');
$paiement->num_payment = GETPOST("num_payment", 'alphanohtml');
$paiement->note = GETPOST("note", 'none');
if (!$error)
{
$paymentid = $paiement->create($user, (int) GETPOST('closepaidtva'));
if ($paymentid < 0)
{
$error++;
setEventMessages($paiement->error, null, 'errors');
$action = 'create';
}
}
if (!$error)
{
$result = $paiement->addPaymentToBank($user, 'payment_vat', '(VATPayment)', GETPOST('accountid', 'int'), '', '');
if (!($result > 0))
{
$error++;
setEventMessages($paiement->error, null, 'errors');
}
}
if (!$error)
{
$db->commit();
}
else {
$db->rollback();
}
}
if (empty($error)) {
header("Location: card.php?id=" . $object->id);
exit;
} else {
$db->rollback();
setEventMessages($object->error, $object->errors, 'errors');
$action = "create";
}
}
$action = 'create';
}
if ($action == 'delete')
if ($action == 'confirm_delete' && $confirm == 'yes')
{
$result = $object->fetch($id);
$result = $object->fetch($id);
$totalpaye = $object->getSommePaiement();
if ($object->rappro == 0)
if (empty($totalpaye))
{
$db->begin();
$db->begin();
$ret = $object->delete($user);
if ($ret > 0)
{
$ret = $object->delete($user);
if ($ret > 0)
{
if ($object->fk_bank)
{
$accountline = new AccountLine($db);
@ -164,21 +255,99 @@ if ($action == 'delete')
$db->commit();
header("Location: ".DOL_URL_ROOT.'/compta/tva/list.php');
exit;
} else {
}
else {
$object->error = $accountline->error;
$db->rollback();
setEventMessages($object->error, $object->errors, 'errors');
}
} else {
$db->rollback();
setEventMessages($object->error, $object->errors, 'errors');
}
} else {
$mesg = 'Error try do delete a line linked to a conciliated bank transaction';
setEventMessages($mesg, null, 'errors');
}
else {
$db->rollback();
setEventMessages($object->error, $object->errors, 'errors');
}
}
else {
setEventMessages($langs->trans('DisabledBecausePayments'), null, 'errors');
}
}
if ($action == 'update' && !$_POST["cancel"] && $user->rights->tax->charges->creer)
{
$amount = price2num(GETPOST('amount'));
if (empty($amount))
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount")), null, 'errors');
$action = 'edit';
}
elseif (!is_numeric($amount))
{
setEventMessages($langs->trans("ErrorFieldMustBeANumeric", $langs->transnoentities("Amount")), null, 'errors');
$action = 'create';
}
else {
$result = $object->fetch($id);
$object->amount = price2num($amount);
$result = $object->update($user);
if ($result <= 0)
{
setEventMessages($object->error, $object->errors, 'errors');
}
}
}
// Action clone object
if ($action == 'confirm_clone' && $confirm != 'yes') { $action = ''; }
if ($action == 'confirm_clone' && $confirm == 'yes' && ($user->rights->tax->charges->creer))
{
$db->begin();
$originalId = $id;
$object->fetch($id);
if ($object->id > 0)
{
$object->paye = 0;
$object->id = $object->ref = null;
if (GETPOST('clone_label', 'alphanohtml')) {
$object->label = GETPOST('clone_label', 'alphanohtml');
}
else {
$object->label = $langs->trans("CopyOf").' '.$object->label;
}
$newdateperiod = dol_mktime(0, 0, 0, GETPOST('clone_periodmonth', 'int'), GETPOST('clone_periodday', 'int'), GETPOST('clone_periodyear', 'int'));
if ($newdateperiod) $object->datev = $newdateperiod;
//if ($object->check()) {
$id = $object->create($user);
if ($id > 0)
{
$db->commit();
$db->close();
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
exit;
}
else {
$id = $originalId;
$db->rollback();
setEventMessages($object->error, $object->errors, 'errors');
}
//}
}
else {
$db->rollback();
dol_print_error($db, $object->error);
}
}
/*
* View
@ -205,11 +374,10 @@ if ($id)
if ($action == 'create')
{
print load_fiche_titre($langs->trans("VAT").' - '.$langs->trans("New"));
if (!empty($conf->use_javascript_ajax))
{
print "\n".'<script type="text/javascript" language="javascript">';
print '$(document).ready(function () {
{
print "\n".'<script type="text/javascript" language="javascript">';
print '$(document).ready(function () {
$("#radiopayment").click(function() {
$("#label").val($(this).data("label"));
@ -218,44 +386,68 @@ if ($action == 'create')
$("#label").val($(this).data("label"));
});
});';
$("#auto_create_paiement").click(function() {
if($(this).is(":checked")) {
$("#label_fk_account").addClass("fieldrequired");
$("#label_type_payment").addClass("fieldrequired");
$(".hide_if_no_auto_create_payment").show();
} else {
$("#label_fk_account").removeClass("fieldrequired");
$("#label_type_payment").removeClass("fieldrequired");
$(".hide_if_no_auto_create_payment").hide();
}
});';
if ($_REQUEST['action'] === 'add') { // form has been send but there is at least one error
if (empty($auto_create_payment)) {
print '$("#label_fk_account").removeClass("fieldrequired");
$("#label_type_payment").removeClass("fieldrequired");
$(".hide_if_no_auto_create_payment").hide();';
} else {
print '$("#label_fk_account").addClass("fieldrequired");
$("#label_type_payment").addClass("fieldrequired");
$(".hide_if_no_auto_create_payment").show();';
}
}
print '});';
print '</script>'."\n";
}
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" name="formvat" method="post">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="add">';
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" name="formvat" method="post">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="add">';
print '<div id="selectmethod">';
print '<div class="hideonsmartphone float">';
print $langs->trans("Type").':&nbsp;&nbsp;&nbsp;';
print '</div>';
print '<label for="radiopayment">';
print '<input type="radio" id="radiopayment" data-label="'.$langs->trans('VATPayment').'" class="flat" name="refund" value="0"'.($refund ? '' : ' checked="checked"').'>';
print '&nbsp;';
print $langs->trans("Payment");
print '</label>';
print '&nbsp;&nbsp;&nbsp;';
print '<label for="radiorefund">';
print '<input type="radio" id="radiorefund" data-label="'.$langs->trans('VATRefund').'" class="flat" name="refund" value="1"'.($refund ? ' checked="checked"' : '').'>';
print '&nbsp;';
print $langs->trans("PaymentBack");
print '</label>';
print '</div>';
print "<br>\n";
print '<div id="selectmethod">';
print '<div class="hideonsmartphone float">';
print $langs->trans("Type").':&nbsp;&nbsp;&nbsp;';
print '</div>';
print '<label for="radiopayment">';
print '<input type="radio" id="radiopayment" data-label="'.$langs->trans('VATPayment').'" class="flat" name="refund" value="0"'.($refund ? '' : ' checked="checked"').'>';
print '&nbsp;';
print $langs->trans("Payment");
print '</label>';
print '&nbsp;&nbsp;&nbsp;';
print '<label for="radiorefund">';
print '<input type="radio" id="radiorefund" data-label="'.$langs->trans('VATRefund').'" class="flat" name="refund" value="1"'.($refund ? ' checked="checked"' : '').'>';
print '&nbsp;';
print $langs->trans("Refund");
print '</label>';
print '</div>';
print "<br>\n";
print dol_get_fiche_head();
dol_fiche_head();
print '<table class="border centpercent">';
print '<table class="border centpercent">';
print "<tr>";
print '<td class="titlefieldcreate fieldrequired">'.$langs->trans("DatePayment").'</td><td>';
print $form->selectDate($datep, "datep", '', '', '', 'add', 1, 1);
print '</td></tr>';
print '<tr class="hide_if_no_auto_create_payment">';
print '<td class="fieldrequired">'.$langs->trans("DatePayment").'</td><td>';
print $form->selectDate($datep, "datep", '', '', '', 'add', 1, 1);
print '</td></tr>';
print '<tr><td class="fieldrequired">'.$form->textwithpicto($langs->trans("PeriodEndDate"), $langs->trans("LastDayTaxIsRelatedTo")).'</td><td>';
print $form->selectDate((GETPOST("datevmonth", 'int') ? $datev : -1), "datev", '', '', '', 'add', 1, 1);
print '</td></tr>';
print '<tr><td class="titlefieldcreate fieldrequired">'.$form->textwithpicto($langs->trans("PeriodEndDate"), $langs->trans("LastDayTaxIsRelatedTo")).'</td><td>';
print $form->selectDate((GETPOST("datevmonth", 'int') ? $datev : -1), "datev", '', '', '', 'add', 1, 1);
print '</td></tr>';
// Label
if ($refund == 1) {
@ -268,32 +460,47 @@ if ($action == 'create')
// Amount
print '<tr><td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input name="amount" size="10" value="'.GETPOST("amount", "alpha").'"></td></tr>';
if (!empty($conf->banque->enabled))
{
print '<tr><td class="fieldrequired">'.$langs->trans("BankAccount").'</td><td>';
$form->select_comptes(GETPOST("accountid", 'int'), "accountid", 0, "courant=1", 2); // List of bank account available
print '</td></tr>';
}
// Type payment
print '<tr><td class="fieldrequired">'.$langs->trans("PaymentMode").'</td><td>';
// Type payment
print '<tr><td class="fieldrequired" id="label_type_payment">'.$langs->trans("PaymentMode").'</td><td>';
$form->select_types_paiements(GETPOST("type_payment"), "type_payment");
print "</td>\n";
print "</tr>";
if (!empty($conf->banque->enabled))
{
print '<tr><td class="fieldrequired" id="label_fk_account">'.$langs->trans("BankAccount").'</td><td>';
$form->select_comptes(GETPOST("accountid", 'int'), "accountid", 0, "courant=1", 1); // List of bank account available
print '</td></tr>';
}
// Auto create payment
print '<tr><td>'.$langs->trans('AutomaticCreationPayment').'</td>';
print '<td><input id="auto_create_paiement" name="auto_create_paiement" type="checkbox" '.($_REQUEST['action'] === 'add' ? (empty($auto_create_payment) ? '' : 'checked="checked"') : 'checked="checked"').' value="1"></td></tr>'."\n";
// Number
print '<tr><td>'.$langs->trans('Numero');
print '<tr class="hide_if_no_auto_create_payment"><td>'.$langs->trans('Numero');
print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
print '<td><input name="num_payment" type="text" value="'.GETPOST("num_payment").'"></td></tr>'."\n";
// Other attributes
$parameters = array();
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Comments
print '<tr class="hide_if_no_auto_create_payment">';
print '<td class="tdtop">'.$langs->trans("Comments").'</td>';
print '<td class="tdtop"><textarea name="note" wrap="soft" cols="60" rows="'.ROWS_3.'"></textarea></td>';
print '</tr>';
print '</table>';
// Other attributes
$parameters = array();
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print dol_get_fiche_end();
// Bouton Save payment
print '<tr class="hide_if_no_auto_create_payment"><td>';
print $langs->trans("ClosePaidVATAutomatically");
print '</td><td><input type="checkbox" checked value="1" name="closepaidtva"></td></tr>';
print '</table>';
dol_fiche_end();
print '<div class="center">';
print '<input type="submit" class="button button-save" value="'.$langs->trans("Save").'">';
@ -301,7 +508,7 @@ if ($action == 'create')
print '<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</div>';
print '</form>';
print '</form>';
}
// View mode
@ -309,7 +516,40 @@ if ($id)
{
$head = vat_prepare_head($object);
print dol_get_fiche_head($head, 'card', $langs->trans("VATPayment"), -1, 'payment');
$totalpaye = $object->getSommePaiement();
// Clone confirmation
if ($action === 'clone')
{
$formquestion = array(
array('type' => 'text', 'name' => 'clone_label', 'label' => $langs->trans("Label"), 'value' => $langs->trans("CopyOf").' '.$object->label),
);
//$formquestion[] = array('type' => 'date', 'name' => 'clone_date_ech', 'label' => $langs->trans("Date"), 'value' => -1);
$formquestion[] = array('type' => 'date', 'name' => 'clone_period', 'label' => $langs->trans("PeriodEndDate"), 'value' => -1);
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneVAT', $object->ref), 'confirm_clone', $formquestion, 'yes', 1, 240);
}
if ($action == 'paid')
{
$text = $langs->trans('ConfirmPayVAT');
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans('PayVAT'), $text, "confirm_paid", '', '', 2);
}
if ($action == 'delete')
{
$text = $langs->trans('ConfirmDeleteVAT');
print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('DeleteVAT'), $text, 'confirm_delete', '', '', 2);
}
if ($action == 'edit')
{
print "<form name=\"charge\" action=\"".$_SERVER["PHP_SELF"]."?id=$object->id&amp;action=update\" method=\"post\">";
print '<input type="hidden" name="token" value="'.newToken().'">';
}
dol_fiche_head($head, 'card', $langs->trans("VATPayment"), -1, 'payment');
$morehtmlref = '<div class="refidno">';
// Label of social contribution
@ -320,9 +560,12 @@ if ($id)
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/tva/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', '');
print '<div class="fichecenter">';
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">';
@ -330,10 +573,10 @@ if ($id)
// Label
//print '<tr><td class="titlefield">'.$langs->trans("Label").'</td><td>'.$object->label.'</td></tr>';
print "<tr>";
/*print "<tr>";
print '<td class="titlefield">'.$langs->trans("DatePayment").'</td><td>';
print dol_print_date($object->datep, 'day');
print '</td></tr>';
print '</td></tr>';*/
print '<tr><td>';
print $form->editfieldkey($form->textwithpicto($langs->trans("PeriodEndDate"), $langs->trans("LastDayTaxIsRelatedTo")), 'datev', $object->datev, $object, $user->rights->tax->charges->creer, 'day');
@ -342,22 +585,46 @@ if ($id)
//print dol_print_date($object->datev,'day');
print '</td></tr>';
print '<tr><td>'.$langs->trans("Amount").'</td><td>'.price($object->amount).'</td></tr>';
if ($action == 'edit') {
print '<tr><td class="fieldrequired">' . $langs->trans("Amount") . '</td><td><input name="amount" size="10" value="' . $object->amount . '"></td></tr>';
} else {
print '<tr><td>' . $langs->trans("Amount") . '</td><td>' . price($object->amount) . '</td></tr>';
}
// Mode of payment
print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('PaymentMode');
print '</td>';
if ($action != 'editmode')
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmode&amp;id='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>';
print '</tr></table>';
print '</td><td>';
if ($action == 'editmode') {
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->type_payment, 'mode_reglement_id');
} else {
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->type_payment, 'none');
}
print '</td></tr>';
// Bank account
if (!empty($conf->banque->enabled))
{
if ($object->fk_account > 0)
{
$bankline = new AccountLine($db);
$bankline->fetch($object->fk_bank);
print '<tr>';
print '<td>'.$langs->trans('BankTransactionLine').'</td>';
print '<td>';
print $bankline->getNomUrl(1, 0, 'showall');
print '</td>';
print '</tr>';
print '<tr><td class="nowrap">';
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
print $langs->trans('BankAccount');
print '<td>';
if ($action != 'editbankaccount' && $user->rights->tax->charges->creer)
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&amp;id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'), 1).'</a></td>';
print '</tr></table>';
print '</td><td>';
if ($action == 'editbankaccount') {
$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1);
} else {
$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none');
}
print '</td>';
print '</tr>';
}
// Other attributes
@ -369,22 +636,180 @@ if ($id)
print '</div>';
print dol_get_fiche_end();
print '<div class="fichehalfright">';
print '<div class="ficheaddleft">';
$nbcols = 3;
if (!empty($conf->banque->enabled)) {
$nbcols++;
}
/*
* Payments
*/
$sql = "SELECT p.rowid, p.num_paiement as num_payment, p.datep as dp, p.amount,";
$sql .= " c.code as type_code,c.libelle as paiement_type,";
$sql .= ' ba.rowid as baid, ba.ref as baref, ba.label, ba.number as banumber, ba.account_number, ba.currency_code as bacurrency_code, ba.fk_accountancy_journal';
$sql .= " FROM ".MAIN_DB_PREFIX."payment_vat as p";
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid';
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as ba ON b.fk_account = ba.rowid';
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_typepaiement = c.id";
$sql .= ", ".MAIN_DB_PREFIX."tva as tva";
$sql .= " WHERE p.fk_tva = ".$id;
$sql .= " AND p.fk_tva = tva.rowid";
$sql .= " AND tva.entity IN (".getEntity('tax').")";
$sql .= " ORDER BY dp DESC";
//print $sql;
$resql = $db->query($sql);
if ($resql)
{
$totalpaye = 0;
$num = $db->num_rows($resql);
$i = 0; $total = 0;
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<table class="noborder paymenttable">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("RefPayment").'</td>';
print '<td>'.$langs->trans("Date").'</td>';
print '<td>'.$langs->trans("Type").'</td>';
if (!empty($conf->banque->enabled)) {
print '<td class="liste_titre right">'.$langs->trans('BankAccount').'</td>';
}
print '<td class="right">'.$langs->trans("Amount").'</td>';
print '</tr>';
if ($num > 0)
{
$bankaccountstatic = new Account($db);
while ($i < $num)
{
$objp = $db->fetch_object($resql);
print '<tr class="oddeven"><td>';
print '<a href="'.DOL_URL_ROOT.'/compta/payment_vat/card.php?id='.$objp->rowid.'">'.img_object($langs->trans("Payment"), "payment").' '.$objp->rowid.'</a></td>';
print '<td>'.dol_print_date($db->jdate($objp->dp), 'day')."</td>\n";
$labeltype = $langs->trans("PaymentType".$objp->type_code) != ("PaymentType".$objp->type_code) ? $langs->trans("PaymentType".$objp->type_code) : $objp->paiement_type;
print "<td>".$labeltype.' '.$objp->num_payment."</td>\n";
if (!empty($conf->banque->enabled))
{
$bankaccountstatic->id = $objp->baid;
$bankaccountstatic->ref = $objp->baref;
$bankaccountstatic->label = $objp->baref;
$bankaccountstatic->number = $objp->banumber;
$bankaccountstatic->currency_code = $objp->bacurrency_code;
if (!empty($conf->accounting->enabled)) {
$bankaccountstatic->account_number = $objp->account_number;
$accountingjournal = new AccountingJournal($db);
$accountingjournal->fetch($objp->fk_accountancy_journal);
$bankaccountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1);
}
print '<td class="right">';
if ($bankaccountstatic->id)
print $bankaccountstatic->getNomUrl(1, 'transactions');
print '</td>';
}
print '<td class="right">'.price($objp->amount)."</td>\n";
print "</tr>";
$totalpaye += $objp->amount;
$i++;
}
}
else {
print '<tr class="oddeven"><td><span class="opacitymedium">'.$langs->trans("None").'</span></td>';
print '<td></td><td></td><td></td><td></td>';
print '</tr>';
}
print '<tr><td colspan="'.$nbcols.'" class="right">'.$langs->trans("AlreadyPaid")." :</td><td class=\"right\">".price($totalpaye)."</td></tr>\n";
print '<tr><td colspan="'.$nbcols.'" class="right">'.$langs->trans("AmountExpected")." :</td><td class=\"right\">".price($object->amount)."</td></tr>\n";
$resteapayer = $object->amount - $totalpaye;
$cssforamountpaymentcomplete = 'amountpaymentcomplete';
print '<tr><td colspan="'.$nbcols.'" class="right">'.$langs->trans("RemainderToPay")." :</td>";
print '<td class="right'.($resteapayer ? ' amountremaintopay' : (' '.$cssforamountpaymentcomplete)).'">'.price($resteapayer)."</td></tr>\n";
print "</table>";
print '</div>';
$db->free($resql);
}
else {
dol_print_error($db);
}
print '</div>';
print '</div>';
print '</div>';
print '<div class="clearboth"></div>';
dol_fiche_end();
if ($action == 'edit')
{
print '<div align="center">';
print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
print ' &nbsp; ';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</div>';
print "</form>\n";
}
/*
* Action buttons
*/
print "<div class=\"tabsAction\">\n";
if ($object->rappro == 0)
if ($action != 'edit')
{
if (!empty($user->rights->tax->charges->supprimer))
// Reopen
if ($object->paye && $user->rights->tax->charges->creer)
{
print '<div class="inline-block divButAction"><a class="butActionDelete" href="card.php?id='.$object->id.'&action=delete&token='.newToken().'">'.$langs->trans("Delete").'</a></div>';
} else {
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.(dol_escape_htmltag($langs->trans("NotAllowed"))).'">'.$langs->trans("Delete").'</a></div>';
print "<div class=\"inline-block divButAction\"><a class=\"butAction\" href=\"".dol_buildpath("/compta/tva/card.php", 1)."?id=$object->id&amp;action=reopen\">".$langs->trans("ReOpen")."</a></div>";
}
// Edit
if ($object->paye == 0 && $user->rights->tax->charges->creer)
{
print "<div class=\"inline-block divButAction\"><a class=\"butAction\" href=\"".DOL_URL_ROOT."/compta/tva/card.php?id=$object->id&amp;action=edit\">".$langs->trans("Modify")."</a></div>";
}
// Emit payment
if ($object->paye == 0 && ((price2num($object->amount) < 0 && price2num($resteapayer, 'MT') < 0) || (price2num($object->amount) > 0 && price2num($resteapayer, 'MT') > 0)) && $user->rights->tax->charges->creer)
{
print "<div class=\"inline-block divButAction\"><a class=\"butAction\" href=\"".DOL_URL_ROOT."/compta/paiement_vat.php?id=$object->id&amp;action=create\">".$langs->trans("DoPayment")."</a></div>";
}
// Classify 'paid'
if ($object->paye == 0
&& (
(round($resteapayer) <= 0 && $object->amount > 0)
|| (round($resteapayer) >= 0 && $object->amount < 0)
)
&& $user->rights->tax->charges->creer)
{
print "<div class=\"inline-block divButAction\"><a class=\"butAction\" href=\"".DOL_URL_ROOT."/compta/tva/card.php?id=$object->id&amp;action=paid\">".$langs->trans("ClassifyPaid")."</a></div>";
}
// Clone
if ($user->rights->tax->charges->creer)
{
print "<div class=\"inline-block divButAction\"><a class=\"butAction\" href=\"".dol_buildpath("/compta/tva/card.php", 1)."?id=$object->id&amp;action=clone\">".$langs->trans("ToClone")."</a></div>";
}
if (!empty($user->rights->tax->charges->supprimer) && empty($totalpaye))
{
print '<div class="inline-block divButAction"><a class="butActionDelete" href="card.php?id='.$object->id.'&action=delete">'.$langs->trans("Delete").'</a></div>';
}
else {
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.(dol_escape_htmltag($langs->trans("DisabledBecausePayments"))).'">'.$langs->trans("Delete").'</a></div>';
}
} else {
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("LinkedToAConciliatedTransaction").'">'.$langs->trans("Delete").'</a></div>';
}
print "</div>";
}

View File

@ -0,0 +1,724 @@
<?php
/* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
*
* 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 <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/compta/sociales/class/paymentsocialcontribution.class.php
* \ingroup facture
* \brief File of class to manage payment of social contributions
*/
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
/**
* Class to manage payments of social contributions
*/
class PaymentVAT extends CommonObject
{
/**
* @var string ID to identify managed object
*/
public $element = 'payment_vat';
/**
* @var string Name of table without prefix where object is stored
*/
public $table_element = 'payment_vat';
/**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
*/
public $picto = 'payment';
/**
* @var int ID
*/
public $fk_tva;
public $datec = '';
public $tms = '';
public $datep = '';
/**
* @deprecated
* @see $amount
*/
public $total;
public $amount; // Total amount of payment
public $amounts = array(); // Array of amounts
/**
* @var int ID
*/
public $fk_typepaiement;
/**
* @var string
* @deprecated
*/
public $num_paiement;
/**
* @var string
*/
public $num_payment;
/**
* @var int ID
*/
public $fk_bank;
/**
* @var int ID
*/
public $fk_user_creat;
/**
* @var int ID
*/
public $fk_user_modif;
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
public function __construct($db)
{
$this->db = $db;
}
/**
* Create payment of social contribution into database.
* Use this->amounts to have list of lines for the payment
*
* @param User $user User making payment
* @param int $closepaidcontrib 1=Also close payed contributions to paid, 0=Do nothing more
* @return int <0 if KO, id of payment if OK
*/
public function create($user, $closepaidcontrib = 0)
{
global $conf, $langs;
$error = 0;
$now = dol_now();
dol_syslog(get_class($this)."::create", LOG_DEBUG);
// Validate parametres
if (!$this->datepaye)
{
$this->error = 'ErrorBadValueForParameterCreatePaymentVAT';
return -1;
}
// Clean parameters
if (isset($this->fk_tva)) $this->fk_tva = (int) $this->fk_tva;
if (isset($this->amount)) $this->amount = trim($this->amount);
if (isset($this->fk_typepaiement)) $this->fk_typepaiement = (int) $this->fk_typepaiement;
if (isset($this->num_paiement)) $this->num_paiement = trim($this->num_paiement); // deprecated
if (isset($this->num_payment)) $this->num_payment = trim($this->num_payment);
if (isset($this->note)) $this->note = trim($this->note);
if (isset($this->fk_bank)) $this->fk_bank = (int) $this->fk_bank;
if (isset($this->fk_user_creat)) $this->fk_user_creat = (int) $this->fk_user_creat;
if (isset($this->fk_user_modif)) $this->fk_user_modif = (int) $this->fk_user_modif;
$totalamount = 0;
foreach ($this->amounts as $key => $value) // How payment is dispatch
{
$newvalue = price2num($value, 'MT');
$this->amounts[$key] = $newvalue;
$totalamount += $newvalue;
}
$totalamount = price2num($totalamount);
// Check parameters
if ($totalamount == 0) return -1; // On accepte les montants negatifs pour les rejets de prelevement mais pas null
$this->db->begin();
if ($totalamount != 0)
{
$sql = "INSERT INTO ".MAIN_DB_PREFIX."payment_vat (fk_tva, datec, datep, amount,";
$sql .= " fk_typepaiement, num_paiement, note, fk_user_creat, fk_bank)";
$sql .= " VALUES ($this->chid, '".$this->db->idate($now)."',";
$sql .= " '".$this->db->idate($this->datepaye)."',";
$sql .= " ".$totalamount.",";
$sql .= " ".$this->paiementtype.", '".$this->db->escape($this->num_payment)."', '".$this->db->escape($this->note)."', ".$user->id.",";
$sql .= " 0)";
$resql = $this->db->query($sql);
if ($resql)
{
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."payment_vat");
// Insere tableau des montants / factures
foreach ($this->amounts as $key => $amount)
{
$contribid = $key;
if (is_numeric($amount) && $amount <> 0)
{
$amount = price2num($amount);
// If we want to closed payed invoices
if ($closepaidcontrib)
{
$contrib = new Tva($this->db);
$contrib->fetch($contribid);
$paiement = $contrib->getSommePaiement();
//$creditnotes=$contrib->getSumCreditNotesUsed();
$creditnotes = 0;
//$deposits=$contrib->getSumDepositsUsed();
$deposits = 0;
$alreadypayed = price2num($paiement + $creditnotes + $deposits, 'MT');
$remaintopay = price2num($contrib->amount - $paiement - $creditnotes - $deposits, 'MT');
if ($remaintopay == 0)
{
$result = $contrib->set_paid($user);
}
else dol_syslog("Remain to pay for conrib ".$contribid." not null. We do nothing.");
}
}
}
}
else {
$error++;
}
}
$result = $this->call_trigger('PAYMENTVAT_CREATE', $user);
if ($result < 0) $error++;
if ($totalamount != 0 && !$error)
{
$this->amount = $totalamount;
$this->total = $totalamount; // deprecated
$this->db->commit();
return $this->id;
}
else {
$this->error = $this->db->error();
$this->db->rollback();
return -1;
}
}
/**
* Load object in memory from database
*
* @param int $id Id object
* @return int <0 if KO, >0 if OK
*/
public function fetch($id)
{
global $langs;
$sql = "SELECT";
$sql .= " t.rowid,";
$sql .= " t.fk_tva,";
$sql .= " t.datec,";
$sql .= " t.tms,";
$sql .= " t.datep,";
$sql .= " t.amount,";
$sql .= " t.fk_typepaiement,";
$sql .= " t.num_paiement as num_payment,";
$sql .= " t.note,";
$sql .= " t.fk_bank,";
$sql .= " t.fk_user_creat,";
$sql .= " t.fk_user_modif,";
$sql .= " pt.code as type_code, pt.libelle as type_label,";
$sql .= ' b.fk_account';
$sql .= " FROM ".MAIN_DB_PREFIX."payment_vat as t LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pt ON t.fk_typepaiement = pt.id";
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON t.fk_bank = b.rowid';
$sql .= " WHERE t.rowid = ".$id;
// TODO link on entity of tax;
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
{
if ($this->db->num_rows($resql))
{
$obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid;
$this->ref = $obj->rowid;
$this->fk_tva = $obj->fk_tva;
$this->datec = $this->db->jdate($obj->datec);
$this->tms = $this->db->jdate($obj->tms);
$this->datep = $this->db->jdate($obj->datep);
$this->amount = $obj->amount;
$this->fk_typepaiement = $obj->fk_typepaiement;
$this->num_paiement = $obj->num_payment;
$this->num_payment = $obj->num_payment;
$this->note = $obj->note;
$this->fk_bank = $obj->fk_bank;
$this->fk_user_creat = $obj->fk_user_creat;
$this->fk_user_modif = $obj->fk_user_modif;
$this->type_code = $obj->type_code;
$this->type_label = $obj->type_label;
$this->bank_account = $obj->fk_account;
$this->bank_line = $obj->fk_bank;
}
$this->db->free($resql);
return 1;
}
else {
$this->error = "Error ".$this->db->lasterror();
return -1;
}
}
/**
* Update database
*
* @param User $user User that modify
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
public function update($user = null, $notrigger = 0)
{
global $conf, $langs;
$error = 0;
// Clean parameters
if (isset($this->fk_tva)) $this->fk_tva = (int) $this->fk_tva;
if (isset($this->amount)) $this->amount = trim($this->amount);
if (isset($this->fk_typepaiement)) $this->fk_typepaiement = (int) $this->fk_typepaiement;
if (isset($this->num_paiement)) $this->num_paiement = trim($this->num_paiement); // deprecated
if (isset($this->num_payment)) $this->num_payment = trim($this->num_payment);
if (isset($this->note)) $this->note = trim($this->note);
if (isset($this->fk_bank)) $this->fk_bank = (int) $this->fk_bank;
if (isset($this->fk_user_creat)) $this->fk_user_creat = (int) $this->fk_user_creat;
if (isset($this->fk_user_modif)) $this->fk_user_modif = (int) $this->fk_user_modif;
// Check parameters
// Put here code to add control on parameters values
// Update request
$sql = "UPDATE ".MAIN_DB_PREFIX."payment_vat SET";
$sql .= " fk_tva=".(isset($this->fk_tva) ? $this->fk_tva : "null").",";
$sql .= " datec=".(dol_strlen($this->datec) != 0 ? "'".$this->db->idate($this->datec)."'" : 'null').",";
$sql .= " tms=".(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : 'null').",";
$sql .= " datep=".(dol_strlen($this->datep) != 0 ? "'".$this->db->idate($this->datep)."'" : 'null').",";
$sql .= " amount=".(isset($this->amount) ? $this->amount : "null").",";
$sql .= " fk_typepaiement=".(isset($this->fk_typepaiement) ? $this->fk_typepaiement : "null").",";
$sql .= " num_paiement=".(isset($this->num_paiement) ? "'".$this->db->escape($this->num_paiement)."'" : "null").",";
$sql .= " note=".(isset($this->note) ? "'".$this->db->escape($this->note)."'" : "null").",";
$sql .= " fk_bank=".(isset($this->fk_bank) ? $this->fk_bank : "null").",";
$sql .= " fk_user_creat=".(isset($this->fk_user_creat) ? $this->fk_user_creat : "null").",";
$sql .= " fk_user_modif=".(isset($this->fk_user_modif) ? $this->fk_user_modif : "null")."";
$sql .= " WHERE rowid=".$this->id;
$this->db->begin();
dol_syslog(get_class($this)."::update", LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); }
// Commit or rollback
if ($error)
{
foreach ($this->errors as $errmsg)
{
dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
}
$this->db->rollback();
return -1 * $error;
}
else {
$this->db->commit();
return 1;
}
}
/**
* Delete object in database
*
* @param User $user User that delete
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
public function delete($user, $notrigger = 0)
{
global $conf, $langs;
$error = 0;
dol_syslog(get_class($this)."::delete");
$this->db->begin();
if ($this->bank_line > 0)
{
$accline = new AccountLine($this->db);
$accline->fetch($this->bank_line);
$result = $accline->delete();
if ($result < 0) {
$this->errors[] = $accline->error;
$error++;
}
}
if (!$error)
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."payment_vat";
$sql .= " WHERE rowid=".$this->id;
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); }
}
// Commit or rollback
if ($error)
{
foreach ($this->errors as $errmsg)
{
dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
}
$this->db->rollback();
return -1 * $error;
}
else {
$this->db->commit();
return 1;
}
}
/**
* Load an object from its id and create a new one in database
*
* @param User $user User making the clone
* @param int $fromid Id of object to clone
* @return int New id of clone
*/
public function createFromClone(User $user, $fromid)
{
$error = 0;
$object = new PaymentSocialContribution($this->db);
$this->db->begin();
// Load source object
$object->fetch($fromid);
$object->id = 0;
$object->statut = 0;
// Clear fields
// ...
// Create clone
$object->context['createfromclone'] = 'createfromclone';
$result = $object->create($user);
// Other options
if ($result < 0)
{
$this->error = $object->error;
$error++;
}
unset($object->context['createfromclone']);
// End
if (!$error)
{
$this->db->commit();
return $object->id;
}
else {
$this->db->rollback();
return -1;
}
}
/**
* Initialise an instance with random values.
* Used to build previews or test instances.
* id must be 0 if object instance is a specimen.
*
* @return void
*/
public function initAsSpecimen()
{
$this->id = 0;
$this->fk_tva = '';
$this->datec = '';
$this->tms = '';
$this->datep = '';
$this->amount = '';
$this->fk_typepaiement = '';
$this->num_payment = '';
$this->note_private = '';
$this->note_public = '';
$this->fk_bank = '';
$this->fk_user_creat = '';
$this->fk_user_modif = '';
}
/**
* Add record into bank for payment with links between this bank record and invoices of payment.
* All payment properties must have been set first like after a call to create().
*
* @param User $user Object of user making payment
* @param string $mode 'payment_sc'
* @param string $label Label to use in bank record
* @param int $accountid Id of bank account to do link with
* @param string $emetteur_nom Name of transmitter
* @param string $emetteur_banque Name of bank
* @return int <0 if KO, >0 if OK
*/
public function addPaymentToBank($user, $mode, $label, $accountid, $emetteur_nom, $emetteur_banque)
{
global $conf;
// Clean data
$this->num_payment = trim($this->num_payment ? $this->num_payment : $this->num_paiement);
$error = 0;
if (!empty($conf->banque->enabled))
{
include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$acc = new Account($this->db);
$acc->fetch($accountid);
$total = $this->total;
if ($mode == 'payment_vat') $total = -$total;
// Insert payment into llx_bank
$bank_line_id = $acc->addline(
$this->datepaye,
$this->paiementtype, // Payment mode id or code ("CHQ or VIR for example")
$label,
$total,
$this->num_payment,
'',
$user,
$emetteur_nom,
$emetteur_banque
);
// Mise a jour fk_bank dans llx_paiement.
// On connait ainsi le paiement qui a genere l'ecriture bancaire
if ($bank_line_id > 0)
{
$result = $this->update_fk_bank($bank_line_id);
if ($result <= 0)
{
$error++;
dol_print_error($this->db);
}
// Add link 'payment', 'payment_supplier', 'payment_sc' in bank_url between payment and bank transaction
$url = '';
if ($mode == 'payment_vat') $url = DOL_URL_ROOT.'/compta/payment_vat/card.php?id=';
if ($url)
{
$result = $acc->add_url_line($bank_line_id, $this->id, $url, '(paiement)', $mode);
if ($result <= 0)
{
$error++;
dol_print_error($this->db);
}
}
// Add link 'company' in bank_url between invoice and bank transaction (for each invoice concerned by payment)
$linkaddedforthirdparty = array();
foreach ($this->amounts as $key => $value)
{
if ($mode == 'payment_vat')
{
$tva = new Tva($this->db);
$tva->fetch($key);
$result = $acc->add_url_line($bank_line_id, $tva->id, DOL_URL_ROOT.'/compta/tva/card.php?id=', '('.$tva->label.')', 'vat');
if ($result <= 0) dol_print_error($this->db);
}
}
}
else {
$this->error = $acc->error;
$error++;
}
}
if (!$error)
{
return 1;
}
else {
return -1;
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Mise a jour du lien entre le paiement de tva et la ligne dans llx_bank generee
*
* @param int $id_bank Id if bank
* @return int >0 if OK, <=0 if KO
*/
public function update_fk_bank($id_bank)
{
// phpcs:enable
$sql = "UPDATE ".MAIN_DB_PREFIX."payment_vat SET fk_bank = ".$id_bank." WHERE rowid = ".$this->id;
dol_syslog(get_class($this)."::update_fk_bank", LOG_DEBUG);
$result = $this->db->query($sql);
if ($result)
{
return 1;
}
else {
$this->error = $this->db->error();
return 0;
}
}
/**
* Retourne le libelle du statut d'une facture (brouillon, validee, abandonnee, payee)
*
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Libelle
*/
public function getLibStatut($mode = 0)
{
return $this->LibStatut($this->statut, $mode);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi le libelle d'un statut donne
*
* @param int $status Statut
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Libelle du statut
*/
public function LibStatut($status, $mode = 0)
{
// phpcs:enable
global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage
$langs->load('compta');
/*if ($mode == 0)
{
if ($status == 0) return $langs->trans('ToValidate');
if ($status == 1) return $langs->trans('Validated');
}
if ($mode == 1)
{
if ($status == 0) return $langs->trans('ToValidate');
if ($status == 1) return $langs->trans('Validated');
}
if ($mode == 2)
{
if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1').' '.$langs->trans('ToValidate');
if ($status == 1) return img_picto($langs->trans('Validated'),'statut4').' '.$langs->trans('Validated');
}
if ($mode == 3)
{
if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1');
if ($status == 1) return img_picto($langs->trans('Validated'),'statut4');
}
if ($mode == 4)
{
if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1').' '.$langs->trans('ToValidate');
if ($status == 1) return img_picto($langs->trans('Validated'),'statut4').' '.$langs->trans('Validated');
}
if ($mode == 5)
{
if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'),'statut1');
if ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'),'statut4');
}
if ($mode == 6)
{
if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'),'statut1');
if ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'),'statut4');
}*/
return '';
}
/**
* Return clicable name (with picto eventually)
*
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param int $maxlen Longueur max libelle
* @return string Chaine avec URL
*/
public function getNomUrl($withpicto = 0, $maxlen = 0)
{
global $langs;
$result = '';
if (empty($this->ref)) $this->ref = $this->lib;
$label = img_picto('', $this->picto).' <u>'.$langs->trans("VATPayment").'</u>';
$label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
if (!empty($this->label)) {
$labeltoshow = $this->label;
$reg = array();
if (preg_match('/^\((.*)\)$/i', $this->label, $reg))
{
// Label generique car entre parentheses. On l'affiche en le traduisant
if ($reg[1] == 'paiement') $reg[1] = 'Payment';
$labeltoshow = $langs->trans($reg[1]);
}
$label .= '<br><b>'.$langs->trans('Label').':</b> '.$labeltoshow;
}
if ($this->datep) $label .= '<br><b>'.$langs->trans('Date').':</b> '.dol_print_date($this->datep, 'day');
if (!empty($this->id)) {
$link = '<a href="'.DOL_URL_ROOT.'/compta/payment_vat/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$linkend = '</a>';
if ($withpicto) $result .= ($link.img_object($label, 'payment', 'class="classfortooltip"').$linkend.' ');
if ($withpicto && $withpicto != 2) $result .= ' ';
if ($withpicto != 2) $result .= $link.($maxlen ?dol_trunc($this->ref, $maxlen) : $this->ref).$linkend;
}
return $result;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -5,6 +5,7 @@
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
*
* 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
@ -35,6 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/localtax/class/localtax.class.php';
// Load translation files required by the page
$langs->loadLangs(array("other", "compta", "banks", "bills", "companies", "product", "trips", "admin"));
$form = new Form($db);
$now = dol_now();
$current_date = dol_getdate($now);
if (empty($conf->global->SOCIETE_FISCAL_MONTH_START)) $conf->global->SOCIETE_FISCAL_MONTH_START = 1;
@ -57,11 +59,13 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
$q = GETPOST("q", "int");
if (empty($q))
{
if (GETPOST("month", "int")) { $date_start = dol_get_first_day($year_start, GETPOST("month", "int"), false); $date_end = dol_get_last_day($year_start, GETPOST("month", "int"), false); } else {
if (GETPOST("month", "int")) { $date_start = dol_get_first_day($year_start, GETPOST("month", "int"), false); $date_end = dol_get_last_day($year_start, GETPOST("month", "int"), false); }
else {
if (empty($conf->global->MAIN_INFO_VAT_RETURN) || $conf->global->MAIN_INFO_VAT_RETURN == 2) { // quaterly vat, we take last past complete quarter
$date_start = dol_time_plus_duree(dol_get_first_day($year_start, $current_date['mon'], false), -3 - (($current_date['mon'] - $conf->global->SOCIETE_FISCAL_MONTH_START) % 3), 'm');
$date_end = dol_time_plus_duree($date_start, 3, 'm') - 1;
} elseif ($conf->global->MAIN_INFO_VAT_RETURN == 3) { // yearly vat
}
elseif ($conf->global->MAIN_INFO_VAT_RETURN == 3) { // yearly vat
if ($current_date['mon'] < $conf->global->SOCIETE_FISCAL_MONTH_START) {
if (($conf->global->SOCIETE_FISCAL_MONTH_START - $current_date['mon']) > 6) { // If period started from less than 6 years, we show past year
$year_start--;
@ -73,12 +77,14 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
}
$date_start = dol_get_first_day($year_start, $conf->global->SOCIETE_FISCAL_MONTH_START, false);
$date_end = dol_time_plus_duree($date_start, 1, 'y') - 1;
} elseif ($conf->global->MAIN_INFO_VAT_RETURN == 1) { // monthly vat, we take last past complete month
}
elseif ($conf->global->MAIN_INFO_VAT_RETURN == 1) { // monthly vat, we take last past complete month
$date_start = dol_time_plus_duree(dol_get_first_day($year_start, $current_date['mon'], false), -1, 'm');
$date_end = dol_time_plus_duree($date_start, 1, 'm') - 1;
}
}
} else {
}
else {
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); }
@ -108,100 +114,102 @@ $result = restrictedArea($user, 'tax', '', '', 'charges');
*/
function pt($db, $sql, $date)
{
global $conf, $bc, $langs;
global $conf, $bc, $langs, $form;
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result);
$i = 0;
$total = 0;
print '<table class="noborder centpercent">';
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result);
$i = 0;
$total = 0;
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td class="nowrap">'.$date.'</td>';
print '<td class="right">'.$langs->trans("ClaimedForThisPeriod").'</td>';
print '<td class="right">'.$langs->trans("PaidDuringThisPeriod").'</td>';
print "</tr>\n";
print '<tr class="liste_titre">';
print '<td class="nowrap">'.$date.'</td>';
print '<td class="right">'.$langs->trans("ClaimedForThisPeriod").'</td>';
print '<td class="right">'.$langs->trans("PaidDuringThisPeriod").$form->textwithpicto('', $langs->trans('PaidDuringThisPeriodDesc'), 1).'</td>';
print "</tr>\n";
$totalclaimed = 0;
$totalpaid = 0;
$amountclaimed = 0;
$amountpaid = 0;
$previousmonth = '';
$previousmode = '';
$mode = '';
$totalclaimed = 0;
$totalpaid = 0;
$amountclaimed = 0;
$amountpaid = 0;
$previousmonth = '';
$previousmode = '';
$mode = '';
while ($i < $num) {
$obj = $db->fetch_object($result);
$mode = $obj->mode;
while ($i < $num) {
$obj = $db->fetch_object($result);
$mode = $obj->mode;
//print $obj->dm.' '.$obj->mode.' '.$previousmonth.' '.$previousmode;
if ($obj->mode == 'claimed' && !empty($previousmode))
{
print '<tr class="oddeven">';
print '<td class="nowrap">'.$previousmonth."</td>\n";
print '<td class="nowrap right">'.price($amountclaimed)."</td>\n";
print '<td class="nowrap right">'.price($amountpaid)."</td>\n";
print "</tr>\n";
//print $obj->dm.' '.$obj->mode.' '.$previousmonth.' '.$previousmode;
if ($obj->mode == 'claimed' && !empty($previousmode))
{
print '<tr class="oddeven">';
print '<td class="nowrap">'.$previousmonth."</td>\n";
print '<td class="nowrap right">'.price($amountclaimed)."</td>\n";
print '<td class="nowrap right">'.price($amountpaid)."</td>\n";
print "</tr>\n";
$amountclaimed = 0;
$amountpaid = 0;
}
$amountclaimed = 0;
$amountpaid = 0;
}
if ($obj->mode == 'claimed')
{
$amountclaimed = $obj->mm;
$totalclaimed = $totalclaimed + $amountclaimed;
}
if ($obj->mode == 'paid')
{
$amountpaid = $obj->mm;
$totalpaid = $totalpaid + $amountpaid;
}
if ($obj->mode == 'claimed')
{
$amountclaimed = $obj->mm;
$totalclaimed = $totalclaimed + $amountclaimed;
}
if ($obj->mode == 'paid')
{
$amountpaid = $obj->mm;
$totalpaid = $totalpaid + $amountpaid;
}
if ($obj->mode == 'paid')
{
print '<tr class="oddeven">';
print '<td class="nowrap">'.$obj->dm."</td>\n";
print '<td class="nowrap right">'.price($amountclaimed)."</td>\n";
print '<td class="nowrap right">'.price($amountpaid)."</td>\n";
print "</tr>\n";
$amountclaimed = 0;
$amountpaid = 0;
$previousmode = '';
$previousmonth = '';
} else {
$previousmode = $obj->mode;
$previousmonth = $obj->dm;
}
if ($obj->mode == 'paid')
{
print '<tr class="oddeven">';
print '<td class="nowrap">'.$obj->dm."</td>\n";
print '<td class="nowrap right">'.price($amountclaimed)."</td>\n";
print '<td class="nowrap right">'.price($amountpaid)."</td>\n";
print "</tr>\n";
$amountclaimed = 0;
$amountpaid = 0;
$previousmode = '';
$previousmonth = '';
}
else {
$previousmode = $obj->mode;
$previousmonth = $obj->dm;
}
$i++;
}
$i++;
}
if ($mode == 'claimed' && !empty($previousmode))
{
print '<tr class="oddeven">';
print '<td class="nowrap">'.$previousmonth."</td>\n";
print '<td class="nowrap right">'.price($amountclaimed)."</td>\n";
print '<td class="nowrap right">'.price($amountpaid)."</td>\n";
print "</tr>\n";
if ($mode == 'claimed' && !empty($previousmode))
{
print '<tr class="oddeven">';
print '<td class="nowrap">'.$previousmonth."</td>\n";
print '<td class="nowrap right">'.price($amountclaimed)."</td>\n";
print '<td class="nowrap right">'.price($amountpaid)."</td>\n";
print "</tr>\n";
$amountclaimed = 0;
$amountpaid = 0;
}
$amountclaimed = 0;
$amountpaid = 0;
}
print '<tr class="liste_total">';
print '<td class="right">'.$langs->trans("Total").'</td>';
print '<td class="nowrap right">'.price($totalclaimed).'</td>';
print '<td class="nowrap right">'.price($totalpaid).'</td>';
print "</tr>";
print '<tr class="liste_total">';
print '<td class="right">'.$langs->trans("Total").'</td>';
print '<td class="nowrap right">'.price($totalclaimed).'</td>';
print '<td class="nowrap right">'.price($totalpaid).'</td>';
print "</tr>";
print "</table>";
print "</table>";
$db->free($result);
} else {
dol_print_error($db);
}
$db->free($result);
}
else {
dol_print_error($db);
}
}
@ -209,7 +217,6 @@ function pt($db, $sql, $date)
* View
*/
$form = new Form($db);
$company_static = new Societe($db);
$tva = new Tva($db);
@ -362,7 +369,8 @@ while ((($y < $yend) || ($y == $yend && $m <= $mend)) && $mcursor < 1000) // $mc
'vat' =>$x_paye[$my_paye_rate]['vat_list'][$id],
//'link' =>$expensereport->getNomUrl(1)
);
} else {
}
else {
//$invoice_supplier->id=$x_paye[$my_paye_rate]['facid'][$id];
//$invoice_supplier->ref=$x_paye[$my_paye_rate]['facnum'][$id];
//$invoice_supplier->type=$x_paye[$my_paye_rate]['type'][$id];
@ -392,144 +400,144 @@ while ((($y < $yend) || ($y == $yend && $m <= $mend)) && $mcursor < 1000) // $mc
}
//now we have an array (x_both) indexed by rates for coll and paye
$action = "tva";
$object = array(&$x_coll, &$x_paye, &$x_both);
$parameters["mode"] = $modetax;
$parameters["year"] = $y;
$parameters["month"] = $m;
$parameters["type"] = 'vat';
$action = "tva";
$object = array(&$x_coll, &$x_paye, &$x_both);
$parameters["mode"] = $modetax;
$parameters["year"] = $y;
$parameters["month"] = $m;
$parameters["type"] = 'vat';
// Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('externalbalance'));
$reshook = $hookmanager->executeHooks('addVatLine', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
// Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('externalbalance'));
$reshook = $hookmanager->executeHooks('addVatLine', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if (!is_array($x_coll) && $coll_listbuy == -1)
{
$langs->load("errors");
print '<tr><td colspan="5">'.$langs->trans("ErrorNoAccountancyModuleLoaded").'</td></tr>';
break;
}
if (!is_array($x_paye) && $coll_listbuy == -2)
{
print '<tr><td colspan="5">'.$langs->trans("FeatureNotYetAvailable").'</td></tr>';
break;
}
if (!is_array($x_coll) && $coll_listbuy == -1)
{
$langs->load("errors");
print '<tr><td colspan="5">'.$langs->trans("ErrorNoAccountancyModuleLoaded").'</td></tr>';
break;
}
if (!is_array($x_paye) && $coll_listbuy == -2)
{
print '<tr><td colspan="5">'.$langs->trans("FeatureNotYetAvailable").'</td></tr>';
break;
}
print '<tr class="oddeven">';
print '<td class="nowrap"><a href="'.DOL_URL_ROOT.'/compta/tva/quadri_detail.php?leftmenu=tax_vat&month='.$m.'&year='.$y.'">'.dol_print_date(dol_mktime(0, 0, 0, $m, 1, $y), "%b %Y").'</a></td>';
print '<tr class="oddeven">';
print '<td class="nowrap"><a href="'.DOL_URL_ROOT.'/compta/tva/quadri_detail.php?leftmenu=tax_vat&month='.$m.'&year='.$y.'">'.dol_print_date(dol_mktime(0, 0, 0, $m, 1, $y), "%b %Y").'</a></td>';
$x_coll_sum = 0;
foreach (array_keys($x_coll) as $rate)
{
$subtot_coll_total_ht = 0;
$subtot_coll_vat = 0;
$x_coll_sum = 0;
foreach (array_keys($x_coll) as $rate)
{
$subtot_coll_total_ht = 0;
$subtot_coll_vat = 0;
foreach ($x_both[$rate]['coll']['detail'] as $index => $fields)
{
// Payment
$ratiopaymentinvoice = 1;
if ($modetax != 1)
{
// Define type
// We MUST use dtype (type in line). We can use something else, only if dtype is really unknown.
$type = (isset($fields['dtype']) ? $fields['dtype'] : $fields['ptype']);
// Try to enhance type detection using date_start and date_end for free lines where type
// was not saved.
if (!empty($fields['ddate_start'])) {
$type = 1;
}
if (!empty($fields['ddate_end'])) {
$type = 1;
}
foreach ($x_both[$rate]['coll']['detail'] as $index => $fields)
{
// Payment
$ratiopaymentinvoice = 1;
if ($modetax != 1)
{
// Define type
// We MUST use dtype (type in line). We can use something else, only if dtype is really unknown.
$type = (isset($fields['dtype']) ? $fields['dtype'] : $fields['ptype']);
// Try to enhance type detection using date_start and date_end for free lines where type
// was not saved.
if (!empty($fields['ddate_start'])) {
$type = 1;
}
if (!empty($fields['ddate_end'])) {
$type = 1;
}
if (($type == 0 && $conf->global->TAX_MODE_SELL_PRODUCT == 'invoice')
|| ($type == 1 && $conf->global->TAX_MODE_SELL_SERVICE == 'invoice'))
{
//print $langs->trans("NA");
} else {
if (isset($fields['payment_amount']) && price2num($fields['ftotal_ttc'])) {
$ratiopaymentinvoice = ($fields['payment_amount'] / $fields['ftotal_ttc']);
}
}
}
//var_dump('type='.$type.' '.$fields['totalht'].' '.$ratiopaymentinvoice);
$temp_ht = $fields['totalht'] * $ratiopaymentinvoice;
$temp_vat = $fields['vat'] * $ratiopaymentinvoice;
$subtot_coll_total_ht += $temp_ht;
$subtot_coll_vat += $temp_vat;
$x_coll_sum += $temp_vat;
}
}
print '<td class="nowrap right">'.price(price2num($x_coll_sum, 'MT')).'</td>';
if (($type == 0 && $conf->global->TAX_MODE_SELL_PRODUCT == 'invoice')
|| ($type == 1 && $conf->global->TAX_MODE_SELL_SERVICE == 'invoice'))
{
//print $langs->trans("NA");
} else {
if (isset($fields['payment_amount']) && price2num($fields['ftotal_ttc'])) {
$ratiopaymentinvoice = ($fields['payment_amount'] / $fields['ftotal_ttc']);
}
}
}
//var_dump('type='.$type.' '.$fields['totalht'].' '.$ratiopaymentinvoice);
$temp_ht = $fields['totalht'] * $ratiopaymentinvoice;
$temp_vat = $fields['vat'] * $ratiopaymentinvoice;
$subtot_coll_total_ht += $temp_ht;
$subtot_coll_vat += $temp_vat;
$x_coll_sum += $temp_vat;
}
}
print '<td class="nowrap right">'.price(price2num($x_coll_sum, 'MT')).'</td>';
$x_paye_sum = 0;
foreach (array_keys($x_paye) as $rate)
{
$subtot_paye_total_ht = 0;
$subtot_paye_vat = 0;
$x_paye_sum = 0;
foreach (array_keys($x_paye) as $rate)
{
$subtot_paye_total_ht = 0;
$subtot_paye_vat = 0;
foreach ($x_both[$rate]['paye']['detail'] as $index => $fields)
{
// Payment
$ratiopaymentinvoice = 1;
if ($modetax != 1)
{
// Define type
// We MUST use dtype (type in line). We can use something else, only if dtype is really unknown.
$type = (isset($fields['dtype']) ? $fields['dtype'] : $fields['ptype']);
// Try to enhance type detection using date_start and date_end for free lines where type
// was not saved.
if (!empty($fields['ddate_start'])) {
$type = 1;
}
if (!empty($fields['ddate_end'])) {
$type = 1;
}
foreach ($x_both[$rate]['paye']['detail'] as $index => $fields)
{
// Payment
$ratiopaymentinvoice = 1;
if ($modetax != 1)
{
// Define type
// We MUST use dtype (type in line). We can use something else, only if dtype is really unknown.
$type = (isset($fields['dtype']) ? $fields['dtype'] : $fields['ptype']);
// Try to enhance type detection using date_start and date_end for free lines where type
// was not saved.
if (!empty($fields['ddate_start'])) {
$type = 1;
}
if (!empty($fields['ddate_end'])) {
$type = 1;
}
if (($type == 0 && $conf->global->TAX_MODE_SELL_PRODUCT == 'invoice')
|| ($type == 1 && $conf->global->TAX_MODE_SELL_SERVICE == 'invoice'))
{
//print $langs->trans("NA");
} else {
if (isset($fields['payment_amount']) && price2num($fields['ftotal_ttc'])) {
$ratiopaymentinvoice = ($fields['payment_amount'] / $fields['ftotal_ttc']);
}
}
}
//var_dump('type='.$type.' '.$fields['totalht'].' '.$ratiopaymentinvoice);
$temp_ht = $fields['totalht'] * $ratiopaymentinvoice;
$temp_vat = $fields['vat'] * $ratiopaymentinvoice;
$subtot_paye_total_ht += $temp_ht;
$subtot_paye_vat += $temp_vat;
$x_paye_sum += $temp_vat;
}
}
print '<td class="nowrap right">'.price(price2num($x_paye_sum, 'MT')).'</td>';
if (($type == 0 && $conf->global->TAX_MODE_SELL_PRODUCT == 'invoice')
|| ($type == 1 && $conf->global->TAX_MODE_SELL_SERVICE == 'invoice'))
{
//print $langs->trans("NA");
} else {
if (isset($fields['payment_amount']) && price2num($fields['ftotal_ttc'])) {
$ratiopaymentinvoice = ($fields['payment_amount'] / $fields['ftotal_ttc']);
}
}
}
//var_dump('type='.$type.' '.$fields['totalht'].' '.$ratiopaymentinvoice);
$temp_ht = $fields['totalht'] * $ratiopaymentinvoice;
$temp_vat = $fields['vat'] * $ratiopaymentinvoice;
$subtot_paye_total_ht += $temp_ht;
$subtot_paye_vat += $temp_vat;
$x_paye_sum += $temp_vat;
}
}
print '<td class="nowrap right">'.price(price2num($x_paye_sum, 'MT')).'</td>';
$subtotalcoll = $subtotalcoll + $x_coll_sum;
$subtotalpaye = $subtotalpaye + $x_paye_sum;
$subtotalcoll = $subtotalcoll + $x_coll_sum;
$subtotalpaye = $subtotalpaye + $x_paye_sum;
$diff = $x_coll_sum - $x_paye_sum;
$total = $total + $diff;
$subtotal = price2num($subtotal + $diff, 'MT');
$diff = $x_coll_sum - $x_paye_sum;
$total = $total + $diff;
$subtotal = price2num($subtotal + $diff, 'MT');
print '<td class="nowrap right">'.price(price2num($diff, 'MT')).'</td>'."\n";
print "<td>&nbsp;</td>\n";
print "</tr>\n";
print '<td class="nowrap right">'.price(price2num($diff, 'MT')).'</td>'."\n";
print "<td>&nbsp;</td>\n";
print "</tr>\n";
$i++; $m++;
if ($i > 2)
{
print '<tr class="liste_total">';
print '<td class="right"><a href="quadri_detail.php?leftmenu=tax_vat&q='.round($m / 3).'&year='.$y.'">'.$langs->trans("SubTotal").'</a>:</td>';
print '<td class="nowrap right">'.price(price2num($subtotalcoll, 'MT')).'</td>';
print '<td class="nowrap right">'.price(price2num($subtotalpaye, 'MT')).'</td>';
print '<td class="nowrap right">'.price(price2num($subtotal, 'MT')).'</td>';
print '<td>&nbsp;</td></tr>';
$i = 0;
$subtotalcoll = 0; $subtotalpaye = 0; $subtotal = 0;
}
$i++; $m++;
if ($i > 2)
{
print '<tr class="liste_total">';
print '<td class="right"><a href="quadri_detail.php?leftmenu=tax_vat&q='.round($m / 3).'&year='.$y.'">'.$langs->trans("SubTotal").'</a>:</td>';
print '<td class="nowrap right">'.price(price2num($subtotalcoll, 'MT')).'</td>';
print '<td class="nowrap right">'.price(price2num($subtotalpaye, 'MT')).'</td>';
print '<td class="nowrap right">'.price(price2num($subtotal, 'MT')).'</td>';
print '<td>&nbsp;</td></tr>';
$i = 0;
$subtotalcoll = 0; $subtotalpaye = 0; $subtotal = 0;
}
}
print '<tr class="liste_total"><td class="right" colspan="3">'.$langs->trans("TotalToPay").':</td><td class="nowrap right">'.price(price2num($total, 'MT')).'</td>';
print "<td>&nbsp;</td>\n";
@ -543,25 +551,26 @@ print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
/*
* Payed
* Paid
*/
print load_fiche_titre($langs->trans("VATPaid"), '', '');
$sql = '';
$sql .= "SELECT SUM(amount) as mm, date_format(f.datev,'%Y-%m') as dm, 'claimed' as mode";
$sql .= " FROM ".MAIN_DB_PREFIX."tva as f";
$sql .= " WHERE f.entity = ".$conf->entity;
$sql .= " AND (f.datev >= '".$db->idate($date_start)."' AND f.datev <= '".$db->idate($date_end)."')";
$sql .= "SELECT SUM(amount) as mm, date_format(tva.datev,'%Y-%m') as dm, 'claimed' as mode";
$sql .= " FROM ".MAIN_DB_PREFIX."tva as tva";
$sql .= " WHERE tva.entity = ".$conf->entity;
$sql .= " AND (tva.datev >= '".$db->idate($date_start)."' AND tva.datev <= '".$db->idate($date_end)."')";
$sql .= " GROUP BY dm";
$sql .= " UNION ";
$sql .= "SELECT SUM(amount) as mm, date_format(f.datep,'%Y-%m') as dm, 'paid' as mode";
$sql .= " FROM ".MAIN_DB_PREFIX."tva as f";
$sql .= " WHERE f.entity = ".$conf->entity;
$sql .= " AND (f.datep >= '".$db->idate($date_start)."' AND f.datep <= '".$db->idate($date_end)."')";
$sql .= "SELECT SUM(ptva.amount) as mm, date_format(tva.datev,'%Y-%m') as dm, 'paid' as mode";
$sql .= " FROM ".MAIN_DB_PREFIX."tva as tva";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."payment_vat as ptva ON (tva.rowid = ptva.fk_tva)";
$sql .= " WHERE tva.entity = ".$conf->entity;
$sql .= " AND (tva.datev >= '".$db->idate($date_start)."' AND tva.datev <= '".$db->idate($date_end)."')";
$sql .= " GROUP BY dm";
$sql .= " ORDER BY dm ASC, mode ASC";
@ -578,37 +587,37 @@ if (!empty($conf->global->MAIN_FEATURES_LEVEL))
* Recap
*/
print load_fiche_titre($langs->trans("VATBalance"), '', ''); // need to add translation
print load_fiche_titre($langs->trans("VATBalance"), '', ''); // need to add translation
$sql1 = "SELECT SUM(amount) as mm";
$sql1 .= " FROM ".MAIN_DB_PREFIX."tva as f";
$sql1 .= " WHERE f.entity = ".$conf->entity;
$sql1 .= " AND f.datev >= '".$db->idate($date_start)."'";
$sql1 .= " AND f.datev <= '".$db->idate($date_end)."'";
$sql1 = "SELECT SUM(amount) as mm";
$sql1 .= " FROM ".MAIN_DB_PREFIX."tva as f";
$sql1 .= " WHERE f.entity = ".$conf->entity;
$sql1 .= " AND f.datev >= '".$db->idate($date_start)."'";
$sql1 .= " AND f.datev <= '".$db->idate($date_end)."'";
$result = $db->query($sql1);
if ($result) {
$obj = $db->fetch_object($result);
print '<table class="noborder centpercent">';
$result = $db->query($sql1);
if ($result) {
$obj = $db->fetch_object($result);
print '<table class="noborder centpercent">';
print "<tr>";
print '<td class="right">'.$langs->trans("VATDue").'</td>';
print '<td class="nowrap right">'.price(price2num($total, 'MT')).'</td>';
print "</tr>\n";
print "<tr>";
print '<td class="right">'.$langs->trans("VATDue").'</td>';
print '<td class="nowrap right">'.price(price2num($total, 'MT')).'</td>';
print "</tr>\n";
print "<tr>";
print '<td class="right">'.$langs->trans("VATPaid").'</td>';
print '<td class="nowrap right">'.price(price2num($obj->mm, 'MT'))."</td>\n";
print "</tr>\n";
print "<tr>";
print '<td class="right">'.$langs->trans("VATPaid").'</td>';
print '<td class="nowrap right">'.price(price2num($obj->mm, 'MT'))."</td>\n";
print "</tr>\n";
$restopay = $total - $obj->mm;
print "<tr>";
print '<td class="right">'.$langs->trans("RemainToPay").'</td>';
print '<td class="nowrap right">'.price(price2num($restopay, 'MT')).'</td>';
print "</tr>\n";
$restopay = $total - $obj->mm;
print "<tr>";
print '<td class="right">'.$langs->trans("RemainToPay").'</td>';
print '<td class="nowrap right">'.price(price2num($restopay, 'MT')).'</td>';
print "</tr>\n";
print '</table>';
}
print '</table>';
}
}
print '</div></div>';

View File

@ -83,6 +83,8 @@ dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0,
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<br>';
print '<table width="100%"><tr><td>';
dol_print_object_info($object);
print '</td></tr></table>';

View File

@ -4,6 +4,7 @@
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
*
* 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
@ -57,6 +58,7 @@ $search_type = GETPOST('search_type', 'int');
$search_cheque = GETPOST('search_cheque', 'alpha');
$search_account = GETPOST('search_account', 'int');
$search_amount = GETPOST('search_amount', 'alpha');
$search_status = GETPOST('search_status', 'int');
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'alpha');
@ -75,12 +77,9 @@ $arrayfields = array(
't.rowid' =>array('checked'=>1, 'position'=>10, 'label'=>"Ref",),
't.label' =>array('checked'=>1, 'position'=>20, 'label'=>"Label"),
't.datev' =>array('checked'=>1, 'position'=>30, 'label'=>"PeriodEndDate"),
't.datep' =>array('checked'=>1, 'position'=>40, 'label'=>"DatePayment"),
't.fk_typepayment' =>array('checked'=>1, 'position'=>50, 'label'=>"Type"),
't.num_payment' =>array('checked'=>1, 'position'=>60, 'label'=>"Numero", 'tooltip'=>"ChequeOrTransferNumber"),
'transaction' =>array('checked'=>1, 'position'=>70, 'label'=>"BankTransactionLine", 'enabled'=>(!empty($conf->banque->enabled))),
'ba.label' =>array('checked'=>1, 'position'=>80, 'label'=>"Account", 'enable'=>(!empty($conf->banque->enabled))),
't.amount' =>array('checked'=>1, 'position'=>90, 'label'=>"PayedByThisPayment"),
't.amount' =>array('checked'=>1, 'position'=>90, 'label'=>"Amount"),
't.status' =>array('checked'=>1, 'position'=>90, 'label'=>"Status"),
);
$arrayfields = dol_sort_array($arrayfields, 'position');
@ -113,6 +112,7 @@ if (empty($reshook)) {
$search_cheque = '';
$search_account = '';
$search_amount = '';
$search_status = '';
}
}
@ -128,15 +128,13 @@ $bankstatic = new Account($db);
$accountingjournal = new AccountingJournal($db);
$bankline = new AccountLine($db);
llxHeader('', $langs->trans("VATPayments"));
llxHeader('', $langs->trans("VATDeclarations"));
$sql = 'SELECT t.rowid, t.amount, t.label, t.datev, t.datep, t.fk_typepayment as type, t.num_payment, t.fk_bank';
$sql .= ', ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel';
$sql .= ', pst.code as payment_code';
$sql = 'SELECT t.rowid, t.amount, t.label, t.datev, t.datep, t.paye, t.fk_typepayment as type, t.num_payment, pst.code as payment_code,';
$sql .= ' SUM(ptva.amount) as alreadypayed';
$sql .= ' FROM '.MAIN_DB_PREFIX.'tva as t';
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as pst ON t.fk_typepayment = pst.id';
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON t.fk_bank = b.rowid';
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as ba ON b.fk_account = ba.rowid';
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."payment_vat as ptva ON ptva.fk_tva = t.rowid";
$sql .= ' WHERE t.entity IN ('.getEntity($object->element).')';
if (!empty($search_ref)) $sql .= natural_search('t.rowid', $search_ref);
@ -146,10 +144,11 @@ if (!empty($search_dateend_end)) $sql .= ' AND t.datev <= "'.$db->idate($sea
if (!empty($search_datepayment_start)) $sql .= ' AND t.datep >= "'.$db->idate($search_datepayment_start).'"';
if (!empty($search_datepayment_end)) $sql .= ' AND t.datep <= "'.$db->idate($search_datepayment_end).'"';
if (!empty($search_type) && $search_type > 0) $sql .= ' AND t.fk_typepayment='.$search_type;
if (!empty($search_cheque)) $sql .= natural_search('t.num_payment', $search_cheque);
if (!empty($search_account) && $search_account > 0) $sql .= ' AND b.fk_account='.$search_account;
if (!empty($search_amount)) $sql .= natural_search('t.amount', price2num(trim($search_amount)), 1);
if ($search_status != '' && $search_status >= 0) $sql .= " AND t.paye = ".$db->escape($search_status);
$sql .= " GROUP BY t.rowid, t.amount, t.label, t.datev, t.datep, t.paye, t.fk_typepayment, t.num_payment, pst.code";
$sql .= $db->order($sortfield, $sortorder);
$nbtotalofrecords = '';
@ -200,6 +199,7 @@ if (!empty($search_type) && $search_type > 0) $param .= '&search_type='.$search
if (!empty($search_cheque)) $param .= '&search_cheque="'.$search_cheque.'"';
if (!empty($search_account) && $search_account > 0) $param .= '&search_account='.$search_account;
if (!empty($search_amount)) $param .= '&search_amount="'.$search_amount.'"';
if ($search_status != '' && $search_status != '-1') $param .= '&search_status='.urlencode($search_status);
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
@ -213,7 +213,7 @@ print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
$url = DOL_URL_ROOT.'/compta/tva/card.php?action=create';
if (!empty($socid)) $url .= '&socid='.$socid;
$newcardbutton = dolGetButtonTitle($langs->trans('NewVATPayment', ($ltt + 1)), '', 'fa fa-plus-circle', $url, '', $user->rights->tax->charges->creer);
print_barre_liste($langs->trans("VATPayments"), $page, $_SERVER['PHP_SELF'], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1);
print_barre_liste($langs->trans("VATDeclarations"), $page, $_SERVER['PHP_SELF'], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1);
$varpage = empty($contextpage) ? $_SERVER['PHP_SELF'] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
@ -257,7 +257,7 @@ if (!empty($arrayfields['t.datev']['checked'])) {
}
// Filter: Date payment
if (!empty($arrayfields['t.datep']['checked'])) {
/*if (!empty($arrayfields['t.datep']['checked'])) {
print '<td class="liste_titre center">';
print '<div class="nowrap">';
print $form->selectDate($search_datepayment_start ? $search_datepayment_start : -1, 'search_datepayment_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
@ -266,7 +266,7 @@ if (!empty($arrayfields['t.datep']['checked'])) {
print $form->selectDate($search_datepayment_end ? $search_datepayment_end : -1, 'search_datepayment_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
print '</div>';
print '</td>';
}
}*/
// Filter: Type
if (!empty($arrayfields['t.fk_typepayment']['checked'])) {
@ -275,26 +275,6 @@ if (!empty($arrayfields['t.fk_typepayment']['checked'])) {
print '</td>';
}
// Filter: Cheque number
if (!empty($arrayfields['t.num_payment']['checked'])) {
print '<td class="liste_titre left">';
print '<input name="search_cheque" class="flat" type="text" size="8" value="'.$search_cheque.'">';
print '</td>';
}
// Filter: Bank transaction number (placeholder)
if (!empty($arrayfields['transaction']['checked'])) {
print '<td class="liste_titre">';
print '</td>';
}
// Filter: Bank account
if (!empty($arrayfields['ba.label']['checked'])) {
print '<td class="liste_titre">';
$form->select_comptes($search_account, 'search_account', 0, '', 1);
print '</td>';
}
// Filter: Amount
if (!empty($arrayfields['t.amount']['checked'])) {
print '<td class="liste_titre right">';
@ -302,6 +282,14 @@ if (!empty($arrayfields['t.amount']['checked'])) {
print '</td>';
}
// Status
if (!empty($arrayfields['t.status']['checked'])) {
print '<td class="liste_titre maxwidthonsmartphone right">';
$liststatus = array('0' => $langs->trans("Unpaid"), '1' => $langs->trans("Paid"));
print $form->selectarray('search_status', $liststatus, $search_status, 1);
print '</td>';
}
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields);
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
@ -319,12 +307,9 @@ if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) print_liste_field_titr
if (!empty($arrayfields['t.rowid']['checked'])) print_liste_field_titre($arrayfields['t.rowid']['label'], $_SERVER['PHP_SELF'], 't.rowid', '', $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['t.label']['checked'])) print_liste_field_titre($arrayfields['t.label']['label'], $_SERVER['PHP_SELF'], 't.label', '', $param, 'align="left"', $sortfield, $sortorder);
if (!empty($arrayfields['t.datev']['checked'])) print_liste_field_titre($arrayfields['t.datev']['label'], $_SERVER['PHP_SELF'], 't.datev', '', $param, 'align="center"', $sortfield, $sortorder);
if (!empty($arrayfields['t.datep']['checked'])) print_liste_field_titre($arrayfields['t.datep']['label'], $_SERVER['PHP_SELF'], 't.datep', '', $param, 'align="center"', $sortfield, $sortorder);
if (!empty($arrayfields['t.fk_typepayment']['checked'])) print_liste_field_titre($arrayfields['t.fk_typepayment']['label'], $_SERVER['PHP_SELF'], 't.fk_typepayment', '', $param, '', $sortfield, $sortorder, 'left ');
if (!empty($arrayfields['t.num_payment']['checked'])) print_liste_field_titre($arrayfields['t.num_payment']['label'], $_SERVER['PHP_SELF'], 't.num_payment', '', $param, '', $sortfield, $sortorder, '', $arrayfields['t.num_payment']['tooltip']);
if (!empty($arrayfields['transaction']['checked'])) print_liste_field_titre($arrayfields['transaction']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['ba.label']['checked'])) print_liste_field_titre($arrayfields['ba.label']['label'], $_SERVER['PHP_SELF'], 'ba.label', '', $param, '', $sortfield, $sortorder, 'left ');
if (!empty($arrayfields['t.amount']['checked'])) print_liste_field_titre($arrayfields['t.amount']['label'], $_SERVER['PHP_SELF'], 't.amount', '', $param, '', $sortfield, $sortorder, 'right ');
if (!empty($arrayfields['t.status']['checked'])) print_liste_field_titre($arrayfields['t.status']['label'], $_SERVER["PHP_SELF"], "t.paye", "", $param, 'class="right"', $sortfield, $sortorder);
// Hook fields
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
@ -341,6 +326,7 @@ while ($i < min($num, $limit)) {
$tva_static->id = $obj->rowid;
$tva_static->ref = $obj->rowid;
$tva_static->label = $obj->label;
print '<tr class="oddeven">';
@ -369,10 +355,10 @@ while ($i < min($num, $limit)) {
}
// Date payment
if (!empty($arrayfields['t.datep']['checked'])) {
/*if (!empty($arrayfields['t.datep']['checked'])) {
print '<td class="center">'.dol_print_date($db->jdate($obj->datep), 'day').'</td>';
if (!$i) $totalarray['nbfield']++;
}
}*/
// Type
if (!empty($arrayfields['t.fk_typepayment']['checked']))
@ -381,21 +367,8 @@ while ($i < min($num, $limit)) {
if (!$i) $totalarray['nbfield']++;
}
// Cheque number
if (!empty($arrayfields['t.num_payment']['checked'])) {
print '<td>'.$obj->num_payment.'</td>';
if (!$i) $totalarray['nbfield']++;
}
// Bank transaction
if (!empty($arrayfields['transaction']['checked'])) {
$bankline->fetch($obj->fk_bank);
print '<td>'.$bankline->getNomUrl(1, 0).'</td>';
if (!$i) $totalarray['nbfield']++;
}
// Account
if (!empty($arrayfields['ba.label']['checked'])) {
/*if (!empty($arrayfields['ba.label']['checked'])) {
print '<td>';
if ($obj->fk_bank > 0) {
$bankstatic->id = $obj->bid;
@ -411,14 +384,22 @@ while ($i < min($num, $limit)) {
}
print '</td>';
if (!$i) $totalarray['nbfield']++;
}
}*/
// Amount
$total = $total + $obj->amount;
print '<td class="nowrap right">'.price($obj->amount).'</td>';
if (!$i) $totalarray['nbfield']++;
$totalarray['pos'][$totalarray['nbfield']] = 'amount';
$totalarray['val']['amount'] += $objp->amount;
if (!empty($arrayfields['t.amount']['checked'])) {
$total = $total + $obj->amount;
print '<td class="nowrap right">' . price($obj->amount) . '</td>';
if (!$i) $totalarray['nbfield']++;
$totalarray['pos'][$totalarray['nbfield']] = 'amount';
$totalarray['val']['amount'] += $obj->amount;
}
if (!empty($arrayfields['t.status']['checked'])) {
print '<td class="nowrap right">' . $tva_static->LibStatut($obj->paye, 5, $obj->alreadypayed) . '</td>';
if (!$i) $totalarray['nbfield']++;
if (!empty($arrayfields['t.amount']['checked'])) $totalarray['pos'][$totalarray['nbfield']] = '';
}
// Buttons
print '<td></td>';

View File

@ -0,0 +1,217 @@
<?php
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011-2016 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2011-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
*
* 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 <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/compta/tva/payments.php
* \ingroup compta
* \brief Page to list payments of special expenses
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/paymentvat.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/salaries/class/paymentsalary.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
// Load translation files required by the page
$langs->loadLangs(array('compta', 'bills'));
// Security check
if ($user->socid) $socid = $user->socid;
$result = restrictedArea($user, 'tax|salaries', '', '', 'charges|');
$mode = GETPOST("mode", 'alpha');
$year = GETPOST("year", 'int');
$filtre = GETPOST("filtre", 'alpha');
if (!$year && $mode != 'tvaonly') { $year = date("Y", time()); }
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (!$sortfield) $sortfield = "ptva.datep";
if (!$sortorder) $sortorder = "DESC";
/*
* View
*/
$tva_static = new Tva($db);
$tva = new Tva($db);
$payment_vat_static = new PaymentVAT($db);
$sal_static = new PaymentSalary($db);
llxHeader('', $langs->trans("VATExpensesArea"));
$title = $langs->trans("VATPayments");
$param = '';
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit;
if ($sortfield) $param .= '&sortfield='.$sortfield;
if ($sortorder) $param .= '&sortorder='.$sortorder;
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $totalnboflines, 'title_accountancy', 0, '', '', $limit);
if ($year) $param .= '&year='.$year;
if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
{
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print_liste_field_titre("RefPayment", $_SERVER["PHP_SELF"], "ptva.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "ptva.datep", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "pct.code", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("BankAccount", $_SERVER["PHP_SELF"], "bank.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("LabelContrib", $_SERVER["PHP_SELF"], "tva.label", "", $param, '', $sortfield, $sortorder);
//print_liste_field_titre("TypeContrib", $_SERVER["PHP_SELF"], "tva.fk_type", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("PeriodEndDate", $_SERVER["PHP_SELF"], "tva.datev", "", $param, 'width="140px"', $sortfield, $sortorder);
print_liste_field_titre("ExpectedToPay", $_SERVER["PHP_SELF"], "tva.amount", "", $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre("PayedByThisPayment", $_SERVER["PHP_SELF"], "ptva.amount", "", $param, 'class="right"', $sortfield, $sortorder);
print "</tr>\n";
$sql = "SELECT tva.rowid, tva.label as label, b.fk_account";
$sql .= ", tva.datev";
$sql .= ", tva.amount as total,";
$sql .= " ptva.rowid as pid, ptva.datep, ptva.amount as totalpaye, ptva.num_paiement as num_payment,";
$sql .= " pct.code as payment_code";
$sql .= " FROM ".MAIN_DB_PREFIX."tva as tva,";
$sql .= " ".MAIN_DB_PREFIX."payment_vat as ptva";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."bank as b ON (b.rowid = ptva.fk_bank)";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."bank_account as bank ON (bank.rowid = b.fk_account)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON ptva.fk_typepaiement = pct.id";
$sql .= " WHERE ptva.fk_tva = tva.rowid";
$sql .= " AND tva.entity = ".$conf->entity;
if ($year > 0)
{
$sql .= " AND (";
// Si period renseignee on l'utilise comme critere de date, sinon on prend date echeance,
// ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire
$sql .= " (tva.datev IS NOT NULL AND tva.datev between '".$db->idate(dol_get_first_day($year))."' AND '".$db->idate(dol_get_last_day($year))."')";
$sql .= " OR (tva.datev IS NULL AND tva.datev between '".$db->idate(dol_get_first_day($year))."' AND '".$db->idate(dol_get_last_day($year))."')";
$sql .= ")";
}
if (preg_match('/^cs\./', $sortfield)
|| preg_match('/^tva\./', $sortfield)
|| preg_match('/^ptva\./', $sortfield)
|| preg_match('/^pct\./', $sortfield)
|| preg_match('/^bank\./', $sortfield)) $sql .= $db->order($sortfield, $sortorder);
//$sql.= $db->plimit($limit+1,$offset);
//print $sql;
dol_syslog("compta/tva/payments.php: select payment", LOG_DEBUG);
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
$total = 0;
$totalnb = 0;
$totalpaye = 0;
while ($i < min($num, $limit))
{
$obj = $db->fetch_object($resql);
$payment_vat_static->id = $obj->pid;
$payment_vat_static->ref = $obj->pid;
print '<tr class="oddeven">';
// Ref payment
print '<td>'.$payment_vat_static->getNomUrl(1)."</td>\n";
// Date payment
print '<td class="center">'.dol_print_date($db->jdate($obj->datep), 'day').'</td>';
// Type payment
print '<td>';
if ($obj->payment_code) print $langs->trans("PaymentTypeShort".$obj->payment_code).' ';
print $obj->num_payment.'</td>';
// Account
print '<td>';
$account = new Account($db);
$account->fetch($obj->fk_account);
print $account->getNomUrl(1);
print '</td>';
// Label
print '<td>';
$tva->id = $obj->rowid;
$tva->ref = $obj->rowid;
$tva->label = $obj->label;
print $tva->getNomUrl(1, '20');
print '</td>';
// Type
//print '<td><a href="../tva/list.php?filtre=tva.fk_type:'.$obj->type.'">'.$obj->type_label.'</a></td>';
// Date
$date = $obj->datev;
print '<td>'.dol_print_date($date, 'day').'</td>';
// Expected to pay
print '<td class="right">'.price($obj->total).'</td>';
// Paid
print '<td class="right">';
if ($obj->totalpaye) print price($obj->totalpaye);
print '</td>';
print '</tr>';
$total = $total + $obj->total;
$totalnb = $totalnb + $obj->nb;
$totalpaye = $totalpaye + $obj->totalpaye;
$i++;
}
print '<tr class="liste_total"><td colspan="3" class="liste_total">'.$langs->trans("Total").'</td>';
print '<td class="liste_total right"></td>'; // A total here has no sense
//print '<td align="center" class="liste_total">&nbsp;</td>';
print '<td align="center" class="liste_total">&nbsp;</td>';
print '<td align="center" class="liste_total">&nbsp;</td>';
print '<td align="center" class="liste_total">&nbsp;</td>';
print '<td class="liste_total right">'.price($totalpaye)."</td>";
print "</tr>";
}
else {
dol_print_error($db);
}
print '</table>';
print '</div>';
}
print '</form>';
// End of page
llxFooter();
$db->close();

View File

@ -175,6 +175,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$sall = "";
$search_status = "";
$toselect = '';
$search_type_thirdparty = '';
$search_array_options = array();
}
@ -198,6 +199,7 @@ $form = new Form($db);
$formfile = new FormFile($db);
$formother = new FormOther($db);
$socstatic = new Societe($db);
$formcompany = new FormCompany($db);
$contracttmp = new Contrat($db);
$sql = 'SELECT';
@ -235,6 +237,7 @@ if ($search_user > 0)
}
$sql .= " WHERE c.fk_soc = s.rowid ";
$sql .= ' AND c.entity IN ('.getEntity('contract').')';
if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) $sql .= " AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).')';
if ($search_product_category > 0) $sql .= " AND cp.fk_categorie = ".$search_product_category;
if ($socid) $sql .= " AND s.rowid = ".$db->escape($socid);
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
@ -346,6 +349,7 @@ if ($search_dfyear != '') $param .= '&search_dfyear='.urlencode($search_df
if ($search_dfmonth != '') $param .= '&search_dfmonth='.urlencode($search_dfmonth);
if ($search_sale != '') $param .= '&search_sale='.urlencode($search_sale);
if ($search_user != '') $param .= '&search_user='.urlencode($search_user);
if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) $param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty);
if ($search_product_category != '') $param .= '&search_product_category='.urlencode($search_product_category);
if ($show_files) $param .= '&show_files='.urlencode($show_files);
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
@ -491,7 +495,7 @@ if (!empty($arrayfields['country.code_iso']['checked']))
if (!empty($arrayfields['typent.code']['checked']))
{
print '<td class="liste_titre maxwidthonsmartphone center">';
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 $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT), '', 1);
print '</td>';
}
if (!empty($arrayfields['sale_representative']['checked']))
@ -657,7 +661,7 @@ while ($i < min($num, $limit))
}
if (!empty($arrayfields['s.nom']['checked']))
{
print '<td>';
print '<td class="tdoverflowmax150">';
if ($obj->socid > 0) {
// TODO Use a cache for this string
print $socstatic->getNomUrl(1, '');
@ -746,7 +750,7 @@ while ($i < min($num, $limit))
}
//else print $langs->trans("NoSalesRepresentativeAffected");
} else {
print '&nbsp';
print '&nbsp;';
}
print '</td>';
}

View File

@ -291,10 +291,8 @@ class box_dolibarr_state_board extends ModeleBoxes
$boxstat .= '<a class="boxstatsindicator thumbstat nobold nounderline"><div class="boxstatsempty"></div></a>';
$boxstat .= '<a class="boxstatsindicator thumbstat nobold nounderline"><div class="boxstatsempty"></div></a>';
$boxstat .= '</td></tr>';
$boxstat .= '</table>';
$this->info_box_contents[0][0] = array(
'tr' => 'class="nohover"',
'td' => '',
'textnoformat' => $boxstat
);

View File

@ -26,7 +26,7 @@ include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
/**
* Class to manage the box to show not payed suppliers invoices
* Class to manage the box to show not paid suppliers invoices
*/
class box_factures_fourn_imp extends ModeleBoxes
{

View File

@ -110,7 +110,8 @@ class box_factures_imp extends ModeleBoxes
$sql .= " AND fk_statut = 1";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
if ($user->socid) $sql .= " AND s.rowid = ".$user->socid;
$sql .= " GROUP BY s.nom, s.rowid, s.email, s.code_client, s.logo, f.ref, f.date_lim_reglement,";
$sql .= " GROUP BY s.rowid, s.nom, s.name_alias, s.code_client, s.code_compta, s.client, s.logo, s.email, s.entity, s.tva_intra, s.siren, s.siret, s.ape, s.idprof4, s.idprof5, s.idprof6,";
$sql .= " f.ref, f.date_lim_reglement,";
$sql .= " f.type, f.datef, f.total, f.tva, f.total_ttc, f.paye, f.fk_statut, f.rowid";
//$sql.= " ORDER BY f.datef DESC, f.ref DESC ";
$sql .= " ORDER BY datelimite ASC, f.ref ASC ";

View File

@ -96,6 +96,7 @@ class box_funnel_of_prospection extends ModeleBoxes
$listofopplabel = array();
$listofoppcode = array();
$colorseriesstat = array();
$bordercolorseries = array();
$sql = "SELECT cls.rowid, cls.code, cls.percent, cls.label";
$sql .= " FROM " . MAIN_DB_PREFIX . "c_lead_status as cls";
$sql .= " WHERE active=1";
@ -113,19 +114,24 @@ class box_funnel_of_prospection extends ModeleBoxes
$listofoppcode[$objp->rowid] = $objp->code;
switch ($objp->code) {
case 'PROSP':
$colorseriesstat[$objp->rowid] = "-" . $badgeStatus0;
$colorseriesstat[$objp->rowid] = '#FFFFFF';
$bordercolorseries[$objp->rowid] = $badgeStatus0;
break;
case 'QUAL':
$colorseriesstat[$objp->rowid] = "-" . $badgeStatus1;
$colorseriesstat[$objp->rowid] = '#FFFFFF';
$bordercolorseries[$objp->rowid] = $badgeStatus1;
break;
case 'PROPO':
$colorseriesstat[$objp->rowid] = $badgeStatus1;
$bordercolorseries[$objp->rowid] = $badgeStatus1;
break;
case 'NEGO':
$colorseriesstat[$objp->rowid] = $badgeStatus4;
$bordercolorseries[$objp->rowid] = $badgeStatus4;
break;
case 'WON':
$colorseriesstat[$objp->rowid] = $badgeStatus6;
$bordercolorseries[$objp->rowid] = $badgeStatus6;
break;
default:
break;
@ -191,7 +197,10 @@ class box_funnel_of_prospection extends ModeleBoxes
$listofstatus = array_keys($listofoppstatus);
$liststatus = array();
$data = array('');
$customlabels = array();
$total=0;
foreach ($listofstatus as $status) {
$customlabel = '';
$labelStatus = '';
if ($status != 7) {
$code = dol_getIdFromCode($this->db, $status, 'c_lead_status', 'rowid', 'code');
@ -201,8 +210,9 @@ class box_funnel_of_prospection extends ModeleBoxes
if (empty($labelStatus)) {
$labelStatus = $listofopplabel[$status];
}
$data[] = (isset($valsamount[$status]) ? (float) $valsamount[$status] : 0);
$amount = (isset($valsamount[$status]) ? (float) $valsamount[$status] : 0);
$data[] = $amount;
$customlabel = $amount;
$liststatus[] = $labelStatus;
if (!$conf->use_javascript_ajax) {
$stringtoprint .= '<tr class="oddeven">';
@ -211,6 +221,7 @@ class box_funnel_of_prospection extends ModeleBoxes
$stringtoprint .= "</tr>\n";
}
}
$customlabels[]=$customlabel;
}
$dataseries[] = $data;
if ($conf->use_javascript_ajax) {
@ -219,13 +230,18 @@ class box_funnel_of_prospection extends ModeleBoxes
$dolgraph->SetMinValue(0);
$dolgraph->SetData($dataseries);
$dolgraph->SetLegend($liststatus);
$dolgraph->setHideXValues(true);
$dolgraph->SetDataColor(array_values($colorseriesstat));
$dolgraph->setBorderColor(array_values($bordercolorseries));
$dolgraph->setShowLegend(2);
$dolgraph->setShowPercent(1);
$dolgraph->setTitle('');
$dolgraph->setMirrorGraphValues(true);
$dolgraph->setBorderWidth(2);
$dolgraph->SetType(array('horizontalbars'));
$dolgraph->SetHeight('200');
$dolgraph->SetWidth('600');
$dolgraph->setTooltipsTitles($liststatus);
$dolgraph->setTooltipsLabels($customlabels);
$dolgraph->mode = 'depth';
$dolgraph->draw('idgraphleadfunnel');
$stringtoprint .= $dolgraph->show($totaloppnb ? 0 : 1);

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
* Copyright (C) 2015-2021 Frederic France <frederic.france@netlogic.fr>
*
* 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
@ -196,7 +196,7 @@ class box_produits extends ModeleBoxes
$this->info_box_contents[$line][] = array(
'td' => 'class="right" width="18"',
'text' => '<span class="statusrefsell">'.$productstatic->LibStatut($objp->tosell, 3, 0).'<span>',
'text' => '<span class="statusrefsell">'.$productstatic->LibStatut($objp->tosell, 3, 0).'</span>',
'asis' => 1
);

View File

@ -3,7 +3,7 @@
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2005-2012 Maxime Kohlhaas <mko@atm-consulting.fr>
* Copyright (C) 2015-2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2015-2021 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
@ -206,23 +206,24 @@ class box_produits_alerte_stock extends ModeleBoxes
$this->info_box_contents[$line][] = array(
'td' => 'class="right" width="18"',
'text' => '<span class="statusrefsell">'.$productstatic->LibStatut($objp->tosell, 3, 0).'<span>',
'text' => '<span class="statusrefsell">'.$productstatic->LibStatut($objp->tosell, 3, 0).'</span>',
'asis' => 1
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right" width="18"',
'text' => '<span class="statusrefbuy">'.$productstatic->LibStatut($objp->tobuy, 3, 0).'<span>',
'text' => '<span class="statusrefbuy">'.$productstatic->LibStatut($objp->tobuy, 3, 0).'</span>',
'asis' => 1
);
$line++;
}
if ($num == 0)
if ($num == 0) {
$this->info_box_contents[$line][0] = array(
'td' => 'class="center"',
'text'=>$langs->trans("NoTooLowStockProducts"),
);
}
$this->db->free($result);
} else {

View File

@ -222,6 +222,12 @@ abstract class CommonObject
*/
public $statut;
/**
* @var int The object's status
* @see setStatut()
*/
public $status;
/**
* @var string
* @see getFullAddress()
@ -1055,7 +1061,6 @@ abstract class CommonObject
{
$this->error = $this->db->errno();
$this->db->rollback();
echo 'err rollback';
return -2;
} else {
$this->error = $this->db->error();
@ -2066,6 +2071,7 @@ abstract class CommonObject
$fieldname = 'fk_mode_reglement';
if ($this->element == 'societe') $fieldname = 'mode_reglement';
if (get_class($this) == 'Fournisseur') $fieldname = 'mode_reglement_supplier';
if (get_class($this) == 'Tva') $fieldname = 'fk_typepayment';
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
$sql .= ' SET '.$fieldname.' = '.(($id > 0 || $id == '0') ? $id : 'NULL');
@ -4909,7 +4915,7 @@ abstract class CommonObject
$this->result['filename']=$ecmfile->filename;*/
//var_dump($obj->update_main_doc_field);exit;
// Update the last_main_doc field into main object (if documenent generator has property ->update_main_doc_field set)
// Update the last_main_doc field into main object (if document generator has property ->update_main_doc_field set)
$update_main_doc_field = 0;
if (!empty($obj->update_main_doc_field)) $update_main_doc_field = 1;
if ($update_main_doc_field && !empty($this->table_element))
@ -7164,9 +7170,6 @@ abstract class CommonObject
if ($(this).val() == 0){
$("#"+child_list).hide();
}
$("select[name=\""+parent_list+"\"]").change(function() {
showOptions(child_list, parent_list, orig_select[child_list]);
});
});
}

View File

@ -66,6 +66,7 @@ class DolGraph
public $labelInterval = -1;
public $hideXGrid = false;
public $hideXValues = false;
public $hideYGrid = false;
public $Legend = array();
@ -75,6 +76,12 @@ class DolGraph
public $showpercent = 0;
public $combine = 0; // 0.05 if you want to combine records < 5% into "other"
public $graph; // Objet Graph (Artichow, Phplot...)
/**
* @var boolean Mirrors graph values
*/
public $mirrorGraphValues = false;
public $tooltipsTitles = null;
public $tooltipsLabels = null;
/**
* @var string Error code (or message)
@ -85,6 +92,7 @@ class DolGraph
public $bgcolor; // array(R,G,B)
public $bgcolorgrid = array(255, 255, 255); // array(R,G,B)
public $datacolor; // array(array(R,G,B),...)
public $borderwidth = 1;
private $stringtoshow; // To store string to output graph into HTML page
@ -175,6 +183,18 @@ class DolGraph
return true;
}
/**
* Hide X Values
*
* @param boolean $bool XValues or not
* @return boolean true
*/
public function setHideXValues($bool)
{
$this->hideXValues = $bool;
return true;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Hide Y grid
@ -244,9 +264,9 @@ class DolGraph
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Set data
* Set data color
*
* @param array $datacolor Data color array(array(R,G,B),array(R,G,B)...)
* @param array $datacolor Data color array(array(R,G,B),array(R,G,B)...) or array('#......','#......'...)
* @return void
*/
public function SetDataColor($datacolor)
@ -255,6 +275,50 @@ class DolGraph
$this->datacolor = $datacolor;
}
/**
* Set border color
*
* @param array $bordercolor Border Color array(array(R,G,B),array(R,G,B)...) or array('#FFFFFF','#......'...)
* @return void
*/
public function setBorderColor($bordercolor)
{
$this->bordercolor = $bordercolor;
}
/**
* Set border width
*
* @param int $borderwidth Border Width
* @return void
*/
public function setBorderWidth($borderwidth)
{
$this->borderwidth = $borderwidth;
}
/**
* Set tooltips labels of the graph
*
* @param array $tooltipsLabels Tooltips Labels array('...','...'...)
* @return void
*/
public function setTooltipsLabels($tooltipsLabels)
{
$this->tooltipsLabels = $tooltipsLabels;
}
/**
* Set tooltips titles of the graph
*
* @param array $tooltipsTitles Tooltips Titles array('...','...'...)
* @return void
*/
public function setTooltipsTitles($tooltipsTitles)
{
$this->tooltipsTitles = $tooltipsTitles;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Set type
@ -408,6 +472,17 @@ class DolGraph
unset($this->bgcolorgrid);
}
/**
* Mirror Values of the graph
*
* @param boolean $mirrorGraphValues Mirror Values if true and doesn't if false
* @return void
*/
public function setMirrorGraphValues($mirrorGraphValues)
{
$this->mirrorGraphValues = $mirrorGraphValues;
}
/**
* Is graph ko
*
@ -1129,9 +1204,6 @@ class DolGraph
else {
$type = 'bar';
$isfunnel = false;
if ($file == 'idgraphleadfunnel') $isfunnel = true;
if (!isset($this->type[$firstlot]) || $this->type[$firstlot] == 'bars') $type = 'bar';
if (isset($this->type[$firstlot]) && $this->type[$firstlot] == 'horizontalbars') $type = 'horizontalBar';
if (isset($this->type[$firstlot]) && ($this->type[$firstlot] == 'lines' || $this->type[$firstlot] == 'linesnopoint')) $type = 'line';
@ -1141,7 +1213,7 @@ class DolGraph
$this->stringtoshow .= 'legend: { display: false }, ';
}
$this->stringtoshow .= 'scales: { xAxes: [{ ';
if ($isfunnel) { // FIXME Remove isfunnel by introducing a method hideXValues() on dolgraph
if ($this->hideXValues) {
$this->stringtoshow .= ' ticks: { display: false }, display: true,';
}
//$this->stringtoshow .= 'type: \'time\', '; // Need Moment.js
@ -1156,17 +1228,23 @@ class DolGraph
}
$this->stringtoshow .= ' }] }';
// Add a callback to change label to show only positive value
if ($isfunnel) {
if (is_array($this->tooltipsLabels) || is_array($this->tooltipsTitles)) {
$this->stringtoshow .= ', tooltips: { mode: \'nearest\',
callbacks: {
title: function(tooltipItem, data) {
return data.datasets[tooltipItem[0].datasetIndex].label;
},
label: function(tooltipItem, data) {
return data.datasets[tooltipItem.datasetIndex].data[0][1];
}
}
},';
callbacks: {';
if (is_array($this->tooltipsTitles)) {
$this->stringtoshow .='
title: function(tooltipItem, data) {
var tooltipsTitle ='.json_encode($this->tooltipsTitles).'
return tooltipsTitle[tooltipItem[0].datasetIndex];
},';
}
if (is_array($this->tooltipsLabels)) {
$this->stringtoshow .= 'label: function(tooltipItem, data) {
var tooltipslabels ='.json_encode($this->tooltipsLabels).'
return tooltipslabels[tooltipItem.datasetIndex]
}';
}
$this->stringtoshow .='}},';
}
$this->stringtoshow .= '};';
$this->stringtoshow .= '
@ -1180,13 +1258,11 @@ class DolGraph
labels: [';
$i = 0;
if (!$isfunnel) {
foreach ($legends as $val) // Loop on each serie
{
if ($i > 0) $this->stringtoshow .= ', ';
$this->stringtoshow .= "'".dol_escape_js(dol_trunc($val, 32))."'";
$i++;
}
foreach ($legends as $val) // Loop on each serie
{
if ($i > 0) $this->stringtoshow .= ', ';
$this->stringtoshow .= "'" . dol_escape_js(dol_trunc($val, 32)) . "'";
$i++;
}
//var_dump($arrayofgroupslegend);
@ -1196,7 +1272,8 @@ class DolGraph
global $theme_datacolor;
//var_dump($arrayofgroupslegend);
$i = 0; $iinstack = 0;
$i = 0;
$iinstack = 0;
$oldstacknum = -1;
while ($i < $nblot) // Loop on each serie
{
@ -1242,34 +1319,15 @@ class DolGraph
$color = 'rgb(' . $newcolor[0] . ', ' . $newcolor[1] . ', ' . $newcolor[2] . ', 0.9)';
$bordercolor = 'rgb(' . $newcolor[0] . ', ' . $newcolor[1] . ', ' . $newcolor[2] . ')';
} else { // We do not use a 'group by'
if ($isfunnel) {
$bordercolor == 'null';
if (is_array($this->datacolor[$i])) {
$color = 'rgb(' . $this->datacolor[$i][0] . ', ' . $this->datacolor[$i][1] . ', ' . $this->datacolor[$i][2] . ', 0.9)'; // If datacolor is array(R, G, B)
} else {
// TODO FIXME This logic must be in the caller that set $this->datacolor
$tmp = str_replace('#', '', $this->datacolor[$i]);
if (strpos($tmp, '-') !== false) {
$foundnegativecolor++;
$color = '#FFFFFF'; // If $val is '-123'
} else {
$color = "#" . $tmp; // If $val is '123' or '#123'
$bordercolor = $color;
}
if ($foundnegativecolor) {
if (is_array($this->datacolor[$i])) $color = 'null'; // If datacolor is array(R, G, B)
else {
$tmp = str_replace('#', '', $this->datacolor[$i]);
if (strpos($tmp, '-') !== false) $bordercolor = '#' . str_replace('-', '', $tmp); // If $val is '-123'
else $bordercolor = 'null'; // If $val is '123' or '#123'
}
}
}
$bordercolor == 'null' ? "'rgba(0,0,0,0.2)'" : "'" . $bordercolor . "'";
if (is_array($this->datacolor[$i])) {
$color = 'rgb(' . $this->datacolor[$i][0] . ', ' . $this->datacolor[$i][1] . ', ' . $this->datacolor[$i][2] . ', 0.9)';
} else {
$color = 'rgb('.$this->datacolor[$i][0].', '.$this->datacolor[$i][1].', '.$this->datacolor[$i][2].', 0.9)';
$color = $this->datacolor[$i];
}
if (is_array($this->bordercolor[$i])) {
$bordercolor = $color;
//$color = (!empty($data['seriescolor']) ? json_encode($data['seriescolor']) : json_encode($datacolor));
} else {
$bordercolor = $this->bordercolor[$i];
}
}
@ -1280,21 +1338,16 @@ class DolGraph
$this->stringtoshow .= 'label: \'' . dol_escape_js(dol_string_nohtmltag($textoflegend)) . '\', ';
$this->stringtoshow .= 'pointStyle: \'' . ((!empty($this->type[$i]) && $this->type[$i] == 'linesnopoint') ? 'line' : 'circle') . '\', ';
$this->stringtoshow .= 'fill: ' . ($type == 'bar' ? 'true' : 'false') . ', ';
if ($isfunnel) {
$this->stringtoshow .= 'borderWidth: \'2\', ';
} elseif ($type == 'bar' || $type == 'horizontalBar') {
$this->stringtoshow .= 'borderWidth: \'1\', ';
if ($type == 'bar' || $type == 'horizontalBar') {
$this->stringtoshow .= 'borderWidth: \''.$this->borderwidth.'\', ';
}
$this->stringtoshow .= 'borderColor: \'' . $bordercolor . '\', ';
$this->stringtoshow .= 'backgroundColor: \'' . $color . '\', ';
if (!empty($arrayofgroupslegend) && !empty($arrayofgroupslegend[$i])) $this->stringtoshow .= 'stack: \'' . $arrayofgroupslegend[$i]['stacknum'] . '\', ';
$this->stringtoshow .='data: [';
if ($isfunnel) {
$this->stringtoshow .= '['.-$serie[$i].','.$serie[$i].']';
} else {
$this->stringtoshow .= $serie[$i];
}
$this->stringtoshow .=']';
$this->stringtoshow .= 'data: [';
$this->stringtoshow .= $this->mirrorGraphValues ? '[' . -$serie[$i] . ',' . $serie[$i] . ']' : $serie[$i];
$this->stringtoshow .= ']';
$this->stringtoshow .= '}' . "\n";
$i++;
@ -1318,7 +1371,7 @@ class DolGraph
{
$value = 0;
foreach ($this->data as $valarray) // Loop on each x
{
{
$value += $valarray[1];
}
return $value;
@ -1361,13 +1414,11 @@ class DolGraph
{
global $conf;
if ($direction == 'width')
{
if ($direction == 'width') {
if (empty($conf->dol_optimize_smallscreen)) return ($defaultsize ? $defaultsize : '500');
else return (empty($_SESSION['dol_screen_width']) ? '280' : ($_SESSION['dol_screen_width'] - 40));
}
if ($direction == 'height')
{
if ($direction == 'height') {
return (empty($conf->dol_optimize_smallscreen) ? ($defaultsize ? $defaultsize : '200') : '160');
}
return 0;

View File

@ -1952,7 +1952,7 @@ class ExtraFields
$extrafield_collapse_display_value = intval($extrafield_param_list[0]);
if ($extrafield_collapse_display_value == 1 || $extrafield_collapse_display_value == 2) {
// Set the collapse_display status to cookie in priority or if ignorecollapsesetup is 1, if cookie and ignorecollapsesetup not defined, use the setup.
$collapse_display = ((isset($_COOKIE['DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key.(!empty($object->id)?'_'.$object->id:'')]) || GETPOST('ignorecollapsesetup', 'int')) ? ($_COOKIE['DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key.(!empty($object->id)?'_'.$object->id:'')] ? true : false) : ($extrafield_collapse_display_value == 2 ? false : true));
$collapse_display = ((isset($_COOKIE['DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key]) || GETPOST('ignorecollapsesetup', 'int')) ? ($_COOKIE['DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key] ? true : false) : ($extrafield_collapse_display_value == 2 ? false : true));
$extrafields_collapse_num = $this->attributes[$object->table_element]['pos'][$key].(!empty($object->id)?'_'.$object->id:'');
$out .= '<!-- Add js script to manage the collapse/uncollapse of extrafields separators '.$key.' -->'."\n";
@ -1970,10 +1970,10 @@ class ExtraFields
$out .= ' jQuery(".trextrafields_collapse'.$extrafields_collapse_num.'").toggle(300, function(){'."\n";
$out .= ' if (jQuery(".trextrafields_collapse'.$extrafields_collapse_num.'").is(":hidden")) {'."\n";
$out .= ' jQuery("#trextrafieldseparator'.$key.(!empty($object->id)?'_'.$object->id:'').' '.$tagtype_dyn.' span").addClass("fa-plus-square").removeClass("fa-minus-square");'."\n";
$out .= ' document.cookie = "DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key.(!empty($object->id)?'_'.$object->id:'').'=0; path='.$_SERVER["PHP_SELF"].'"'."\n";
$out .= ' document.cookie = "DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key.'=0; path='.$_SERVER["PHP_SELF"].'"'."\n";
$out .= ' } else {'."\n";
$out .= ' jQuery("#trextrafieldseparator'.$key.(!empty($object->id)?'_'.$object->id:'').' '.$tagtype_dyn.' span").addClass("fa-minus-square").removeClass("fa-plus-square");'."\n";
$out .= ' document.cookie = "DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key.(!empty($object->id)?'_'.$object->id:'').'=1; path='.$_SERVER["PHP_SELF"].'"'."\n";
$out .= ' document.cookie = "DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key.'=1; path='.$_SERVER["PHP_SELF"].'"'."\n";
$out .= ' }'."\n";
$out .= ' });'."\n";
$out .= ' });'."\n";

View File

@ -17,7 +17,7 @@
* Copyright (C) 2012-2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2014-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2018 Christophe Battarel <christophe@altairis.fr>
* Copyright (C) 2018 Josep Lluis Amador <joseplluis@lliuretic.cat>
@ -668,7 +668,7 @@ class Form
$ret .= '</select>';
if (empty($conf->dol_optimize_smallscreen)) $ret .= ajax_combobox('.'.$name.'select');
if (empty($conf->dol_optimize_smallscreen)) $ret .= ajax_combobox('.'.$name.'select');
// Warning: if you set submit button to disabled, post using 'Enter' will no more work if there is no another input submit. So we add a hidden button
$ret .= '<input type="submit" name="confirmmassactioninvisible" style="display: none" tabindex="-1">'; // Hidden button BEFORE so it is the one used when we submit with ENTER.
@ -1800,10 +1800,9 @@ class Form
}
$out .= ' data-html="';
$outhtml = '';
if (!empty($obj->photo))
{
$outhtml .= $userstatic->getNomUrl(-3, '', 0, 1, 24, 1, 'login', '', 1).' ';
}
// if (!empty($obj->photo)) {
$outhtml .= $userstatic->getNomUrl(-3, '', 0, 1, 24, 1, 'login', '', 1).' ';
// }
if ($showstatus >= 0 && $obj->status == 0) $outhtml .= '<strike class="opacitymediumxxx">';
$outhtml .= $labeltoshow;
if ($showstatus >= 0 && $obj->status == 0) $outhtml .= '</strike>';
@ -1927,7 +1926,7 @@ class Form
* Return list of products for customer in Ajax if Ajax activated or go to select_produits_list
*
* @param int $selected Preselected products
* @param string $htmlname Name of HTML select field (must be unique in page)
* @param string $htmlname Name of HTML select field (must be unique in page).
* @param int $filtertype Filter on product type (''=nofilter, 0=product, 1=service)
* @param int $limit Limit on number of returned lines
* @param int $price_level Level of price to show
@ -1949,7 +1948,7 @@ class Form
* @param string $nooutput No print, return the output into a string
* @return void|string
*/
public function select_produits($selected = '', $htmlname = 'productid', $filtertype = '', $limit = 0, $price_level = 0, $status = 1, $finished = 2, $selected_input_value = '', $hidelabel = 0, $ajaxoptions = array(), $socid = 0, $showempty = '1', $forcecombo = 0, $morecss = '', $hidepriceinlabel = 0, $warehouseStatus = '', $selected_combinations = array(), $nooutput = 0)
public function select_produits($selected = '', $htmlname = 'productid', $filtertype = '', $limit = 0, $price_level = 0, $status = 1, $finished = 2, $selected_input_value = '', $hidelabel = 0, $ajaxoptions = array(), $socid = 0, $showempty = '1', $forcecombo = 0, $morecss = '', $hidepriceinlabel = 0, $warehouseStatus = '', $selected_combinations = null, $nooutput = 0)
{
// phpcs:enable
global $langs, $conf;
@ -1997,10 +1996,13 @@ class Form
}
$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
if (!empty($conf->variants->enabled)) {
if (!empty($conf->variants->enabled) && is_array($selected_combinations)) {
// Code to automatically insert with javascript the select of attributes under the select of product
// when a parent of variant has been selected.
$out .= '
<!-- script to auto show attributes select tags if a variant was selected -->
<script>
// auto show attributes fields
selected = '.json_encode($selected_combinations).';
combvalues = {};
@ -2019,6 +2021,8 @@ class Form
return;
}
console.log("A change has started. We get variants fields to inject html select");
jQuery.getJSON("'.DOL_URL_ROOT.'/variants/ajax/getCombinations.php", {
id: jQuery(this).val()
}, function (data) {
@ -2035,8 +2039,7 @@ class Form
span.append(
jQuery(document.createElement(\'div\')).text(val.label).css({
\'font-weight\': \'bold\',
\'display\': \'table-cell\',
\'text-align\': \'right\'
\'display\': \'table-cell\'
})
);
@ -2226,6 +2229,7 @@ class Form
{
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_lang as pl ON pl.fk_product = p.rowid ";
if (!empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE) && !empty($socid)) {
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
$soc = new Societe($db);
$result = $soc->fetch($socid);
if ($result > 0 && !empty($soc->default_lang)) {
@ -4245,7 +4249,7 @@ class Form
$output .= '<option value="-1">&nbsp;</option>';
foreach ($cate_arbo as $key => $value)
{
if ($cate_arbo[$key]['id'] == $selected || ($selected == 'auto' && count($cate_arbo) == 1))
if ($cate_arbo[$key]['id'] == $selected || ($selected === 'auto' && count($cate_arbo) == 1))
{
$add = 'selected ';
} else {
@ -5582,9 +5586,11 @@ class Form
*/
public function selectDateToDate($set_time = '', $set_time_end = '', $prefix = 're', $empty = 0)
{
$ret = $this->selectDate($set_time, $prefix.'_start', 0, 0, $empty);
$ret .= '<br/>';
$ret .= $this->selectDate($set_time_end, $prefix.'_end', 0, 0, $empty);
global $langs;
$ret = $this->selectDate($set_time, $prefix.'_start', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"), 'tzuserrel');
$ret .= '<br>';
$ret .= $this->selectDate($set_time_end, $prefix.'_end', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"), 'tzuserrel');
return $ret;
}
@ -5699,7 +5705,7 @@ class Form
if (strval($set_time) != '' && $set_time != -1)
{
//$formated_date=dol_print_date($set_time,$conf->format_date_short);
$formated_date = dol_print_date($set_time, $langs->trans("FormatDateShortInput")); // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
$formated_date = dol_print_date($set_time, $langs->trans("FormatDateShortInput"), $gm); // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
}
// Calendrier popup version eldy
@ -6427,7 +6433,7 @@ class Form
* @param string $htmlname Name of html select area. Must start with "multi" if this is a multiselect
* @param array $array Array like array(key => value) or array(key=>array('label'=>..., 'data-...'=>..., 'disabled'=>..., 'css'=>...))
* @param string|string[] $id Preselected key or preselected keys for multiselect
* @param int|string $show_empty 0 no empty value allowed, 1 or string to add an empty value into list (key is -1 and value is '' or '&nbsp;' if 1, key is -1 and value is the text if it is a placeholder string), <0 to add an empty value with key that is this value.
* @param int|string $show_empty 0 no empty value allowed, 1 or string to add an empty value into list (If 1: key is -1 and value is '' or '&nbsp;', If placeholder string: key is -1 and value is the string), <0 to add an empty value with key that is this value.
* @param int $key_in_label 1 to show key into label with format "[key] value"
* @param int $value_as_key 1 to use value as key
* @param string $moreparam Add more parameters onto the select tag. For example 'style="width: 95%"' to avoid select2 component to go over parent container
@ -6443,7 +6449,7 @@ class Form
* @return string HTML select string.
* @see multiselectarray(), selectArrayAjax(), selectArrayFilter()
*/
public static function selectarray($htmlname, $array, $id = '', $show_empty = 0, $key_in_label = 0, $value_as_key = 0, $moreparam = '', $translate = 0, $maxlen = 0, $disabled = 0, $sort = '', $morecss = '', $addjscombo = 0, $moreparamonempty = '', $disablebademail = 0, $nohtmlescape = 0)
public static function selectarray($htmlname, $array, $id = '', $show_empty = 0, $key_in_label = 0, $value_as_key = 0, $moreparam = '', $translate = 0, $maxlen = 0, $disabled = 0, $sort = '', $morecss = '', $addjscombo = 1, $moreparamonempty = '', $disablebademail = 0, $nohtmlescape = 0)
{
global $conf, $langs;
@ -6457,11 +6463,7 @@ class Form
$out = '';
// Add code for jquery to use multiselect
if ($addjscombo && $jsbeautify)
{
$minLengthToAutocomplete = 0;
$tmpplugin = empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) ? (constant('REQUIRE_JQUERY_MULTISELECT') ?constant('REQUIRE_JQUERY_MULTISELECT') : 'select2') : $conf->global->MAIN_USE_JQUERY_MULTISELECT;
if ($addjscombo && $jsbeautify) {
// Enhance with select2
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
$out .= ajax_combobox($htmlname);
@ -6471,16 +6473,14 @@ class Form
$out .= ' name="'.preg_replace('/^\./', '', $htmlname).'" '.($moreparam ? $moreparam : '');
$out .= '>';
if ($show_empty)
{
if ($show_empty) {
$textforempty = ' ';
if (!empty($conf->use_javascript_ajax)) $textforempty = '&nbsp;'; // If we use ajaxcombo, we need &nbsp; here to avoid to have an empty element that is too small.
if (!is_numeric($show_empty)) $textforempty = $show_empty;
$out .= '<option class="optiongrey" '.($moreparamonempty ? $moreparamonempty.' ' : '').'value="'.($show_empty < 0 ? $show_empty : -1).'"'.($id == $show_empty ? ' selected' : '').'>'.$textforempty.'</option>'."\n";
}
if (is_array($array))
{
if (is_array($array)) {
// Translate
if ($translate)
{

View File

@ -130,7 +130,7 @@ class FormActions
//var_dump($selected);
if ($selected == 'done') $selected = '100';
print '<select '.($canedit ? '' : 'disabled ').'name="'.$htmlname.'" id="select'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'">';
if ($showempty) print '<option value=""'.($selected == '' ? ' selected' : '').'></option>';
if ($showempty) print '<option value=""'.($selected == '' ? ' selected' : '').'>&nbsp;</option>';
foreach ($listofstatus as $key => $val)
{
print '<option value="'.$key.'"'.(($selected == $key && strlen($selected) == strlen($key)) || (($selected > 0 && $selected < 100) && $key == '50') ? ' selected' : '').'>'.$val.'</option>';
@ -142,6 +142,8 @@ class FormActions
print '</select>';
if ($selected == 0 || $selected == 100) $canedit = 0;
print ajax_combobox('select'.$htmlname);
if (empty($onlyselect))
{
print ' <input type="text" id="val'.$htmlname.'" name="percentage" class="flat hideifna" value="'.($selected >= 0 ? $selected : '').'" size="2"'.($canedit && ($selected >= 0) ? '' : ' disabled').'>';
@ -202,7 +204,7 @@ class FormActions
$newcardbutton = '';
if (!empty($conf->agenda->enabled) && !empty($user->rights->agenda->myactions->create))
{
$url = DOL_URL_ROOT.'/comm/action/card.php?action=create&amp;datep='.urlencode(dol_print_date(dol_now(), 'dayhourlog'), 'tzuser').'&amp;origin='.urlencode($typeelement).'&amp;originid='.$object->id.((!empty($object->socid) && $object->socid > 0) ? '&amp;socid='.$object->socid : ((!empty($socid) && $socid > 0) ? '&amp;socid='.$socid : '')).($projectid > 0 ? '&amp;projectid='.$projectid : '').'&amp;backtopage='.urlencode($urlbacktopage);
$url = DOL_URL_ROOT.'/comm/action/card.php?action=create&amp;datep='.urlencode(dol_print_date(dol_now(), 'dayhourlog', 'tzuser')).'&amp;origin='.urlencode($typeelement).'&amp;originid='.$object->id.((!empty($object->socid) && $object->socid > 0) ? '&amp;socid='.$object->socid : ((!empty($socid) && $socid > 0) ? '&amp;socid='.$socid : '')).($projectid > 0 ? '&amp;projectid='.$projectid : '').'&amp;backtopage='.urlencode($urlbacktopage);
$newcardbutton .= dolGetButtonTitle($langs->trans("AddEvent"), '', 'fa fa-plus-circle', $url);
}

View File

@ -52,7 +52,8 @@ class FormCategory extends Form
$filter = '';
$filter .= '<div class="divsearchfield">';
$filter .= $langs->trans('Categories').": ";
$filter .= img_picto($langs->trans("Categories"), 'category', 'class="pictofixedwidth"');
//$filter .= $langs->trans('Categories').": ";
$filter .= Form::multiselectarray($htmlName, $categoryArray, $preSelected, 0, 0, "minwidth300");
$filter .= "</div>";

View File

@ -1031,7 +1031,7 @@ class FormCompany extends Form
$out .= '<input type="hidden" name="action" value="set_thirdpartytype">';
$out .= '<input type="hidden" name="token" value="'.newToken().'">';
$sortparam = (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT); // NONE means we keep sort of original array, so we sort on position. ASC, means next function will sort on label.
$out .= $this->selectarray($htmlname, $this->typent_array(0, $filter), $selected, 0, 0, 0, '', 0, 0, 0, $sortparam, '', 1);
$out .= $this->selectarray($htmlname, $this->typent_array(0, $filter), $selected, 1, 0, 0, '', 0, 0, 0, $sortparam, '', 1);
$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
$out .= '</form>';
} else {

View File

@ -488,13 +488,18 @@ class FormMail extends Form
// Zone to select email template
if (count($modelmail_array) > 0) {
$model_mail_selected_id = GETPOSTISSET('modelmailselected') ? GETPOST('modelmailselected', 'int') : $arraydefaultmessage->id;
// If list of template is filled
$out .= '<div class="center" style="padding: 0px 0 12px 0">'."\n";
$out .= '<span class="opacitymedium">'.$langs->trans('SelectMailModel').':</span> ';
$out .= $this->selectarray('modelmailselected', $modelmail_array, 0, 1, 0, 0, '', 0, 0, 0, '', 'minwidth100', 1, '', 0, 1);
$out .= $this->selectarray('modelmailselected', $modelmail_array, $model_mail_selected_id, 1, 0, 0, '', 0, 0, 0, '', 'minwidth100', 1, '', 0, 1);
if ($user->admin) {
$out .= info_admin($langs->trans("YouCanChangeValuesForThisListFrom", $langs->transnoentitiesnoconv('Setup').' - '.$langs->transnoentitiesnoconv('EMails')), 1);
}
$out .= ' &nbsp; ';
$out .= '<input class="button" type="submit" value="'.$langs->trans('Apply').'" name="modelselected" id="modelselected">';
$out .= ' &nbsp; ';

View File

@ -332,13 +332,13 @@ class FormOther
/**
* Return select list for categories (to use in form search selectors)
*
* @param int $type Type of category ('customer', 'supplier', 'contact', 'product', 'member'). Old mode (0, 1, 2, ...) is deprecated.
* @param integer $selected Preselected value
* @param string $htmlname Name of combo list
* @param int $nocateg Show also an entry "Not categorized"
* @param int $showempty Add also an empty line
* @param string $morecss More CSS
* @return string Html combo list code
* @param int $type Type of category ('customer', 'supplier', 'contact', 'product', 'member'). Old mode (0, 1, 2, ...) is deprecated.
* @param integer $selected Preselected value
* @param string $htmlname Name of combo list
* @param int $nocateg Show also an entry "Not categorized"
* @param int|string $showempty Add also an empty line
* @param string $morecss More CSS
* @return string Html combo list code
* @see select_all_categories()
*/
public function select_categories($type, $selected = 0, $htmlname = 'search_categ', $nocateg = 0, $showempty = 1, $morecss = '')
@ -368,7 +368,13 @@ class FormOther
// Print a select with each of them
$moreforfilter .= '<select class="flat minwidth100'.($morecss ? ' '.$morecss : '').'" id="select_categ_'.$htmlname.'" name="'.$htmlname.'">';
if ($showempty) $moreforfilter .= '<option value="0">&nbsp;</option>'; // Should use -1 to say nothing
if ($showempty) {
$textforempty = ' ';
if (!empty($conf->use_javascript_ajax)) $textforempty = '&nbsp;'; // If we use ajaxcombo, we need &nbsp; here to avoid to have an empty element that is too small.
if (!is_numeric($showempty)) $textforempty = $showempty;
$moreforfilter .= '<option class="optiongrey" '.($moreparamonempty ? $moreparamonempty.' ' : '').'value="'.($showempty < 0 ? $showempty : -1).'"'.($selected == $showempty ? ' selected' : '').'>'.$textforempty.'</option>'."\n";
//$moreforfilter .= '<option value="0" '.($moreparamonempty ? $moreparamonempty.' ' : '').' class="optiongrey">'.(is_numeric($showempty) ? '&nbsp;' : $showempty).'</option>'; // Should use -1 to say nothing
}
if (is_array($tab_categs))
{
@ -394,14 +400,14 @@ class FormOther
/**
* Return select list for categories (to use in form search selectors)
*
* @param string $selected Preselected value
* @param string $htmlname Name of combo list (example: 'search_sale')
* @param User $user Object user
* @param int $showstatus 0=show user status only if status is disabled, 1=always show user status into label, -1=never show user status
* @param int $showempty 1=show also an empty value
* @param string $morecss More CSS
* @param int $norepresentative Show also an entry "Not categorized"
* @return string Html combo list code
* @param string $selected Preselected value
* @param string $htmlname Name of combo list (example: 'search_sale')
* @param User $user Object user
* @param int $showstatus 0=show user status only if status is disabled, 1=always show user status into label, -1=never show user status
* @param int|string $showempty 1=show also an empty value
* @param string $morecss More CSS
* @param int $norepresentative Show also an entry "Not categorized"
* @return string Html combo list code
*/
public function select_salesrepresentatives($selected, $htmlname, $user, $showstatus = 0, $showempty = 1, $morecss = '', $norepresentative = 0)
{
@ -427,7 +433,12 @@ class FormOther
// Select each sales and print them in a select input
$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'">';
if ($showempty) $out .= '<option value="0">&nbsp;</option>';
if ($showempty) {
$textforempty = ' ';
if (!empty($conf->use_javascript_ajax)) $textforempty = '&nbsp;'; // If we use ajaxcombo, we need &nbsp; here to avoid to have an empty element that is too small.
if (!is_numeric($showempty)) $textforempty = $showempty;
$out .= '<option class="optiongrey" value="'.($showempty < 0 ? $showempty : -1).'"'.($selected == $showempty ? ' selected' : '').'>'.$textforempty.'</option>'."\n";
}
// Get list of users allowed to be viewed
$sql_usr = "SELECT u.rowid, u.lastname, u.firstname, u.statut as status, u.login, u.photo, u.gender, u.entity, u.admin";
@ -499,11 +510,7 @@ class FormOther
$out .= '<option value="'.$obj_usr->rowid.'"';
if ($obj_usr->rowid == $selected) $out .= ' selected';
$out .= ' data-html="';
$outhtml = '';
if (!empty($obj_usr->photo))
{
$outhtml .= $userstatic->getNomUrl(-3, '', 0, 1, 24, 1, 'login', '', 1).' ';
}
$outhtml = $userstatic->getNomUrl(-3, '', 0, 1, 24, 1, 'login', '', 1).' ';
if ($showstatus >= 0 && $obj_usr->status == 0) $outhtml .= '<strike class="opacitymediumxxx">';
$outhtml .= $labeltoshow;
if ($showstatus >= 0 && $obj_usr->status == 0) $outhtml .= '</strike>';

View File

@ -111,6 +111,11 @@ class Menubase
*/
public $title;
/**
* @var string Prefix
*/
public $prefix;
/**
* @var string Lang file to load for translation
*/
@ -248,6 +253,7 @@ class Menubase
$sql .= "url,";
$sql .= "target,";
$sql .= "titre,";
$sql .= "prefix,";
$sql .= "langs,";
$sql .= "perms,";
$sql .= "enabled,";
@ -266,6 +272,7 @@ class Menubase
$sql .= " '".$this->db->escape($this->url)."',";
$sql .= " '".$this->db->escape($this->target)."',";
$sql .= " '".$this->db->escape($this->title)."',";
$sql .= " '".$this->db->escape($this->prefix)."',";
$sql .= " '".$this->db->escape($this->langs)."',";
$sql .= " '".$this->db->escape($this->perms)."',";
$sql .= " '".$this->db->escape($this->enabled)."',";
@ -319,6 +326,7 @@ class Menubase
$this->url = trim($this->url);
$this->target = trim($this->target);
$this->title = trim($this->title);
$this->prefix = trim($this->prefix);
$this->langs = trim($this->langs);
$this->perms = trim($this->perms);
$this->enabled = trim($this->enabled);
@ -341,6 +349,7 @@ class Menubase
$sql .= " url='".$this->db->escape($this->url)."',";
$sql .= " target='".$this->db->escape($this->target)."',";
$sql .= " titre='".$this->db->escape($this->title)."',";
$sql .= " prefix='".$this->db->escape($this->prefix)."',";
$sql .= " langs='".$this->db->escape($this->langs)."',";
$sql .= " perms='".$this->db->escape($this->perms)."',";
$sql .= " enabled='".$this->db->escape($this->enabled)."',";
@ -385,6 +394,7 @@ class Menubase
$sql .= " t.url,";
$sql .= " t.target,";
$sql .= " t.titre as title,";
$sql .= " t.prefix,";
$sql .= " t.langs,";
$sql .= " t.perms,";
$sql .= " t.enabled,";
@ -416,6 +426,7 @@ class Menubase
$this->url = $obj->url;
$this->target = $obj->target;
$this->title = $obj->title;
$this->prefix = $obj->prefix;
$this->langs = $obj->langs;
$this->perms = $obj->perms;
$this->enabled = str_replace("\"", "'", $obj->enabled);
@ -505,8 +516,7 @@ class Menubase
$leftmenu = $myleftmenu; // To export to dol_eval function
$newTabMenu = array();
foreach ($tabMenu as $val)
{
foreach ($tabMenu as $val) {
if ($val['type'] == 'top') $newTabMenu[] = $val;
}
@ -554,15 +564,13 @@ class Menubase
// Now complete $this->newmenu->list when fk_menu value is -1 (left menu added by modules with no top menu)
foreach ($tabMenu as $key => $val)
{
//var_dump($tabMenu);
if ($val['fk_menu'] == -1 && $val['fk_mainmenu'] == $mainmenu) // We found a menu entry not linked to parent with good mainmenu
{
//print 'Try to add menu (current is mainmenu='.$mainmenu.' leftmenu='.$leftmenu.') for '.join(',',$val).' fk_mainmenu='.$val['fk_mainmenu'].' fk_leftmenu='.$val['fk_leftmenu'].'<br>';
//var_dump($this->newmenu->liste);exit;
if (empty($val['fk_leftmenu']))
{
$this->newmenu->add($val['url'], $val['titre'], 0, $val['perms'], $val['target'], $val['mainmenu'], $val['leftmenu'], $val['position']);
if (empty($val['fk_leftmenu'])) {
$this->newmenu->add($val['url'], $val['titre'], 0, $val['perms'], $val['target'], $val['mainmenu'], $val['leftmenu'], $val['position'], '', '', '', $val['prefix']);
//var_dump($this->newmenu->liste);
} else {
// Search first menu with this couple (mainmenu,leftmenu)=(fk_mainmenu,fk_leftmenu)
@ -579,8 +587,7 @@ class Menubase
break;
}
}
if ($valparent['mainmenu'] == $val['fk_mainmenu'] && $valparent['leftmenu'] == $val['fk_leftmenu'])
{
if ($valparent['mainmenu'] == $val['fk_mainmenu'] && $valparent['leftmenu'] == $val['fk_leftmenu']) {
//print "We found parent: keyparent='.$keyparent.' - level=".$valparent['level'].' - '.join(',',$valparent).'<br>';
// Now we look to find last subelement of this parent (we add at end)
$searchlastsub = ($valparent['level'] + 1);
@ -589,8 +596,9 @@ class Menubase
}
}
//print 'We must insert menu entry between entry '.$lastid.' and '.$nextid.'<br>';
if ($found) $this->newmenu->insert($lastid, $val['url'], $val['titre'], $searchlastsub, $val['perms'], $val['target'], $val['mainmenu'], $val['leftmenu'], $val['position']);
else {
if ($found) {
$this->newmenu->insert($lastid, $val['url'], $val['titre'], $searchlastsub, $val['perms'], $val['target'], $val['mainmenu'], $val['leftmenu'], $val['position'], '', '', '', $val['prefix']);
} else {
dol_syslog("Error. Modules ".$val['module']." has defined a menu entry with a parent='fk_mainmenu=".$val['fk_leftmenu'].",fk_leftmenu=".$val['fk_leftmenu']."' and position=".$val['position'].'. The parent was not found. May be you forget it into your definition of menu, or may be the parent has a "position" that is after the child (fix field "position" of parent or child in this case).', LOG_WARNING);
//print "Parent menu not found !!<br>";
}
@ -620,7 +628,7 @@ class Menubase
$mainmenu = $mymainmenu; // To export to dol_eval function
$leftmenu = $myleftmenu; // To export to dol_eval function
$sql = "SELECT m.rowid, m.type, m.module, m.fk_menu, m.fk_mainmenu, m.fk_leftmenu, m.url, m.titre, m.langs, m.perms, m.enabled, m.target, m.mainmenu, m.leftmenu, m.position";
$sql = "SELECT m.rowid, m.type, m.module, m.fk_menu, m.fk_mainmenu, m.fk_leftmenu, m.url, m.titre, m.prefix, m.langs, m.perms, m.enabled, m.target, m.mainmenu, m.leftmenu, m.position";
$sql .= " FROM ".MAIN_DB_PREFIX."menu as m";
$sql .= " WHERE m.entity IN (0,".$conf->entity.")";
$sql .= " AND m.menu_handler IN ('".$this->db->escape($menu_handler)."','all')";
@ -700,12 +708,15 @@ class Menubase
$tabMenu[$b]['module'] = $menu['module'];
$tabMenu[$b]['fk_menu'] = $menu['fk_menu'];
$tabMenu[$b]['url'] = $menu['url'];
if (!preg_match("/^(http:\/\/|https:\/\/)/i", $tabMenu[$b]['url']))
{
if (preg_match('/\?/', $tabMenu[$b]['url'])) $tabMenu[$b]['url'] .= '&amp;idmenu='.$menu['rowid'];
else $tabMenu[$b]['url'] .= '?idmenu='.$menu['rowid'];
if (!preg_match("/^(http:\/\/|https:\/\/)/i", $tabMenu[$b]['url'])) {
if (preg_match('/\?/', $tabMenu[$b]['url'])) {
$tabMenu[$b]['url'] .= '&amp;idmenu='.$menu['rowid'];
} else {
$tabMenu[$b]['url'] .= '?idmenu='.$menu['rowid'];
}
}
$tabMenu[$b]['titre'] = $title;
$tabMenu[$b]['prefix'] = $menu['prefix'];
$tabMenu[$b]['target'] = $menu['target'];
$tabMenu[$b]['mainmenu'] = $menu['mainmenu'];
$tabMenu[$b]['leftmenu'] = $menu['leftmenu'];
@ -750,9 +761,8 @@ class Menubase
for ($x = 0; $x < $num; $x++)
{
//si un element a pour pere : $pere
if ((($tab[$x]['fk_menu'] >= 0 && $tab[$x]['fk_menu'] == $pere)) && $tab[$x]['enabled'])
{
$this->newmenu->add($tab[$x]['url'], $tab[$x]['titre'], ($level - 1), $tab[$x]['perms'], $tab[$x]['target'], $tab[$x]['mainmenu'], $tab[$x]['leftmenu']);
if ((($tab[$x]['fk_menu'] >= 0 && $tab[$x]['fk_menu'] == $pere)) && $tab[$x]['enabled']) {
$this->newmenu->add($tab[$x]['url'], $tab[$x]['titre'], ($level - 1), $tab[$x]['perms'], $tab[$x]['target'], $tab[$x]['mainmenu'], $tab[$x]['leftmenu'], 0, '', '', '', $tab[$x]['prefix']);
$this->recur($tab, $tab[$x]['rowid'], ($level + 1));
}
}

View File

@ -65,29 +65,29 @@ print "jQuery(document).ready(function () {\n";
if (empty($conf->dol_no_mouse_hover)) {
print 'jQuery(".classfortooltip").tooltip({
show: { collision: "flipfit", effect:"toggle", delay:50, duration: 20 },
hide: { delay: 250, duration: 20 },
tooltipClass: "mytooltip",
content: function () {
console.log("Return title for popup");
return $(this).prop("title"); /* To force to get title as is */
}
});'."\n";
show: { collision: "flipfit", effect:"toggle", delay:50, duration: 20 },
hide: { delay: 250, duration: 20 },
tooltipClass: "mytooltip",
content: function () {
console.log("Return title for popup");
return $(this).prop("title"); /* To force to get title as is */
}
});'."\n";
}
print '
jQuery(".classfortooltiponclicktext").dialog(
{ closeOnEscape: true, classes: { "ui-dialog": "highlight" },
jQuery(".classfortooltiponclicktext").dialog({
closeOnEscape: true, classes: { "ui-dialog": "highlight" },
maxHeight: window.innerHeight-60, width: '.($conf->browser->layout == 'phone' ? max($_SESSION['dol_screenwidth'] - 20, 320) : 700).',
modal: true,
autoOpen: false }).css("z-index: 5000");
autoOpen: false
}).css("z-index: 5000");
jQuery(".classfortooltiponclick").click(function () {
console.log("We click on tooltip for element with dolid="+$(this).attr(\'dolid\'));
if ($(this).attr(\'dolid\'))
{
if ($(this).attr(\'dolid\')) {
obj=$("#idfortooltiponclick_"+$(this).attr(\'dolid\')); /* obj is a div component */
obj.dialog("open");
return false;
return false;
}
});'."\n";

View File

@ -73,8 +73,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
{
print '<div class="divsearchfield">';
// Type
print '<span class="fas fa-square inline-block fawidth30" style=" color: #ddd;"></span>';
print '<span class="hideonsmartphone">'.$langs->trans("Type").'</span>';
print '<span class="fas fa-square inline-block fawidth30" style=" color: #ddd;" title="'.$langs->trans("Type").'"></span>';
$multiselect = 0;
if (!empty($conf->global->MAIN_ENABLE_MULTISELECT_TYPE)) // We use an option here because it adds bugs when used on agenda page "peruser" and "list"
{
@ -85,13 +84,11 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
// Assigned to
print '<div class="divsearchfield">';
print img_picto('', 'user', 'class="fawidth30 inline-block"');
print '<span class="hideonsmartphone">'.$langs->trans("ActionsToDoBy").'</span>';
print img_picto($langs->trans("ActionsToDoBy"), 'user', 'class="fawidth30 inline-block"');
print $form->select_dolusers($filtert, 'search_filtert', 1, '', !$canedit, '', '', 0, 0, 0, '', 0, '', 'maxwidth500 widthcentpercentminusxx');
print '</div>';
print '<div class="divsearchfield">';
print img_picto('', 'object_group', 'class="fawidth30 inline-block"');
print '<span class="hideonsmartphone">'.$langs->trans("ToUserOfGroup").'</span>';
print img_picto($langs->trans("ToUserOfGroup"), 'object_group', 'class="fawidth30 inline-block"');
print $form->select_dolgroups($usergroupid, 'usergroup', 1, '', !$canedit, '', '', '0', false, 'maxwidth500');
print '</div>';
@ -102,8 +99,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
// Resource
print '<div class="divsearchfield">';
print img_picto('', 'object_resource', 'class="fawidth30 inline-block"');
print '<span class="hideonsmartphone">'.$langs->trans("Resource").'</span>';
print img_picto($langs->trans("Resource"), 'object_resource', 'class="fawidth30 inline-block"');
print $formresource->select_resource_list($resourceid, "search_resourceid", '', 1, 0, 0, null, '', 2, 0, 'maxwidth500');
print '</div>';
}
@ -112,8 +108,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
if (!empty($conf->societe->enabled) && $user->rights->societe->lire)
{
print '<div class="divsearchfield">';
print img_picto('', 'company', 'class="fawidth30 inline-block"');
print '<span class="hideonsmartphone">'.$langs->trans("ThirdParty").'</span>';
print img_picto($langs->trans("ThirdParty"), 'company', 'class="fawidth30 inline-block"');
print $form->select_company($socid, 'search_socid', '', '&nbsp;', 0, 0, null, 0, 'minwidth100 maxwidth500');
print '</div>';
}
@ -124,8 +119,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
$formproject = new FormProjets($db);
print '<div class="divsearchfield">';
print img_picto('', 'project', 'class="fawidth30 inline-block"');
print '<span class="hideonsmartphone">'.$langs->trans("Project").'</span>';
print img_picto($langs->trans("Project"), 'project', 'class="fawidth30 inline-block"');
print $formproject->select_projects($socid ? $socid : -1, $pid, 'search_projectid', 0, 0, 1, 0, 0, 0, 0, '', 1, 0, 'maxwidth500');
print '</div>';
}
@ -134,8 +128,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
{
// Status
print '<div class="divsearchfield">';
print img_picto('', 'setup', 'class="fawidth30 inline-block"');
print '<span class="hideonsmartphone">'.$langs->trans("Status").'</span>';
print img_picto($langs->trans("Status"), 'setup', 'class="fawidth30 inline-block"');
$formactions->form_select_status_action('formaction', $status, 1, 'search_status', 1, 2, 'minwidth100');
print '</div>';
}

View File

@ -149,9 +149,11 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen
dataType: "json",
minLength: '.$minLength.',
select: function( event, ui ) { // Function ran once new value has been selected into javascript combo
console.log("Call change on input '.$htmlname.' because of select definition of autocomplete select call on input#search_'.$htmlname.'");
console.log("We will trigger change on input '.$htmlname.' because of the select definition of autocomplete code for input#search_'.$htmlname.'");
console.log("Selected id = "+ui.item.id+" - If this value is null, it means you select a record with key that is null so selection is not effective");
console.log("Propagate before some properties");
//console.log(ui.item);
//For supplier price
$("#'.$htmlname.'").attr("data-up", ui.item.up);
@ -162,7 +164,6 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen
//For customer price
';
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) {
$script .= '
$("#' . $htmlname . '").attr("data-pbq", ui.item.pbq);
@ -181,6 +182,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen
}
$script .= '
$("#'.$htmlname.'").val(ui.item.id).trigger("change"); // Select new value
// Disable an element
if (options.option_disabled) {
console.log("Make action option_disabled on #"+options.option_disabled+" with disabled="+ui.item.disabled)
@ -196,6 +198,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen
$("#" + options.option_disabled).removeAttr("disabled");
}
}
if (options.disabled) {
console.log("Make action disabled on each "+options.option_disabled)
$.each(options.disabled, function(key, value) {
@ -208,6 +211,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen
$("#" + value).show().trigger("show");
});
}
// Update an input
if (ui.item.update) {
console.log("Make action update on each ui.item.update")
@ -228,7 +232,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen
}
});
}
console.log("ajax_autocompleter new value selected, we trigger change on original component so field #search_'.$htmlname.'");
console.log("ajax_autocompleter new value selected, we trigger change also on original component so on field #search_'.$htmlname.'");
$("#search_'.$htmlname.'").trigger("change"); // We have changed value of the combo select, we must be sure to trigger all js hook binded on this event. This is required to trigger other javascript change method binded on original field by other code.
}

View File

@ -1206,27 +1206,23 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
global $form;
global $param, $massactionbutton;
$start_year = GETPOST('dateevent_startyear');
$start_month = GETPOST('dateevent_startmonth');
$start_day = GETPOST('dateevent_startday');
$end_year = GETPOST('dateevent_endyear');
$end_month = GETPOST('dateevent_endmonth');
$end_day = GETPOST('dateevent_endday');
$start_year = GETPOST('dateevent_startyear', 'int');
$start_month = GETPOST('dateevent_startmonth', 'int');
$start_day = GETPOST('dateevent_startday', 'int');
$end_year = GETPOST('dateevent_endyear', 'int');
$end_month = GETPOST('dateevent_endmonth', 'int');
$end_day = GETPOST('dateevent_endday', 'int');
$tms_start = '';
$tms_end = '';
if (!empty($start_year) && !empty($start_month) && !empty($start_day)) {
$search_start = $start_year.'-'.$start_month.'-'.$start_day;
$tms_start = strtotime($search_start);
$tms_start = dol_mktime(0, 0, 0, $start_month, $start_day, $start_year, 'tzuserrel');
}
if (!empty($end_year) && !empty($end_month) && !empty($end_day)) {
$search_end = $end_year.'-'.$end_month.'-'.$end_day.' 23:59:59';
$tms_end = strtotime($search_end);
$tms_end = dol_mktime(23, 59, 59, $end_month, $end_day, $end_year, 'tzuserrel');
}
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All test are required to be compatible with all browsers
$search_start = '';
$tms_start = '';
$search_end = '';
$tms_end = '';
}
dol_include_once('/comm/action/class/actioncomm.class.php');
@ -1328,14 +1324,14 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
}
}
if (!empty($search_start) && !empty($search_end)) {
$sql .= " AND ((a.datep BETWEEN '$search_start' AND '$search_end') OR (a.datep2 BETWEEN '$search_start' AND '$search_end'))";
if (!empty($tms_start) && !empty($tms_end)) {
$sql .= " AND ((a.datep BETWEEN '".$db->idate($tms_start)."' AND '".$db->idate($tms_end)."') OR (a.datep2 BETWEEN '".$db->idate($tms_start)."' AND '".$db->idate($tms_end)."'))";
}
elseif (empty($search_start) && !empty($search_end)) {
$sql .= " AND ((a.datep <= '$search_end') OR (a.datep2 <= '$search_end'))";
elseif (empty($tms_start) && !empty($tms_end)) {
$sql .= " AND ((a.datep <= '".$db->idate($tms_end)."') OR (a.datep2 <= '".$db->idate($tms_end)."'))";
}
elseif (!empty($search_start) && empty($search_end)) {
$sql .= " AND ((a.datep >= '$search_start') OR (a.datep2 >= '$search_start'))";
elseif (!empty($tms_start) && empty($tms_end)) {
$sql .= " AND ((a.datep >= '".$db->idate($tms_start)."') OR (a.datep2 >= '".$db->idate($tms_start)."'))";
}
if (is_array($actioncode) && !empty($actioncode)) {
@ -1491,7 +1487,9 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
$out .= $formactions->select_type_actions($actioncode, "actioncode", '', empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : -1, 0, (empty($conf->global->AGENDA_USE_MULTISELECT_TYPE) ? 0 : 1), 1);
$out .= '</td>';
$out .= '<td class="liste_titre maxwidth100onsmartphone"><input type="text" class="maxwidth100onsmartphone" name="search_agenda_label" value="'.$filters['search_agenda_label'].'"></td>';
$out .= '<td class="liste_titre center">'.$form->selectDateToDate($tms_start, $tms_end, 'dateevent', 1).'</td>';
$out .= '<td class="liste_titre center">';
$out .= $form->selectDateToDate($tms_start, $tms_end, 'dateevent', 1);
$out .= '</td>';
$out .= '<td class="liste_titre"></td>';
$out .= '<td class="liste_titre"></td>';
$out .= '<td class="liste_titre"></td>';

View File

@ -1513,6 +1513,7 @@ function dol_init_file_process($pathtoscan = '', $trackid = '')
* @param int $generatethumbs 1=Generate also thumbs for uploaded image files
* @param Object $object Object used to set 'src_object_*' fields
* @return int <=0 if KO, >0 if OK
* @see dol_remove_file_process()
*/
function dol_add_file_process($upload_dir, $allowoverwrite = 0, $donotupdatesession = 0, $varfiles = 'addedfile', $savingdocmask = '', $link = null, $trackid = '', $generatethumbs = 1, $object = null)
{
@ -1673,6 +1674,7 @@ function dol_add_file_process($upload_dir, $allowoverwrite = 0, $donotupdatesess
* @param int $donotdeletefile 1=Do not delete physically file
* @param string $trackid Track id (used to prefix name of session vars to avoid conflict)
* @return void
* @see dol_add_file_process()
*/
function dol_remove_file_process($filenb, $donotupdatesession = 0, $donotdeletefile = 1, $trackid = '')
{

View File

@ -16,6 +16,7 @@
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019 Thibault Foucart <support@ptibogxiv.net>
* Copyright (C) 2020 Open-Dsi <support@open-dsi.fr>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
*
* 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
@ -1771,7 +1772,7 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
} else {
$morehtmlstatus .= '<span class="statusrefbuy">'.$object->getLibStatut(6, 1).'</span>';
}
} elseif (in_array($object->element, array('facture', 'invoice', 'invoice_supplier', 'chargesociales', 'loan'))) {
} elseif (in_array($object->element, array('facture', 'invoice', 'invoice_supplier', 'chargesociales', 'loan', 'tva'))) {
$tmptxt = $object->getLibStatut(6, $object->totalpaye);
if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3)) $tmptxt = $object->getLibStatut(5, $object->totalpaye);
$morehtmlstatus .= $tmptxt;
@ -3266,8 +3267,8 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'delete', 'dolly', 'dollyrevert', 'donation', 'download', 'edit', 'ellipsis-h', 'email', 'eraser', 'external-link-alt', 'external-link-square-alt',
'filter', 'file-code', 'file-export', 'file-import', 'file-upload', 'folder', 'folder-open', 'globe', 'globe-americas', 'grip', 'grip_title', 'group',
'help', 'holiday',
'intervention', 'label', 'language', 'link', 'list', 'listlight', 'lot',
'map-marker-alt', 'member', 'money-bill-alt', 'mrp', 'note', 'next',
'intervention', 'label', 'language', 'link', 'list', 'listlight', 'loan', 'lot',
'margin', 'map-marker-alt', 'member', 'money-bill-alt', 'mrp', 'note', 'next',
'object_accounting', 'object_account', 'object_accountline', 'object_action', 'object_barcode', 'object_bill', 'object_billa', 'object_billd', 'object_bom',
'object_category', 'object_conversation', 'object_bookmark', 'object_bug', 'object_clock', 'object_dolly', 'object_dollyrevert', 'object_generic', 'object_folder',
'object_list-alt', 'object_calendar', 'object_calendarweek', 'object_calendarmonth', 'object_calendarday', 'object_calendarperuser',
@ -3278,7 +3279,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'object_payment', 'object_pdf', 'object_product', 'object_propal',
'object_paragraph', 'object_poll', 'object_printer', 'object_project', 'object_projectpub', 'object_propal', 'object_resource', 'object_rss', 'object_projecttask',
'object_recruitmentjobposition', 'object_recruitmentcandidature',
'object_shipment', 'object_share-alt', 'object_supplier_invoice', 'object_supplier_invoicea', 'object_supplier_invoiced', 'object_supplier_order', 'object_supplier_proposal', 'object_service', 'object_stock',
'object_salary', 'object_shipment', 'object_share-alt', 'object_supplier_invoice', 'object_supplier_invoicea', 'object_supplier_invoiced', 'object_supplier_order', 'object_supplier_proposal', 'object_service', 'object_stock',
'object_technic', 'object_ticket', 'object_trip', 'object_user', 'object_group', 'object_member',
'object_phoning', 'object_phoning_mobile', 'object_phoning_fax', 'object_email', 'object_website', 'object_movement',
'off', 'on', 'order',
@ -3287,10 +3288,10 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'jabber', 'skype', 'twitter', 'facebook', 'linkedin', 'instagram', 'snapchat', 'youtube', 'google-plus-g', 'whatsapp',
'chevron-left', 'chevron-right', 'chevron-down', 'chevron-top', 'commercial', 'companies',
'generic', 'home', 'hrm', 'members', 'products', 'invoicing',
'payment', 'pencil-ruler', 'preview', 'project', 'projectpub', 'refresh', 'supplier_invoice', 'ticket',
'payment', 'pencil-ruler', 'preview', 'project', 'projectpub', 'refresh', 'salary', 'supplier_invoice', 'ticket',
'error', 'warning',
'recruitmentcandidature', 'recruitmentjobposition', 'resource',
'supplier_proposal', 'supplier_order', 'supplier_invoice',
'shapes', 'supplier_proposal', 'supplier_order', 'supplier_invoice',
'title_setup', 'title_accountancy', 'title_bank', 'title_hrm', 'title_agenda'
)
)) {
@ -3308,14 +3309,15 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
$arrayconvpictotofa = array(
'account'=>'university', 'accountline'=>'receipt', 'accountancy'=>'money-check-alt', 'action'=>'calendar-alt', 'add'=>'plus-circle', 'address'=> 'address-book',
'bank_account'=>'university', 'bill'=>'file-invoice-dollar', 'billa'=>'file-excel', 'supplier_invoicea'=>'file-excel', 'billd'=>'file-medical', 'supplier_invoiced'=>'file-medical', 'bom'=>'cubes',
'bank_account'=>'university', 'bill'=>'file-invoice-dollar', 'billa'=>'file-excel', 'supplier_invoicea'=>'file-excel', 'billd'=>'file-medical', 'supplier_invoiced'=>'file-medical',
'bom'=>'shapes',
'company'=>'building', 'contact'=>'address-book', 'contract'=>'suitcase', 'conversation'=>'comments', 'donation'=>'file-alt', 'dynamicprice'=>'hand-holding-usd',
'setup'=>'cog', 'companies'=>'building', 'products'=>'cube', 'commercial'=>'suitcase', 'invoicing'=>'coins',
'accounting'=>'chart-line', 'category'=>'tag', 'dollyrevert'=>'dolly',
'hrm'=>'user-tie', 'margin'=>'calculator', 'members'=>'users', 'ticket'=>'ticket-alt', 'globe'=>'external-link-alt', 'lot'=>'barcode',
'email'=>'at',
'edit'=>'pencil-alt', 'grip_title'=>'arrows-alt', 'grip'=>'arrows-alt', 'help'=>'question-circle',
'generic'=>'file', 'holiday'=>'umbrella-beach', 'label'=>'layer-group',
'generic'=>'file', 'holiday'=>'umbrella-beach', 'label'=>'layer-group', 'loan'=>'money-bill-alt',
'member'=>'users', 'mrp'=>'cubes', 'next'=>'arrow-alt-circle-right',
'trip'=>'wallet', 'group'=>'users', 'movement'=>'people-carry',
'sign-out'=>'sign-out-alt',
@ -3330,7 +3332,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'recruitmentjobposition'=>'id-card-alt', 'recruitmentcandidature'=>'id-badge',
'resize'=>'crop', 'supplier_order'=>'dol-order_supplier', 'supplier_proposal'=>'file-signature',
'refresh'=>'redo', 'resource'=>'laptop-house',
'shipment'=>'dolly', 'stock'=>'box-open', 'stats' => 'chart-bar', 'split'=>'code-branch', 'supplier_invoice'=>'file-invoice-dollar', 'technic'=>'cogs', 'ticket'=>'ticket-alt',
'salary'=>'wallet', 'shipment'=>'dolly', 'stock'=>'box-open', 'stats' => 'chart-bar', 'split'=>'code-branch', 'supplier_invoice'=>'file-invoice-dollar', 'technic'=>'cogs', 'ticket'=>'ticket-alt',
'title_setup'=>'tools', 'title_accountancy'=>'money-check-alt', 'title_bank'=>'university', 'title_hrm'=>'umbrella-beach',
'title_agenda'=>'calendar-alt',
'uparrow'=>'mail-forward', 'vcard'=>'address-card',
@ -3363,6 +3365,13 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
$fakey = 'fa-'.$pictowithouttext;
}
if (in_array($pictowithouttext, array('member', 'contract'))) {
$fasize = '0.92em';
}
if (in_array($pictowithouttext, array('intervention', 'payment', 'loan'))) {
$fasize = '0.80em';
}
// Define $marginleftonlyshort
$arrayconvpictotomarginleftonly = array(
'bank', 'check', 'delete', 'generic', 'grip', 'grip_title', 'jabber',
@ -3386,11 +3395,11 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'order'=>'infobox-commande',
'user'=>'infobox-adherent', 'users'=>'infobox-adherent',
'error'=>'pictoerror', 'warning'=>'pictowarning', 'switch_on'=>'font-status4',
'holiday'=>'infobox-holiday', 'invoice'=>'infobox-commande',
'holiday'=>'infobox-holiday', 'invoice'=>'infobox-commande', 'loan'=>'infobox-bank_account',
'payment'=>'infobox-bank_account', 'poll'=>'infobox-adherent', 'project'=>'infobox-project', 'projecttask'=>'infobox-project', 'propal'=>'infobox-propal',
'recruitmentjobposition'=>'infobox-adherent', 'recruitmentcandidature'=>'infobox-adherent',
'resource'=>'infobox-action',
'supplier_invoice'=>'infobox-order_supplier', 'supplier_invoicea'=>'infobox-order_supplier', 'supplier_invoiced'=>'infobox-order_supplier',
'salary'=>'infobox-bank_account', 'supplier_invoice'=>'infobox-order_supplier', 'supplier_invoicea'=>'infobox-order_supplier', 'supplier_invoiced'=>'infobox-order_supplier',
'supplier_order'=>'infobox-order_supplier', 'supplier_proposal'=>'infobox-supplier_proposal',
'ticket'=>'infobox-contrat', 'title_accountancy'=>'infobox-bank_account', 'title_hrm'=>'infobox-holiday', 'trip'=>'infobox-expensereport', 'title_agenda'=>'infobox-action',
//'title_setup'=>'infobox-action', 'tools'=>'infobox-action',
@ -4100,21 +4109,21 @@ function dol_print_error($db = '', $error = '', $errors = null)
$out .= "<b>".$langs->trans("Date").":</b> ".dol_print_date(time(), 'dayhourlog')."<br>\n";
$out .= "<b>".$langs->trans("Dolibarr").":</b> ".DOL_VERSION." - https://www.dolibarr.org<br>\n";
if (isset($conf->global->MAIN_FEATURES_LEVEL)) $out .= "<b>".$langs->trans("LevelOfFeature").":</b> ".$conf->global->MAIN_FEATURES_LEVEL."<br>\n";
if (isset($conf->global->MAIN_FEATURES_LEVEL)) $out .= "<b>".$langs->trans("LevelOfFeature").":</b> ".dol_htmlentities($conf->global->MAIN_FEATURES_LEVEL, ENT_COMPAT)."<br>\n";
if (function_exists("phpversion"))
{
$out .= "<b>".$langs->trans("PHP").":</b> ".phpversion()."<br>\n";
}
$out .= "<b>".$langs->trans("Server").":</b> ".dol_htmlentities($_SERVER["SERVER_SOFTWARE"])."<br>\n";
$out .= "<b>".$langs->trans("Server").":</b> ".(isset($_SERVER["SERVER_SOFTWARE"]) ? dol_htmlentities($_SERVER["SERVER_SOFTWARE"], ENT_COMPAT) : '')."<br>\n";
if (function_exists("php_uname"))
{
$out .= "<b>".$langs->trans("OS").":</b> ".php_uname()."<br>\n";
}
$out .= "<b>".$langs->trans("UserAgent").":</b> ".dol_htmlentities($_SERVER["HTTP_USER_AGENT"], ENT_COMPAT, 'UTF-8')."<br>\n";
$out .= "<b>".$langs->trans("UserAgent").":</b> ".(isset($_SERVER["HTTP_USER_AGENT"]) ? dol_htmlentities($_SERVER["HTTP_USER_AGENT"], ENT_COMPAT) : '')."<br>\n";
$out .= "<br>\n";
$out .= "<b>".$langs->trans("RequestedUrl").":</b> ".dol_htmlentities($_SERVER["REQUEST_URI"], ENT_COMPAT, 'UTF-8')."<br>\n";
$out .= "<b>".$langs->trans("Referer").":</b> ".(isset($_SERVER["HTTP_REFERER"]) ? dol_htmlentities($_SERVER["HTTP_REFERER"], ENT_COMPAT, 'UTF-8') : '')."<br>\n";
$out .= "<b>".$langs->trans("MenuManager").":</b> ".(isset($conf->standard_menu) ? dol_htmlentities($conf->standard_menu) : '')."<br>\n";
$out .= "<b>".$langs->trans("RequestedUrl").":</b> ".dol_htmlentities($_SERVER["REQUEST_URI"], ENT_COMPAT)."<br>\n";
$out .= "<b>".$langs->trans("Referer").":</b> ".(isset($_SERVER["HTTP_REFERER"]) ? dol_htmlentities($_SERVER["HTTP_REFERER"], ENT_COMPAT) : '')."<br>\n";
$out .= "<b>".$langs->trans("MenuManager").":</b> ".(isset($conf->standard_menu) ? dol_htmlentities($conf->standard_menu, ENT_COMPAT) : '')."<br>\n";
$out .= "<br>\n";
$syslog .= "url=".dol_escape_htmltag($_SERVER["REQUEST_URI"]);
$syslog .= ", query_string=".dol_escape_htmltag($_SERVER["QUERY_STRING"]);
@ -4500,7 +4509,7 @@ function print_barre_liste($titre, $page, $file, $options = '', $sortfield = '',
//print 'totalnboflines='.$totalnboflines.'-savlimit='.$savlimit.'-limit='.$limit.'-num='.$num.'-nextpage='.$nextpage;
print "\n";
print "<!-- Begin title '".$titre."' -->\n";
print "<!-- Begin title -->\n";
print '<table class="centpercent notopnoleftnoright table-fiche-title'.($morecss ? ' '.$morecss : '').'"><tr>'; // maring bottom must be same than into load_fiche_tire
// Left
@ -5786,8 +5795,8 @@ function dol_string_nohtmltag($stringtoclean, $removelinefeed = 1, $pagecodeto =
// Example of $temp: <a href="/myurl" title="<u>A title</u>">0000-021</a>
$temp = preg_replace($pattern, "", $temp); // pass 1 - $temp after pass 1: <a href="/myurl" title="A title">0000-021
$temp = preg_replace($pattern, "", $temp); // pass 2 - $temp after pass 2: 0000-021
// removed '<' into non closing html tags like '<a'
$temp = preg_replace('/<(\w+)/', '\1', $temp);
// Remove '<' into remainging, so non closing html tags like '<abc'. Note: '<123abc' is not a html tag (can be kept), but '<abc123' is (must be removed).
$temp = preg_replace('/<([a-z]+)/i', '\1', $temp);
}
$temp = dol_html_entity_decode($temp, ENT_COMPAT, $pagecodeto);

View File

@ -315,7 +315,7 @@ function dol_print_object_info($object, $usetable = 0)
if ($usetable) print '</td><td>';
else print ': ';
print dol_print_date($object->date_validation, 'dayhour', 'tzserver');
if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").' &nbsp; / &nbsp; '.dol_print_date($object->date_validation, "dayhour", 'tzserver').' &nbsp;'.$langs->trans("ClientHour");
if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").' &nbsp; / &nbsp; '.dol_print_date($object->date_validation, "dayhour", 'tzuserrel').' &nbsp;'.$langs->trans("ClientHour");
if ($usetable) print '</td></tr>';
else print '<br>';
}
@ -349,7 +349,7 @@ function dol_print_object_info($object, $usetable = 0)
if ($usetable) print '</td><td>';
else print ': ';
print dol_print_date($object->date_approve, 'dayhour', 'tzserver');
if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").' &nbsp; / &nbsp; '.dol_print_date($object->date_approve, "dayhour", 'tzserver').' &nbsp;'.$langs->trans("ClientHour");
if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").' &nbsp; / &nbsp; '.dol_print_date($object->date_approve, "dayhour", 'tzuserrel').' &nbsp;'.$langs->trans("ClientHour");
if ($usetable) print '</td></tr>';
else print '<br>';
}
@ -377,7 +377,7 @@ function dol_print_object_info($object, $usetable = 0)
if ($usetable) print '</td><td>';
else print ': ';
print dol_print_date($object->date_approve2, 'dayhour', 'tzserver');
if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").' &nbsp; / &nbsp; '.dol_print_date($object->date_approve2, "dayhour", 'tzserver').' &nbsp;'.$langs->trans("ClientHour");
if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").' &nbsp; / &nbsp; '.dol_print_date($object->date_approve2, "dayhour", 'tzuserrel').' &nbsp;'.$langs->trans("ClientHour");
if ($usetable) print '</td></tr>';
else print '<br>';
}
@ -413,7 +413,7 @@ function dol_print_object_info($object, $usetable = 0)
if ($usetable) print '</td><td>';
else print ': ';
print dol_print_date($object->date_closing, 'dayhour', 'tzserver');
if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").' &nbsp; / &nbsp; '.dol_print_date($object->date_closing, "dayhour", 'tzserver').' &nbsp;'.$langs->trans("ClientHour");
if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").' &nbsp; / &nbsp; '.dol_print_date($object->date_closing, "dayhour", 'tzuserrel').' &nbsp;'.$langs->trans("ClientHour");
if ($usetable) print '</td></tr>';
else print '<br>';
}
@ -447,7 +447,7 @@ function dol_print_object_info($object, $usetable = 0)
if ($usetable) print '</td><td>';
else print ': ';
print dol_print_date($object->date_rappro, 'dayhour', 'tzserver');
if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").' &nbsp; / &nbsp; '.dol_print_date($object->date_rappro, "dayhour", 'tzserver').' &nbsp;'.$langs->trans("ClientHour");
if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").' &nbsp; / &nbsp; '.dol_print_date($object->date_rappro, "dayhour", 'tzuserrel').' &nbsp;'.$langs->trans("ClientHour");
if ($usetable) print '</td></tr>';
else print '<br>';
}
@ -460,7 +460,7 @@ function dol_print_object_info($object, $usetable = 0)
if ($usetable) print '</td><td>';
else print ': ';
print dol_print_date($object->date_envoi, 'dayhour', 'tzserver');
if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").' &nbsp; / &nbsp; '.dol_print_date($object->date_envoi, "dayhour", 'tzserver').' &nbsp;'.$langs->trans("ClientHour");
if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").' &nbsp; / &nbsp; '.dol_print_date($object->date_envoi, "dayhour", 'tzuserrel').' &nbsp;'.$langs->trans("ClientHour");
if ($usetable) print '</td></tr>';
else print '<br>';
}

View File

@ -51,6 +51,11 @@ function holiday_prepare_head($object)
$head[$h][2] = 'documents';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/holiday/info.php?id='.$object->id;
$head[$h][1] = $langs->trans("Info");
$head[$h][2] = 'info';
$h++;
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab

View File

@ -43,7 +43,11 @@ function import_prepare_head($param, $maxstep = 0)
$i = 1;
while ($i <= $maxstep)
{
$head[$h][0] = DOL_URL_ROOT.'/imports/import.php?step='.$i.$param;
if ($i < 6) {
$head[$h][0] = DOL_URL_ROOT.'/imports/import.php?step='.$i.$param;
} else {
$head[$h][0] = DOL_URL_ROOT.'/imports/import.php?step=5'.$param; // For step6, link is to step 5
}
$head[$h][1] = $langs->trans("Step")." ".$i;
$head[$h][2] = 'step'.$i;
$h++;

View File

@ -219,15 +219,14 @@ if (!function_exists('dol_loginfunction'))
$width = 0;
$urllogo = DOL_URL_ROOT.'/theme/common/login_logo.png';
if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small))
{
if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) {
$urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_small);
} elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo))
{
} elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) {
$urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/'.$mysoc->logo);
$width = 128;
} elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.svg'))
{
} elseif (!empty($mysoc->logo_squarred_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_small)) {
$urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_squarred_small);
} elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.svg')) {
$urllogo = DOL_URL_ROOT.'/theme/dolibarr_logo.svg';
}

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2016 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2018 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
*
* 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
@ -37,7 +38,7 @@ function vat_prepare_head($object)
$head = array();
$head[$tab][0] = DOL_URL_ROOT.'/compta/tva/card.php?id='.$object->id;
$head[$tab][1] = $langs->trans('VATPayment');
$head[$tab][1] = $langs->trans('VATDeclaration');
$head[$tab][2] = 'card';
$tab++;

View File

@ -6,6 +6,7 @@
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
*
* 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
@ -707,10 +708,10 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
$langs->load("users");
// Home - dashboard
$newmenu->add("/index.php?mainmenu=home&amp;leftmenu=home", $langs->trans("MyDashboard"), 0, 1, '', $mainmenu, 'home', 0, '', '', '', '<i class="fa fa-bar-chart fa-fw paddingright"></i>');
$newmenu->add("/index.php?mainmenu=home&amp;leftmenu=home", $langs->trans("MyDashboard"), 0, 1, '', $mainmenu, 'home', 0, '', '', '', '<i class="fa fa-bar-chart fa-fw paddingright pictofixedwidth"></i>');
// Setup
$newmenu->add("/admin/index.php?mainmenu=home&amp;leftmenu=setup", $langs->trans("Setup"), 0, $user->admin, '', $mainmenu, 'setup', 0, '', '', '', '<i class="fa fa-wrench fa-fw paddingright"></i>');
$newmenu->add("/admin/index.php?mainmenu=home&amp;leftmenu=setup", $langs->trans("Setup"), 0, $user->admin, '', $mainmenu, 'setup', 0, '', '', '', '<i class="fa fa-wrench fa-fw paddingright pictofixedwidth"></i>');
if ($usemenuhider || empty($leftmenu) || $leftmenu == "setup") {
// Load translation files required by the page
@ -757,7 +758,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
}
// System tools
$newmenu->add("/admin/tools/index.php?mainmenu=home&amp;leftmenu=admintools", $langs->trans("AdminTools"), 0, $user->admin, '', $mainmenu, 'admintools', 0, '', '', '', '<i class="fa fa-server fa-fw paddingright"></i>');
$newmenu->add("/admin/tools/index.php?mainmenu=home&amp;leftmenu=admintools", $langs->trans("AdminTools"), 0, $user->admin, '', $mainmenu, 'admintools', 0, '', '', '', '<i class="fa fa-server fa-fw paddingright pictofixedwidth"></i>');
if ($usemenuhider || empty($leftmenu) || preg_match('/^admintools/', $leftmenu)) {
// Load translation files required by the page
$langs->loadLangs(array('admin', 'help'));
@ -791,7 +792,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
}
}
$newmenu->add("/user/home.php?leftmenu=users", $langs->trans("MenuUsersAndGroups"), 0, $user->rights->user->user->lire, '', $mainmenu, 'users', 0, '', '', '', '<i class="fa fa-users fa-fw paddingright"></i>');
$newmenu->add("/user/home.php?leftmenu=users", $langs->trans("MenuUsersAndGroups"), 0, $user->rights->user->user->lire, '', $mainmenu, 'users', 0, '', '', '', img_picto('', 'user', 'class="paddingright pictofixedwidth"'));
if ($user->rights->user->user->lire) {
if ($usemenuhider || empty($leftmenu) || $leftmenu == "users") {
$newmenu->add("", $langs->trans("Users"), 1, $user->rights->user->user->lire || $user->admin);
@ -817,7 +818,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
// Societes
if (!empty($conf->societe->enabled)) {
$langs->load("companies");
$newmenu->add("/societe/index.php?leftmenu=thirdparties", $langs->trans("ThirdParty"), 0, $user->rights->societe->lire, '', $mainmenu, 'thirdparties');
$newmenu->add("/societe/index.php?leftmenu=thirdparties", $langs->trans("ThirdParty"), 0, $user->rights->societe->lire, '', $mainmenu, 'thirdparties', 0, '', '', '', img_picto('', 'company', 'class="paddingright pictofixedwidth"'));
if ($user->rights->societe->creer) {
$newmenu->add("/societe/card.php?action=create", $langs->trans("MenuNewThirdParty"), 1);
@ -879,7 +880,8 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
}
// Contacts
$newmenu->add("/societe/index.php?leftmenu=thirdparties", (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses")), 0, $user->rights->societe->contact->lire, '', $mainmenu, 'contacts');
$newmenu->add("/societe/index.php?leftmenu=thirdparties", (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses")), 0, $user->rights->societe->contact->lire, '', $mainmenu, 'contacts', 0, '', '', '', img_picto('', 'contact', 'class="paddingright pictofixedwidth"'));
$newmenu->add("/contact/card.php?leftmenu=contacts&amp;action=create", (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("NewContact") : $langs->trans("NewContactAddress")), 1, $user->rights->societe->contact->creer);
$newmenu->add("/contact/list.php?leftmenu=contacts", $langs->trans("List"), 1, $user->rights->societe->contact->lire);
if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) {
@ -911,7 +913,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
// Customer proposal
if (!empty($conf->propal->enabled)) {
$langs->load("propal");
$newmenu->add("/comm/propal/index.php?leftmenu=propals", $langs->trans("Proposals"), 0, $user->rights->propale->lire, '', $mainmenu, 'propals', 100);
$newmenu->add("/comm/propal/index.php?leftmenu=propals", $langs->trans("Proposals"), 0, $user->rights->propale->lire, '', $mainmenu, 'propals', 100, '', '', '', img_picto('', 'propal', 'class="paddingright pictofixedwidth"'));
$newmenu->add("/comm/propal/card.php?action=create&amp;leftmenu=propals", $langs->trans("NewPropal"), 1, $user->rights->propale->creer);
$newmenu->add("/comm/propal/list.php?leftmenu=propals", $langs->trans("List"), 1, $user->rights->propale->lire);
if ($usemenuhider || empty($leftmenu) || $leftmenu == "propals") {
@ -928,7 +930,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
// Customers orders
if (!empty($conf->commande->enabled)) {
$langs->load("orders");
$newmenu->add("/commande/index.php?leftmenu=orders", $langs->trans("CustomersOrders"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders', 200);
$newmenu->add("/commande/index.php?leftmenu=orders", $langs->trans("CustomersOrders"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders', 200, '', '', '', img_picto('', 'order', 'class="paddingright pictofixedwidth"'));
$newmenu->add("/commande/card.php?action=create&amp;leftmenu=orders", $langs->trans("NewOrder"), 1, $user->rights->commande->creer);
$newmenu->add("/commande/list.php?leftmenu=orders", $langs->trans("List"), 1, $user->rights->commande->lire);
if ($usemenuhider || empty($leftmenu) || $leftmenu == "orders") {
@ -947,7 +949,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
// Supplier proposal
if (!empty($conf->supplier_proposal->enabled)) {
$langs->load("supplier_proposal");
$newmenu->add("/supplier_proposal/index.php?leftmenu=propals_supplier", $langs->trans("SupplierProposalsShort"), 0, $user->rights->supplier_proposal->lire, '', $mainmenu, 'propals_supplier', 300);
$newmenu->add("/supplier_proposal/index.php?leftmenu=propals_supplier", $langs->trans("SupplierProposalsShort"), 0, $user->rights->supplier_proposal->lire, '', $mainmenu, 'propals_supplier', 300, '', '', '', img_picto('', 'supplier_proposal', 'class="paddingright pictofixedwidth"'));
$newmenu->add("/supplier_proposal/card.php?action=create&amp;leftmenu=supplier_proposals", $langs->trans("SupplierProposalNew"), 1, $user->rights->supplier_proposal->creer);
$newmenu->add("/supplier_proposal/list.php?leftmenu=supplier_proposals", $langs->trans("List"), 1, $user->rights->supplier_proposal->lire);
$newmenu->add("/comm/propal/stats/index.php?leftmenu=supplier_proposals&amp;mode=supplier", $langs->trans("Statistics"), 1, $user->rights->supplier_proposal->lire);
@ -956,7 +958,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
// Suppliers orders
if (!empty($conf->supplier_order->enabled)) {
$langs->load("orders");
$newmenu->add("/fourn/commande/index.php?leftmenu=orders_suppliers", $langs->trans("SuppliersOrders"), 0, $user->rights->fournisseur->commande->lire, '', $mainmenu, 'orders_suppliers', 400);
$newmenu->add("/fourn/commande/index.php?leftmenu=orders_suppliers", $langs->trans("SuppliersOrders"), 0, $user->rights->fournisseur->commande->lire, '', $mainmenu, 'orders_suppliers', 400, '', '', '', img_picto('', 'supplier_order', 'class="paddingright pictofixedwidth"'));
$newmenu->add("/fourn/commande/card.php?action=create&amp;leftmenu=orders_suppliers", $langs->trans("NewOrder"), 1, $user->rights->fournisseur->commande->creer);
$newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers", $langs->trans("List"), 1, $user->rights->fournisseur->commande->lire);
@ -981,7 +983,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
// Contrat
if (!empty($conf->contrat->enabled)) {
$langs->load("contracts");
$newmenu->add("/contrat/index.php?leftmenu=contracts", $langs->trans("ContractsSubscriptions"), 0, $user->rights->contrat->lire, '', $mainmenu, 'contracts', 2000);
$newmenu->add("/contrat/index.php?leftmenu=contracts", $langs->trans("ContractsSubscriptions"), 0, $user->rights->contrat->lire, '', $mainmenu, 'contracts', 2000, '', '', '', img_picto('', 'contract', 'class="paddingright pictofixedwidth"'));
$newmenu->add("/contrat/card.php?action=create&amp;leftmenu=contracts", $langs->trans("NewContractSubscription"), 1, $user->rights->contrat->creer);
$newmenu->add("/contrat/list.php?leftmenu=contracts", $langs->trans("List"), 1, $user->rights->contrat->lire);
$newmenu->add("/contrat/services_list.php?leftmenu=contracts", $langs->trans("MenuServices"), 1, $user->rights->contrat->lire);
@ -996,7 +998,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
// Interventions
if (!empty($conf->ficheinter->enabled)) {
$langs->load("interventions");
$newmenu->add("/fichinter/index.php?leftmenu=ficheinter", $langs->trans("Interventions"), 0, $user->rights->ficheinter->lire, '', $mainmenu, 'ficheinter', 2200);
$newmenu->add("/fichinter/index.php?leftmenu=ficheinter", $langs->trans("Interventions"), 0, $user->rights->ficheinter->lire, '', $mainmenu, 'ficheinter', 2200, '', '', '', img_picto('', 'intervention', 'class="paddingright pictofixedwidth"'));
$newmenu->add("/fichinter/card.php?action=create&amp;leftmenu=ficheinter", $langs->trans("NewIntervention"), 1, $user->rights->ficheinter->creer, '', '', '', 201);
$newmenu->add("/fichinter/list.php?leftmenu=ficheinter", $langs->trans("List"), 1, $user->rights->ficheinter->lire, '', '', '', 202);
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
@ -1016,7 +1018,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
// Customers invoices
if (!empty($conf->facture->enabled)) {
$langs->load("bills");
$newmenu->add("/compta/facture/index.php?leftmenu=customers_bills", $langs->trans("BillsCustomers"), 0, $user->rights->facture->lire, '', $mainmenu, 'customers_bills');
$newmenu->add("/compta/facture/index.php?leftmenu=customers_bills", $langs->trans("BillsCustomers"), 0, $user->rights->facture->lire, '', $mainmenu, 'customers_bills', 0, '', '', '', img_picto('', 'bill', 'class="paddingright pictofixedwidth"'));
$newmenu->add("/compta/facture/card.php?action=create", $langs->trans("NewBill"), 1, $user->rights->facture->creer);
$newmenu->add("/compta/facture/list.php?leftmenu=customers_bills", $langs->trans("List"), 1, $user->rights->facture->lire, '', $mainmenu, 'customers_bills_list');
@ -1041,7 +1043,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
// Suppliers invoices
if (!empty($conf->societe->enabled) && !empty($conf->supplier_invoice->enabled)) {
$langs->load("bills");
$newmenu->add("/fourn/facture/index.php?leftmenu=suppliers_bills", $langs->trans("BillsSuppliers"), 0, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills');
$newmenu->add("/fourn/facture/index.php?leftmenu=suppliers_bills", $langs->trans("BillsSuppliers"), 0, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills', 0, '', '', '', img_picto('', 'supplier_invoice', 'class="paddingright pictofixedwidth"'));
$newmenu->add("/fourn/facture/card.php?leftmenu=suppliers_bills&amp;action=create", $langs->trans("NewBill"), 1, $user->rights->fournisseur->facture->creer, '', $mainmenu, 'suppliers_bills_create');
$newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills", $langs->trans("List"), 1, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_list');
@ -1062,7 +1064,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
if (!empty($conf->commande->enabled)) {
$langs->load("orders");
if (!empty($conf->facture->enabled)) {
$newmenu->add("/commande/list.php?leftmenu=orders&amp;search_status=-3&amp;billed=0&amp;contextpage=billableorders", $langs->trans("MenuOrdersToBill2"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders');
$newmenu->add("/commande/list.php?leftmenu=orders&amp;search_status=-3&amp;billed=0&amp;contextpage=billableorders", $langs->trans("MenuOrdersToBill2"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders', 0, '', '', '', img_picto('', 'order', 'class="paddingright pictofixedwidth"'));
}
//if ($usemenuhider || empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/", $langs->trans("StatusOrderToBill"), 1, $user->rights->commande->lire);
}
@ -1071,7 +1073,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
if (!empty($conf->supplier_invoice->enabled)) {
if (!empty($conf->global->SUPPLIER_MENU_ORDER_RECEIVED_INTO_INVOICE)) {
$langs->load("supplier");
$newmenu->add("/fourn/commande/list.php?leftmenu=orders&amp;search_status=5&amp;billed=0", $langs->trans("MenuOrdersSupplierToBill"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders');
$newmenu->add("/fourn/commande/list.php?leftmenu=orders&amp;search_status=5&amp;billed=0", $langs->trans("MenuOrdersSupplierToBill"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders', 0, '', '', '', img_picto('', 'supplier_order', 'class="paddingright pictofixedwidth"'));
//if ($usemenuhider || empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/", $langs->trans("StatusOrderToBill"), 1, $user->rights->commande->lire);
}
}
@ -1080,7 +1082,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
// Donations
if (!empty($conf->don->enabled)) {
$langs->load("donations");
$newmenu->add("/don/index.php?leftmenu=donations&amp;mainmenu=billing", $langs->trans("Donations"), 0, $user->rights->don->lire, '', $mainmenu, 'donations');
$newmenu->add("/don/index.php?leftmenu=donations&amp;mainmenu=billing", $langs->trans("Donations"), 0, $user->rights->don->lire, '', $mainmenu, 'donations', 0, '', '', '', img_picto('', 'donation', 'class="paddingright pictofixedwidth"'));
if ($usemenuhider || empty($leftmenu) || $leftmenu == "donations") {
$newmenu->add("/don/card.php?leftmenu=donations&amp;action=create", $langs->trans("NewDonation"), 1, $user->rights->don->creer);
$newmenu->add("/don/list.php?leftmenu=donations", $langs->trans("List"), 1, $user->rights->don->lire);
@ -1090,7 +1092,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
// Taxes and social contributions
if (!empty($conf->tax->enabled)) {
$newmenu->add("/compta/charges/index.php?leftmenu=tax&amp;mainmenu=billing", $langs->trans("MenuTaxesAndSpecialExpenses"), 0, $user->rights->tax->charges->lire, '', $mainmenu, 'tax');
$newmenu->add("/compta/charges/index.php?leftmenu=tax&amp;mainmenu=billing", $langs->trans("MenuTaxesAndSpecialExpenses"), 0, $user->rights->tax->charges->lire, '', $mainmenu, 'tax', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"'));
$newmenu->add("/compta/sociales/list.php?leftmenu=tax_social", $langs->trans("MenuSocialContributions"), 1, $user->rights->tax->charges->lire);
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_social/i', $leftmenu)) {
@ -1106,6 +1108,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_vat/i', $leftmenu)) {
$newmenu->add("/compta/tva/card.php?leftmenu=tax_vat&action=create", $langs->trans("New"), 2, $user->rights->tax->charges->creer);
$newmenu->add("/compta/tva/list.php?leftmenu=tax_vat", $langs->trans("List"), 2, $user->rights->tax->charges->lire);
$newmenu->add("/compta/tva/payments.php?mode=tvaonly&amp;leftmenu=tax_vat", $langs->trans("Payments"), 2, $user->rights->tax->charges->lire);
$newmenu->add("/compta/tva/index.php?leftmenu=tax_vat", $langs->trans("ReportByMonth"), 2, $user->rights->tax->charges->lire);
$newmenu->add("/compta/tva/clients.php?leftmenu=tax_vat", $langs->trans("ReportByCustomers"), 2, $user->rights->tax->charges->lire);
$newmenu->add("/compta/tva/quadri_detail.php?leftmenu=tax_vat", $langs->trans("ReportByQuarter"), 2, $user->rights->tax->charges->lire);
@ -1139,7 +1142,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
// Salaries
if (!empty($conf->salaries->enabled)) {
$langs->load("salaries");
$newmenu->add("/salaries/list.php?leftmenu=tax_salary&amp;mainmenu=billing", $langs->trans("Salaries"), 0, $user->rights->salaries->read, '', $mainmenu, 'tax_salary');
$newmenu->add("/salaries/list.php?leftmenu=tax_salary&amp;mainmenu=billing", $langs->trans("Salaries"), 0, $user->rights->salaries->read, '', $mainmenu, 'tax_salary', 0, '', '', '', img_picto('', 'salary', 'class="paddingright pictofixedwidth"'));
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_salary/i', $leftmenu)) {
$newmenu->add("/salaries/card.php?leftmenu=tax_salary&action=create", $langs->trans("NewPayment"), 1, $user->rights->salaries->write);
$newmenu->add("/salaries/list.php?leftmenu=tax_salary", $langs->trans("Payments"), 1, $user->rights->salaries->read);
@ -1150,7 +1153,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
// Loan
if (!empty($conf->loan->enabled)) {
$langs->load("loan");
$newmenu->add("/loan/list.php?leftmenu=tax_loan&amp;mainmenu=billing", $langs->trans("Loans"), 0, $user->rights->loan->read, '', $mainmenu, 'tax_loan');
$newmenu->add("/loan/list.php?leftmenu=tax_loan&amp;mainmenu=billing", $langs->trans("Loans"), 0, $user->rights->loan->read, '', $mainmenu, 'tax_loan', 0, '', '', '', img_picto('', 'loan', 'class="paddingright pictofixedwidth"'));
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_loan/i', $leftmenu)) {
$newmenu->add("/loan/card.php?leftmenu=tax_loan&action=create", $langs->trans("NewLoan"), 1, $user->rights->loan->write);
//$newmenu->add("/loan/payment/list.php?leftmenu=tax_loan",$langs->trans("Payments"),2,$user->rights->loan->read);
@ -1160,7 +1163,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
// Various payment
if (!empty($conf->banque->enabled) && empty($conf->global->BANK_USE_OLD_VARIOUS_PAYMENT)) {
$langs->load("banks");
$newmenu->add("/compta/bank/various_payment/list.php?leftmenu=tax_various&amp;mainmenu=billing", $langs->trans("MenuVariousPayment"), 0, $user->rights->banque->lire, '', $mainmenu, 'tax_various');
$newmenu->add("/compta/bank/various_payment/list.php?leftmenu=tax_various&amp;mainmenu=billing", $langs->trans("MenuVariousPayment"), 0, $user->rights->banque->lire, '', $mainmenu, 'tax_various', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"'));
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_various/i', $leftmenu)) {
$newmenu->add("/compta/bank/various_payment/card.php?leftmenu=tax_various&action=create", $langs->trans("New"), 1, $user->rights->banque->modifier);
$newmenu->add("/compta/bank/various_payment/list.php?leftmenu=tax_various", $langs->trans("List"), 1, $user->rights->banque->lire);
@ -1654,7 +1657,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
if (!empty($conf->bom->enabled) || !empty($conf->mrp->enabled)) {
$langs->load("mrp");
$newmenu->add("", $langs->trans("MenuBOM"), 0, $user->rights->bom->read, '', $mainmenu, 'bom');
$newmenu->add("", $langs->trans("MenuBOM"), 0, $user->rights->bom->read, '', $mainmenu, 'bom', 0, '', '', '', img_picto('', 'bom', 'class="paddingrightonly pictofixedwidth"'));
$newmenu->add("/bom/bom_card.php?leftmenu=bom&amp;action=create", $langs->trans("NewBOM"), 1, $user->rights->bom->write, '', $mainmenu, 'bom');
$newmenu->add("/bom/bom_list.php?leftmenu=bom", $langs->trans("List"), 1, $user->rights->bom->read, '', $mainmenu, 'bom');
}
@ -1662,7 +1665,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
if (!empty($conf->mrp->enabled)) {
$langs->load("mrp");
$newmenu->add("", $langs->trans("MenuMRP"), 0, $user->rights->mrp->read, '', $mainmenu, 'mo');
$newmenu->add("", $langs->trans("MenuMRP"), 0, $user->rights->mrp->read, '', $mainmenu, 'mo', 0, '', '', '', img_picto('', 'mrp', 'class="paddingrightonly pictofixedwidth"'));
$newmenu->add("/mrp/mo_card.php?leftmenu=mo&amp;action=create", $langs->trans("NewMO"), 1, $user->rights->mrp->write, '', $mainmenu, 'mo');
$newmenu->add("/mrp/mo_list.php?leftmenu=mo", $langs->trans("List"), 1, $user->rights->mrp->read, '', $mainmenu, 'mo');
}
@ -1806,11 +1809,11 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
if ($mainmenu == 'tools') {
if (empty($user->socid)) { // limit to internal users
$langs->load("mails");
$newmenu->add("/admin/mails_templates.php?leftmenu=email_templates", $langs->trans("EMailTemplates"), 0, 1, '', $mainmenu, 'email_templates');
$newmenu->add("/admin/mails_templates.php?leftmenu=email_templates", $langs->trans("EMailTemplates"), 0, 1, '', $mainmenu, 'email_templates', 0, '', '', '', img_picto('', 'email', 'class="paddingright pictofixedwidth"'));
}
if (!empty($conf->mailing->enabled)) {
$newmenu->add("/comm/mailing/index.php?leftmenu=mailing", $langs->trans("EMailings"), 0, $user->rights->mailing->lire, '', $mainmenu, 'mailing');
$newmenu->add("/comm/mailing/index.php?leftmenu=mailing", $langs->trans("EMailings"), 0, $user->rights->mailing->lire, '', $mainmenu, 'mailing', 0, '', '', '', img_picto('', 'email', 'class="paddingright pictofixedwidth"'));
$newmenu->add("/comm/mailing/card.php?leftmenu=mailing&amp;action=create", $langs->trans("NewMailing"), 1, $user->rights->mailing->creer);
$newmenu->add("/comm/mailing/list.php?leftmenu=mailing", $langs->trans("List"), 1, $user->rights->mailing->lire);
}
@ -1837,7 +1840,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
// Load translation files required by the page
$langs->loadLangs(array("members", "compta"));
$newmenu->add("/adherents/index.php?leftmenu=members&amp;mainmenu=members", $langs->trans("Members"), 0, $user->rights->adherent->lire, '', $mainmenu, 'members');
$newmenu->add("/adherents/index.php?leftmenu=members&amp;mainmenu=members", $langs->trans("Members"), 0, $user->rights->adherent->lire, '', $mainmenu, 'members', 0, '', '', '', img_picto('', 'member', 'class="paddingright pictofixedwidth"'));
$newmenu->add("/adherents/card.php?leftmenu=members&amp;action=create", $langs->trans("NewMember"), 1, $user->rights->adherent->creer);
$newmenu->add("/adherents/list.php?leftmenu=members", $langs->trans("List"), 1, $user->rights->adherent->lire);
$newmenu->add("/adherents/list.php?leftmenu=members&amp;statut=-1", $langs->trans("MenuMembersToValidate"), 2, $user->rights->adherent->lire);
@ -1887,7 +1890,6 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
//print $paramkey;
if (!empty($conf->global->$paramkey)) {
$link = "/ftp/index.php?idmenu=".$_SESSION["idmenu"]."&numero_ftp=".$i;
$newmenu->add($link, dol_trunc($conf->global->$paramkey, 24));
}
$i++;

Some files were not shown because too many files have changed in this diff Show More