Merge github.com:Dolibarr/dolibarr into dev_objectrefferent_for_BOM
This commit is contained in:
commit
6ff58aafdc
@ -1,7 +1,7 @@
|
||||
#----------------------------------------------------------------------------
|
||||
# \file dolibarr.pl
|
||||
# \brief Dolibarr script install for Virtualmin Pro
|
||||
# \author (c)2009-2019 Regis Houssin <regis.houssin@inodbox.com>
|
||||
# \author (c)2009-2020 Regis Houssin <regis.houssin@inodbox.com>
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
|
||||
@ -30,7 +30,7 @@ return "Regis Houssin";
|
||||
# script_dolibarr_versions()
|
||||
sub script_dolibarr_versions
|
||||
{
|
||||
return ( "10.0.0", "9.0.3", "8.0.5", "7.0.5", "6.0.8" );
|
||||
return ( "12.0.3", "11.0.5", "10.0.7", "9.0.4", "8.0.6", "7.0.5" );
|
||||
}
|
||||
|
||||
sub script_dolibarr_release
|
||||
@ -77,6 +77,16 @@ if ($ver >= 3.6) {
|
||||
push(@rv, "Dolibarr requires PHP version 5.3 or later");
|
||||
}
|
||||
}
|
||||
if ($ver >= 12.0) {
|
||||
# Check for PHP 5.6+
|
||||
local $phpv = &get_php_version($phpver || 5, $d);
|
||||
if (!$phpv) {
|
||||
push(@rv, "Could not work out exact PHP version");
|
||||
}
|
||||
elsif ($phpv < 5.6) {
|
||||
push(@rv, "Dolibarr requires PHP version 5.6 or later");
|
||||
}
|
||||
}
|
||||
|
||||
return @rv;
|
||||
}
|
||||
@ -376,7 +386,7 @@ sub script_dolibarr_realversion
|
||||
local ($d, $opts, $sinfo) = @_;
|
||||
local $lref = &read_file_lines("$opts->{'dir'}/filefunc.inc.php", 1);
|
||||
foreach my $l (@$lref) {
|
||||
if ($l =~ /'DOL_VERSION','([0-9a-z\.\-]+)'/) {
|
||||
if ($l =~ /'DOL_VERSION',\s?'([0-9a-z\.\-]+)'/) {
|
||||
return $1;
|
||||
}
|
||||
}
|
||||
@ -390,6 +400,8 @@ sub script_dolibarr_check_latest
|
||||
{
|
||||
local ($ver) = @_;
|
||||
local @vers = &osdn_package_versions("dolibarr",
|
||||
$ver >= 12.0 ? "dolibarr\\-(12\\.0\\.[0-9\\.]+)\\.tgz" :
|
||||
$ver >= 11.0 ? "dolibarr\\-(11\\.0\\.[0-9\\.]+)\\.tgz" :
|
||||
$ver >= 10.0 ? "dolibarr\\-(10\\.0\\.[0-9\\.]+)\\.tgz" :
|
||||
$ver >= 9.0 ? "dolibarr\\-(9\\.0\\.[0-9\\.]+)\\.tgz" :
|
||||
$ver >= 8.0 ? "dolibarr\\-(8\\.0\\.[0-9\\.]+)\\.tgz" :
|
||||
@ -410,7 +422,7 @@ return $ver eq $vers[0] ? undef : $vers[0];
|
||||
|
||||
sub script_dolibarr_site
|
||||
{
|
||||
return 'http://www.dolibarr.org/';
|
||||
return 'https://www.dolibarr.org/';
|
||||
}
|
||||
|
||||
sub script_dolibarr_passmode
|
||||
|
||||
@ -49,7 +49,7 @@ llxHeader();
|
||||
|
||||
print load_fiche_titre($langs->trans("PerfDolibarr"), '', 'title_setup');
|
||||
|
||||
print $langs->trans("YouMayFindPerfAdviceHere", 'https://wiki.dolibarr.org/index.php/FAQ_Increase_Performance').' (<a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("Reload").'</a>)<br>';
|
||||
print '<span class="opacitymedium">'.$langs->trans("YouMayFindPerfAdviceHere", 'https://wiki.dolibarr.org/index.php/FAQ_Increase_Performance').'</span> (<a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("Reload").'</a>)<br>';
|
||||
|
||||
// Recupere la version de PHP
|
||||
$phpversion = version_php();
|
||||
|
||||
143
htdocs/admin/system/security.php
Normal file
143
htdocs/admin/system/security.php
Normal file
@ -0,0 +1,143 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2019 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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/admin/system/security.php
|
||||
* \brief Page to show Security information
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("install", "other", "admin"));
|
||||
|
||||
if (!$user->admin)
|
||||
accessforbidden();
|
||||
|
||||
if (GETPOST('action', 'aZ09') == 'donothing')
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
$nowstring = dol_print_date(dol_now(), 'dayhourlog');
|
||||
|
||||
llxHeader();
|
||||
|
||||
print load_fiche_titre($langs->trans("Security"), '', 'title_setup');
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("YouMayFindSecurityAdviceHere", 'hhttps://wiki.dolibarr.org/index.php/Security_information').'</span> (<a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("Reload").'</a>)<br>';
|
||||
|
||||
// Recupere la version de PHP
|
||||
$phpversion = version_php();
|
||||
print "<br><strong>PHP</strong> - ".$langs->trans("Version").": ".$phpversion."<br>\n";
|
||||
|
||||
// Recupere la version du serveur web
|
||||
print "<br><strong>Web server</strong> - ".$langs->trans("Version").": ".$_SERVER["SERVER_SOFTWARE"]."<br>\n";
|
||||
print '<br>';
|
||||
|
||||
|
||||
print load_fiche_titre($langs->trans("ConfigFile"), '', '');
|
||||
|
||||
print '<strong>'.$langs->trans("dolibarr_main_prod").'</strong>: '.$dolibarr_main_prod;
|
||||
// dolibarr_main_prod
|
||||
|
||||
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
print load_fiche_titre($langs->trans("PermissionsOnFiles"), '', '');
|
||||
|
||||
print '<strong>'.$langs->trans("PermissionOnFileInWebRoot").'</strong>: ';
|
||||
// TODO
|
||||
|
||||
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
|
||||
print load_fiche_titre($langs->trans("Modules"), '', '');
|
||||
|
||||
// XDebug
|
||||
print '<strong>'.$langs->trans("XDebug").'</strong>: ';
|
||||
$test = !function_exists('xdebug_is_enabled');
|
||||
if ($test) print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled");
|
||||
else {
|
||||
print img_picto('', 'warning').' '.$langs->trans("ModuleActivatedMayExposeInformation", $langs->transnoentities("XDebug"));
|
||||
print ' - '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xdebug.php">XDebug admin page</a>';
|
||||
}
|
||||
print '<br>';
|
||||
|
||||
// Module log
|
||||
print '<br>';
|
||||
print '<strong>'.$langs->trans("Syslog").'</strong>: ';
|
||||
$test = empty($conf->syslog->enabled);
|
||||
if ($test) print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled");
|
||||
else {
|
||||
print img_picto('', 'warning').' '.$langs->trans("ModuleActivatedMayExposeInformation", $langs->transnoentities("Syslog"));
|
||||
//print ' '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xdebug.php'.'">XDebug admin page</a>';
|
||||
}
|
||||
print '<br>';
|
||||
|
||||
// Module debugbar
|
||||
print '<br>';
|
||||
print '<strong>'.$langs->trans("DebugBar").'</strong>: ';
|
||||
$test = empty($conf->debugbar->enabled);
|
||||
if ($test) print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled");
|
||||
else {
|
||||
print img_picto('', 'error').' '.$langs->trans("ModuleActivatedDoNotUseInProduction", $langs->transnoentities("DebugBar"));
|
||||
//print ' '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xdebug.php'.'">XDebug admin page</a>';
|
||||
}
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
print load_fiche_titre($langs->trans("SecuritySetup"), '', '');
|
||||
|
||||
//print '<strong>'.$langs->trans("PasswordEncryption").'</strong>: ';
|
||||
print '<strong>MAIN_SECURITY_HASH_ALGO</strong> = '.$conf->global->MAIN_SECURITY_HASH_ALGO." (Recommanded value: 'password_hash')<br>";
|
||||
print '<strong>MAIN_SECURITY_SALT</strong> = '.$conf->global->MAIN_SECURITY_SALT.'<br>';
|
||||
print '<br>';
|
||||
// TODO
|
||||
|
||||
print '<strong>'.$langs->trans("AntivirusEnabledOnUpload").'</strong>: ';
|
||||
// TODO
|
||||
print '<br>';
|
||||
|
||||
print '<strong>'.$langs->trans("SecurityAudit").'</strong>: ';
|
||||
// TODO Disabled or enabled ?
|
||||
print '<br>';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
@ -1068,12 +1068,14 @@ if ($action == 'create')
|
||||
// Location
|
||||
if (empty($conf->global->AGENDA_DISABLE_LOCATION))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Location").'</td><td colspan="3"><input type="text" name="location" class="minwidth300" value="'.(GETPOST('location') ? GETPOST('location') : $object->location).'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Location").'</td><td><input type="text" name="location" class="minwidth300 maxwidth150onsmartphone" value="'.(GETPOST('location') ? GETPOST('location') : $object->location).'"></td></tr>';
|
||||
}
|
||||
|
||||
// Assigned to
|
||||
print '<tr><td class="tdtop nowrap">'.$langs->trans("ActionAffectedTo").'</td><td>';
|
||||
$listofuserid = array();
|
||||
$listofcontactid = array();
|
||||
$listofotherid = array();
|
||||
if (empty($donotclearsession))
|
||||
{
|
||||
$assignedtouser = GETPOST("assignedtouser") ?GETPOST("assignedtouser") : (!empty($object->userownerid) && $object->userownerid > 0 ? $object->userownerid : $user->id);
|
||||
@ -1090,12 +1092,6 @@ if ($action == 'create')
|
||||
print '<div class="assignedtouser">';
|
||||
print $form->select_dolusers_forevent(($action == 'create' ? 'add' : 'update'), 'assignedtouser', 1, '', 0, '', '', 0, 0, 0, 'AND u.statut != 0', 1, $listofuserid, $listofcontactid, $listofotherid);
|
||||
print '</div>';
|
||||
/*if (in_array($user->id,array_keys($listofuserid)))
|
||||
{
|
||||
print '<div class="myavailability">';
|
||||
print $langs->trans("MyAvailability").': <input id="transparency" type="checkbox" name="transparency"'.(((! isset($_GET['transparency']) && ! isset($_POST['transparency'])) || GETPOST('transparency'))?' checked':'').'> '.$langs->trans("Busy");
|
||||
print '</div>';
|
||||
}*/
|
||||
print '</td></tr>';
|
||||
|
||||
// Done by
|
||||
@ -1108,9 +1104,9 @@ if ($action == 'create')
|
||||
|
||||
if ($conf->categorie->enabled) {
|
||||
// Categories
|
||||
print '<tr><td>'.$langs->trans("Categories").'</td><td colspan="3">';
|
||||
print '<tr><td>'.$langs->trans("Categories").'</td><td>';
|
||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_ACTIONCOMM, '', 'parent', 64, 0, 1);
|
||||
print $form->multiselectarray('categories', $cate_arbo, GETPOST('categories', 'array'), '', 0, '', 0, '100%');
|
||||
print $form->multiselectarray('categories', $cate_arbo, GETPOST('categories', 'array'), '', 0, 'minwidth300 quatrevingtpercent', 0, 0);
|
||||
print "</td></tr>";
|
||||
}
|
||||
|
||||
@ -1148,7 +1144,8 @@ if ($action == 'create')
|
||||
print '<tr><td class="nowrap">'.$langs->trans("ActionOnContact").'</td><td>';
|
||||
$preselectedids = GETPOST('socpeopleassigned', 'array');
|
||||
if (GETPOST('contactid', 'int')) $preselectedids[GETPOST('contactid', 'int')] = GETPOST('contactid', 'int');
|
||||
print img_picto('', 'contact', 'class="paddingrightonly"').$form->selectcontacts(GETPOST('socid', 'int'), $preselectedids, 'socpeopleassigned[]', 1, '', '', 0, 'quatrevingtpercent', false, 0, array(), false, 'multiple', 'contactid');
|
||||
print img_picto('', 'contact', 'class="paddingrightonly"');
|
||||
print $form->selectcontacts(GETPOST('socid', 'int'), $preselectedids, 'socpeopleassigned[]', 1, '', '', 0, 'minwidth300 quatrevingtpercent', false, 0, array(), false, 'multiple', 'contactid');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -1161,7 +1158,7 @@ if ($action == 'create')
|
||||
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("Project").'</td><td id="project-input-container" >';
|
||||
print img_picto('', 'project', 'class="paddingrightonly"');
|
||||
$numproject = $formproject->select_projects((!empty($societe->id) ? $societe->id : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 0, 0, 'maxwidth500');
|
||||
$numproject = $formproject->select_projects((!empty($societe->id) ? $societe->id : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 0, 0, 'maxwidth500 widthcentpercentminusxx');
|
||||
|
||||
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$societe->id.'&action=create"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddProject").'"></span></a>';
|
||||
$urloption = '?action=create&donotclearsession=1';
|
||||
|
||||
@ -360,7 +360,9 @@ if (empty($action) || $action == 'show_month')
|
||||
$nav .= " <span id=\"month_name\">".dol_print_date(dol_mktime(0, 0, 0, $month, 1, $year), "%b %Y");
|
||||
$nav .= " </span>\n";
|
||||
$nav .= " <a href=\"?year=".$next_year."&month=".$next_month.$param."\"><i class=\"fa fa-chevron-right\"></i></a>\n";
|
||||
$nav .= " <a href=\"?year=".$nowyear."&month=".$nowmonth.$param."\">".$langs->trans("Today")."</a> ";
|
||||
if (empty($conf->dol_optimize_smallscreen)) {
|
||||
$nav .= " <a href=\"?year=".$nowyear."&month=".$nowmonth.$param."\">".$langs->trans("Today")."</a> ";
|
||||
}
|
||||
$picto = 'calendar';
|
||||
}
|
||||
if ($action == 'show_week')
|
||||
@ -369,7 +371,9 @@ if ($action == 'show_week')
|
||||
$nav .= " <span id=\"month_name\">".dol_print_date(dol_mktime(0, 0, 0, $first_month, $first_day, $first_year), "%Y").", ".$langs->trans("Week")." ".$week;
|
||||
$nav .= " </span>\n";
|
||||
$nav .= " <a href=\"?year=".$next_year."&month=".$next_month."&day=".$next_day.$param."\"><i class=\"fa fa-chevron-right\" title=\"".dol_escape_htmltag($langs->trans("Next"))."\"></i></a>\n";
|
||||
$nav .= " <a href=\"?year=".$nowyear."&month=".$nowmonth."&day=".$nowday.$param."\">".$langs->trans("Today")."</a> ";
|
||||
if (empty($conf->dol_optimize_smallscreen)) {
|
||||
$nav .= " <a href=\"?year=".$nowyear."&month=".$nowmonth."&day=".$nowday.$param."\">".$langs->trans("Today")."</a> ";
|
||||
}
|
||||
$picto = 'calendarweek';
|
||||
}
|
||||
if ($action == 'show_day')
|
||||
@ -378,7 +382,9 @@ if ($action == 'show_day')
|
||||
$nav .= " <span id=\"month_name\">".dol_print_date(dol_mktime(0, 0, 0, $month, $day, $year), "daytextshort");
|
||||
$nav .= " </span>\n";
|
||||
$nav .= " <a href=\"?year=".$next_year."&month=".$next_month."&day=".$next_day.$param."\"><i class=\"fa fa-chevron-right\"></i></a>\n";
|
||||
$nav .= " <a href=\"?year=".$nowyear."&month=".$nowmonth."&day=".$nowday.$param."\">".$langs->trans("Today")."</a> ";
|
||||
if (empty($conf->dol_optimize_smallscreen)) {
|
||||
$nav .= " <a href=\"?year=".$nowyear."&month=".$nowmonth."&day=".$nowday.$param."\">".$langs->trans("Today")."</a> ";
|
||||
}
|
||||
$picto = 'calendarday';
|
||||
}
|
||||
|
||||
|
||||
@ -274,34 +274,17 @@ $lastdaytoshow = dol_time_plus_duree($firstdaytoshow, 7, 'd');
|
||||
$max_day_in_month = date("t", dol_mktime(0, 0, 0, $month, 1, $year));
|
||||
|
||||
$tmpday = $first_day;
|
||||
$picto = 'calendartype';
|
||||
$picto = 'calendarweek';
|
||||
|
||||
$nav = "<a href=\"?year=".$prev_year."&month=".$prev_month."&day=".$prev_day.$param."\">".img_previous($langs->trans("Previous"))."</a>\n";
|
||||
$nav .= " <span id=\"month_name\">".dol_print_date(dol_mktime(0, 0, 0, $first_month, $first_day, $first_year), "%Y")."</span> \n";
|
||||
$nav .= "<a href=\"?year=".$next_year."&month=".$next_month."&day=".$next_day.$param."\">".img_next($langs->trans("Next"))."</a>\n";
|
||||
$nav .= " (<a href=\"?year=".$nowyear."&month=".$nowmonth."&day=".$nowday.$param."\">".$langs->trans("Today")."</a>)";
|
||||
$picto = 'calendarweek';
|
||||
if (empty($conf->dol_optimize_smallscreen)) {
|
||||
$nav .= " (<a href=\"?year=".$nowyear."&month=".$nowmonth."&day=".$nowday.$param."\">".$langs->trans("Today")."</a>)";
|
||||
}
|
||||
|
||||
/*$nav .= ' <form name="dateselect" action="'.$_SERVER["PHP_SELF"].'?action=show_peruser'.$param.'">';
|
||||
$nav .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$nav .= '<input type="hidden" name="action" value="'.$action.'">';
|
||||
$nav .= '<input type="hidden" name="filtert" value="'.$filtert.'">';
|
||||
$nav .= '<input type="hidden" name="usergroup" value="'.$usergroup.'">';
|
||||
$nav .= '<input type="hidden" name="actioncode" value="'.$actioncode.'">';
|
||||
$nav .= '<input type="hidden" name="resourceid" value="'.$resourceid.'">';
|
||||
$nav .= '<input type="hidden" name="status" value="'.$status.'">';
|
||||
$nav .= '<input type="hidden" name="socid" value="'.$socid.'">';
|
||||
$nav .= '<input type="hidden" name="projectid" value="'.$projectid.'">';
|
||||
$nav .= '<input type="hidden" name="begin_h" value="'.$begin_h.'">';
|
||||
$nav .= '<input type="hidden" name="end_h" value="'.$end_h.'">';
|
||||
$nav .= '<input type="hidden" name="begin_d" value="'.$begin_d.'">';
|
||||
$nav .= '<input type="hidden" name="end_d" value="'.$end_d.'">';
|
||||
$nav .= '<input type="hidden" name="showbirthday" value="'.$showbirthday.'">';
|
||||
*/
|
||||
$nav .= $form->selectDate($dateselect, 'dateselect', 0, 0, 1, '', 1, 0);
|
||||
//$nav .= ' <input type="submit" name="submitdateselect" class="button" value="'.$langs->trans("Refresh").'">';
|
||||
$nav .= ' <button type="submit" class="liste_titre button_search" name="button_search_x" value="x"><span class="fa fa-search"></span></button>';
|
||||
//$nav .= '</form>';
|
||||
|
||||
// Must be after the nav definition
|
||||
$param .= '&year='.urlencode($year).'&month='.urlencode($month).($day ? '&day='.urlencode($day) : '');
|
||||
|
||||
@ -285,28 +285,11 @@ $nav = "<a href=\"?year=".$prev_year."&month=".$prev_month."&day=".$prev
|
||||
$nav .= " <span id=\"month_name\">".dol_print_date(dol_mktime(0, 0, 0, $first_month, $first_day, $first_year), "%Y").", ".$langs->trans("Week")." ".$week;
|
||||
$nav .= " </span>\n";
|
||||
$nav .= " <a href=\"?year=".$next_year."&month=".$next_month."&day=".$next_day.$param."\"><i class=\"fa fa-chevron-right\" title=\"".dol_escape_htmltag($langs->trans("Next"))."\"></i></a>\n";
|
||||
$nav .= " <a href=\"?year=".$nowyear."&month=".$nowmonth."&day=".$nowday.$param."\">".$langs->trans("Today")."</a> ";
|
||||
|
||||
/*$nav.=' <form name="dateselect" action="'.$_SERVER["PHP_SELF"].'?action=show_peruser'.$param.'">';
|
||||
$nav.='<input type="hidden" name="token" value="' . newToken() . '">';
|
||||
$nav.='<input type="hidden" name="action" value="' . $action . '">';
|
||||
$nav.='<input type="hidden" name="filtert" value="' . $filtert . '">';
|
||||
$nav.='<input type="hidden" name="usergroup" value="' . $usergroup . '">';
|
||||
$nav.='<input type="hidden" name="actioncode" value="' . $actioncode . '">';
|
||||
$nav.='<input type="hidden" name="resourceid" value="' . $resourceid . '">';
|
||||
$nav.='<input type="hidden" name="status" value="' . $status . '">';
|
||||
$nav.='<input type="hidden" name="socid" value="' . $socid . '">';
|
||||
$nav.='<input type="hidden" name="projectid" value="' . $projectid . '">';
|
||||
$nav.='<input type="hidden" name="begin_h" value="' . $begin_h . '">';
|
||||
$nav.='<input type="hidden" name="end_h" value="' . $end_h . '">';
|
||||
$nav.='<input type="hidden" name="begin_d" value="' . $begin_d . '">';
|
||||
$nav.='<input type="hidden" name="end_d" value="' . $end_d . '">';
|
||||
$nav.='<input type="hidden" name="showbirthday" value="' . $showbirthday . '">';
|
||||
*/
|
||||
if (empty($conf->dol_optimize_smallscreen)) {
|
||||
$nav .= " <a href=\"?year=".$nowyear."&month=".$nowmonth."&day=".$nowday.$param."\">".$langs->trans("Today")."</a> ";
|
||||
}
|
||||
$nav .= $form->selectDate($dateselect, 'dateselect', 0, 0, 1, '', 1, 0);
|
||||
//$nav .= ' <input type="submit" name="submitdateselect" class="button" value="'.$langs->trans("Refresh").'">';
|
||||
$nav .= ' <button type="submit" class="liste_titre button_search" name="button_search_x" value="x"><span class="fa fa-search"></span></button>';
|
||||
//$nav.='</form>';
|
||||
|
||||
// Must be after the nav definition
|
||||
$param .= '&year='.urlencode($year).'&month='.urlencode($month).($day ? '&day='.urlencode($day) : '');
|
||||
|
||||
@ -3153,7 +3153,7 @@ class Propal extends CommonObject
|
||||
$sql .= " c.datec, c.date_valid as datev, c.date_cloture as dateo,";
|
||||
$sql .= " c.fk_user_author, c.fk_user_valid, c.fk_user_cloture";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."propal as c";
|
||||
$sql .= " WHERE c.rowid = ".$id;
|
||||
$sql .= " WHERE c.rowid = ".((int) $id);
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
|
||||
@ -98,7 +98,7 @@ class RemiseCheque extends CommonObject
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."bordereau_cheque as bc";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON bc.fk_bank_account = ba.rowid";
|
||||
$sql .= " WHERE bc.entity = ".$conf->entity;
|
||||
if ($id) $sql .= " AND bc.rowid = ".$id;
|
||||
if ($id) $sql .= " AND bc.rowid = ".((int) $id);
|
||||
if ($ref) $sql .= " AND bc.ref = '".$this->db->escape($ref)."'";
|
||||
|
||||
dol_syslog("RemiseCheque::fetch", LOG_DEBUG);
|
||||
|
||||
@ -99,6 +99,7 @@ $sql .= $db->plimit($max);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
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 centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th>'.$langs->trans("LastCheckReceiptShort", $max).'</th>';
|
||||
@ -126,9 +127,9 @@ if ($resql)
|
||||
|
||||
print '<tr class="oddeven">'."\n";
|
||||
|
||||
print '<td>'.$checkdepositstatic->getNomUrl(1).'</td>';
|
||||
print '<td class="nowraponall">'.$checkdepositstatic->getNomUrl(1).'</td>';
|
||||
print '<td>'.dol_print_date($db->jdate($objp->db), 'day').'</td>';
|
||||
print '<td>'.$accountstatic->getNomUrl(1).'</td>';
|
||||
print '<td class="nowraponall">'.$accountstatic->getNomUrl(1).'</td>';
|
||||
print '<td class="right">'.$objp->nbcheque.'</td>';
|
||||
print '<td class="right">'.price($objp->amount).'</td>';
|
||||
print '<td class="right">'.$checkdepositstatic->LibStatut($objp->statut, 3).'</td>';
|
||||
@ -136,6 +137,7 @@ if ($resql)
|
||||
print '</tr>';
|
||||
}
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
$db->free($resql);
|
||||
} else {
|
||||
|
||||
@ -4,7 +4,8 @@
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2016 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2020 Pierre Ardoin <mapiolca@me.com>
|
||||
*
|
||||
* Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com>
|
||||
|
||||
* 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
|
||||
@ -20,12 +21,18 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/compta/sociales/list.php
|
||||
* \ingroup tax
|
||||
* \brief Page to list all social contributions
|
||||
* \file htdocs/compta/sociales/list.php
|
||||
* \ingroup tax
|
||||
* \brief Page to list all social contributions
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
|
||||
// Security check
|
||||
$socid = isset($_GET["socid"]) ? $_GET["socid"] : '';
|
||||
if ($user->socid) $socid = $user->socid;
|
||||
$result = restrictedArea($user, 'tax', '', '', 'charges');
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsocialcontrib.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
@ -35,36 +42,32 @@ if (!empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/clas
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('compta', 'banks', 'bills'));
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$massaction = GETPOST('massaction', 'alpha');
|
||||
$show_files = GETPOST('show_files', 'int');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'sclist';
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$massaction = GETPOST('massaction', 'alpha');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'sclist';
|
||||
|
||||
// Security check
|
||||
$socid = isset($_GET["socid"]) ? $_GET["socid"] : '';
|
||||
if ($user->socid) $socid = $user->socid;
|
||||
$result = restrictedArea($user, 'tax', '', '', 'charges');
|
||||
|
||||
$search_ref = GETPOST('search_ref', 'int');
|
||||
$search_label = GETPOST('search_label', 'alpha');
|
||||
$search_amount = GETPOST('search_amount', 'alpha');
|
||||
$search_status = GETPOST('search_status', 'int');
|
||||
$search_ref = GETPOST('search_ref', 'int');
|
||||
$search_label = GETPOST('search_label', 'alpha');
|
||||
$search_amount = GETPOST('search_amount', 'alpha');
|
||||
$search_status = GETPOST('search_status', 'int');
|
||||
$search_day_lim = GETPOST('search_day_lim', 'int');
|
||||
$search_month_lim = GETPOST('search_month_lim', 'int');
|
||||
$search_month_lim = GETPOST('search_month_lim', 'int');
|
||||
$search_year_lim = GETPOST('search_year_lim', 'int');
|
||||
$search_project_ref = GETPOST('search_project_ref', 'alpha');
|
||||
$search_project = GETPOST('search_project', 'alpha');
|
||||
$search_project_ref = GETPOST('search_project_ref', 'alpha');
|
||||
$search_project = GETPOST('search_project', 'alpha');
|
||||
|
||||
$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
|
||||
$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 = "cs.date_ech";
|
||||
if (!$sortorder) $sortorder = "DESC";
|
||||
|
||||
@ -84,23 +87,50 @@ if (!GETPOSTISSET('search_typeid'))
|
||||
$search_typeid = GETPOST('search_typeid', 'int');
|
||||
}
|
||||
|
||||
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_ref = "";
|
||||
$search_label = "";
|
||||
$search_amount = "";
|
||||
$search_status = '';
|
||||
$search_typeid = "";
|
||||
$year = "";
|
||||
$search_day_lim = '';
|
||||
$search_year_lim = '';
|
||||
$search_month_lim = '';
|
||||
$search_project_ref = '';
|
||||
$search_project = '';
|
||||
$toselect = '';
|
||||
$search_array_options = array();
|
||||
}
|
||||
$arrayfields = array(
|
||||
'cs.rowid' =>array('label'=>"Ref", 'checked'=>1, 'position'=>10),
|
||||
'cs.libelle' =>array('label'=>"Label", 'checked'=>1, 'position'=>20),
|
||||
'cs.fk_type' =>array('label'=>"Type", 'checked'=>1, 'position'=>30),
|
||||
'p.ref' =>array('label'=>"ProjectRef", 'checked'=>1, 'position'=>40, 'enable'=>(!empty($conf->projet->enabled))),
|
||||
'cs.date_ech' =>array('label'=>"Date", 'checked'=>1, 'position'=>50),
|
||||
'cs.periode' =>array('label'=>"PeriodEndDate", 'checked'=>1, 'position'=>60),
|
||||
'cs.amount' =>array('label'=>"Amount", 'checked'=>1, 'position'=>70),
|
||||
'cs.paye' =>array('label'=>"Status", 'checked'=>1, 'position'=>80),
|
||||
);
|
||||
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('sclist'));
|
||||
$object = new ChargeSociales($db);
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
$parameters = array('socid'=>$socid);
|
||||
$reshook = $hookmanager->executeHooks('doActions', $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)) {
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
|
||||
// All tests are required to be compatible with all browsers
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
|
||||
$search_ref = '';
|
||||
$search_label = '';
|
||||
$search_amount = '';
|
||||
$search_status = '';
|
||||
$search_typeid = '';
|
||||
$year = '';
|
||||
$search_day_lim = '';
|
||||
$search_year_lim = '';
|
||||
$search_month_lim = '';
|
||||
$search_project_ref = '';
|
||||
$search_project = '';
|
||||
$search_array_options = array();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* View
|
||||
@ -114,8 +144,8 @@ if (!empty($conf->projet->enabled)) $projectstatic = new Project($db);
|
||||
|
||||
llxHeader('', $langs->trans("SocialContributions"));
|
||||
|
||||
$sql = "SELECT cs.rowid as id, cs.fk_type as type, ";
|
||||
$sql .= " cs.amount, cs.date_ech, cs.libelle as label, cs.paye, cs.periode,";
|
||||
$sql = "SELECT cs.rowid, cs.fk_type as type, ";
|
||||
$sql .= " cs.amount, cs.date_ech, cs.libelle, 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,";
|
||||
$sql .= " SUM(pc.amount) as alreadypayed";
|
||||
@ -135,19 +165,19 @@ $sql .= dolSqlDateFilter("cs.periode", $search_day_lim, $search_month_lim, $sear
|
||||
//$sql.= dolSqlDateFilter("cs.periode", 0, 0, $year);
|
||||
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 .= " (cs.periode IS NOT NULL AND date_format(cs.periode, '%Y') = '".$db->escape($year)."') ";
|
||||
$sql .= "OR (cs.periode IS NULL AND date_format(cs.date_ech, '%Y') = '".$db->escape($year)."')";
|
||||
$sql .= ")";
|
||||
$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 .= " (cs.periode IS NOT NULL AND date_format(cs.periode, '%Y') = '".$db->escape($year)."') ";
|
||||
$sql .= "OR (cs.periode IS NULL AND date_format(cs.date_ech, '%Y') = '".$db->escape($year)."')";
|
||||
$sql .= ")";
|
||||
}
|
||||
if ($filtre) {
|
||||
$filtre = str_replace(":", "=", $filtre);
|
||||
$sql .= " AND ".$filtre;
|
||||
$filtre = str_replace(":", "=", $filtre);
|
||||
$sql .= " AND ".$filtre;
|
||||
}
|
||||
if ($search_typeid) {
|
||||
$sql .= " AND cs.fk_type=".$db->escape($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";
|
||||
if (!empty($conf->projet->enabled)) $sql .= ", p.rowid, p.ref, p.title";
|
||||
@ -157,193 +187,275 @@ $totalnboflines = 0;
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$totalnboflines = $db->num_rows($result);
|
||||
$totalnboflines = $db->num_rows($result);
|
||||
}
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
if (!$resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
$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_ref) $param .= '&search_ref='.urlencode($search_ref);
|
||||
if ($search_label) $param .= '&search_label='.urlencode($search_label);
|
||||
if ($search_project_ref >= 0) $param .= "&search_project_ref=".urlencode($search_project_ref);
|
||||
if ($search_amount) $param .= '&search_amount='.urlencode($search_amount);
|
||||
if ($search_typeid) $param .= '&search_typeid='.urlencode($search_typeid);
|
||||
if ($search_status != '' && $search_status != '-1') $param .= '&search_status='.urlencode($search_status);
|
||||
if ($year) $param .= '&year='.urlencode($year);
|
||||
|
||||
$newcardbutton = '';
|
||||
if ($user->rights->tax->charges->creer)
|
||||
{
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('MenuNewSocialContribution'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/sociales/card.php?action=create');
|
||||
}
|
||||
|
||||
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="action" value="list">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="search_status" value="'.$search_status.'">';
|
||||
|
||||
$center = '';
|
||||
if ($year)
|
||||
{
|
||||
$center = ($year ? "<a href='list.php?year=".($year - 1)."'>".img_previous()."</a> ".$langs->trans("Year")." $year <a href='list.php?year=".($year + 1)."'>".img_next()."</a>" : "");
|
||||
}
|
||||
|
||||
print_barre_liste($langs->trans("SocialContributions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $totalnboflines, 'bill', 0, $newcardbutton, '', $limit, 0, 0, 1);
|
||||
|
||||
if (empty($mysoc->country_id) && empty($mysoc->country_code))
|
||||
{
|
||||
print '<div class="error">';
|
||||
$langs->load("errors");
|
||||
$countrynotdefined = $langs->trans("ErrorSetACountryFirst");
|
||||
print $countrynotdefined;
|
||||
print '</div>';
|
||||
} else {
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
|
||||
|
||||
print '<tr class="liste_titre_filter">';
|
||||
// Ref
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat maxwidth75" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
|
||||
print '</td>';
|
||||
// Label
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="search_label" value="'.dol_escape_htmltag($search_label).'"></td>';
|
||||
// Type
|
||||
print '<td class="liste_titre" align="left">';
|
||||
$formsocialcontrib->select_type_socialcontrib($search_typeid, 'search_typeid', 1, 0, 0, 'maxwidth100onsmartphone', 1);
|
||||
print '</td>';
|
||||
// Ref Project
|
||||
if (!empty($conf->projet->enabled)) print '<td class="liste_titre"><input type="text" class="flat" size="6" name="search_project_ref" value="'.$search_project_ref.'"></td>';
|
||||
// Date
|
||||
print '<td class="liste_titre"> </td>';
|
||||
// Period end date
|
||||
print '<td class="liste_titre center">';
|
||||
if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_day_lim" value="'.dol_escape_htmltag($search_day_lim).'">';
|
||||
print '<input class="flat valignmiddle width25" type="text" size="1" maxlength="2" name="search_month_lim" value="'.dol_escape_htmltag($search_month_lim).'">';
|
||||
$formother->select_year($search_year_lim ? $search_year_lim : -1, 'search_year_lim', 1, 20, 5, 0, 0, '', 'widthauto valignmiddle');
|
||||
print '</td>';
|
||||
// Amount
|
||||
print '<td class="liste_titre right">';
|
||||
print '<input class="flat maxwidth75" type="text" name="search_amount" value="'.dol_escape_htmltag($search_amount).'">';
|
||||
print '</td>';
|
||||
// Status
|
||||
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>';
|
||||
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
$searchpicto = $form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "id", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "cs.libelle", "", $param, 'class="left"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "type", "", $param, 'class="left"', $sortfield, $sortorder);
|
||||
if (!empty($conf->projet->enabled)) print_liste_field_titre('ProjectRef', $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "cs.date_ech", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("PeriodEndDate", $_SERVER["PHP_SELF"], "periode", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "cs.amount", "", $param, 'class="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "cs.paye", "", $param, 'class="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
$i = 0;
|
||||
$totalarray = array();
|
||||
while ($i < min($num, $limit))
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$chargesociale_static->id = $obj->id;
|
||||
$chargesociale_static->ref = $obj->id;
|
||||
$chargesociale_static->label = $obj->label;
|
||||
$chargesociale_static->type_label = $obj->type_label;
|
||||
if (!empty($conf->projet->enabled)) {
|
||||
$projectstatic->id = $obj->project_id;
|
||||
$projectstatic->ref = $obj->project_ref;
|
||||
$projectstatic->title = $obj->project_label;
|
||||
}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Ref
|
||||
print "<td>".$chargesociale_static->getNomUrl(1, '20')."</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
|
||||
// Label
|
||||
print "<td>".dol_trunc($obj->label, 42)."</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
|
||||
// Type
|
||||
print "<td>".$obj->type_label."</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
|
||||
// Project Ref
|
||||
if (!empty($conf->projet->enabled)) {
|
||||
print '<td class="nowrap">';
|
||||
if ($obj->project_id > 0)
|
||||
{
|
||||
print $projectstatic->getNomUrl(1);
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Date
|
||||
print '<td width="110" align="center">'.dol_print_date($db->jdate($obj->date_ech), 'day').'</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
|
||||
// Date end period
|
||||
print '<td class="center">';
|
||||
if ($obj->periode)
|
||||
{
|
||||
print '<a href="list.php?year='.strftime("%Y", $db->jdate($obj->periode)).'">'.dol_print_date($db->jdate($obj->periode), 'day').'</a>';
|
||||
} else {
|
||||
print ' ';
|
||||
}
|
||||
print "</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
|
||||
// Amount
|
||||
print '<td class="nowrap right">'.price($obj->amount).'</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'totalttcfield';
|
||||
$totalarray['val']['totalttcfield'] += $obj->amount;
|
||||
|
||||
print '<td class="nowrap right">'.$chargesociale_static->LibStatut($obj->paye, 5, $obj->alreadypayed).'</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
|
||||
print '<td></td>';
|
||||
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
|
||||
// Show total line
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
}
|
||||
print '</form>';
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
llxFooter();
|
||||
$db->close();
|
||||
exit;
|
||||
}
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
$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_ref) $param .= '&search_ref='.urlencode($search_ref);
|
||||
if ($search_label) $param .= '&search_label='.urlencode($search_label);
|
||||
if ($search_project_ref >= 0) $param .= "&search_project_ref=".urlencode($search_project_ref);
|
||||
if ($search_amount) $param .= '&search_amount='.urlencode($search_amount);
|
||||
if ($search_typeid) $param .= '&search_typeid='.urlencode($search_typeid);
|
||||
if ($search_status != '' && $search_status != '-1') $param .= '&search_status='.urlencode($search_status);
|
||||
if ($year) $param .= '&year='.urlencode($year);
|
||||
|
||||
$newcardbutton = '';
|
||||
if ($user->rights->tax->charges->creer)
|
||||
{
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('MenuNewSocialContribution'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/sociales/card.php?action=create');
|
||||
}
|
||||
|
||||
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="action" value="list">';
|
||||
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="search_status" value="'.$search_status.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
|
||||
$center = '';
|
||||
if ($year)
|
||||
{
|
||||
$center = '<a href="list.php?year='.($year - 1).'">'.img_previous().'</a>';
|
||||
$center .= ' '.$langs->trans("Year").' '.$year;
|
||||
$center .= ' <a href="list.php?year='.($year + 1).'">'.img_next().'</a>';
|
||||
}
|
||||
|
||||
print_barre_liste($langs->trans("SocialContributions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $totalnboflines, 'bill', 0, $newcardbutton, '', $limit, 0, 0, 1);
|
||||
|
||||
if (empty($mysoc->country_id) && empty($mysoc->country_code))
|
||||
{
|
||||
print '<div class="error">';
|
||||
$langs->load("errors");
|
||||
$countrynotdefined = $langs->trans("ErrorSetACountryFirst");
|
||||
print $countrynotdefined;
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
llxFooter();
|
||||
$db->close();
|
||||
}
|
||||
|
||||
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
|
||||
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
if ($massactionbutton) $selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : '').'">'."\n";
|
||||
|
||||
print '<tr class="liste_titre_filter">';
|
||||
|
||||
// Filters: Line number (placeholder)
|
||||
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Filter: Ref
|
||||
if (!empty($arrayfields['cs.rowid']['checked'])) {
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat maxwidth75" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Filter: Label
|
||||
if (!empty($arrayfields['cs.rowid']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat maxwidth100" name="search_label" value="'.dol_escape_htmltag($search_label).'">';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Filter: Type
|
||||
if (!empty($arrayfields['cs.fk_type']['checked'])) {
|
||||
print '<td class="liste_titre" align="left">';
|
||||
$formsocialcontrib->select_type_socialcontrib($search_typeid, 'search_typeid', 1, 0, 0, 'maxwidth100onsmartphone', 1);
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Filter: Project ref
|
||||
if (!empty($arrayfields['p.ref']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" size="6" name="search_project_ref" value="'.$search_project_ref.'">';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Filter: Date (placeholder)
|
||||
if (!empty($arrayfields['cs.date_ech']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Filter: Period end date
|
||||
if (!empty($arrayfields['cs.periode']['checked'])) {
|
||||
print '<td class="liste_titre center">';
|
||||
if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_day_lim" value="'.dol_escape_htmltag($search_day_lim).'">';
|
||||
print '<input class="flat valignmiddle width25" type="text" size="1" maxlength="2" name="search_month_lim" value="'.dol_escape_htmltag($search_month_lim).'">';
|
||||
$formother->select_year($search_year_lim ? $search_year_lim : -1, 'search_year_lim', 1, 20, 5, 0, 0, '', 'widthauto valignmiddle');
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Filter: Amount
|
||||
if (!empty($arrayfields['cs.amount']['checked'])) {
|
||||
print '<td class="liste_titre right">';
|
||||
print '<input class="flat maxwidth75" type="text" name="search_amount" value="'.dol_escape_htmltag($search_amount).'">';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Filter: Status
|
||||
if (!empty($arrayfields['cs.paye']['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
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
// Filter: Buttons
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
print $form->showFilterAndCheckAddButtons(0);
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) print_liste_field_titre('#', $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['cs.rowid']['checked'])) print_liste_field_titre($arrayfields['cs.rowid']['label'], $_SERVER["PHP_SELF"], "cs.rowid", '', $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['cs.libelle']['checked'])) print_liste_field_titre($arrayfields['cs.libelle']['label'], $_SERVER["PHP_SELF"], "cs.libelle", '', $param, 'class="left"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['cs.fk_type']['checked'])) print_liste_field_titre($arrayfields['cs.fk_type']['label'], $_SERVER["PHP_SELF"], "cs.fk_type", '', $param, 'class="left"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], "p.ref", '', $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['cs.date_ech']['checked'])) print_liste_field_titre($arrayfields['cs.date_ech']['label'], $_SERVER["PHP_SELF"], "cs.date_ech", '', $param, 'align="center"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['cs.periode']['checked'])) print_liste_field_titre($arrayfields['cs.periode']['label'], $_SERVER["PHP_SELF"], "cs.periode", '', $param, 'align="center"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['cs.amount']['checked'])) print_liste_field_titre($arrayfields['cs.amount']['label'], $_SERVER["PHP_SELF"], "cs.amount", '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['cs.paye']['checked'])) print_liste_field_titre($arrayfields['cs.paye']['label'], $_SERVER["PHP_SELF"], "cs.paye", '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
|
||||
// Hook fields
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'maxwidthsearch ');
|
||||
print '</tr>';
|
||||
|
||||
$i = 0;
|
||||
$totalarray = array();
|
||||
while ($i < min($num, $limit))
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$chargesociale_static->id = $obj->rowid;
|
||||
$chargesociale_static->ref = $obj->rowid;
|
||||
$chargesociale_static->label = $obj->libelle;
|
||||
$chargesociale_static->type_label = $obj->type_label;
|
||||
if (!empty($conf->projet->enabled)) {
|
||||
$projectstatic->id = $obj->project_id;
|
||||
$projectstatic->ref = $obj->project_ref;
|
||||
$projectstatic->title = $obj->project_label;
|
||||
}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Line number
|
||||
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
|
||||
print '<td>'.(($offset * $limit) + $i).'</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Ref
|
||||
if (!empty($arrayfields['cs.rowid']['checked'])) {
|
||||
print '<td>'.$chargesociale_static->getNomUrl(1, '20').'</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Label
|
||||
if (!empty($arrayfields['cs.libelle']['checked'])) {
|
||||
print '<td>'.dol_trunc($obj->libelle, 42).'</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Type
|
||||
if (!empty($arrayfields['cs.fk_type']['checked'])) {
|
||||
print '<td>'.$obj->type_label.'</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Project ref
|
||||
if (!empty($arrayfields['p.ref']['checked'])) {
|
||||
print '<td class="nowrap">';
|
||||
if ($obj->project_id > 0) {
|
||||
print $projectstatic->getNomUrl(1);
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Date
|
||||
if (!empty($arrayfields['cs.date_ech']['checked'])) {
|
||||
print '<td width="110" align="center">'.dol_print_date($db->jdate($obj->date_ech), 'day').'</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Date end period
|
||||
if (!empty($arrayfields['cs.periode']['checked'])) {
|
||||
print '<td class="center">';
|
||||
if ($obj->periode) {
|
||||
print '<a href="list.php?year='.strftime("%Y", $db->jdate($obj->periode)).'">';
|
||||
print dol_print_date($db->jdate($obj->periode), 'day');
|
||||
print '</a>';
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Amount
|
||||
if (!empty($arrayfields['cs.amount']['checked'])) {
|
||||
print '<td class="nowrap right">'.price($obj->amount).'</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'totalttcfield';
|
||||
$totalarray['val']['totalttcfield'] += $obj->amount;
|
||||
}
|
||||
|
||||
// Status
|
||||
if (!empty($arrayfields['cs.paye']['checked'])) {
|
||||
print '<td class="nowrap right">'.$chargesociale_static->LibStatut($obj->paye, 5, $obj->alreadypayed).'</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Buttons
|
||||
print '<td></td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
|
||||
// Show total line
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
print '</form>';
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
|
||||
@ -879,7 +879,7 @@ class Contact extends CommonObject
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON c.rowid = u.fk_socpeople";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON c.fk_soc = s.rowid";
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_stcommcontact as st ON c.fk_stcommcontact = st.id';
|
||||
if ($id) $sql .= " WHERE c.rowid = ".$id;
|
||||
if ($id) $sql .= " WHERE c.rowid = ".((int) $id);
|
||||
else {
|
||||
$sql .= " WHERE c.entity IN (".getEntity($this->element).")";
|
||||
if ($ref_ext) {
|
||||
|
||||
@ -2028,7 +2028,7 @@ class Contrat extends CommonObject
|
||||
$sql .= " c.tms as date_modification,";
|
||||
$sql .= " fk_user_author";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."contrat as c";
|
||||
$sql .= " WHERE c.rowid = ".$id;
|
||||
$sql .= " WHERE c.rowid = ".((int) $id);
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
|
||||
@ -186,7 +186,7 @@ class Comment extends CommonObject
|
||||
$sql .= " c.entity,";
|
||||
$sql .= " c.import_key";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element." as c";
|
||||
$sql .= " WHERE c.rowid = ".$id;
|
||||
$sql .= " WHERE c.rowid = ".((int) $id);
|
||||
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
@ -1848,7 +1848,7 @@ class Form
|
||||
if ($ownerid == $value['id'] && is_array($listofuserid) && count($listofuserid) && in_array($ownerid, array_keys($listofuserid)))
|
||||
{
|
||||
$out .= '<div class="myavailability inline-block">';
|
||||
$out .= ' - <span class="opacitymedium">'.$langs->trans("Availability").':</span> <input id="transparency" class="marginleftonly marginrightonly" '.($action == 'view' ? 'disabled' : '').' type="checkbox" name="transparency"'.($listofuserid[$ownerid]['transparency'] ? ' checked' : '').'>'.$langs->trans("Busy");
|
||||
$out .= '<span class="hideonsmartphone"> - <span class="opacitymedium">'.$langs->trans("Availability").':</span> </span><input id="transparency" class="paddingrightonly" '.($action == 'view' ? 'disabled' : '').' type="checkbox" name="transparency"'.($listofuserid[$ownerid]['transparency'] ? ' checked' : '').'><label for="transparency">'.$langs->trans("Busy").'</label>';
|
||||
$out .= '</div>';
|
||||
}
|
||||
}
|
||||
@ -5578,7 +5578,6 @@ class Form
|
||||
}
|
||||
// Show date with combo selects
|
||||
else {
|
||||
//$retstring.='<div class="inline-block">';
|
||||
// Day
|
||||
$retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50imp" id="'.$prefix.'day" name="'.$prefix.'day">';
|
||||
|
||||
@ -5622,11 +5621,13 @@ class Form
|
||||
}
|
||||
$retstring .= "</select>\n";
|
||||
}
|
||||
//$retstring.='</div>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($d && $h) $retstring .= ($h == 2 ? '<br>' : ' ');
|
||||
if ($d && $h) {
|
||||
$retstring .= ($h == 2 ? '<br>' : ' ');
|
||||
$retstring.='<span class="nowraponall">';
|
||||
}
|
||||
|
||||
if ($h)
|
||||
{
|
||||
@ -5644,10 +5645,13 @@ class Form
|
||||
for ($hour = $hourstart; $hour < $hourend; $hour++)
|
||||
{
|
||||
if (strlen($hour) < 2) $hour = "0".$hour;
|
||||
$retstring .= '<option value="'.$hour.'"'.(($hour == $shour) ? ' selected' : '').'>'.$hour.(empty($conf->dol_optimize_smallscreen) ? '' : 'H').'</option>';
|
||||
$retstring .= '<option value="'.$hour.'"'.(($hour == $shour) ? ' selected' : '').'>'.$hour;
|
||||
//$retstring .= (empty($conf->dol_optimize_smallscreen) ? '' : 'H');
|
||||
$retstring .= '</option>';
|
||||
}
|
||||
$retstring .= '</select>';
|
||||
if ($m && empty($conf->dol_optimize_smallscreen)) $retstring .= ":";
|
||||
//if ($m && empty($conf->dol_optimize_smallscreen)) $retstring .= ":";
|
||||
if ($m) $retstring .= ":";
|
||||
}
|
||||
|
||||
if ($m)
|
||||
@ -5665,6 +5669,10 @@ class Form
|
||||
$retstring .= '<input type="hidden" name="'.$prefix.'sec" value="'.$ssec.'">';
|
||||
}
|
||||
|
||||
if ($d && $h) {
|
||||
$retstring .= '</span>';
|
||||
}
|
||||
|
||||
// Add a "Now" link
|
||||
if ($conf->use_javascript_ajax && $addnowlink)
|
||||
{
|
||||
@ -7257,7 +7265,7 @@ class Form
|
||||
}
|
||||
if ($morehtml)
|
||||
{
|
||||
$ret .= '<li class="noborder litext">'.$morehtml.'</li>';
|
||||
$ret .= '<li class="noborder litext'.(($shownav && $previous_ref && $next_ref) ? ' clearbothonsmartphone' : '').'">'.$morehtml.'</li>';
|
||||
}
|
||||
if ($shownav && ($previous_ref || $next_ref))
|
||||
{
|
||||
|
||||
@ -353,7 +353,7 @@ class FormProjets
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
|
||||
$comboenhancement = ajax_combobox($htmlname, '', 0, $forcefocus);
|
||||
$out .= $comboenhancement;
|
||||
$morecss = 'minwidth200imp maxwidth500';
|
||||
$morecss = 'minwidth200 maxwidth500';
|
||||
}
|
||||
|
||||
if (empty($option_only)) {
|
||||
|
||||
@ -1522,8 +1522,9 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
|
||||
$showimage = $object->is_photo_available($conf->product->multidir_output[$entity]);
|
||||
$maxvisiblephotos = (isset($conf->global->PRODUCT_MAX_VISIBLE_PHOTO) ? $conf->global->PRODUCT_MAX_VISIBLE_PHOTO : 5);
|
||||
if ($conf->browser->layout == 'phone') $maxvisiblephotos = 1;
|
||||
if ($showimage) $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref">'.$object->show_photos('product', $conf->product->multidir_output[$entity], 'small', $maxvisiblephotos, 0, 0, 0, $width, 0).'</div>';
|
||||
else {
|
||||
if ($showimage) {
|
||||
$morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref">'.$object->show_photos('product', $conf->product->multidir_output[$entity], 'small', $maxvisiblephotos, 0, 0, 0, $width, 0).'</div>';
|
||||
} else {
|
||||
if (!empty($conf->global->PRODUCT_NODISPLAYIFNOPHOTO)) {
|
||||
$nophoto = '';
|
||||
$morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref"></div>';
|
||||
@ -1610,9 +1611,9 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
|
||||
// If the preview file is found
|
||||
if (file_exists($fileimage))
|
||||
{
|
||||
$phototoshow = '<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref">';
|
||||
$phototoshow = '<div class="photoref">';
|
||||
$phototoshow .= '<img height="'.$heightforphotref.'" class="photo photowithmargin photowithborder" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=apercu'.$modulepart.'&file='.urlencode($relativepathimage).'">';
|
||||
$phototoshow .= '</div></div>';
|
||||
$phototoshow .= '</div>';
|
||||
}
|
||||
}
|
||||
} elseif (!$phototoshow)
|
||||
|
||||
@ -2017,7 +2017,25 @@ function pdf_getlinetotalwithtax($object, $i, $outputlangs, $hidedetails = 0)
|
||||
if ($object->lines[$i]->special_code == 3)
|
||||
{
|
||||
$result .= $outputlangs->transnoentities("Option");
|
||||
} elseif (empty($hidedetails) || $hidedetails > 1) $result .= price($sign * ($object->lines[$i]->total_ht) + ($object->lines[$i]->total_ht) * ($object->lines[$i]->tva_tx) / 100, 0, $outputlangs);
|
||||
}
|
||||
if (empty($hidedetails) || $hidedetails > 1)
|
||||
{
|
||||
$total_ttc = ($conf->multicurrency->enabled && $object->multicurrency_tx != 1 ? $object->lines[$i]->multicurrency_total_ttc : $object->lines[$i]->total_ttc);
|
||||
if ($object->lines[$i]->situation_percent > 0)
|
||||
{
|
||||
// TODO Remove this. The total should be saved correctly in database instead of being modified here.
|
||||
$prev_progress = 0;
|
||||
$progress = 1;
|
||||
if (method_exists($object->lines[$i], 'get_prev_progress'))
|
||||
{
|
||||
$prev_progress = $object->lines[$i]->get_prev_progress($object->id);
|
||||
$progress = ($object->lines[$i]->situation_percent - $prev_progress) / 100;
|
||||
}
|
||||
$result .= price($sign * ($total_ttc / ($object->lines[$i]->situation_percent / 100)) * $progress, 0, $outputlangs);
|
||||
} else {
|
||||
$result .= price($sign * $total_ttc, 0, $outputlangs);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
@ -224,9 +224,16 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
// Load translation files required by the page
|
||||
$outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products", "orders", "deliveries"));
|
||||
|
||||
if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) {
|
||||
global $outputlangsbis;
|
||||
$outputlangsbis = new Translate('', $conf);
|
||||
$outputlangsbis->setDefaultLang($conf->global->PDF_USE_ALSO_LANGUAGE_CODE);
|
||||
$outputlangsbis->loadLangs(array("main", "dict", "companies", "bills", "products", "orders", "deliveries"));
|
||||
}
|
||||
|
||||
$nblines = count($object->lines);
|
||||
|
||||
if ($conf->commande->dir_output)
|
||||
if ($conf->commande->multidir_output[$conf->entity])
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
@ -325,7 +332,7 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
$pdf->AddPage();
|
||||
if (!empty($tplidx)) $pdf->useTemplate($tplidx);
|
||||
$pagenb++;
|
||||
$top_shift = $this->_pagehead($pdf, $object, 1, $outputlangs);
|
||||
$top_shift = $this->_pagehead($pdf, $object, 1, $outputlangs, $outputlangsbis);
|
||||
$pdf->SetFont('', '', $default_font_size - 1);
|
||||
$pdf->MultiCell(0, 3, ''); // Set interline to 3
|
||||
$pdf->SetTextColor(0, 0, 0);
|
||||
@ -335,6 +342,7 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 + $top_shift : 10);
|
||||
|
||||
// Incoterm
|
||||
$height_incoterms = 0;
|
||||
if ($conf->incoterm->enabled)
|
||||
{
|
||||
$desc_incoterms = $object->getIncotermsForPDF();
|
||||
@ -585,15 +593,17 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
}
|
||||
|
||||
// Show square
|
||||
if ($pagenb == 1)
|
||||
if ($pagenb == 1) {
|
||||
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0, $object->multicurrency_code);
|
||||
else $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code);
|
||||
} else {
|
||||
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code);
|
||||
}
|
||||
$bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
|
||||
|
||||
// Affiche zone infos
|
||||
// Display infos area
|
||||
$posy = $this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs);
|
||||
|
||||
// Affiche zone totaux
|
||||
// Display total zone
|
||||
$posy = $this->_tableau_tot($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs);
|
||||
|
||||
// Affiche zone versements
|
||||
@ -664,7 +674,7 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
* @param Object $object Object to show
|
||||
* @param int $posy Y
|
||||
* @param Translate $outputlangs Langs object
|
||||
* @return void
|
||||
* @return int
|
||||
*/
|
||||
protected function _tableau_info(&$pdf, $object, $posy, $outputlangs)
|
||||
{
|
||||
@ -783,20 +793,22 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
// Si mode reglement non force ou si force a CHQ
|
||||
if (!empty($conf->global->FACTURE_CHQ_NUMBER))
|
||||
{
|
||||
if ($conf->global->FACTURE_CHQ_NUMBER > 0)
|
||||
$diffsizetitle = (empty($conf->global->PDF_DIFFSIZE_TITLE) ? 3 : $conf->global->PDF_DIFFSIZE_TITLE);
|
||||
|
||||
if ($conf->global->FACTURE_CHQ_NUMBER > 0)
|
||||
{
|
||||
$account = new Account($this->db);
|
||||
$account->fetch($conf->global->FACTURE_CHQ_NUMBER);
|
||||
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
$pdf->SetFont('', 'B', $default_font_size - 3);
|
||||
$pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo', $account->proprio), 0, 'L', 0);
|
||||
$posy = $pdf->GetY() + 1;
|
||||
|
||||
if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS))
|
||||
{
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
$pdf->SetFont('', '', $default_font_size - 3);
|
||||
$pdf->SetFont('', '', $default_font_size - $diffsizetitle);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($account->owner_address), 0, 'L', 0);
|
||||
$posy = $pdf->GetY() + 2;
|
||||
}
|
||||
@ -804,14 +816,14 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
if ($conf->global->FACTURE_CHQ_NUMBER == -1)
|
||||
{
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
$pdf->SetFont('', 'B', $default_font_size - 3);
|
||||
$pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo', $this->emetteur->name), 0, 'L', 0);
|
||||
$posy = $pdf->GetY() + 1;
|
||||
|
||||
if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS))
|
||||
{
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
$pdf->SetFont('', '', $default_font_size - 3);
|
||||
$pdf->SetFont('', '', $default_font_size - $diffsizetitle);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0, 'L', 0);
|
||||
$posy = $pdf->GetY() + 2;
|
||||
}
|
||||
@ -822,10 +834,10 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
// If payment mode not forced or forced to VIR, show payment with BAN
|
||||
if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'VIR')
|
||||
{
|
||||
if (!empty($object->fk_account) || !empty($object->fk_bank) || !empty($conf->global->FACTURE_RIB_NUMBER))
|
||||
if ($object->fk_account > 0 || $object->fk_bank > 0 || !empty($conf->global->FACTURE_RIB_NUMBER))
|
||||
{
|
||||
$bankid = (empty($object->fk_account) ? $conf->global->FACTURE_RIB_NUMBER : $object->fk_account);
|
||||
if (!empty($object->fk_bank)) $bankid = $object->fk_bank; // For backward compatibility when object->fk_account is forced with object->fk_bank
|
||||
$bankid = ($object->fk_account <= 0 ? $conf->global->FACTURE_RIB_NUMBER : $object->fk_account);
|
||||
if ($object->fk_bank > 0) $bankid = $object->fk_bank; // For backward compatibility when object->fk_account is forced with object->fk_bank
|
||||
$account = new Account($this->db);
|
||||
$account->fetch($bankid);
|
||||
|
||||
@ -856,15 +868,23 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf, $mysoc;
|
||||
global $conf, $mysoc, $hookmanager;
|
||||
|
||||
$default_font_size = pdf_getPDFFontSize($outputlangs);
|
||||
|
||||
$outputlangsbis = null;
|
||||
if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) {
|
||||
$outputlangsbis = new Translate('', $conf);
|
||||
$outputlangsbis->setDefaultLang($conf->global->PDF_USE_ALSO_LANGUAGE_CODE);
|
||||
$outputlangsbis->loadLangs(array("main", "dict", "companies", "bills", "products", "propal"));
|
||||
$default_font_size--;
|
||||
}
|
||||
|
||||
$tab2_top = $posy;
|
||||
$tab2_hl = 4;
|
||||
$pdf->SetFont('', '', $default_font_size - 1);
|
||||
|
||||
// Tableau total
|
||||
// Total table
|
||||
$col1x = 120; $col2x = 170;
|
||||
if ($this->page_largeur < 210) // To work with US executive format
|
||||
{
|
||||
@ -878,7 +898,7 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
// Total HT
|
||||
$pdf->SetFillColor(255, 255, 255);
|
||||
$pdf->SetXY($col1x, $tab2_top + 0);
|
||||
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
|
||||
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("TotalHT") : ''), 0, 'L', 1);
|
||||
|
||||
$total_ht = (($conf->multicurrency->enabled && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht);
|
||||
$pdf->SetXY($col2x, $tab2_top + 0);
|
||||
@ -918,7 +938,8 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
$tvakey = str_replace('*', '', $tvakey);
|
||||
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
|
||||
}
|
||||
$totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' ';
|
||||
$totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalLT1", $mysoc->country_code) : '');
|
||||
$totalvat .= ' ';
|
||||
$totalvat .= vatrate(abs($tvakey), 1).$tvacompl;
|
||||
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
|
||||
|
||||
@ -949,7 +970,8 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
$tvakey = str_replace('*', '', $tvakey);
|
||||
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
|
||||
}
|
||||
$totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' ';
|
||||
$totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalLT2", $mysoc->country_code) : '');
|
||||
$totalvat .= ' ';
|
||||
$totalvat .= vatrate(abs($tvakey), 1).$tvacompl;
|
||||
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
|
||||
|
||||
@ -975,7 +997,8 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
$tvakey = str_replace('*', '', $tvakey);
|
||||
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
|
||||
}
|
||||
$totalvat = $outputlangs->transcountrynoentities("TotalVAT", $mysoc->country_code).' ';
|
||||
$totalvat = $outputlangs->transcountrynoentities("TotalVAT", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalVAT", $mysoc->country_code) : '');
|
||||
$totalvat .= ' ';
|
||||
$totalvat .= vatrate($tvakey, 1).$tvacompl;
|
||||
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
|
||||
|
||||
@ -1006,8 +1029,9 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
$tvakey = str_replace('*', '', $tvakey);
|
||||
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
|
||||
}
|
||||
$totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' ';
|
||||
|
||||
$totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalLT1", $mysoc->country_code) : '');
|
||||
$totalvat .= ' ';
|
||||
|
||||
$totalvat .= vatrate(abs($tvakey), 1).$tvacompl;
|
||||
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
|
||||
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
|
||||
@ -1025,6 +1049,7 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
|
||||
foreach ($localtax_rate as $tvakey => $tvaval)
|
||||
{
|
||||
// retrieve global local tax
|
||||
if ($tvakey != 0) // On affiche pas taux 0
|
||||
{
|
||||
//$this->atleastoneratenotnull++;
|
||||
@ -1038,8 +1063,9 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
$tvakey = str_replace('*', '', $tvakey);
|
||||
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
|
||||
}
|
||||
$totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' ';
|
||||
|
||||
$totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalLT2", $mysoc->country_code) : '');
|
||||
$totalvat .= ' ';
|
||||
|
||||
$totalvat .= vatrate(abs($tvakey), 1).$tvacompl;
|
||||
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
|
||||
|
||||
@ -1055,7 +1081,7 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
|
||||
$pdf->SetTextColor(0, 0, 60);
|
||||
$pdf->SetFillColor(224, 224, 224);
|
||||
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1);
|
||||
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalTTC", $mysoc->country_code) : ''), $useborder, 'L', 1);
|
||||
|
||||
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price($total_ttc, 0, $outputlangs), $useborder, 'R', 1);
|
||||
@ -1078,7 +1104,7 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
$index++;
|
||||
|
||||
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
|
||||
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("AlreadyPaid"), 0, 'L', 0);
|
||||
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("AlreadyPaid").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("AlreadyPaid") : ''), 0, 'L', 0);
|
||||
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price($deja_regle, 0, $outputlangs), 0, 'R', 0);
|
||||
|
||||
@ -1086,7 +1112,7 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
$pdf->SetTextColor(0, 0, 60);
|
||||
$pdf->SetFillColor(224, 224, 224);
|
||||
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
|
||||
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("RemainderToPay"), $useborder, 'L', 1);
|
||||
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("RemainderToPay").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("AlreadyPaid") : ''), $useborder, 'L', 1);
|
||||
|
||||
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price($resteapayer, 0, $outputlangs), $useborder, 'R', 1);
|
||||
@ -1111,9 +1137,10 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
* @param int $hidetop 1=Hide top bar of array and title, 0=Hide nothing, -1=Hide only title
|
||||
* @param int $hidebottom Hide bottom bar of array
|
||||
* @param string $currency Currency code
|
||||
* @param Translate $outputlangsbis Langs object bis
|
||||
* @return void
|
||||
*/
|
||||
protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
|
||||
protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '', $outputlangsbis = null)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@ -1131,6 +1158,10 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
if (empty($hidetop))
|
||||
{
|
||||
$titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency".$currency));
|
||||
if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && is_object($outputlangsbis)) {
|
||||
$titre .= ' - '.$outputlangsbis->transnoentities("AmountInCurrency", $outputlangsbis->transnoentitiesnoconv("Currency".$currency));
|
||||
}
|
||||
|
||||
$pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4);
|
||||
$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
|
||||
|
||||
@ -1214,10 +1245,11 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
* @param Object $object Object to show
|
||||
* @param int $showaddress 0=no, 1=yes
|
||||
* @param Translate $outputlangs Object lang for output
|
||||
* @param Translate $outputlangsbis Object lang for output bis
|
||||
* @param string $titlekey Translation key to show as title of document
|
||||
* @return int Return topshift value
|
||||
*/
|
||||
protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey = "PdfOrderTitle")
|
||||
protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $outputlangsbis = null, $titlekey = "PdfOrderTitle")
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf, $langs, $hookmanager;
|
||||
@ -1238,8 +1270,10 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
$pdf->SetTextColor(0, 0, 60);
|
||||
$pdf->SetFont('', 'B', $default_font_size + 3);
|
||||
|
||||
$w = 100;
|
||||
|
||||
$posy = $this->marge_haute;
|
||||
$posx = $this->page_largeur - $this->marge_droite - 100;
|
||||
$posx = $this->page_largeur - $this->marge_droite - $w;
|
||||
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
|
||||
@ -1263,12 +1297,12 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
} else {
|
||||
$pdf->SetTextColor(200, 0, 0);
|
||||
$pdf->SetFont('', 'B', $default_font_size - 2);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L');
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L');
|
||||
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L');
|
||||
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L');
|
||||
}
|
||||
} else {
|
||||
$text = $this->emetteur->name;
|
||||
$pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
|
||||
$pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
|
||||
}
|
||||
}
|
||||
|
||||
@ -1276,7 +1310,7 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
$pdf->SetXY($posx, $posy);
|
||||
$pdf->SetTextColor(0, 0, 60);
|
||||
$title = $outputlangs->transnoentities($titlekey);
|
||||
$pdf->MultiCell(100, 3, $title, '', 'R');
|
||||
$pdf->MultiCell($w, 3, $title, '', 'R');
|
||||
|
||||
$pdf->SetFont('', 'B', $default_font_size);
|
||||
|
||||
@ -1293,7 +1327,7 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
$posy += 5;
|
||||
$pdf->SetXY($posx, $posy);
|
||||
$pdf->SetTextColor(0, 0, 60);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R');
|
||||
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R');
|
||||
}
|
||||
|
||||
if (!empty($conf->global->PDF_SHOW_PROJECT_TITLE))
|
||||
@ -1323,14 +1357,14 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
$posy += 4;
|
||||
$pdf->SetXY($posx, $posy);
|
||||
$pdf->SetTextColor(0, 0, 60);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("OrderDate")." : ".dol_print_date($object->date, "day", false, $outputlangs, true), '', 'R');
|
||||
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("OrderDate")." : ".dol_print_date($object->date, "day", false, $outputlangs, true), '', 'R');
|
||||
|
||||
if (!empty($conf->global->DOC_SHOW_CUSTOMER_CODE) && !empty($object->thirdparty->code_client))
|
||||
{
|
||||
$posy += 4;
|
||||
$pdf->SetXY($posx, $posy);
|
||||
$pdf->SetTextColor(0, 0, 60);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : ".$outputlangs->transnoentities($object->thirdparty->code_client), '', 'R');
|
||||
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("CustomerCode")." : ".$outputlangs->transnoentities($object->thirdparty->code_client), '', 'R');
|
||||
}
|
||||
|
||||
// Get contact
|
||||
@ -1344,7 +1378,7 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
$posy += 4;
|
||||
$pdf->SetXY($posx, $posy);
|
||||
$pdf->SetTextColor(0, 0, 60);
|
||||
$pdf->MultiCell(100, 3, $langs->trans("SalesRepresentative")." : ".$usertmp->getFullName($langs), '', 'R');
|
||||
$pdf->MultiCell($w, 3, $langs->transnoentities("SalesRepresentative")." : ".$usertmp->getFullName($langs), '', 'R');
|
||||
}
|
||||
}
|
||||
|
||||
@ -1353,7 +1387,7 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
$top_shift = 0;
|
||||
// Show list of linked objects
|
||||
$current_y = $pdf->getY();
|
||||
$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size);
|
||||
$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, $w, 3, 'R', $default_font_size);
|
||||
if ($current_y < $pdf->getY())
|
||||
{
|
||||
$top_shift = $pdf->getY() - $current_y;
|
||||
@ -1402,8 +1436,7 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
$pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L');
|
||||
|
||||
|
||||
|
||||
// If CUSTOMER contact defined on order, we use it
|
||||
// If CUSTOMER contact defined, we use it
|
||||
$usecontact = false;
|
||||
$arrayidcontact = $object->getIdContact('external', 'CUSTOMER');
|
||||
if (count($arrayidcontact) > 0)
|
||||
@ -1425,9 +1458,10 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
$carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact : ''), $usecontact, 'target', $object);
|
||||
|
||||
// Show recipient
|
||||
$widthrecbox = 100;
|
||||
$widthrecbox = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 100;
|
||||
if ($this->page_largeur < 210) $widthrecbox = 84; // To work with US executive format
|
||||
$posy = 42 + $top_shift;
|
||||
$posy = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 40 : 42;
|
||||
$posy += $top_shift;
|
||||
$posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
|
||||
if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->marge_gauche;
|
||||
|
||||
@ -1441,7 +1475,7 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
// Show recipient name
|
||||
$pdf->SetXY($posx + 2, $posy + 3);
|
||||
$pdf->SetFont('', 'B', $default_font_size);
|
||||
$pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, 'L');
|
||||
$pdf->MultiCell($widthrecbox, 2, $carac_client_name, 0, 'L');
|
||||
|
||||
$posy = $pdf->getY();
|
||||
|
||||
|
||||
@ -120,7 +120,12 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
*/
|
||||
public $emetteur;
|
||||
|
||||
|
||||
/**
|
||||
* @var array of document table collumns
|
||||
*/
|
||||
public $cols;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@ -165,11 +170,13 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
if (empty($this->emetteur->country_code)) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default, if was not defined
|
||||
|
||||
// Define position of columns
|
||||
$this->posxdesc = $this->marge_gauche + 1;
|
||||
$this->posxdesc = $this->marge_gauche + 1; // used for notes ans other stuff
|
||||
|
||||
|
||||
$this->tabTitleHeight = 5; // default height
|
||||
|
||||
// Use new system for position of columns, view $this->defineColumnField()
|
||||
|
||||
$this->tva = array();
|
||||
$this->localtax1 = array();
|
||||
$this->localtax2 = array();
|
||||
@ -242,7 +249,11 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
{
|
||||
if (!$arephoto)
|
||||
{
|
||||
$dir = $conf->product->dir_output.'/'.$midir;
|
||||
if ($conf->product->entity != $objphoto->entity) {
|
||||
$dir = $conf->product->multidir_output[$objphoto->entity].'/'.$midir; //Check repertories of current entities
|
||||
} else {
|
||||
$dir = $conf->product->dir_output.'/'.$midir; //Check repertory of the current product
|
||||
}
|
||||
|
||||
foreach ($objphoto->liste_photos($dir, 1) as $key => $obj)
|
||||
{
|
||||
@ -271,7 +282,7 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
|
||||
|
||||
|
||||
if ($conf->commande->dir_output)
|
||||
if ($conf->commande->multidir_output[$conf->entity])
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
@ -345,20 +356,21 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
|
||||
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
|
||||
|
||||
/// Does we have at least one line with discount $this->atleastonediscount
|
||||
foreach ($object->lines as $line) {
|
||||
if ($line->remise_percent) {
|
||||
$this->atleastonediscount = true;
|
||||
break;
|
||||
}
|
||||
// Set $this->atleastonediscount if you have at least one discount
|
||||
for ($i = 0; $i < $nblines; $i++)
|
||||
{
|
||||
if ($object->lines[$i]->remise_percent)
|
||||
{
|
||||
$this->atleastonediscount++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// New page
|
||||
$pdf->AddPage();
|
||||
if (!empty($tplidx)) $pdf->useTemplate($tplidx);
|
||||
$pagenb++;
|
||||
$top_shift = $this->_pagehead($pdf, $object, 1, $outputlangs);
|
||||
$top_shift = $this->_pagehead($pdf, $object, 1, $outputlangs, $outputlangsbis);
|
||||
$pdf->SetFont('', '', $default_font_size - 1);
|
||||
$pdf->MultiCell(0, 3, ''); // Set interline to 3
|
||||
$pdf->SetTextColor(0, 0, 0);
|
||||
@ -368,6 +380,7 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 + $top_shift : 10);
|
||||
|
||||
// Incoterm
|
||||
$height_incoterms = 0;
|
||||
if ($conf->incoterm->enabled)
|
||||
{
|
||||
$desc_incoterms = $object->getIncotermsForPDF();
|
||||
@ -404,15 +417,16 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
|
||||
// Extrafields in note
|
||||
$extranote = $this->getExtrafieldsInHtml($object, $outputlangs);
|
||||
if (!empty($extranote))
|
||||
{
|
||||
if (!empty($extranote)) {
|
||||
$notetoshow = dol_concatdesc($notetoshow, $extranote);
|
||||
}
|
||||
|
||||
$pagenb = $pdf->getPage();
|
||||
if ($notetoshow)
|
||||
{
|
||||
$tab_width = $this->page_largeur - $this->marge_gauche - $this->marge_droite;
|
||||
$tab_top -= 2;
|
||||
|
||||
$tab_width = $this->page_largeur - $this->marge_gauche - $this->marge_droite;
|
||||
$pageposbeforenote = $pagenb;
|
||||
|
||||
$substitutionarray = pdf_getSubstitutionArray($outputlangs, null, $object);
|
||||
@ -420,8 +434,6 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
$notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs);
|
||||
$notetoshow = convertBackOfficeMediasLinksToPublicLinks($notetoshow);
|
||||
|
||||
$tab_top -= 2;
|
||||
|
||||
$pdf->startTransaction();
|
||||
|
||||
$pdf->SetFont('', '', $default_font_size - 1);
|
||||
@ -582,6 +594,7 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
}
|
||||
}
|
||||
|
||||
// Description of product line
|
||||
if ($this->getColumnStatus('desc'))
|
||||
{
|
||||
$pdf->startTransaction();
|
||||
@ -632,7 +645,7 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
$pdf->setTopMargin($this->marge_haute);
|
||||
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
|
||||
|
||||
// We suppose that a too long description is moved completely on next page
|
||||
// We suppose that a too long description or photo were moved completely on next page
|
||||
if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
|
||||
$pdf->setPage($pageposafter); $curY = $tab_top_newpage;
|
||||
}
|
||||
@ -681,7 +694,7 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
$nexY = max($pdf->GetY(), $nexY);
|
||||
}
|
||||
|
||||
// Total HT line
|
||||
// Total excl tax line (HT)
|
||||
if ($this->getColumnStatus('totalexcltax'))
|
||||
{
|
||||
$total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails);
|
||||
@ -689,7 +702,15 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
$nexY = max($pdf->GetY(), $nexY);
|
||||
}
|
||||
|
||||
// Extrafields
|
||||
// Total with tax line (TTC)
|
||||
if ($this->getColumnStatus('totalincltax'))
|
||||
{
|
||||
$total_incl_tax = pdf_getlinetotalwithtax($object, $i, $outputlangs, $hidedetails);
|
||||
$this->printStdColumnContent($pdf, $curY, 'totalincltax', $total_incl_tax);
|
||||
$nexY = max($pdf->GetY(), $nexY);
|
||||
}
|
||||
|
||||
// Extrafields
|
||||
if (!empty($object->lines[$i]->array_options)) {
|
||||
foreach ($object->lines[$i]->array_options as $extrafieldColKey => $extrafieldValue) {
|
||||
if ($this->getColumnStatus($extrafieldColKey))
|
||||
@ -795,14 +816,17 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
|
||||
// Show square
|
||||
if ($pagenb == $pageposbeforeprintlines)
|
||||
{
|
||||
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, $hidetop, 0, $object->multicurrency_code);
|
||||
else $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code);
|
||||
} else {
|
||||
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code);
|
||||
}
|
||||
$bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
|
||||
|
||||
// Affiche zone infos
|
||||
// Display infos area
|
||||
$posy = $this->drawInfoTable($pdf, $object, $bottomlasttab, $outputlangs);
|
||||
|
||||
// Affiche zone totaux
|
||||
// Display total zone
|
||||
$posy = $this->drawTotalTable($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs);
|
||||
|
||||
// Affiche zone versements
|
||||
@ -986,20 +1010,22 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
// Si mode reglement non force ou si force a CHQ
|
||||
if (!empty($conf->global->FACTURE_CHQ_NUMBER))
|
||||
{
|
||||
if ($conf->global->FACTURE_CHQ_NUMBER > 0)
|
||||
$diffsizetitle = (empty($conf->global->PDF_DIFFSIZE_TITLE) ? 3 : $conf->global->PDF_DIFFSIZE_TITLE);
|
||||
|
||||
if ($conf->global->FACTURE_CHQ_NUMBER > 0)
|
||||
{
|
||||
$account = new Account($this->db);
|
||||
$account->fetch($conf->global->FACTURE_CHQ_NUMBER);
|
||||
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
$pdf->SetFont('', 'B', $default_font_size - 3);
|
||||
$pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo', $account->proprio), 0, 'L', 0);
|
||||
$posy = $pdf->GetY() + 1;
|
||||
|
||||
if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS))
|
||||
{
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
$pdf->SetFont('', '', $default_font_size - 3);
|
||||
$pdf->SetFont('', '', $default_font_size - $diffsizetitle);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($account->owner_address), 0, 'L', 0);
|
||||
$posy = $pdf->GetY() + 2;
|
||||
}
|
||||
@ -1007,14 +1033,14 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
if ($conf->global->FACTURE_CHQ_NUMBER == -1)
|
||||
{
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
$pdf->SetFont('', 'B', $default_font_size - 3);
|
||||
$pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo', $this->emetteur->name), 0, 'L', 0);
|
||||
$posy = $pdf->GetY() + 1;
|
||||
|
||||
if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS))
|
||||
{
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
$pdf->SetFont('', '', $default_font_size - 3);
|
||||
$pdf->SetFont('', '', $default_font_size - $diffsizetitle);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0, 'L', 0);
|
||||
$posy = $pdf->GetY() + 2;
|
||||
}
|
||||
@ -1025,10 +1051,10 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
// If payment mode not forced or forced to VIR, show payment with BAN
|
||||
if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'VIR')
|
||||
{
|
||||
if (!empty($object->fk_account) || !empty($object->fk_bank) || !empty($conf->global->FACTURE_RIB_NUMBER))
|
||||
if ($object->fk_account > 0 || $object->fk_bank > 0 || !empty($conf->global->FACTURE_RIB_NUMBER))
|
||||
{
|
||||
$bankid = (empty($object->fk_account) ? $conf->global->FACTURE_RIB_NUMBER : $object->fk_account);
|
||||
if (!empty($object->fk_bank)) $bankid = $object->fk_bank; // For backward compatibility when object->fk_account is forced with object->fk_bank
|
||||
$bankid = ($object->fk_account <= 0 ? $conf->global->FACTURE_RIB_NUMBER : $object->fk_account);
|
||||
if ($object->fk_bank > 0) $bankid = $object->fk_bank; // For backward compatibility when object->fk_account is forced with object->fk_bank
|
||||
$account = new Account($this->db);
|
||||
$account->fetch($bankid);
|
||||
|
||||
@ -1057,30 +1083,32 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
*/
|
||||
protected function drawTotalTable(&$pdf, $object, $deja_regle, $posy, $outputlangs)
|
||||
{
|
||||
global $conf, $mysoc;
|
||||
global $conf, $mysoc, $hookmanager;
|
||||
|
||||
$default_font_size = pdf_getPDFFontSize($outputlangs);
|
||||
|
||||
$tab2_top = $posy;
|
||||
$tab2_hl = 4;
|
||||
$pdf->SetFont('', '', $default_font_size - 1);
|
||||
|
||||
// Tableau total
|
||||
$col1x = 120; $col2x = 170;
|
||||
if ($this->page_largeur < 210) // To work with US executive format
|
||||
{
|
||||
$col2x -= 20;
|
||||
}
|
||||
$largcol2 = ($this->page_largeur - $this->marge_droite - $col2x);
|
||||
$useborder = 0;
|
||||
$index = 0;
|
||||
|
||||
$outputlangsbis = null;
|
||||
if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) {
|
||||
$outputlangsbis = new Translate('', $conf);
|
||||
$outputlangsbis->setDefaultLang($conf->global->PDF_USE_ALSO_LANGUAGE_CODE);
|
||||
$outputlangsbis->loadLangs(array("main", "dict", "companies", "bills", "products", "propal"));
|
||||
$default_font_size--;
|
||||
}
|
||||
|
||||
$tab2_top = $posy;
|
||||
$tab2_hl = 4;
|
||||
$pdf->SetFont('', '', $default_font_size - 1);
|
||||
|
||||
// Total table
|
||||
$col1x = 120; $col2x = 170;
|
||||
if ($this->page_largeur < 210) // To work with US executive format
|
||||
{
|
||||
$col2x -= 20;
|
||||
}
|
||||
$largcol2 = ($this->page_largeur - $this->marge_droite - $col2x);
|
||||
|
||||
$useborder = 0;
|
||||
$index = 0;
|
||||
|
||||
// Total HT
|
||||
$pdf->SetFillColor(255, 255, 255);
|
||||
@ -1234,6 +1262,7 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
|
||||
foreach ($localtax_rate as $tvakey => $tvaval)
|
||||
{
|
||||
// retrieve global local tax
|
||||
if ($tvakey != 0) // On affiche pas taux 0
|
||||
{
|
||||
//$this->atleastoneratenotnull++;
|
||||
@ -1321,9 +1350,10 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
* @param int $hidetop 1=Hide top bar of array and title, 0=Hide nothing, -1=Hide only title
|
||||
* @param int $hidebottom Hide bottom bar of array
|
||||
* @param string $currency Currency code
|
||||
* @param Translate $outputlangsbis Langs object bis
|
||||
* @return void
|
||||
*/
|
||||
protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
|
||||
protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '', $outputlangsbis = null)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@ -1341,6 +1371,10 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
if (empty($hidetop))
|
||||
{
|
||||
$titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency".$currency));
|
||||
if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && is_object($outputlangsbis)) {
|
||||
$titre .= ' - '.$outputlangsbis->transnoentities("AmountInCurrency", $outputlangsbis->transnoentitiesnoconv("Currency".$currency));
|
||||
}
|
||||
|
||||
$pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4);
|
||||
$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
|
||||
|
||||
@ -1373,10 +1407,11 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
* @param Object $object Object to show
|
||||
* @param int $showaddress 0=no, 1=yes
|
||||
* @param Translate $outputlangs Object lang for output
|
||||
* @param Translate $outputlangsbis Object lang for output bis
|
||||
* @param string $titlekey Translation key to show as title of document
|
||||
* @return int Return topshift value
|
||||
*/
|
||||
protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey = "PdfOrderTitle")
|
||||
protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $outputlangsbis = null, $titlekey = "PdfOrderTitle")
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf, $langs, $hookmanager;
|
||||
@ -1397,8 +1432,10 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
$pdf->SetTextColor(0, 0, 60);
|
||||
$pdf->SetFont('', 'B', $default_font_size + 3);
|
||||
|
||||
$w = 100;
|
||||
|
||||
$posy = $this->marge_haute;
|
||||
$posx = $this->page_largeur - $this->marge_droite - 100;
|
||||
$posx = $this->page_largeur - $this->marge_droite - $w;
|
||||
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
|
||||
@ -1422,12 +1459,12 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
} else {
|
||||
$pdf->SetTextColor(200, 0, 0);
|
||||
$pdf->SetFont('', 'B', $default_font_size - 2);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L');
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L');
|
||||
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L');
|
||||
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L');
|
||||
}
|
||||
} else {
|
||||
$text = $this->emetteur->name;
|
||||
$pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
|
||||
$pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
|
||||
}
|
||||
}
|
||||
|
||||
@ -1435,7 +1472,7 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
$pdf->SetXY($posx, $posy);
|
||||
$pdf->SetTextColor(0, 0, 60);
|
||||
$title = $outputlangs->transnoentities($titlekey);
|
||||
$pdf->MultiCell(100, 3, $title, '', 'R');
|
||||
$pdf->MultiCell($w, 4, $title, '', 'R');
|
||||
|
||||
$pdf->SetFont('', 'B', $default_font_size);
|
||||
|
||||
@ -1449,10 +1486,10 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
|
||||
if ($object->ref_client)
|
||||
{
|
||||
$posy += 5;
|
||||
$posy += 4;
|
||||
$pdf->SetXY($posx, $posy);
|
||||
$pdf->SetTextColor(0, 0, 60);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R');
|
||||
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R');
|
||||
}
|
||||
|
||||
if (!empty($conf->global->PDF_SHOW_PROJECT_TITLE))
|
||||
@ -1483,14 +1520,14 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
|
||||
$pdf->SetXY($posx, $posy);
|
||||
$pdf->SetTextColor(0, 0, 60);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("OrderDate")." : ".dol_print_date($object->date, "day", false, $outputlangs, true), '', 'R');
|
||||
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("OrderDate")." : ".dol_print_date($object->date, "day", false, $outputlangs, true), '', 'R');
|
||||
|
||||
if (!empty($conf->global->DOC_SHOW_CUSTOMER_CODE) && !empty($object->thirdparty->code_client))
|
||||
{
|
||||
$posy += 4;
|
||||
$pdf->SetXY($posx, $posy);
|
||||
$pdf->SetTextColor(0, 0, 60);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : ".$outputlangs->transnoentities($object->thirdparty->code_client), '', 'R');
|
||||
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("CustomerCode")." : ".$outputlangs->transnoentities($object->thirdparty->code_client), '', 'R');
|
||||
}
|
||||
|
||||
// Get contact
|
||||
@ -1504,7 +1541,7 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
$posy += 4;
|
||||
$pdf->SetXY($posx, $posy);
|
||||
$pdf->SetTextColor(0, 0, 60);
|
||||
$pdf->MultiCell(100, 3, $langs->trans("SalesRepresentative")." : ".$usertmp->getFullName($langs), '', 'R');
|
||||
$pdf->MultiCell($w, 3, $langs->transnoentities("SalesRepresentative")." : ".$usertmp->getFullName($langs), '', 'R');
|
||||
}
|
||||
}
|
||||
|
||||
@ -1513,7 +1550,7 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
$top_shift = 0;
|
||||
// Show list of linked objects
|
||||
$current_y = $pdf->getY();
|
||||
$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size);
|
||||
$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, $w, 3, 'R', $default_font_size);
|
||||
if ($current_y < $pdf->getY())
|
||||
{
|
||||
$top_shift = $pdf->getY() - $current_y;
|
||||
@ -1562,8 +1599,7 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
$pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L');
|
||||
|
||||
|
||||
|
||||
// If CUSTOMER contact defined on order, we use it
|
||||
// If CUSTOMER contact defined, we use it
|
||||
$usecontact = false;
|
||||
$arrayidcontact = $object->getIdContact('external', 'CUSTOMER');
|
||||
if (count($arrayidcontact) > 0)
|
||||
@ -1585,9 +1621,10 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
$carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact : ''), $usecontact, 'target', $object);
|
||||
|
||||
// Show recipient
|
||||
$widthrecbox = 100;
|
||||
$widthrecbox = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 100;
|
||||
if ($this->page_largeur < 210) $widthrecbox = 84; // To work with US executive format
|
||||
$posy = 42 + $top_shift;
|
||||
$posy = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 40 : 42;
|
||||
$posy += $top_shift;
|
||||
$posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
|
||||
if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->marge_gauche;
|
||||
|
||||
@ -1601,7 +1638,7 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
// Show recipient name
|
||||
$pdf->SetXY($posx + 2, $posy + 3);
|
||||
$pdf->SetFont('', 'B', $default_font_size);
|
||||
$pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, 'L');
|
||||
$pdf->MultiCell($widthrecbox, 2, $carac_client_name, 0, 'L');
|
||||
|
||||
$posy = $pdf->getY();
|
||||
|
||||
@ -1690,7 +1727,7 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
'align' => 'L',
|
||||
// 'textkey' => 'yourLangKey', // if there is no label, yourLangKey will be translated to replace label
|
||||
// 'label' => ' ', // the final label
|
||||
'padding' => array(0.5, 1, 0.5, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
|
||||
'padding' => array(0.5, 0.5, 0.5, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
|
||||
),
|
||||
'content' => array(
|
||||
'align' => 'L',
|
||||
@ -1698,6 +1735,7 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
),
|
||||
);
|
||||
|
||||
// Image of product
|
||||
$rank = $rank + 10;
|
||||
$this->cols['photo'] = array(
|
||||
'rank' => $rank,
|
||||
@ -1789,14 +1827,25 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
$this->cols['totalexcltax'] = array(
|
||||
'rank' => $rank,
|
||||
'width' => 26, // in mm
|
||||
'status' => true,
|
||||
'status' => empty($conf->global->PDF_PROPAL_HIDE_PRICE_EXCL_TAX) ? true : false,
|
||||
'title' => array(
|
||||
'textkey' => 'TotalHT'
|
||||
),
|
||||
'border-left' => true, // add left line separator
|
||||
);
|
||||
|
||||
// Add extrafields cols
|
||||
$rank = $rank + 1010; // add a big offset to be sure is the last col because default extrafield rank is 100
|
||||
$this->cols['totalincltax'] = array(
|
||||
'rank' => $rank,
|
||||
'width' => 26, // in mm
|
||||
'status' => empty($conf->global->PDF_PROPAL_SHOW_PRICE_INCL_TAX) ? false : true,
|
||||
'title' => array(
|
||||
'textkey' => 'TotalTTC'
|
||||
),
|
||||
'border-left' => true, // add left line separator
|
||||
);
|
||||
|
||||
// Add extrafields cols
|
||||
if (!empty($object->lines)) {
|
||||
$line = reset($object->lines);
|
||||
$this->defineColumnExtrafield($line, $outputlangs, $hidedetails);
|
||||
|
||||
@ -289,7 +289,7 @@ class pdf_sponge extends ModelePDFFactures
|
||||
|
||||
//if (count($realpatharray) == 0) $this->posxpicture=$this->posxtva;
|
||||
|
||||
if ($conf->facture->dir_output)
|
||||
if ($conf->facture->multidir_output[$conf->entity])
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
@ -300,11 +300,11 @@ class pdf_sponge extends ModelePDFFactures
|
||||
// Definition of $dir and $file
|
||||
if ($object->specimen)
|
||||
{
|
||||
$dir = $conf->facture->dir_output;
|
||||
$dir = $conf->facture->multidir_output[$conf->entity];
|
||||
$file = $dir."/SPECIMEN.pdf";
|
||||
} else {
|
||||
$objectref = dol_sanitizeFileName($object->ref);
|
||||
$dir = $conf->facture->dir_output."/".$objectref;
|
||||
$dir = $conf->facture->multidir_output[$conf->entity]."/".$objectref;
|
||||
$file = $dir."/".$objectref.".pdf";
|
||||
}
|
||||
if (!file_exists($dir))
|
||||
@ -386,14 +386,15 @@ class pdf_sponge extends ModelePDFFactures
|
||||
|
||||
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
|
||||
|
||||
// Does we have at least one line with discount $this->atleastonediscount
|
||||
foreach ($object->lines as $line) {
|
||||
if ($line->remise_percent) {
|
||||
$this->atleastonediscount = true;
|
||||
break;
|
||||
// Set $this->atleastonediscount if you have at least one discount
|
||||
for ($i = 0; $i < $nblines; $i++)
|
||||
{
|
||||
if ($object->lines[$i]->remise_percent)
|
||||
{
|
||||
$this->atleastonediscount++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Situation invoice handling
|
||||
if ($object->situation_cycle_ref)
|
||||
@ -458,8 +459,7 @@ class pdf_sponge extends ModelePDFFactures
|
||||
|
||||
// Extrafields in note
|
||||
$extranote = $this->getExtrafieldsInHtml($object, $outputlangs);
|
||||
if (!empty($extranote))
|
||||
{
|
||||
if (!empty($extranote)) {
|
||||
$notetoshow = dol_concatdesc($notetoshow, $extranote);
|
||||
}
|
||||
|
||||
@ -735,7 +735,7 @@ class pdf_sponge extends ModelePDFFactures
|
||||
$nexY = max($pdf->GetY(), $nexY);
|
||||
}
|
||||
|
||||
// Total HT line
|
||||
// Total excl tax line (HT)
|
||||
if ($this->getColumnStatus('totalexcltax'))
|
||||
{
|
||||
$total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails);
|
||||
@ -743,6 +743,14 @@ class pdf_sponge extends ModelePDFFactures
|
||||
$nexY = max($pdf->GetY(), $nexY);
|
||||
}
|
||||
|
||||
// Total with tax line (TTC)
|
||||
if ($this->getColumnStatus('totalincltax'))
|
||||
{
|
||||
$total_incl_tax = pdf_getlinetotalwithtax($object, $i, $outputlangs, $hidedetails);
|
||||
$this->printStdColumnContent($pdf, $curY, 'totalincltax', $total_incl_tax);
|
||||
$nexY = max($pdf->GetY(), $nexY);
|
||||
}
|
||||
|
||||
// Extrafields
|
||||
if (!empty($object->lines[$i]->array_options)) {
|
||||
foreach ($object->lines[$i]->array_options as $extrafieldColKey => $extrafieldValue) {
|
||||
@ -2216,7 +2224,7 @@ class pdf_sponge extends ModelePDFFactures
|
||||
),
|
||||
);
|
||||
|
||||
// PHOTO
|
||||
// Image of product
|
||||
$rank = $rank + 10;
|
||||
$this->cols['photo'] = array(
|
||||
'rank' => $rank,
|
||||
@ -2324,13 +2332,24 @@ class pdf_sponge extends ModelePDFFactures
|
||||
$this->cols['totalexcltax'] = array(
|
||||
'rank' => $rank,
|
||||
'width' => 26, // in mm
|
||||
'status' => true,
|
||||
'status' => empty($conf->global->PDF_PROPAL_HIDE_PRICE_EXCL_TAX) ? true : false,
|
||||
'title' => array(
|
||||
'textkey' => 'TotalHT'
|
||||
),
|
||||
'border-left' => true, // add left line separator
|
||||
);
|
||||
|
||||
$rank = $rank + 1010; // add a big offset to be sure is the last col because default extrafield rank is 100
|
||||
$this->cols['totalincltax'] = array(
|
||||
'rank' => $rank,
|
||||
'width' => 26, // in mm
|
||||
'status' => empty($conf->global->PDF_PROPAL_SHOW_PRICE_INCL_TAX) ? false : true,
|
||||
'title' => array(
|
||||
'textkey' => 'TotalTTC'
|
||||
),
|
||||
'border-left' => true, // add left line separator
|
||||
);
|
||||
|
||||
// Add extrafields cols
|
||||
if (!empty($object->lines)) {
|
||||
$line = reset($object->lines);
|
||||
|
||||
@ -173,8 +173,8 @@ class pdf_azur extends ModelePDFPropales
|
||||
$this->posxqty = 135;
|
||||
$this->posxunit = 151;
|
||||
} else {
|
||||
$this->posxtva = 110;
|
||||
$this->posxup = 126;
|
||||
$this->posxtva = 106;
|
||||
$this->posxup = 122;
|
||||
$this->posxqty = 145;
|
||||
$this->posxunit = 162;
|
||||
}
|
||||
|
||||
@ -57,7 +57,7 @@ class pdf_cyan extends ModelePDFPropales
|
||||
public $description;
|
||||
|
||||
/**
|
||||
* @var string Save the name of generated file as the main doc when generating a doc with this template
|
||||
* @var int Save the name of generated file as the main doc when generating a doc with this template
|
||||
*/
|
||||
public $update_main_doc_field;
|
||||
|
||||
@ -119,7 +119,12 @@ class pdf_cyan extends ModelePDFPropales
|
||||
*/
|
||||
public $emetteur;
|
||||
|
||||
|
||||
/**
|
||||
* @var array of document table collumns
|
||||
*/
|
||||
public $cols;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@ -164,11 +169,13 @@ class pdf_cyan extends ModelePDFPropales
|
||||
if (empty($this->emetteur->country_code)) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default, if was not defined
|
||||
|
||||
// Define position of columns
|
||||
$this->posxdesc = $this->marge_gauche + 1;
|
||||
|
||||
$this->posxdesc = $this->marge_gauche + 1; // used for notes ans other stuff
|
||||
|
||||
|
||||
$this->tabTitleHeight = 5; // default height
|
||||
|
||||
// Use new system for position of columns, view $this->defineColumnField()
|
||||
|
||||
$this->tva = array();
|
||||
$this->localtax1 = array();
|
||||
$this->localtax2 = array();
|
||||
@ -197,7 +204,7 @@ class pdf_cyan extends ModelePDFPropales
|
||||
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
|
||||
if (!empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output = 'ISO-8859-1';
|
||||
|
||||
// Load traductions files required by page
|
||||
// Load translation files required by page
|
||||
$outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products", "propal"));
|
||||
|
||||
if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) {
|
||||
@ -344,15 +351,15 @@ class pdf_cyan extends ModelePDFPropales
|
||||
|
||||
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
|
||||
|
||||
// Does we have at least one line with discount $this->atleastonediscount
|
||||
foreach ($object->lines as $line) {
|
||||
if ($line->remise_percent) {
|
||||
$this->atleastonediscount = true;
|
||||
break;
|
||||
// Set $this->atleastonediscount if you have at least one discount
|
||||
for ($i = 0; $i < $nblines; $i++)
|
||||
{
|
||||
if ($object->lines[$i]->remise_percent)
|
||||
{
|
||||
$this->atleastonediscount++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// New page
|
||||
$pdf->AddPage();
|
||||
@ -365,7 +372,7 @@ class pdf_cyan extends ModelePDFPropales
|
||||
$heightforfooter = $this->marge_basse + (empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 12 : 22); // Height reserved to output the footer (value include bottom margin)
|
||||
//print $heightforinfotot + $heightforsignature + $heightforfreetext + $heightforfooter;exit;
|
||||
|
||||
$top_shift = $this->_pagehead($pdf, $object, 1, $outputlangs);
|
||||
$top_shift = $this->_pagehead($pdf, $object, 1, $outputlangs, $outputlangsbis);
|
||||
$pdf->SetFont('', '', $default_font_size - 1);
|
||||
$pdf->MultiCell(0, 3, ''); // Set interline to 3
|
||||
$pdf->SetTextColor(0, 0, 0);
|
||||
@ -397,7 +404,7 @@ class pdf_cyan extends ModelePDFPropales
|
||||
}
|
||||
}
|
||||
|
||||
// Affiche notes
|
||||
// Displays notes
|
||||
$notetoshow = empty($object->note_public) ? '' : $object->note_public;
|
||||
if (!empty($conf->global->MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE))
|
||||
{
|
||||
@ -454,7 +461,7 @@ class pdf_cyan extends ModelePDFPropales
|
||||
{
|
||||
$pdf->rollbackTransaction(true);
|
||||
|
||||
// prepar pages to receive notes
|
||||
// prepare pages to receive notes
|
||||
while ($pagenb < $pageposafternote) {
|
||||
$pdf->AddPage();
|
||||
$pagenb++;
|
||||
@ -488,7 +495,7 @@ class pdf_cyan extends ModelePDFPropales
|
||||
}
|
||||
|
||||
|
||||
// apply note frame to previus pages
|
||||
// apply note frame to previous pages
|
||||
$i = $pageposbeforenote;
|
||||
while ($i < $pageposafternote) {
|
||||
$pdf->setPage($i);
|
||||
@ -544,10 +551,10 @@ class pdf_cyan extends ModelePDFPropales
|
||||
$height_note = 0;
|
||||
}
|
||||
|
||||
// Use new auto collum system
|
||||
// Use new auto column system
|
||||
$this->prepareArrayColumnField($object, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
|
||||
// Simulation de tableau pour connaitre la hauteur de la ligne de titre
|
||||
// tab simulation to know line height
|
||||
$pdf->startTransaction();
|
||||
$this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
|
||||
$pdf->rollbackTransaction(true);
|
||||
@ -582,7 +589,6 @@ class pdf_cyan extends ModelePDFPropales
|
||||
{
|
||||
$pdf->AddPage('', '', true);
|
||||
if (!empty($tplidx)) $pdf->useTemplate($tplidx);
|
||||
//if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
|
||||
$pdf->setPage($pageposbefore + 1);
|
||||
|
||||
$curY = $tab_top_newpage;
|
||||
@ -656,7 +662,7 @@ class pdf_cyan extends ModelePDFPropales
|
||||
$pdf->setPage($pageposafter); $curY = $tab_top_newpage;
|
||||
}
|
||||
|
||||
$pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut
|
||||
$pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font
|
||||
|
||||
// VAT Rate
|
||||
if ($this->getColumnStatus('vat'))
|
||||
@ -700,7 +706,7 @@ class pdf_cyan extends ModelePDFPropales
|
||||
$nexY = max($pdf->GetY(), $nexY);
|
||||
}
|
||||
|
||||
// Total HT line
|
||||
// Total excl tax line (HT)
|
||||
if ($this->getColumnStatus('totalexcltax'))
|
||||
{
|
||||
$total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails);
|
||||
@ -708,6 +714,14 @@ class pdf_cyan extends ModelePDFPropales
|
||||
$nexY = max($pdf->GetY(), $nexY);
|
||||
}
|
||||
|
||||
// Total with tax line (TTC)
|
||||
if ($this->getColumnStatus('totalincltax'))
|
||||
{
|
||||
$total_incl_tax = pdf_getlinetotalwithtax($object, $i, $outputlangs, $hidedetails);
|
||||
$this->printStdColumnContent($pdf, $curY, 'totalincltax', $total_incl_tax);
|
||||
$nexY = max($pdf->GetY(), $nexY);
|
||||
}
|
||||
|
||||
// Extrafields
|
||||
if (!empty($object->lines[$i]->array_options)) {
|
||||
foreach ($object->lines[$i]->array_options as $extrafieldColKey => $extrafieldValue) {
|
||||
@ -732,8 +746,7 @@ class pdf_cyan extends ModelePDFPropales
|
||||
$reshook = $hookmanager->executeHooks('printPDFline', $parameters, $this); // Note that $object may have been modified by hook
|
||||
|
||||
|
||||
|
||||
// Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva
|
||||
// Collection of totals by value of vat in $this->tva["rate"] = total_tva
|
||||
if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne = $object->lines[$i]->multicurrency_total_tva;
|
||||
else $tvaligne = $object->lines[$i]->total_tva;
|
||||
|
||||
@ -826,13 +839,13 @@ class pdf_cyan extends ModelePDFPropales
|
||||
$bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforsignature - $heightforfooter + 1;
|
||||
}
|
||||
|
||||
// Affiche zone infos
|
||||
// Display infos area
|
||||
$posy = $this->drawInfoTable($pdf, $object, $bottomlasttab, $outputlangs);
|
||||
|
||||
// Affiche zone totaux
|
||||
// Display total zone
|
||||
$posy = $this->drawTotalTable($pdf, $object, 0, $bottomlasttab, $outputlangs);
|
||||
|
||||
// Affiche zone versements
|
||||
// Display payment area
|
||||
/*
|
||||
if ($deja_regle || $amount_credit_notes_included || $amount_deposits_included)
|
||||
{
|
||||
@ -1121,10 +1134,10 @@ class pdf_cyan extends ModelePDFPropales
|
||||
// If payment mode not forced or forced to VIR, show payment with BAN
|
||||
if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'VIR')
|
||||
{
|
||||
if (!empty($object->fk_account) || !empty($object->fk_bank) || !empty($conf->global->FACTURE_RIB_NUMBER))
|
||||
if ($object->fk_account > 0 || $object->fk_bank > 0 || !empty($conf->global->FACTURE_RIB_NUMBER))
|
||||
{
|
||||
$bankid = (empty($object->fk_account) ? $conf->global->FACTURE_RIB_NUMBER : $object->fk_account);
|
||||
if (!empty($object->fk_bank)) $bankid = $object->fk_bank; // For backward compatibility when object->fk_account is forced with object->fk_bank
|
||||
$bankid = ($object->fk_account <= 0 ? $conf->global->FACTURE_RIB_NUMBER : $object->fk_account);
|
||||
if ($object->fk_bank > 0) $bankid = $object->fk_bank; // For backward compatibility when object->fk_account is forced with object->fk_bank
|
||||
$account = new Account($this->db);
|
||||
$account->fetch($bankid);
|
||||
|
||||
@ -1154,15 +1167,23 @@ class pdf_cyan extends ModelePDFPropales
|
||||
*/
|
||||
protected function drawTotalTable(&$pdf, $object, $deja_regle, $posy, $outputlangs)
|
||||
{
|
||||
global $conf, $mysoc;
|
||||
global $conf, $mysoc, $hookmanager;
|
||||
|
||||
$default_font_size = pdf_getPDFFontSize($outputlangs);
|
||||
|
||||
$outputlangsbis = null;
|
||||
if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) {
|
||||
$outputlangsbis = new Translate('', $conf);
|
||||
$outputlangsbis->setDefaultLang($conf->global->PDF_USE_ALSO_LANGUAGE_CODE);
|
||||
$outputlangsbis->loadLangs(array("main", "dict", "companies", "bills", "products", "propal"));
|
||||
$default_font_size--;
|
||||
}
|
||||
|
||||
$tab2_top = $posy;
|
||||
$tab2_hl = 4;
|
||||
$pdf->SetFont('', '', $default_font_size - 1);
|
||||
|
||||
// Tableau total
|
||||
// Total table
|
||||
$col1x = 120; $col2x = 170;
|
||||
if ($this->page_largeur < 210) // To work with US executive format
|
||||
{
|
||||
@ -1173,13 +1194,6 @@ class pdf_cyan extends ModelePDFPropales
|
||||
$useborder = 0;
|
||||
$index = 0;
|
||||
|
||||
$outputlangsbis = null;
|
||||
if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) {
|
||||
$outputlangsbis = new Translate('', $conf);
|
||||
$outputlangsbis->setDefaultLang($conf->global->PDF_USE_ALSO_LANGUAGE_CODE);
|
||||
$outputlangsbis->loadLangs(array("main", "dict", "companies", "bills", "products", "propal"));
|
||||
}
|
||||
|
||||
// Total HT
|
||||
$pdf->SetFillColor(255, 255, 255);
|
||||
$pdf->SetXY($col1x, $tab2_top + 0);
|
||||
@ -1387,6 +1401,7 @@ class pdf_cyan extends ModelePDFPropales
|
||||
|
||||
if ($deja_regle > 0)
|
||||
{
|
||||
// Already paid + Deposits
|
||||
$index++;
|
||||
|
||||
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
|
||||
@ -1440,9 +1455,10 @@ class pdf_cyan extends ModelePDFPropales
|
||||
* @param int $hidetop 1=Hide top bar of array and title, 0=Hide nothing, -1=Hide only title
|
||||
* @param int $hidebottom Hide bottom bar of array
|
||||
* @param string $currency Currency code
|
||||
* @param Translate $outputlangsbis Langs object bis
|
||||
* @return void
|
||||
*/
|
||||
protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
|
||||
protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '', $outputlangsbis = null)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@ -1460,6 +1476,10 @@ class pdf_cyan extends ModelePDFPropales
|
||||
if (empty($hidetop))
|
||||
{
|
||||
$titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency".$currency));
|
||||
if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && is_object($outputlangsbis)) {
|
||||
$titre .= ' - '.$outputlangsbis->transnoentities("AmountInCurrency", $outputlangsbis->transnoentitiesnoconv("Currency".$currency));
|
||||
}
|
||||
|
||||
$pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4);
|
||||
$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
|
||||
|
||||
@ -1490,9 +1510,10 @@ class pdf_cyan extends ModelePDFPropales
|
||||
* @param Object $object Object to show
|
||||
* @param int $showaddress 0=no, 1=yes
|
||||
* @param Translate $outputlangs Object lang for output
|
||||
* @param Translate $outputlangsbis Object lang for output bis
|
||||
* @return void
|
||||
*/
|
||||
protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
|
||||
protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $outputlangsbis = null)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
@ -1512,8 +1533,10 @@ class pdf_cyan extends ModelePDFPropales
|
||||
$pdf->SetTextColor(0, 0, 60);
|
||||
$pdf->SetFont('', 'B', $default_font_size + 3);
|
||||
|
||||
$w = 100;
|
||||
|
||||
$posy = $this->marge_haute;
|
||||
$posx = $this->page_largeur - $this->marge_droite - 100;
|
||||
$posx = $this->page_largeur - $this->marge_droite - $w;
|
||||
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
|
||||
@ -1537,12 +1560,12 @@ class pdf_cyan extends ModelePDFPropales
|
||||
} else {
|
||||
$pdf->SetTextColor(200, 0, 0);
|
||||
$pdf->SetFont('', 'B', $default_font_size - 2);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L');
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L');
|
||||
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L');
|
||||
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L');
|
||||
}
|
||||
} else {
|
||||
$text = $this->emetteur->name;
|
||||
$pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
|
||||
$pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
|
||||
}
|
||||
}
|
||||
|
||||
@ -1550,7 +1573,7 @@ class pdf_cyan extends ModelePDFPropales
|
||||
$pdf->SetXY($posx, $posy);
|
||||
$pdf->SetTextColor(0, 0, 60);
|
||||
$title = $outputlangs->transnoentities("PdfCommercialProposalTitle");
|
||||
$pdf->MultiCell(100, 4, $title, '', 'R');
|
||||
$pdf->MultiCell($w, 4, $title, '', 'R');
|
||||
|
||||
$pdf->SetFont('', 'B', $default_font_size);
|
||||
|
||||
@ -1567,7 +1590,7 @@ class pdf_cyan extends ModelePDFPropales
|
||||
$posy += 4;
|
||||
$pdf->SetXY($posx, $posy);
|
||||
$pdf->SetTextColor(0, 0, 60);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R');
|
||||
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R');
|
||||
}
|
||||
|
||||
if (!empty($conf->global->PDF_SHOW_PROJECT_TITLE))
|
||||
@ -1597,7 +1620,7 @@ class pdf_cyan extends ModelePDFPropales
|
||||
$posy += 4;
|
||||
$pdf->SetXY($posx, $posy);
|
||||
$pdf->SetTextColor(0, 0, 60);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("Date")." : ".dol_print_date($object->date, "day", false, $outputlangs, true), '', 'R');
|
||||
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("Date")." : ".dol_print_date($object->date, "day", false, $outputlangs, true), '', 'R');
|
||||
|
||||
$posy += 4;
|
||||
$pdf->SetXY($posx, $posy);
|
||||
@ -1609,7 +1632,7 @@ class pdf_cyan extends ModelePDFPropales
|
||||
$posy += 4;
|
||||
$pdf->SetXY($posx, $posy);
|
||||
$pdf->SetTextColor(0, 0, 60);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : ".$outputlangs->transnoentities($object->thirdparty->code_client), '', 'R');
|
||||
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("CustomerCode")." : ".$outputlangs->transnoentities($object->thirdparty->code_client), '', 'R');
|
||||
}
|
||||
|
||||
// Get contact
|
||||
@ -1623,7 +1646,7 @@ class pdf_cyan extends ModelePDFPropales
|
||||
$posy += 4;
|
||||
$pdf->SetXY($posx, $posy);
|
||||
$pdf->SetTextColor(0, 0, 60);
|
||||
$pdf->MultiCell(100, 3, $langs->trans("SalesRepresentative")." : ".$usertmp->getFullName($langs), '', 'R');
|
||||
$pdf->MultiCell($w, 3, $langs->transnoentities("SalesRepresentative")." : ".$usertmp->getFullName($langs), '', 'R');
|
||||
}
|
||||
}
|
||||
|
||||
@ -1632,7 +1655,7 @@ class pdf_cyan extends ModelePDFPropales
|
||||
$top_shift = 0;
|
||||
// Show list of linked objects
|
||||
$current_y = $pdf->getY();
|
||||
$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size);
|
||||
$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, $w, 3, 'R', $default_font_size);
|
||||
if ($current_y < $pdf->getY())
|
||||
{
|
||||
$top_shift = $pdf->getY() - $current_y;
|
||||
@ -1703,9 +1726,10 @@ class pdf_cyan extends ModelePDFPropales
|
||||
$carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact : ''), $usecontact, 'target', $object);
|
||||
|
||||
// Show recipient
|
||||
$widthrecbox = 100;
|
||||
$widthrecbox = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 100;
|
||||
if ($this->page_largeur < 210) $widthrecbox = 84; // To work with US executive format
|
||||
$posy = 42 + $top_shift;
|
||||
$posy = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 40 : 42;
|
||||
$posy += $top_shift;
|
||||
$posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
|
||||
if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->marge_gauche;
|
||||
|
||||
@ -1719,7 +1743,7 @@ class pdf_cyan extends ModelePDFPropales
|
||||
// Show recipient name
|
||||
$pdf->SetXY($posx + 2, $posy + 3);
|
||||
$pdf->SetFont('', 'B', $default_font_size);
|
||||
$pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, 'L');
|
||||
$pdf->MultiCell($widthrecbox, 2, $carac_client_name, 0, 'L');
|
||||
|
||||
$posy = $pdf->getY();
|
||||
|
||||
@ -1840,7 +1864,7 @@ class pdf_cyan extends ModelePDFPropales
|
||||
'align' => 'L',
|
||||
// 'textkey' => 'yourLangKey', // if there is no label, yourLangKey will be translated to replace label
|
||||
// 'label' => ' ', // the final label
|
||||
'padding' => array(0.5, 1, 0.5, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
|
||||
'padding' => array(0.5, 0.5, 0.5, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
|
||||
),
|
||||
'content' => array(
|
||||
'align' => 'L',
|
||||
@ -1848,6 +1872,7 @@ class pdf_cyan extends ModelePDFPropales
|
||||
),
|
||||
);
|
||||
|
||||
// Image of product
|
||||
$rank = $rank + 10;
|
||||
$this->cols['photo'] = array(
|
||||
'rank' => $rank,
|
||||
@ -1939,13 +1964,24 @@ class pdf_cyan extends ModelePDFPropales
|
||||
$this->cols['totalexcltax'] = array(
|
||||
'rank' => $rank,
|
||||
'width' => 26, // in mm
|
||||
'status' => true,
|
||||
'status' => empty($conf->global->PDF_PROPAL_HIDE_PRICE_EXCL_TAX) ? true : false,
|
||||
'title' => array(
|
||||
'textkey' => 'TotalHT'
|
||||
),
|
||||
'border-left' => true, // add left line separator
|
||||
);
|
||||
|
||||
$rank = $rank + 1010; // add a big offset to be sure is the last col because default extrafield rank is 100
|
||||
$this->cols['totalincltax'] = array(
|
||||
'rank' => $rank,
|
||||
'width' => 26, // in mm
|
||||
'status' => empty($conf->global->PDF_PROPAL_SHOW_PRICE_INCL_TAX) ? false : true,
|
||||
'title' => array(
|
||||
'textkey' => 'TotalTTC'
|
||||
),
|
||||
'border-left' => true, // add left line separator
|
||||
);
|
||||
|
||||
// Add extrafields cols
|
||||
if (!empty($object->lines)) {
|
||||
$line = reset($object->lines);
|
||||
|
||||
@ -1285,9 +1285,9 @@ class Cronjob extends CommonObject
|
||||
elseif ($lastresult) $moretext .= ' ('.$langs->trans("Error").')';
|
||||
|
||||
$this->labelStatus[self::STATUS_DISABLED] = $langs->trans('Disabled').$moretext;
|
||||
$this->labelStatus[self::STATUS_ENABLED] = $langs->trans('Enabled').$moretext;
|
||||
$this->labelStatus[self::STATUS_ENABLED] = $langs->trans('Scheduled').$moretext;
|
||||
$this->labelStatusShort[self::STATUS_DISABLED] = $langs->trans('Disabled');
|
||||
$this->labelStatusShort[self::STATUS_ENABLED] = $langs->trans('Enabled');
|
||||
$this->labelStatusShort[self::STATUS_ENABLED] = $langs->trans('Scheduled');
|
||||
}
|
||||
|
||||
$statusType = 'status4';
|
||||
|
||||
@ -372,7 +372,7 @@ print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print $form->selectarray('search_status', array('0'=>$langs->trans("Disabled"), '1'=>$langs->trans("Enabled")), $search_status, 1);
|
||||
print $form->selectarray('search_status', array('0'=>$langs->trans("Disabled"), '1'=>$langs->trans("Scheduled")), $search_status, 1);
|
||||
print '</td><td class="liste_titre right">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
|
||||
@ -2665,10 +2665,10 @@ if ($action == 'create')
|
||||
print '</td><td colspan="2">';
|
||||
if ($action == 'editmode')
|
||||
{
|
||||
$form->formTransportMode($_SERVER['PHP_SELF'].'?id='.$object->id, $object->transport_mode_id, 'transport_mode_id', 1, 1);
|
||||
$form->formSelectTransportMode($_SERVER['PHP_SELF'].'?id='.$object->id, $object->transport_mode_id, 'transport_mode_id', 1, 1);
|
||||
}
|
||||
else {
|
||||
$form->formTransportMode($_SERVER['PHP_SELF'].'?id='.$object->id, $object->transport_mode_id, 'none');
|
||||
$form->formSelectTransportMode($_SERVER['PHP_SELF'].'?id='.$object->id, $object->transport_mode_id, 'none');
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
@ -139,7 +139,7 @@ CREATE TABLE llx_intracommreport
|
||||
content_xml text,
|
||||
type_export varchar(10),
|
||||
datec datetime,
|
||||
tms timestamp
|
||||
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
)ENGINE=innodb;
|
||||
|
||||
ALTER TABLE llx_c_incoterms ADD COLUMN label varchar(100) NULL;
|
||||
|
||||
@ -35,7 +35,7 @@ CREATE TABLE llx_ecm_files
|
||||
gen_or_uploaded varchar(12), -- 'generated' or 'uploaded'
|
||||
extraparams varchar(255), -- for stocking other parameters with json format
|
||||
date_c datetime,
|
||||
date_m timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
fk_user_c integer,
|
||||
fk_user_m integer,
|
||||
acl text -- for future permission 'per file'
|
||||
|
||||
@ -47,6 +47,7 @@ CronNbRun=Number of launches
|
||||
CronMaxRun=Maximum number of launches
|
||||
CronEach=Every
|
||||
JobFinished=Job launched and finished
|
||||
Scheduled=Scheduled
|
||||
#Page card
|
||||
CronAdd= Add jobs
|
||||
CronEvery=Execute job each
|
||||
@ -57,7 +58,7 @@ CronNote=Comment
|
||||
CronFieldMandatory=Fields %s is mandatory
|
||||
CronErrEndDateStartDt=End date cannot be before start date
|
||||
StatusAtInstall=Status at module installation
|
||||
CronStatusActiveBtn=Enable
|
||||
CronStatusActiveBtn=Schedule
|
||||
CronStatusInactiveBtn=Disable
|
||||
CronTaskInactive=This job is disabled
|
||||
CronId=Id
|
||||
|
||||
@ -590,21 +590,19 @@ $showdatefilter = 0;
|
||||
if (!$showdatefilter)
|
||||
{
|
||||
print '<div class="center centpercent">';
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">';
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="tablename" value="'.$tablename.'">';
|
||||
print '<input type="hidden" name="action" value="view">';
|
||||
print '<table class="center"><tr>';
|
||||
print '<td>'.$langs->trans("From").' ';
|
||||
print $form->selectDate($dates, 'dates', 0, 0, 1, '', 1, 0);
|
||||
print '</td>';
|
||||
print '<td>'.$langs->trans("to").' ';
|
||||
print $form->selectDate($datee, 'datee', 0, 0, 1, '', 1, 0);
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print '<div class="inline-block">';
|
||||
print $form->selectDate($dates, 'dates', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
|
||||
print '</div>';
|
||||
print '<div class="inline-block">';
|
||||
print $form->selectDate($datee, 'datee', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
|
||||
print '</div>';
|
||||
print '<div class="inline-block">';
|
||||
print '<input type="submit" name="refresh" value="'.$langs->trans("Refresh").'" class="button">';
|
||||
print '</td>';
|
||||
print '</tr></table>';
|
||||
print '</div>';
|
||||
print '</form>';
|
||||
print '</div>';
|
||||
|
||||
|
||||
@ -539,7 +539,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td>';
|
||||
print '<input type="text" name="label" autofocus class="minwidth500" value="'.$label.'">';
|
||||
print '<input type="text" name="label" autofocus class="minwidth500 maxwidthonsmartphone" value="'.$label.'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// List of projects
|
||||
@ -704,16 +704,16 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third
|
||||
|
||||
if (!empty($arrayfields['t.dateo']['checked'])) {
|
||||
print '<td class="liste_titre center">';
|
||||
print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_dtstartday" value="'.$search_dtstartday.'">';
|
||||
print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_dtstartmonth" value="'.$search_dtstartmonth.'">';
|
||||
print '<span class="nowraponall"><input class="flat valignmiddle width20" type="text" maxlength="2" name="search_dtstartday" value="'.$search_dtstartday.'">';
|
||||
print '<input class="flat valignmiddle width20" type="text" maxlength="2" name="search_dtstartmonth" value="'.$search_dtstartmonth.'"></span>';
|
||||
$formother->select_year($search_dtstartyear ? $search_dtstartyear : -1, 'search_dtstartyear', 1, 20, 5);
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
if (!empty($arrayfields['t.datee']['checked'])) {
|
||||
print '<td class="liste_titre center">';
|
||||
print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_dtendday" value="'.$search_dtendday.'">';
|
||||
print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_dtendmonth" value="'.$search_dtendmonth.'">';
|
||||
print '<span class="nowraponall"><input class="flat valignmiddle width20" type="text" maxlength="2" name="search_dtendday" value="'.$search_dtendday.'">';
|
||||
print '<input class="flat valignmiddle width20" type="text" maxlength="2" name="search_dtendmonth" value="'.$search_dtendmonth.'"></span>';
|
||||
$formother->select_year($search_dtendyear ? $search_dtendyear : -1, 'search_dtendyear', 1, 20, 5);
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
@ -2103,7 +2103,7 @@ class SupplierProposal extends CommonObject
|
||||
$sql .= " c.datec, c.date_valid as datev, c.date_cloture as dateo,";
|
||||
$sql .= " c.fk_user_author, c.fk_user_valid, c.fk_user_cloture";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."supplier_proposal as c";
|
||||
$sql .= " WHERE c.rowid = ".$id;
|
||||
$sql .= " WHERE c.rowid = ".((int) $id);
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
|
||||
@ -42,6 +42,7 @@ $catname = GETPOST('catname', 'alpha');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$printer1 = GETPOST('printer1', 'alpha');
|
||||
$printer2 = GETPOST('printer2', 'alpha');
|
||||
$printer3 = GETPOST('printer3', 'alpha');
|
||||
|
||||
if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility
|
||||
|
||||
@ -64,6 +65,14 @@ if ($action == "SavePrinter2") {
|
||||
dolibarr_set_const($db, "TAKEPOS_PRINTED_CATEGORIES_2", $printedcategories, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
|
||||
if ($action == "SavePrinter3") {
|
||||
$printedcategories = ";";
|
||||
if (is_array($printer3)) foreach ($printer3 as $cat) {
|
||||
$printedcategories = $printedcategories.$cat.";";
|
||||
}
|
||||
dolibarr_set_const($db, "TAKEPOS_PRINTED_CATEGORIES_3", $printedcategories, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
@ -206,6 +215,33 @@ if ($nbofentries > 0)
|
||||
print '</table></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
//Printer3
|
||||
print '<table class="liste nohover" width="100%">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Printer").' 3</td><td></td><td class="right">';
|
||||
print '</td></tr>';
|
||||
$nbofentries = (count($data) - 1);
|
||||
print '<form action="orderprinters.php">';
|
||||
if ($nbofentries > 0)
|
||||
{
|
||||
print '<tr class="pair"><td colspan="3">';
|
||||
print '<input type="hidden" name="action" value="SavePrinter3">';
|
||||
foreach ($data as $row) {
|
||||
if (strpos($conf->global->TAKEPOS_PRINTED_CATEGORIES_3, ';'.$row["rowid"].';') !== false) $checked = 'checked'; else $checked = '';
|
||||
if ($row["fk_menu"] == 0) print '<input type="checkbox" name="printer3[]" value="'.$row["rowid"].'" '.$checked.'>'.$row["label"].'<br>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
} else {
|
||||
print '<tr class="pair">';
|
||||
print '<td colspan="3"><table class="nobordernopadding"><tr class="nobordernopadding"><td>'.img_picto_common('', 'treemenu/branchbottom.gif').'</td>';
|
||||
print '<td valign="middle">';
|
||||
print $langs->trans("NoCategoryYet");
|
||||
print '</td>';
|
||||
print '<td> </td>';
|
||||
print '</table></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
print '<input type="submit" value="'.$langs->trans("Save").'"></form>';
|
||||
|
||||
|
||||
@ -87,6 +87,7 @@ if (GETPOST('action', 'alpha') == 'set')
|
||||
$res = dolibarr_set_const($db, "TAKEPOS_PRINTER_TO_USE".$terminaltouse, GETPOST('TAKEPOS_PRINTER_TO_USE'.$terminaltouse, 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, "TAKEPOS_ORDER_PRINTER1_TO_USE".$terminaltouse, GETPOST('TAKEPOS_ORDER_PRINTER1_TO_USE'.$terminaltouse, 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, "TAKEPOS_ORDER_PRINTER2_TO_USE".$terminaltouse, GETPOST('TAKEPOS_ORDER_PRINTER2_TO_USE'.$terminaltouse, 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, "TAKEPOS_ORDER_PRINTER3_TO_USE".$terminaltouse, GETPOST('TAKEPOS_ORDER_PRINTER3_TO_USE'.$terminaltouse, 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, "TAKEPOS_TEMPLATE_TO_USE_FOR_INVOICES".$terminaltouse, GETPOST('TAKEPOS_TEMPLATE_TO_USE_FOR_INVOICES'.$terminaltouse, 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, "TAKEPOS_TEMPLATE_TO_USE_FOR_ORDERS".$terminaltouse, GETPOST('TAKEPOS_TEMPLATE_TO_USE_FOR_ORDERS'.$terminaltouse, 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
|
||||
@ -242,6 +243,10 @@ if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter") {
|
||||
print '<td>';
|
||||
print $form->selectarray('TAKEPOS_ORDER_PRINTER2_TO_USE'.$terminal, $printers, (empty($conf->global->{'TAKEPOS_ORDER_PRINTER2_TO_USE'.$terminal}) ? '0' : $conf->global->{'TAKEPOS_ORDER_PRINTER2_TO_USE'.$terminal}), 1);
|
||||
print '</td></tr>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("OrderPrinterToUse").' - '.$langs->trans("Printer").' 3</td>';
|
||||
print '<td>';
|
||||
print $form->selectarray('TAKEPOS_ORDER_PRINTER3_TO_USE'.$terminal, $printers, (empty($conf->global->{'TAKEPOS_ORDER_PRINTER3_TO_USE'.$terminal}) ? '0' : $conf->global->{'TAKEPOS_ORDER_PRINTER3_TO_USE'.$terminal}), 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
$printer->listPrintersTemplates();
|
||||
$templates = array();
|
||||
|
||||
@ -532,8 +532,10 @@ if ($action == "order" and $placeid != 0)
|
||||
$footerorder = '</tbody></table>'.dol_print_date(dol_now(), 'dayhour').'<br></html>';
|
||||
$order_receipt_printer1 = "";
|
||||
$order_receipt_printer2 = "";
|
||||
$order_receipt_printer3 = "";
|
||||
$catsprinter1 = explode(';', $conf->global->TAKEPOS_PRINTED_CATEGORIES_1);
|
||||
$catsprinter2 = explode(';', $conf->global->TAKEPOS_PRINTED_CATEGORIES_2);
|
||||
$catsprinter3 = explode(';', $conf->global->TAKEPOS_PRINTED_CATEGORIES_3);
|
||||
foreach ($invoice->lines as $line)
|
||||
{
|
||||
if ($line->special_code == "4") {
|
||||
@ -588,6 +590,34 @@ if ($action == "order" and $placeid != 0)
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."facturedet set special_code='4' where special_code='2' and fk_facture=".$invoice->id; // Set as printed
|
||||
$db->query($sql);
|
||||
$invoice->fetch($placeid); //Reload object after set lines as printed
|
||||
$linestoprint = 0;
|
||||
|
||||
foreach ($invoice->lines as $line)
|
||||
{
|
||||
if ($line->special_code == "4") {
|
||||
continue;
|
||||
}
|
||||
$c = new Categorie($db);
|
||||
$existing = $c->containing($line->fk_product, Categorie::TYPE_PRODUCT, 'id');
|
||||
$result = array_intersect($catsprinter3, $existing);
|
||||
$count = count($result);
|
||||
if ($count > 0) {
|
||||
$linestoprint++;
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."facturedet set special_code='3' where rowid=".$line->id; //Set to print on printer 3
|
||||
$db->query($sql);
|
||||
$order_receipt_printer3 .= '<tr>'.$line->product_label.'<td class="right">'.$line->qty;
|
||||
if (!empty($line->array_options['options_order_notes'])) $order_receipt_printer3 .= "<br>(".$line->array_options['options_order_notes'].")";
|
||||
$order_receipt_printer3 .= '</td></tr>';
|
||||
}
|
||||
}
|
||||
if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter" && $linestoprint > 0) {
|
||||
$invoice->fetch($placeid); //Reload object before send to printer
|
||||
$printer->orderprinter = 3;
|
||||
$ret = $printer->sendToPrinter($invoice, $conf->global->{'TAKEPOS_TEMPLATE_TO_USE_FOR_ORDERS'.$_SESSION["takeposterminal"]}, $conf->global->{'TAKEPOS_ORDER_PRINTER3_TO_USE'.$_SESSION["takeposterminal"]}); // PRINT TO PRINTER 3
|
||||
}
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."facturedet set special_code='4' where special_code='3' and fk_facture=".$invoice->id; // Set as printed
|
||||
$db->query($sql);
|
||||
$invoice->fetch($placeid); //Reload object after set lines as printed
|
||||
}
|
||||
|
||||
$sectionwithinvoicelink = '';
|
||||
@ -863,7 +893,7 @@ if (!empty($conf->use_javascript_ajax))
|
||||
print '<!-- invoice.php place='.(int) $place.' invoice='.$invoice->ref.' mobilepage='.$mobilepage.' $_SESSION["basiclayout"]='.$_SESSION["basiclayout"].' conf->global->TAKEPOS_BAR_RESTAURANT='.$conf->global->TAKEPOS_BAR_RESTAURANT.' -->'."\n";
|
||||
print '<div class="div-table-responsive-no-min invoice">';
|
||||
print '<table id="tablelines" class="noborder noshadow postablelines" width="100%">';
|
||||
if ($mobilepage == "invoice" || $mobilepage == "") {
|
||||
if ($sectionwithinvoicelink && ($mobilepage == "invoice" || $mobilepage == "")) {
|
||||
print '<tr><td colspan="4">'.$sectionwithinvoicelink.'</td></tr>';
|
||||
}
|
||||
print '<tr class="liste_titre nodrag nodrop">';
|
||||
|
||||
@ -1275,6 +1275,10 @@ table[summary="list_of_modules"] .fa-cog {
|
||||
width: calc(100% - 50px) !important;
|
||||
display: inline-block;
|
||||
}
|
||||
.widthcentpercentminusxx {
|
||||
width: calc(100% - 70px) !important;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
/* Force values for small screen 767 */
|
||||
@media only screen and (max-width: 767px)
|
||||
@ -1287,6 +1291,10 @@ table[summary="list_of_modules"] .fa-cog {
|
||||
padding-right: 5px;
|
||||
}
|
||||
|
||||
div.divphotoref {
|
||||
padding-right: 10px !important;
|
||||
}
|
||||
|
||||
.hideonsmartphone { display: none; }
|
||||
.hideonsmartphoneimp { display: none !important; }
|
||||
|
||||
@ -1298,15 +1306,10 @@ table[summary="list_of_modules"] .fa-cog {
|
||||
margin-bottom: 15px !important;
|
||||
}
|
||||
|
||||
select.minwidth100imp, select.minwidth100, select.minwidth200, select.minwidth300 {
|
||||
width: calc(100% - 50px) !important;
|
||||
select.minwidth100imp, select.minwidth100, select.minwidth200, select.minwidth200imp, select.minwidth300 {
|
||||
width: calc(100% - 40px) !important;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.clearbothonsmartphone { clear: both; display: block; }
|
||||
/*img.photoref, div.photoref {
|
||||
box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.2);
|
||||
}*/
|
||||
}
|
||||
|
||||
/* Force values for small screen 570 */
|
||||
@ -3757,6 +3760,15 @@ ul.noborder li:nth-child(even):not(.liste_titre) {
|
||||
|
||||
@media only screen and (max-width: 767px)
|
||||
{
|
||||
.tabBar .arearef .pagination.paginationref {
|
||||
max-width: calc(50%);
|
||||
}
|
||||
|
||||
.clearbothonsmartphone {
|
||||
clear: both;
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
div.tabs {
|
||||
padding-left: 0 !important;
|
||||
padding-right: 0!important;
|
||||
|
||||
@ -1269,6 +1269,15 @@ table[summary="list_of_modules"] .fa-cog {
|
||||
.minwidth500imp { min-width: 250px !important; }
|
||||
}
|
||||
|
||||
.widthcentpercentminusx {
|
||||
width: calc(100% - 50px) !important;
|
||||
display: inline-block;
|
||||
}
|
||||
.widthcentpercentminusxx {
|
||||
width: calc(100% - 70px) !important;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
/* Force values for small screen 767 */
|
||||
@media only screen and (max-width: 767px)
|
||||
{
|
||||
@ -1279,7 +1288,9 @@ table[summary="list_of_modules"] .fa-cog {
|
||||
font-size: <?php print is_numeric($fontsize) ? ($fontsize).'px' : $fontsize; ?> !important;
|
||||
}
|
||||
|
||||
.clearbothonsmartphone { clear: both; display: block; }
|
||||
div.divphotoref {
|
||||
padding-right: 10px !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* Force values for small screen 570 */
|
||||
@ -3690,6 +3701,15 @@ ul.noborder li:nth-child(even):not(.liste_titre) {
|
||||
}
|
||||
@media only screen and (max-width: 767px)
|
||||
{
|
||||
.tabBar .arearef .pagination.paginationref {
|
||||
max-width: calc(50%);
|
||||
}
|
||||
|
||||
.clearbothonsmartphone {
|
||||
clear: both;
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
div.tabs {
|
||||
padding-left: 0 !important;
|
||||
margin-left: 0 !important;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user