Merge remote-tracking branch 'Dolibarr/develop' into bankStatementDocument
This commit is contained in:
commit
fed6ed8760
@ -8,3 +8,7 @@ linters:
|
||||
|
||||
fixers:
|
||||
enable: true
|
||||
|
||||
files:
|
||||
ignore:
|
||||
- 'htdocs/includes/*'
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
License
|
||||
-------
|
||||
|
||||
Dolibarr is released under the terms of the GNU General Public License as
|
||||
Dolibarr is released 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 (GPL-3+).
|
||||
More information: https://www.gnu.org/licenses/gpl-3.0.txt
|
||||
@ -15,13 +15,13 @@ PHP libraries:
|
||||
AdoDb-Date 0.36 Modified BSD License Yes Date convertion (not into rpm package)
|
||||
CKEditor 4.12.1 LGPL-2.1+ Yes Editor WYSIWYG
|
||||
EvalMath 1.0 BSD Yes Safe math expressions evaluation
|
||||
Escpos-php ? MIT License Yes Thermal receipt printer library, for use with ESC/POS compatible printers
|
||||
Escpos-php 2.2 MIT License Yes Thermal receipt printer library, for use with ESC/POS compatible printers
|
||||
GeoIP 1.4 LGPL-2.1+ Yes Sample code to make geoip convert (not into deb package)
|
||||
Mobiledetect 2.8.33 MIT License Yes Detect mobile devices browsers
|
||||
NuSoap 0.9.5 LGPL 2.1+ Yes Library to develop SOAP Web services (not into rpm and deb package)
|
||||
PEAR Mail_MIME 1.8.9 BSD Yes NuSoap dependency
|
||||
ParseDown 1.6 MIT License Yes Markdown parser
|
||||
PHPDebugBar 1.15.0 MIT License Yes Used only by the module "debugbar" for developers
|
||||
PHPDebugBar 1.15.0 MIT License Yes Used only by the module "debugbar" for developers
|
||||
PHPExcel 1.8.1 LGPL-2.1+ Yes Read/Write XLS files, read ODS files
|
||||
PHPSpreadSheet ? LGPL-2.1+ Yes Read/Write XLS files, read ODS files
|
||||
php-iban 1.4.7 LGPL-3+ Yes Parse and validate IBAN (and IIBAN) bank account information in PHP
|
||||
@ -37,7 +37,7 @@ TCPDF 6.3.2 LGPL-3+ Yes
|
||||
TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes FPDI replacement
|
||||
|
||||
JS libraries:
|
||||
Ace 1.4.6 BSD Yes JS library to get code syntaxique coloration in a textarea.
|
||||
Ace 1.4.6 BSD Yes JS library to get code syntaxique coloration in a textarea.
|
||||
jQuery 3.4.1 MIT License Yes JS library
|
||||
jQuery UI 1.12.1 GPL and MIT License Yes JS library plugin UI
|
||||
jQuery select2 4.0.5 GPL and Apache License Yes JS library plugin for sexier multiselect
|
||||
|
||||
@ -164,7 +164,7 @@ foreach ($files as $filetmp) {
|
||||
if (filetype($file)=="file") {
|
||||
$md5=md5_file($file);
|
||||
$checksumconcat[]=$md5;
|
||||
fputs($fp, ' <md5file name="'.basename($file).'">'.$md5.'</md5file>'."\n");
|
||||
fputs($fp, ' <md5file name="'.basename($file).'" size="'.filesize($file).'">'.$md5.'</md5file>'."\n");
|
||||
}
|
||||
}
|
||||
fputs($fp, ' </dir>'."\n");
|
||||
@ -207,7 +207,7 @@ foreach ($files as $filetmp) {
|
||||
if (filetype($file)=="file") {
|
||||
$md5=md5_file($file);
|
||||
$checksumconcat[]=$md5;
|
||||
fputs($fp, ' <md5file name="'.basename($file).'">'.$md5.'</md5file>'."\n");
|
||||
fputs($fp, ' <md5file name="'.basename($file).'" size="'.filesize($file).'">'.$md5.'</md5file>'."\n");
|
||||
}
|
||||
}
|
||||
fputs($fp, ' </dir>'."\n");
|
||||
|
||||
@ -138,7 +138,7 @@ if (empty($reshook))
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
setEventMessages($langs->trans("ChartLoaded"), null);
|
||||
setEventMessages($langs->trans("ChartLoaded"), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -922,8 +922,8 @@ while ($i < min($num, $limit))
|
||||
{
|
||||
print '<td class="nowrap right">' . ($line->debit ? price($line->debit) : ''). '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['totaldebitfield']=$totalarray['nbfield'];
|
||||
$totalarray['totaldebit'] += $line->debit;
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='totaldebit';
|
||||
$totalarray['val']['totaldebit'] += $line->debit;
|
||||
}
|
||||
|
||||
// Amount credit
|
||||
@ -931,8 +931,8 @@ while ($i < min($num, $limit))
|
||||
{
|
||||
print '<td class="nowrap right">' . ($line->credit ? price($line->credit) : '') . '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['totalcreditfield']=$totalarray['nbfield'];
|
||||
$totalarray['totalcredit'] += $line->credit;
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='totalcredit';
|
||||
$totalarray['val']['totalcredit'] += $line->credit;
|
||||
}
|
||||
|
||||
// Lettering code
|
||||
@ -998,29 +998,7 @@ while ($i < min($num, $limit))
|
||||
}
|
||||
|
||||
// Show total line
|
||||
if (isset($totalarray['totaldebitfield']) || isset($totalarray['totalcreditfield']))
|
||||
{
|
||||
$i=0;
|
||||
print '<tr class="liste_total">';
|
||||
while ($i < $totalarray['nbfield'])
|
||||
{
|
||||
$i++;
|
||||
if ($i == 1)
|
||||
{
|
||||
if ($num < $limit && empty($offset)) print '<td class="left">'.$langs->trans("Total").'</td>';
|
||||
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||
}
|
||||
elseif ($totalarray['totaldebitfield'] == $i) print '<td class="nowrap right">'.price($totalarray['totaldebit']).'</td>';
|
||||
elseif ($totalarray['totalcreditfield'] == $i) print '<td class="nowrap right">'.price($totalarray['totalcredit']).'</td>';
|
||||
else print '<td></td>';
|
||||
}
|
||||
$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
|
||||
|
||||
|
||||
print "</table>";
|
||||
|
||||
@ -197,6 +197,7 @@ if ($resql) {
|
||||
|
||||
$param="&socid=".$socid;
|
||||
print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '?socid=' . $object->id . '" method="POST">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
||||
print '<input type="hidden" name="socid" value="' . $object->id . '">';
|
||||
|
||||
$letteringbutton = '<a class="divButAction"><span class="valignmiddle"><input class="butAction" type="submit" value="lettering" name="lettering" id="lettering"></span></a>';
|
||||
|
||||
@ -195,6 +195,7 @@ if ($resql) {
|
||||
|
||||
$param="&socid=".$socid;
|
||||
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'?socid=' . $object->id . '" method="POST">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
||||
print '<input type="hidden" name="socid" value="' . $object->id . '">';
|
||||
|
||||
$letteringbutton = '<a class="divButAction"><span class="valignmiddle"><input class="butAction" type="submit" value="lettering" name="lettering" id="lettering"></span></a>';
|
||||
|
||||
@ -129,8 +129,8 @@ if (empty($reshook))
|
||||
|
||||
// Mass actions
|
||||
$objectclass='AccountingAccount';
|
||||
$permtoread = $user->rights->accounting->read;
|
||||
$permtodelete = $user->rights->accounting->delete;
|
||||
$permissiontoread = $user->rights->accounting->read;
|
||||
$permissiontodelete = $user->rights->accounting->delete;
|
||||
$uploaddir = $conf->accounting->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
}
|
||||
|
||||
@ -112,8 +112,8 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
||||
// Mass actions
|
||||
$objectclass='ExpenseReport';
|
||||
$objectlabel='ExpenseReport';
|
||||
$permtoread = $user->rights->expensereport->read;
|
||||
$permtodelete = $user->rights->expensereport->delete;
|
||||
$permissiontoread = $user->rights->expensereport->read;
|
||||
$permissiontodelete = $user->rights->expensereport->delete;
|
||||
$uploaddir = $conf->expensereport->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
|
||||
|
||||
@ -133,8 +133,8 @@ if (empty($reshook))
|
||||
|
||||
// Mass actions
|
||||
$objectclass='AccountingAccount';
|
||||
$permtoread = $user->rights->accounting->read;
|
||||
$permtodelete = $user->rights->accounting->delete;
|
||||
$permissiontoread = $user->rights->accounting->read;
|
||||
$permissiontodelete = $user->rights->accounting->delete;
|
||||
$uploaddir = $conf->accounting->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
}
|
||||
|
||||
@ -70,6 +70,8 @@ $extrafields = new ExtraFields($db);
|
||||
// fetch optionals attributes and labels
|
||||
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
|
||||
$socialnetworks = getArrayOfSocialNetworks();
|
||||
|
||||
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
|
||||
$object->getCanvas($id);
|
||||
$canvas = $object->canvas?$object->canvas:GETPOST("canvas");
|
||||
@ -302,10 +304,16 @@ if (empty($reshook))
|
||||
$object->phone_perso = trim(GETPOST("phone_perso", 'alpha'));
|
||||
$object->phone_mobile= trim(GETPOST("phone_mobile", 'alpha'));
|
||||
$object->email = preg_replace('/\s+/', '', GETPOST("member_email", 'alpha'));
|
||||
$object->skype = trim(GETPOST("skype", 'alpha'));
|
||||
$object->twitter = trim(GETPOST("twitter", 'alpha'));
|
||||
$object->facebook = trim(GETPOST("facebook", 'alpha'));
|
||||
$object->linkedin = trim(GETPOST("linkedin", 'alpha'));
|
||||
$object->socialnetworks = array();
|
||||
foreach ($socialnetworks as $key => $value) {
|
||||
if (GETPOSTISSET($key) && GETPOST($key, 'alphanohtml')!='') {
|
||||
$object->socialnetworks[$key] = trim(GETPOST($key, 'alphanohtml'));
|
||||
}
|
||||
}
|
||||
//$object->skype = trim(GETPOST("skype", 'alpha'));
|
||||
//$object->twitter = trim(GETPOST("twitter", 'alpha'));
|
||||
//$object->facebook = trim(GETPOST("facebook", 'alpha'));
|
||||
//$object->linkedin = trim(GETPOST("linkedin", 'alpha'));
|
||||
$object->birth = $birthdate;
|
||||
|
||||
$object->typeid = GETPOST("typeid", 'int');
|
||||
@ -448,10 +456,10 @@ if (empty($reshook))
|
||||
$phone=GETPOST("phone", 'alpha');
|
||||
$phone_perso=GETPOST("phone_perso", 'alpha');
|
||||
$phone_mobile=GETPOST("phone_mobile", 'alpha');
|
||||
$skype=GETPOST("member_skype", 'alpha');
|
||||
$twitter=GETPOST("member_twitter", 'alpha');
|
||||
$facebook=GETPOST("member_facebook", 'alpha');
|
||||
$linkedin=GETPOST("member_linkedin", 'alpha');
|
||||
// $skype=GETPOST("member_skype", 'alpha');
|
||||
// $twitter=GETPOST("member_twitter", 'alpha');
|
||||
// $facebook=GETPOST("member_facebook", 'alpha');
|
||||
// $linkedin=GETPOST("member_linkedin", 'alpha');
|
||||
$email=preg_replace('/\s+/', '', GETPOST("member_email", 'alpha'));
|
||||
$login=GETPOST("member_login", 'alpha');
|
||||
$pass=GETPOST("password", 'alpha');
|
||||
@ -478,11 +486,19 @@ if (empty($reshook))
|
||||
$object->phone = $phone;
|
||||
$object->phone_perso = $phone_perso;
|
||||
$object->phone_mobile= $phone_mobile;
|
||||
$object->socialnetworks = array();
|
||||
if (! empty($conf->socialnetworks->enabled)) {
|
||||
foreach ($socialnetworks as $key => $value) {
|
||||
if (GETPOSTISSET($key) && GETPOST($key, 'alphanohtml')!='') {
|
||||
$object->socialnetworks[$key] = GETPOST("member_".$key, 'alphanohtml');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$object->skype = $skype;
|
||||
$object->twitter = $twitter;
|
||||
$object->facebook = $facebook;
|
||||
$object->linkedin = $linkedin;
|
||||
// $object->skype = $skype;
|
||||
// $object->twitter = $twitter;
|
||||
// $object->facebook = $facebook;
|
||||
// $object->linkedin = $linkedin;
|
||||
|
||||
$object->email = $email;
|
||||
$object->login = $login;
|
||||
@ -802,7 +818,7 @@ if (empty($reshook))
|
||||
|
||||
// Actions to build doc
|
||||
$upload_dir = $conf->adherent->dir_output;
|
||||
$permissioncreate=$user->rights->adherent->creer;
|
||||
$permissiontoadd=$user->rights->adherent->creer;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||
|
||||
// Actions to send emails
|
||||
@ -1028,29 +1044,12 @@ else
|
||||
// Mobile phone
|
||||
print '<tr><td>'.img_picto('', 'object_phoning_mobile').' '.$langs->trans("PhoneMobile").'</td><td><input type="text" name="phone_mobile" size="20" value="'.(GETPOST('phone_mobile', 'alpha')?GETPOST('phone_mobile', 'alpha'):$object->phone_mobile).'"></td></tr>';
|
||||
|
||||
// Skype
|
||||
if (! empty($conf->socialnetworks->enabled))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Skype").'</td><td><input type="text" name="member_skype" size="40" value="'.(GETPOST('member_skype', 'alpha')?GETPOST('member_skype', 'alpha'):$object->skype).'"></td></tr>';
|
||||
}
|
||||
|
||||
// Twitter
|
||||
if (! empty($conf->socialnetworks->enabled))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Twitter").'</td><td><input type="text" name="member_twitter" size="40" value="'.(GETPOST('member_twitter', 'alpha')?GETPOST('member_twitter', 'alpha'):$object->twitter).'"></td></tr>';
|
||||
}
|
||||
|
||||
// Facebook
|
||||
if (! empty($conf->socialnetworks->enabled))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Facebook").'</td><td><input type="text" name="member_facebook" size="40" value="'.(GETPOST('member_facebook', 'alpha')?GETPOST('member_facebook', 'alpha'):$object->facebook).'"></td></tr>';
|
||||
}
|
||||
|
||||
// LinkedIn
|
||||
if (! empty($conf->socialnetworks->enabled))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("LinkedIn").'</td><td><input type="text" name="member_linkedin" size="40" value="'.(GETPOST('member_linkedin', 'alpha')?GETPOST('member_linkedin', 'alpha'):$object->linkedin).'"></td></tr>';
|
||||
}
|
||||
if (! empty($conf->socialnetworks->enabled)) {
|
||||
foreach ($socialnetworks as $key => $value) {
|
||||
if (!$value['active']) break;
|
||||
print '<tr><td>'.$langs->trans($value['label']).'</td><td><input type="text" name="member_'.$key.'" size="40" value="'.(GETPOST('member_'.$key, 'alpha')?GETPOST('member_'.$key, 'alpha'):$object->socialnetworks[$key]).'"></td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
// Birth Date
|
||||
print "<tr><td>".$langs->trans("DateToBirth")."</td><td>\n";
|
||||
@ -1297,29 +1296,12 @@ else
|
||||
// Mobile phone
|
||||
print '<tr><td>'.img_picto('', 'object_phoning_mobile').' '.$langs->trans("PhoneMobile").'</td><td><input type="text" name="phone_mobile" size="20" value="'.(isset($_POST["phone_mobile"])?GETPOST("phone_mobile"):$object->phone_mobile).'"></td></tr>';
|
||||
|
||||
// Skype
|
||||
if (! empty($conf->socialnetworks->enabled))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Skype").'</td><td><input type="text" name="skype" class="minwidth100" value="'.(isset($_POST["skype"])?GETPOST("skype"):$object->skype).'"></td></tr>';
|
||||
}
|
||||
|
||||
// Twitter
|
||||
if (! empty($conf->socialnetworks->enabled))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Twitter").'</td><td><input type="text" name="twitter" class="minwidth100" value="'.(isset($_POST["twitter"])?GETPOST("twitter"):$object->twitter).'"></td></tr>';
|
||||
}
|
||||
|
||||
// Facebook
|
||||
if (! empty($conf->socialnetworks->enabled))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Facebook").'</td><td><input type="text" name="facebook" class="minwidth100" value="'.(isset($_POST["facebook"])?GETPOST("facebook"):$object->facebook).'"></td></tr>';
|
||||
}
|
||||
|
||||
// LinkedIn
|
||||
if (! empty($conf->socialnetworks->enabled))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("LinkedIn").'</td><td><input type="text" name="linkedin" class="minwidth100" value="'.(isset($_POST["linkedin"])?GETPOST("linkedin"):$object->linkedin).'"></td></tr>';
|
||||
}
|
||||
if (! empty($conf->socialnetworks->enabled)) {
|
||||
foreach ($socialnetworks as $key => $value) {
|
||||
if (!$value['active']) break;
|
||||
print '<tr><td>'.$langs->trans($value['label']).'</td><td><input type="text" name="'.$key.'" class="minwidth100" value="'.(isset($_POST[$key])?GETPOST($key):$object->socialnetworks[$key]).'"></td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
// Birth Date
|
||||
print "<tr><td>".$langs->trans("DateToBirth")."</td><td>\n";
|
||||
|
||||
@ -259,6 +259,7 @@ print '<br>';
|
||||
|
||||
print img_picto('', 'puce').' '.$langs->trans("DocForAllMembersCards", ($conf->global->ADHERENT_CARD_TYPE?$conf->global->ADHERENT_CARD_TYPE:$langs->transnoentitiesnoconv("None"))).' ';
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
||||
print '<input type="hidden" name="foruserid" value="all">';
|
||||
print '<input type="hidden" name="mode" value="card">';
|
||||
print '<input type="hidden" name="action" value="builddoc">';
|
||||
@ -278,6 +279,7 @@ print '<br><br>';
|
||||
|
||||
print img_picto('', 'puce').' '.$langs->trans("DocForOneMemberCards", ($conf->global->ADHERENT_CARD_TYPE?$conf->global->ADHERENT_CARD_TYPE:$langs->transnoentitiesnoconv("None"))).' ';
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
||||
print '<input type="hidden" name="mode" value="cardlogin">';
|
||||
print '<input type="hidden" name="action" value="builddoc">';
|
||||
print $langs->trans("DescADHERENT_CARD_TYPE").' ';
|
||||
@ -297,6 +299,7 @@ print '<br><br>';
|
||||
|
||||
print img_picto('', 'puce').' '.$langs->trans("DocForLabels", $conf->global->ADHERENT_ETIQUETTE_TYPE).' ';
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
||||
print '<input type="hidden" name="mode" value="label">';
|
||||
print '<input type="hidden" name="action" value="builddoc">';
|
||||
print $langs->trans("DescADHERENT_ETIQUETTE_TYPE").' ';
|
||||
|
||||
@ -124,23 +124,32 @@ class Adherent extends CommonObject
|
||||
*/
|
||||
public $email;
|
||||
|
||||
/**
|
||||
* @var array array of socialnetworks
|
||||
*/
|
||||
public $socialnetworks;
|
||||
|
||||
/**
|
||||
* @var string skype account
|
||||
* @deprecated
|
||||
*/
|
||||
public $skype;
|
||||
|
||||
/**
|
||||
* @var string twitter account
|
||||
* @deprecated
|
||||
*/
|
||||
public $twitter;
|
||||
|
||||
/**
|
||||
* @var string facebook account
|
||||
* @deprecated
|
||||
*/
|
||||
public $facebook;
|
||||
|
||||
/**
|
||||
* @var string linkedin account
|
||||
* @deprecated
|
||||
*/
|
||||
public $linkedin;
|
||||
|
||||
@ -566,10 +575,7 @@ class Adherent extends CommonObject
|
||||
$sql.= ", country = ".($this->country_id>0?$this->db->escape($this->country_id):"null");
|
||||
$sql.= ", state_id = ".($this->state_id>0?$this->db->escape($this->state_id):"null");
|
||||
$sql.= ", email = '".$this->db->escape($this->email)."'";
|
||||
$sql.= ", skype = '".$this->db->escape($this->skype)."'";
|
||||
$sql.= ", twitter = '".$this->db->escape($this->twitter)."'";
|
||||
$sql.= ", facebook = '".$this->db->escape($this->facebook)."'";
|
||||
$sql.= ", linkedin = '".$this->db->escape($this->linkedin)."'";
|
||||
$sql.= ", socialnetworks = '".$this->db->escape(json_encode($this->socialnetworks))."'";
|
||||
$sql.= ", phone = ".($this->phone?"'".$this->db->escape($this->phone)."'":"null");
|
||||
$sql.= ", phone_perso = ".($this->phone_perso?"'".$this->db->escape($this->phone_perso)."'":"null");
|
||||
$sql.= ", phone_mobile = ".($this->phone_mobile?"'".$this->db->escape($this->phone_mobile)."'":"null");
|
||||
@ -694,10 +700,7 @@ class Adherent extends CommonObject
|
||||
$luser->state_id=$this->state_id;
|
||||
|
||||
$luser->email=$this->email;
|
||||
$luser->skype=$this->skype;
|
||||
$luser->twitter=$this->twitter;
|
||||
$luser->facebook=$this->facebook;
|
||||
$luser->linkedin=$this->linkedin;
|
||||
$luser->socialnetworks=$this->socialnetworks;
|
||||
$luser->office_phone=$this->phone;
|
||||
$luser->user_mobile=$this->phone_mobile;
|
||||
|
||||
@ -736,10 +739,7 @@ class Adherent extends CommonObject
|
||||
$lthirdparty->zip=$this->zip;
|
||||
$lthirdparty->town=$this->town;
|
||||
$lthirdparty->email=$this->email;
|
||||
$lthirdparty->skype=$this->skype;
|
||||
$lthirdparty->twitter=$this->twitter;
|
||||
$lthirdparty->facebook=$this->facebook;
|
||||
$lthirdparty->linkedin=$this->linkedin;
|
||||
$lthirdparty->socialnetworks=$this->socialnetworks;
|
||||
$lthirdparty->phone=$this->phone;
|
||||
$lthirdparty->state_id=$this->state_id;
|
||||
$lthirdparty->country_id=$this->country_id;
|
||||
@ -1228,7 +1228,7 @@ class Adherent extends CommonObject
|
||||
|
||||
$sql = "SELECT d.rowid, d.ref_ext, d.civility as civility_code, d.gender, d.firstname, d.lastname, d.societe as company, d.fk_soc, d.statut, d.public, d.address, d.zip, d.town, d.note_private,";
|
||||
$sql.= " d.note_public,";
|
||||
$sql.= " d.email, d.skype, d.twitter, d.facebook, d.linkedin, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass, d.pass_crypted,";
|
||||
$sql.= " d.email, d.socialnetworks, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass, d.pass_crypted,";
|
||||
$sql.= " d.photo, d.fk_adherent_type, d.morphy, d.entity,";
|
||||
$sql.= " d.datec as datec,";
|
||||
$sql.= " d.tms as datem,";
|
||||
@ -1307,10 +1307,7 @@ class Adherent extends CommonObject
|
||||
$this->phone_mobile = $obj->phone_mobile;
|
||||
$this->email = $obj->email;
|
||||
|
||||
$this->skype = $obj->skype;
|
||||
$this->twitter = $obj->twitter;
|
||||
$this->facebook = $obj->facebook;
|
||||
$this->linkedin = $obj->linkedin;
|
||||
$this->socialnetworks = (array) json_decode($obj->socialnetworks, true);
|
||||
|
||||
$this->photo = $obj->photo;
|
||||
$this->statut = $obj->statut;
|
||||
@ -2385,10 +2382,12 @@ class Adherent extends CommonObject
|
||||
$this->country = 'France';
|
||||
$this->morphy = 'mor';
|
||||
$this->email = 'specimen@specimen.com';
|
||||
$this->skype = 'skypepseudo';
|
||||
$this->twitter = 'twitterpseudo';
|
||||
$this->facebook = 'facebookpseudo';
|
||||
$this->linkedin = 'linkedinpseudo';
|
||||
$this->socialnetworks = array(
|
||||
'skype' => 'skypepseudo',
|
||||
'twitter' => 'twitterpseudo',
|
||||
'facebook' => 'facebookpseudo',
|
||||
'linkedin' => 'linkedinpseudo',
|
||||
);
|
||||
$this->phone = '0999999999';
|
||||
$this->phone_perso = '0999999998';
|
||||
$this->phone_mobile = '0999999997';
|
||||
|
||||
@ -71,6 +71,18 @@ class AdherentType extends CommonObject
|
||||
*/
|
||||
public $morphy;
|
||||
|
||||
public $duration;
|
||||
|
||||
/*
|
||||
* type expiration
|
||||
*/
|
||||
public $duration_value;
|
||||
|
||||
/**
|
||||
* Expiration unit
|
||||
*/
|
||||
public $duration_unit;
|
||||
|
||||
/**
|
||||
* @var int Subsription required (0 or 1)
|
||||
* @since 5.0
|
||||
@ -373,8 +385,9 @@ class AdherentType extends CommonObject
|
||||
$sql.= "SET ";
|
||||
$sql.= "statut = ".$this->statut.",";
|
||||
$sql.= "libelle = '".$this->db->escape($this->label) ."',";
|
||||
$sql.= "morphy = '".$this->db->escape($this->morphy) ."',";
|
||||
$sql.= "morphy = '".$this->db->escape($this->morphy) ."',";
|
||||
$sql.= "subscription = '".$this->db->escape($this->subscription)."',";
|
||||
$sql.= "duration = '" . $this->db->escape($this->duration_value . $this->duration_unit) ."',";
|
||||
$sql.= "note = '".$this->db->escape($this->note)."',";
|
||||
$sql.= "vote = ".(integer) $this->db->escape($this->vote).",";
|
||||
$sql.= "mail_valid = '".$this->db->escape($this->mail_valid)."'";
|
||||
@ -476,7 +489,7 @@ class AdherentType extends CommonObject
|
||||
{
|
||||
global $langs, $conf;
|
||||
|
||||
$sql = "SELECT d.rowid, d.libelle as label, d.morphy, d.statut, d.subscription, d.mail_valid, d.note, d.vote";
|
||||
$sql = "SELECT d.rowid, d.libelle as label, d.morphy, d.statut, d.duration, d.subscription, d.mail_valid, d.note, d.vote";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d";
|
||||
$sql .= " WHERE d.rowid = ".(int) $rowid;
|
||||
|
||||
@ -494,6 +507,9 @@ class AdherentType extends CommonObject
|
||||
$this->label = $obj->label;
|
||||
$this->morphy = $obj->morphy;
|
||||
$this->statut = $obj->statut;
|
||||
$this->duration = $obj->duration;
|
||||
$this->duration_value = substr($obj->duration, 0, dol_strlen($obj->duration)-1);
|
||||
$this->duration_unit = substr($obj->duration, -1);
|
||||
$this->subscription = $obj->subscription;
|
||||
$this->mail_valid = $obj->mail_valid;
|
||||
$this->note = $obj->note;
|
||||
|
||||
@ -232,8 +232,8 @@ if (empty($reshook))
|
||||
// Mass actions
|
||||
$objectclass='Adherent';
|
||||
$objectlabel='Members';
|
||||
$permtoread = $user->rights->adherent->lire;
|
||||
$permtodelete = $user->rights->adherent->supprimer;
|
||||
$permissiontoread = $user->rights->adherent->lire;
|
||||
$permissiontodelete = $user->rights->adherent->supprimer;
|
||||
$uploaddir = $conf->adherent->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
}
|
||||
@ -919,26 +919,8 @@ while ($i < min($num, $limit))
|
||||
}
|
||||
|
||||
// Show total line
|
||||
if (isset($totalarray['pos']))
|
||||
{
|
||||
print '<tr class="liste_total">';
|
||||
$i=0;
|
||||
while ($i < $totalarray['nbfield'])
|
||||
{
|
||||
$i++;
|
||||
if (! empty($totalarray['pos'][$i])) print '<td class="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>';
|
||||
else
|
||||
{
|
||||
if ($i == 1)
|
||||
{
|
||||
if ($num < $limit) print '<td class="left">'.$langs->trans("Total").'</td>';
|
||||
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||
}
|
||||
else print '<td></td>';
|
||||
}
|
||||
}
|
||||
print '</tr>';
|
||||
}
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
|
||||
|
||||
|
||||
// If no record found
|
||||
if ($num == 0)
|
||||
|
||||
@ -588,26 +588,8 @@ while ($i < min($num, $limit))
|
||||
}
|
||||
|
||||
// Show total line
|
||||
if (isset($totalarray['pos']))
|
||||
{
|
||||
print '<tr class="liste_total">';
|
||||
$i=0;
|
||||
while ($i < $totalarray['nbfield'])
|
||||
{
|
||||
$i++;
|
||||
if (! empty($totalarray['pos'][$i])) print '<td class="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>';
|
||||
else
|
||||
{
|
||||
if ($i == 1)
|
||||
{
|
||||
if ($num < $limit) print '<td class="left">'.$langs->trans("Total").'</td>';
|
||||
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||
}
|
||||
else print '<td></td>';
|
||||
}
|
||||
}
|
||||
print '</tr>';
|
||||
}
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
|
||||
|
||||
|
||||
// If no record found
|
||||
if ($num == 0)
|
||||
|
||||
@ -32,6 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
|
||||
|
||||
$langs->load("members");
|
||||
|
||||
@ -61,6 +62,8 @@ $label=GETPOST("label", "alpha");
|
||||
$morphy=GETPOST("morphy", "alpha");
|
||||
$statut=GETPOST("statut", "int");
|
||||
$subscription=GETPOST("subscription", "int");
|
||||
$duration_value = GETPOST('duration_value', 'int');
|
||||
$duration_unit = GETPOST('duration_unit', 'alpha');
|
||||
$vote=GETPOST("vote", "int");
|
||||
$comment=GETPOST("comment", 'alphanohtml');
|
||||
$mail_valid=GETPOST("mail_valid", 'none');
|
||||
@ -104,9 +107,11 @@ if ($cancel) {
|
||||
|
||||
if ($action == 'add' && $user->rights->adherent->configurer) {
|
||||
$object->label = trim($label);
|
||||
$object->morphy = trim($morphy);
|
||||
$object->morphy = trim($morphy);
|
||||
$object->statut = (int) $statut;
|
||||
$object->subscription = (int) $subscription;
|
||||
$object->duration_value = $duration_value;
|
||||
$object->duration_unit = $duration_unit;
|
||||
$object->note = trim($comment);
|
||||
$object->mail_valid = trim($mail_valid);
|
||||
$object->vote = (int) $vote;
|
||||
@ -159,9 +164,11 @@ if ($action == 'update' && $user->rights->adherent->configurer)
|
||||
$object->oldcopy = clone $object;
|
||||
|
||||
$object->label = trim($label);
|
||||
$object->morphy = trim($morphy);
|
||||
$object->morphy = trim($morphy);
|
||||
$object->statut = (int) $statut;
|
||||
$object->subscription = (int) $subscription;
|
||||
$object->duration_value = $duration_value;
|
||||
$object->duration_unit = $duration_unit;
|
||||
$object->note = trim($comment);
|
||||
$object->mail_valid = trim($mail_valid);
|
||||
$object->vote = (boolean) trim($vote);
|
||||
@ -209,6 +216,7 @@ if ($action == 'confirm_delete' && $user->rights->adherent->configurer)
|
||||
*/
|
||||
|
||||
$form=new Form($db);
|
||||
$formproduct = new FormProduct($db);
|
||||
|
||||
llxHeader('', $langs->trans("MembersTypeSetup"), 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros');
|
||||
|
||||
@ -354,6 +362,11 @@ if ($action == 'create')
|
||||
print $form->selectyesno("vote", 0, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Duration").'</td><td colspan="3">';
|
||||
print '<input name="duration_value" size="5" value="'.$_POST["duration_value"].'"> ';
|
||||
print $formproduct->selectMeasuringUnits("duration_unit", "time", $_POST["duration_unit"], 0, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
|
||||
print '<textarea name="comment" wrap="soft" class="centpercent" rows="3"></textarea></td></tr>';
|
||||
|
||||
@ -439,6 +452,18 @@ if ($rowid > 0)
|
||||
print yn($object->vote);
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Duration").'</td><td colspan="2">'.$object->duration_value.' ';
|
||||
if ($object->duration_value > 1)
|
||||
{
|
||||
$dur=array("i"=>$langs->trans("Minute"),"h"=>$langs->trans("Hours"),"d"=>$langs->trans("Days"),"w"=>$langs->trans("Weeks"),"m"=>$langs->trans("Months"),"y"=>$langs->trans("Years"));
|
||||
}
|
||||
elseif ($object->duration_value > 0)
|
||||
{
|
||||
$dur=array("i"=>$langs->trans("Minute"),"h"=>$langs->trans("Hour"),"d"=>$langs->trans("Day"),"w"=>$langs->trans("Week"),"m"=>$langs->trans("Month"),"y"=>$langs->trans("Year"));
|
||||
}
|
||||
print (! empty($object->duration_unit) && isset($dur[$object->duration_unit]) ? $langs->trans($dur[$object->duration_unit]) : '')." ";
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
|
||||
print nl2br($object->note)."</td></tr>";
|
||||
|
||||
@ -592,6 +617,7 @@ if ($rowid > 0)
|
||||
}
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
||||
print '<input class="flat" type="hidden" name="rowid" value="'.$object->id.'" size="12"></td>';
|
||||
|
||||
print '<br>';
|
||||
@ -787,6 +813,11 @@ if ($rowid > 0)
|
||||
print $form->selectyesno("vote", $object->vote, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Duration").'</td><td colspan="3">';
|
||||
print '<input name="duration_value" size="5" value="'.$object->duration_value.'"> ';
|
||||
print $formproduct->selectMeasuringUnits("duration_unit", "time", $object->duration_unit, 0, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
|
||||
print '<textarea name="comment" wrap="soft" class="centpercent" rows="3">'.$object->note.'</textarea></td></tr>';
|
||||
|
||||
@ -796,9 +827,12 @@ if ($rowid > 0)
|
||||
$doleditor->Create();
|
||||
print "</td></tr>";
|
||||
|
||||
// Other attributes
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_edit.tpl.php';
|
||||
|
||||
// Other attributes
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $act, $action); // Note that $action and $object may have been modified by hook
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (empty($reshook))
|
||||
{
|
||||
@ -807,33 +841,6 @@ if ($rowid > 0)
|
||||
|
||||
print '</table>';
|
||||
|
||||
// Extra field
|
||||
if (empty($reshook))
|
||||
{
|
||||
print '<br><br><table class="border" width="100%">';
|
||||
if (is_array($extrafields->attributes['adherent_type']['label']))
|
||||
{
|
||||
foreach($extrafields->attributes['adherent_type']['label'] as $key=>$label)
|
||||
{
|
||||
if (isset($_POST["options_" . $key])) {
|
||||
if (is_array($_POST["options_" . $key])) {
|
||||
// $_POST["options"] is an array but following code expects a comma separated string
|
||||
$value = implode(",", $_POST["options_" . $key]);
|
||||
} else {
|
||||
$value = $_POST["options_" . $key];
|
||||
}
|
||||
} else {
|
||||
$value = $object->array_options["options_" . $key];
|
||||
}
|
||||
|
||||
print '<tr><td width="30%">'.$label.'</td><td>';
|
||||
print $extrafields->showInputField($key, $value);
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
}
|
||||
print '</table><br><br>';
|
||||
}
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<div class="center">';
|
||||
|
||||
@ -324,6 +324,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||
}
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" name="agenda">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
||||
print '<input type="hidden" name="action" value="set">';
|
||||
|
||||
print '<table class="noborder allwidth">'."\n";
|
||||
|
||||
@ -180,6 +180,7 @@ $head=agenda_prepare_head();
|
||||
dol_fiche_head($head, 'reminders', $langs->trans("Agenda"), -1, 'action');
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" name="agenda">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
||||
print '<input type="hidden" name="action" value="set">';
|
||||
|
||||
print '<table class="noborder allwidth">'."\n";
|
||||
|
||||
@ -119,6 +119,7 @@ if (! empty($conf->global->CLICKTODIAL_URL))
|
||||
if (GETPOST('phonefortest')) $phonefortest=GETPOST('phonefortest');
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
||||
print $langs->trans("LinkToTestClickToDial", $user->login).' : ';
|
||||
print '<input class="flat" type="text" name="phonefortest" value="'.dol_escape_htmltag($phonefortest).'">';
|
||||
print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("RefreshPhoneLink")).'">';
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
* Copyright (C) 2011-2016 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -88,7 +89,7 @@ $hookmanager->initHooks(array('admin'));
|
||||
// Put here declaration of dictionaries properties
|
||||
|
||||
// Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this.
|
||||
$taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,0,32,33,34,0,6,0,29,0,7,24,28,17,35,36,0,10,23,12,13,0,14,0,22,20,18,21,0,15,30,0,37,0,25,0);
|
||||
$taborder=array(9,0,4,3,2,0,1,8,19,16,27,38,0,5,11,0,32,33,34,0,6,0,29,0,7,24,28,17,35,36,0,10,23,12,13,0,14,0,22,20,18,21,0,15,30,0,37,0,25,0);
|
||||
|
||||
// Name of SQL tables of dictionaries
|
||||
$tabname=array();
|
||||
@ -130,6 +131,7 @@ $tabname[34]= MAIN_DB_PREFIX."c_hrm_function";
|
||||
$tabname[35]= MAIN_DB_PREFIX."c_exp_tax_cat";
|
||||
$tabname[36]= MAIN_DB_PREFIX."c_exp_tax_range";
|
||||
$tabname[37]= MAIN_DB_PREFIX."c_units";
|
||||
$tabname[38]= MAIN_DB_PREFIX."c_socialnetworks";
|
||||
|
||||
// Dictionary labels
|
||||
$tablib=array();
|
||||
@ -170,6 +172,7 @@ $tablib[34]= "DictionaryFunction";
|
||||
$tablib[35]= "DictionaryExpenseTaxCat";
|
||||
$tablib[36]= "DictionaryExpenseTaxRange";
|
||||
$tablib[37]= "DictionaryMeasuringUnits";
|
||||
$tablib[38]= "DictionarySocialNetworks";
|
||||
|
||||
// Requests to extract data
|
||||
$tabsql=array();
|
||||
@ -210,6 +213,7 @@ $tabsql[34]= "SELECT rowid, pos, code, label, c_level, active FROM ".MAIN_DB_PRE
|
||||
$tabsql[35]= "SELECT c.rowid, c.label, c.active, c.entity FROM ".MAIN_DB_PREFIX."c_exp_tax_cat c";
|
||||
$tabsql[36]= "SELECT r.rowid, r.fk_c_exp_tax_cat, r.range_ik, r.active, r.entity FROM ".MAIN_DB_PREFIX."c_exp_tax_range r";
|
||||
$tabsql[37]= "SELECT r.rowid, r.code, r.label, r.short_label, r.unit_type, r.scale, r.active FROM ".MAIN_DB_PREFIX."c_units r";
|
||||
$tabsql[38]= "SELECT rowid, entity, code, label, url, icon, active FROM ".MAIN_DB_PREFIX."c_socialnetworks";
|
||||
|
||||
// Criteria to sort dictionaries
|
||||
$tabsqlsort=array();
|
||||
@ -250,6 +254,7 @@ $tabsqlsort[34]="code ASC";
|
||||
$tabsqlsort[35]="c.label ASC";
|
||||
$tabsqlsort[36]="r.fk_c_exp_tax_cat ASC, r.range_ik ASC";
|
||||
$tabsqlsort[37]="r.unit_type ASC, r.scale ASC, r.code ASC";
|
||||
$tabsqlsort[38]="rowid, code ASC";
|
||||
|
||||
// Field names in select result for dictionary display
|
||||
$tabfield=array();
|
||||
@ -290,6 +295,7 @@ $tabfield[34]= "code,label";
|
||||
$tabfield[35]= "label";
|
||||
$tabfield[36]= "range_ik,fk_c_exp_tax_cat";
|
||||
$tabfield[37]= "code,label,short_label,unit_type,scale";
|
||||
$tabfield[38]= "code,label,url,icon,entity";
|
||||
|
||||
// Edit field names for editing a record
|
||||
$tabfieldvalue=array();
|
||||
@ -330,6 +336,7 @@ $tabfieldvalue[34]= "code,label";
|
||||
$tabfieldvalue[35]= "label";
|
||||
$tabfieldvalue[36]= "range_ik,fk_c_exp_tax_cat";
|
||||
$tabfieldvalue[37]= "code,label,short_label,unit_type,scale";
|
||||
$tabfieldvalue[38]= "code,label,url,icon";
|
||||
|
||||
// Field names in the table for inserting a record
|
||||
$tabfieldinsert=array();
|
||||
@ -371,6 +378,7 @@ $tabfieldinsert[34]= "code,label";
|
||||
$tabfieldinsert[35]= "label";
|
||||
$tabfieldinsert[36]= "range_ik,fk_c_exp_tax_cat";
|
||||
$tabfieldinsert[37]= "code,label,short_label,unit_type,scale";
|
||||
$tabfieldinsert[38]= "entity,code,label,url,icon";
|
||||
|
||||
// Rowid name of field depending if field is autoincrement on or off..
|
||||
// Use "" if id field is "rowid" and has autoincrement on
|
||||
@ -413,6 +421,7 @@ $tabrowid[34]= "rowid";
|
||||
$tabrowid[35]= "";
|
||||
$tabrowid[36]= "";
|
||||
$tabrowid[37]= "";
|
||||
$tabrowid[38]= "";
|
||||
|
||||
// Condition to show dictionary in setup page
|
||||
$tabcond=array();
|
||||
@ -453,6 +462,7 @@ $tabcond[34]= ! empty($conf->hrm->enabled);
|
||||
$tabcond[35]= ! empty($conf->expensereport->enabled);
|
||||
$tabcond[36]= ! empty($conf->expensereport->enabled);
|
||||
$tabcond[37]= ! empty($conf->product->enabled);
|
||||
$tabcond[38]= ! empty($conf->socialnetworks->enabled);
|
||||
|
||||
// List of help for fields
|
||||
$tabhelp=array();
|
||||
@ -493,6 +503,7 @@ $tabhelp[34] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
$tabhelp[35] = array();
|
||||
$tabhelp[36] = array('range_ik'=>$langs->trans('PrevRangeToThisRange'));
|
||||
$tabhelp[37] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
$tabhelp[38] = array('code'=>$langs->trans("EnterAnyCode"), 'url' => $langs->trans('UrlSocialNetworksDesc'), 'icon' => $langs->trans('FafaIconSocialNetworksDesc'));
|
||||
|
||||
// List of check for fields (NOT USED YET)
|
||||
$tabfieldcheck=array();
|
||||
@ -533,6 +544,7 @@ $tabfieldcheck[34] = array();
|
||||
$tabfieldcheck[35] = array();
|
||||
$tabfieldcheck[36] = array();
|
||||
$tabfieldcheck[37] = array();
|
||||
$tabfieldcheck[38] = array();
|
||||
|
||||
// Complete all arrays with entries found into modules
|
||||
complete_dictionary_with_modules($taborder, $tabname, $tablib, $tabsql, $tabsqlsort, $tabfield, $tabfieldvalue, $tabfieldinsert, $tabrowid, $tabcond, $tabhelp, $tabfieldcheck);
|
||||
|
||||
@ -80,10 +80,9 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be inclu
|
||||
//$isdraft = (($object->statut == MyObject::STATUS_DRAFT) ? 1 : 0);
|
||||
//$result = restrictedArea($user, 'mymodule', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
|
||||
|
||||
$permissionnote=$user->rights->emailcollector->write; // Used by the include of actions_setnotes.inc.php
|
||||
$permissionnote=$user->rights->emailcollector->write; // Used by the include of actions_setnotes.inc.php
|
||||
$permissiondellink=$user->rights->emailcollector->write; // Used by the include of actions_dellink.inc.php
|
||||
$permissionedit=$user->rights->emailcollector->write; // Used by the include of actions_lineupdown.inc.php
|
||||
$permissiontoadd=$user->rights->emailcollector->write; // Used by the include of actions_addupdatedelete.inc.php
|
||||
$permissiontoadd=$user->rights->emailcollector->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
|
||||
|
||||
$debuginfo='';
|
||||
|
||||
|
||||
@ -156,8 +156,8 @@ if (empty($reshook))
|
||||
// Mass actions
|
||||
$objectclass='EmailCollector';
|
||||
$objectlabel='EmailCollector';
|
||||
$permtoread = $user->rights->emailcollector->read;
|
||||
$permtodelete = $user->rights->emailcollector->delete;
|
||||
$permissiontoread = $user->rights->emailcollector->read;
|
||||
$permissiontodelete = $user->rights->emailcollector->delete;
|
||||
$uploaddir = $conf->emailcollector->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
}
|
||||
@ -497,26 +497,8 @@ while ($i < min($num, $limit))
|
||||
}
|
||||
|
||||
// Show total line
|
||||
if (isset($totalarray['pos']))
|
||||
{
|
||||
print '<tr class="liste_total">';
|
||||
$i=0;
|
||||
while ($i < $totalarray['nbfield'])
|
||||
{
|
||||
$i++;
|
||||
if (! empty($totalarray['pos'][$i])) print '<td class="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>';
|
||||
else
|
||||
{
|
||||
if ($i == 1)
|
||||
{
|
||||
if ($num < $limit) print '<td class="left">'.$langs->trans("Total").'</td>';
|
||||
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||
}
|
||||
else print '<td></td>';
|
||||
}
|
||||
}
|
||||
print '</tr>';
|
||||
}
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
|
||||
|
||||
|
||||
// If no record found
|
||||
if ($num == 0)
|
||||
|
||||
@ -185,6 +185,7 @@ else
|
||||
print '<br>'."\n";
|
||||
|
||||
print '<form name="formtest" method="POST" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
||||
|
||||
// Skins
|
||||
show_skin(null, 1);
|
||||
|
||||
@ -148,8 +148,8 @@ if (empty($reshook))
|
||||
// Mass actions
|
||||
$objectclass='EmailSenderProfile';
|
||||
$objectlabel='EmailSenderProfile';
|
||||
$permtoread = $user->admin;
|
||||
$permtodelete = $user->admin;
|
||||
$permissiontoread = $user->admin;
|
||||
$permissiontodelete = $user->admin;
|
||||
$uploaddir = $conf->admin->dir_output.'/senderprofiles';
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
}
|
||||
@ -461,26 +461,8 @@ while ($i < min($num, $limit))
|
||||
}
|
||||
|
||||
// Show total line
|
||||
if (isset($totalarray['pos']))
|
||||
{
|
||||
print '<tr class="liste_total">';
|
||||
$i=0;
|
||||
while ($i < $totalarray['nbfield'])
|
||||
{
|
||||
$i++;
|
||||
if (! empty($totalarray['pos'][$i])) print '<td class="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>';
|
||||
else
|
||||
{
|
||||
if ($i == 1)
|
||||
{
|
||||
if ($num < $limit) print '<td class="left">'.$langs->trans("Total").'</td>';
|
||||
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||
}
|
||||
else print '<td></td>';
|
||||
}
|
||||
}
|
||||
print '</tr>';
|
||||
}
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
|
||||
|
||||
|
||||
// If no record found
|
||||
if ($num == 0)
|
||||
|
||||
@ -166,6 +166,29 @@ if ($action == 'testprinter' && $user->admin) {
|
||||
$action = '';
|
||||
}
|
||||
|
||||
if ($action == 'testtemplate' && $user->admin) {
|
||||
$error=0;
|
||||
// if (empty($printerid)) {
|
||||
// $error++;
|
||||
// setEventMessages($langs->trans("PrinterIdEmpty"), null, 'errors');
|
||||
// }
|
||||
|
||||
// if (! $error) {
|
||||
// test
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
$object = new Facture($db);
|
||||
//$object->initAsSpecimen();
|
||||
$object->fetch(18);
|
||||
//var_dump($object->lines);
|
||||
$ret = $printer->sendToPrinter($object, $templateid, 1);
|
||||
if ($ret == 0) {
|
||||
setEventMessages($langs->trans("TestTemplateToPrinter", $printername), null);
|
||||
} else {
|
||||
setEventMessages($printer->error, $printer->errors, 'errors');
|
||||
}
|
||||
//}
|
||||
$action = '';
|
||||
}
|
||||
|
||||
if ($action == 'updatetemplate' && $user->admin) {
|
||||
$error=0;
|
||||
@ -190,6 +213,29 @@ if ($action == 'updatetemplate' && $user->admin) {
|
||||
$action = '';
|
||||
}
|
||||
|
||||
if ($action == 'addtemplate' && $user->admin) {
|
||||
$error=0;
|
||||
$db->begin();
|
||||
if (empty($templatename)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("TemplateNameEmpty"), null, 'errors');
|
||||
}
|
||||
|
||||
if (! $error) {
|
||||
$result= $printer->addTemplate($templatename, $template);
|
||||
if ($result > 0) $error++;
|
||||
|
||||
if (! $error) {
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("TemplateAdded", $templatename), null);
|
||||
} else {
|
||||
$db->rollback();
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
$action = '';
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
@ -217,15 +263,13 @@ if ($mode == 'config' && $user->admin) {
|
||||
|
||||
print $langs->trans("ReceiptPrinterDesc")."<br><br>\n";
|
||||
|
||||
print '<table class="noborder" width="100%">'."\n";
|
||||
print '<table class="noborder centpercent">'."\n";
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th>'.$langs->trans("Name").'</th>';
|
||||
print '<th>'.$langs->trans("Type").'</th>';
|
||||
print '<th>'.$langs->trans("Profile").'</th>';
|
||||
print '<th>'.$langs->trans("Parameters").'</th>';
|
||||
print '<th></th>';
|
||||
print '<th></th>';
|
||||
print '<th></th>';
|
||||
print "</tr>\n";
|
||||
$ret = $printer->listprinters();
|
||||
$nbofprinters = count($printer->listprinters);
|
||||
@ -244,8 +288,6 @@ if ($mode == 'config' && $user->admin) {
|
||||
print '<td>'.$printer->profileresprint.'</td>';
|
||||
print '<td><input size="60" type="text" name="parameter" value="'.$printer->listprinters[$line]['parameter'].'"></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '</tr>';
|
||||
} else {
|
||||
print '<td>'.$printer->listprinters[$line]['name'].'</td>';
|
||||
@ -255,13 +297,13 @@ if ($mode == 'config' && $user->admin) {
|
||||
// edit icon
|
||||
print '<td><a href="'.$_SERVER['PHP_SELF'].'?mode=config&action=editprinter&printerid='.$printer->listprinters[$line]['rowid'].'">';
|
||||
print img_picto($langs->trans("Edit"), 'edit');
|
||||
print '</a></td>';
|
||||
print '</a>';
|
||||
// delete icon
|
||||
print '<td><a href="'.$_SERVER['PHP_SELF'].'?mode=config&action=deleteprinter&printerid='.$printer->listprinters[$line]['rowid'].'&printername='.$printer->listprinters[$line]['name'].'">';
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?mode=config&action=deleteprinter&printerid='.$printer->listprinters[$line]['rowid'].'&printername='.$printer->listprinters[$line]['name'].'">';
|
||||
print img_picto($langs->trans("Delete"), 'delete');
|
||||
print '</a></td>';
|
||||
print '</a>';
|
||||
// test icon
|
||||
print '<td><a href="'.$_SERVER['PHP_SELF'].'?mode=config&action=testprinter&printerid='.$printer->listprinters[$line]['rowid'].'&printername='.$printer->listprinters[$line]['name'].'">';
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?mode=config&action=testprinter&printerid='.$printer->listprinters[$line]['rowid'].'&printername='.$printer->listprinters[$line]['name'].'">';
|
||||
print img_picto($langs->trans("TestPrinter"), 'printer');
|
||||
print '</a></td>';
|
||||
print '</tr>';
|
||||
@ -269,7 +311,7 @@ if ($mode == 'config' && $user->admin) {
|
||||
}
|
||||
}
|
||||
|
||||
if ($action!='editprinter') {
|
||||
if ($action != 'editprinter') {
|
||||
if ($nbofprinters > 0) {
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th>'.$langs->trans("Name").'</th>';
|
||||
@ -277,8 +319,6 @@ if ($mode == 'config' && $user->admin) {
|
||||
print '<th>'.$langs->trans("Profile").'</th>';
|
||||
print '<th>'.$langs->trans("Parameters").'</th>';
|
||||
print '<th></th>';
|
||||
print '<th></th>';
|
||||
print '<th></th>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
@ -345,7 +385,7 @@ if ($mode == 'template' && $user->admin) {
|
||||
dol_fiche_head($head, $mode, $langs->trans("ModuleSetup"), 0, 'technic');
|
||||
|
||||
print $langs->trans("ReceiptPrinterTemplateDesc")."<br><br>\n";
|
||||
print '<table class="noborder" width="100%">'."\n";
|
||||
print '<table class="noborder centpercent">'."\n";
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th>'.$langs->trans("Name").'</th>';
|
||||
print '<th>'.$langs->trans("Template").'</th>';
|
||||
@ -359,8 +399,7 @@ if ($mode == 'template' && $user->admin) {
|
||||
setEventMessages($printer->error, $printer->errors, 'errors');
|
||||
} else {
|
||||
$max = count($printer->listprinterstemplates);
|
||||
for ($line=0; $line < $max; $line++)
|
||||
{
|
||||
for ($line=0; $line < $max; $line++) {
|
||||
print '<tr class="oddeven">';
|
||||
if ($action=='edittemplate' && $printer->listprinterstemplates[$line]['rowid']==$templateid) {
|
||||
print '<input type="hidden" name="templateid" value="'.$printer->listprinterstemplates[$line]['rowid'].'">';
|
||||
@ -368,21 +407,19 @@ if ($mode == 'template' && $user->admin) {
|
||||
print '<td><textarea name="template" wrap="soft" cols="120" rows="12">'.$printer->listprinterstemplates[$line]['template'].'</textarea>';
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
} else {
|
||||
print '<td>'.$printer->listprinterstemplates[$line]['name'].'</td>';
|
||||
print '<td>'.nl2br(htmlentities($printer->listprinterstemplates[$line]['template'])).'</td>';
|
||||
// edit icon
|
||||
print '<td><a href="'.$_SERVER['PHP_SELF'].'?mode=template&action=edittemplate&templateid='.$printer->listprinterstemplates[$line]['rowid'].'">';
|
||||
print img_picto($langs->trans("Edit"), 'edit');
|
||||
print '</a></td>';
|
||||
print '</a>';
|
||||
// delete icon
|
||||
print '<td><a href="'.$_SERVER['PHP_SELF'].'?mode=template&action=deletetemplate&templateid='.$printer->listprinterstemplates[$line]['rowid'].'&templatename='.$printer->listprinterstemplates[$line]['name'].'">';
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?mode=template&action=deletetemplate&templateid='.$printer->listprinterstemplates[$line]['rowid'].'&templatename='.$printer->listprinterstemplates[$line]['name'].'">';
|
||||
print img_picto($langs->trans("Delete"), 'delete');
|
||||
print '</a></td>';
|
||||
print '</a>';
|
||||
// test icon
|
||||
print '<td><a href="'.$_SERVER['PHP_SELF'].'?mode=template&action=testtemplate&templateid='.$printer->listprinterstemplates[$line]['rowid'].'&templatename='.$printer->listprinterstemplates[$line]['name'].'">';
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?mode=template&action=testtemplate&templateid='.$printer->listprinterstemplates[$line]['rowid'].'&templatename='.$printer->listprinterstemplates[$line]['name'].'">';
|
||||
print img_picto($langs->trans("TestPrinterTemplate"), 'printer');
|
||||
print '</a></td>';
|
||||
}
|
||||
@ -392,13 +429,19 @@ if ($mode == 'template' && $user->admin) {
|
||||
|
||||
print '</table>';
|
||||
if ($action!='edittemplate') {
|
||||
print '<input type="hidden" name="templateid" value="'.$printer->listprinterstemplates[$line]['rowid'].'">';
|
||||
print '<td><input size="50" type="text" name="templatename" value="'.$printer->listprinterstemplates[$line]['name'].'"></td>';
|
||||
print '<td><textarea name="template" wrap="soft" cols="120" rows="12">'.$printer->listprinterstemplates[$line]['template'].'</textarea>';
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
|
||||
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Add")).'"></div>';
|
||||
} else {
|
||||
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'"></div>';
|
||||
}
|
||||
print '</form>';
|
||||
print '<div><p></div>';
|
||||
print '<table class="noborder" width="100%">'."\n";
|
||||
print '<table class="noborder centpercent">'."\n";
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th>'.$langs->trans("Tag").'</th>';
|
||||
print '<th>'.$langs->trans("Description").'</th>';
|
||||
@ -414,18 +457,6 @@ if ($mode == 'template' && $user->admin) {
|
||||
dol_fiche_end();
|
||||
}
|
||||
|
||||
// to remove after test
|
||||
// $object=new stdClass();
|
||||
// $object->date_time = '2015-11-02 22:30:25';
|
||||
// $object->id = 1234;
|
||||
// $object->customer_firstname = 'John';
|
||||
// $object->customer_lastname = 'Deuf';
|
||||
// $object->vendor_firstname = 'Jim';
|
||||
// $object->vendor_lastname = 'Big';
|
||||
// $object->barcode = '3700123862396';
|
||||
//$printer->sendToPrinter($object, 1, 16);
|
||||
//setEventMessages($printer->error, $printer->errors, 'errors');
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
|
||||
@ -46,7 +46,7 @@ llxHeader();
|
||||
|
||||
print load_fiche_titre($langs->trans("FileCheckDolibarr"), '', 'title_setup');
|
||||
|
||||
print $langs->trans("FileCheckDesc").'<br><br>';
|
||||
print '<span class="opacitymedium">'.$langs->trans("FileCheckDesc").'</span><br><br>';
|
||||
|
||||
// Version
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
@ -239,6 +239,7 @@ if (! $error && $xml)
|
||||
$out.='<tr class="liste_titre">';
|
||||
$out.='<td>#</td>';
|
||||
$out.='<td>' . $langs->trans("Filename") . '</td>';
|
||||
$out.='<td class="right">' . $langs->trans("ExpectedSize") . '</td>';
|
||||
$out.='<td class="center">' . $langs->trans("ExpectedChecksum") . '</td>';
|
||||
$out.='</tr>'."\n";
|
||||
$tmpfilelist = dol_sort_array($file_list['missing'], 'filename');
|
||||
@ -251,6 +252,9 @@ if (! $error && $xml)
|
||||
$out.='<tr class="oddeven">';
|
||||
$out.='<td>'.$i.'</td>' . "\n";
|
||||
$out.='<td>'.$file['filename'].'</td>' . "\n";
|
||||
$out.='<td class="right">';
|
||||
if (! empty($file['expectedsize'])) $out.=dol_print_size($file['expectedsize']);
|
||||
$out.='</td>' . "\n";
|
||||
$out.='<td class="center">'.$file['expectedmd5'].'</td>' . "\n";
|
||||
$out.="</tr>\n";
|
||||
}
|
||||
@ -275,7 +279,8 @@ if (! $error && $xml)
|
||||
$out.='<td>' . $langs->trans("Filename") . '</td>';
|
||||
$out.='<td class="center">' . $langs->trans("ExpectedChecksum") . '</td>';
|
||||
$out.='<td class="center">' . $langs->trans("CurrentChecksum") . '</td>';
|
||||
$out.='<td class="right">' . $langs->trans("Size") . '</td>';
|
||||
$out.='<td class="right">' . $langs->trans("ExpectedSize") . '</td>';
|
||||
$out.='<td class="right">' . $langs->trans("CurrentSize") . '</td>';
|
||||
$out.='<td class="right">' . $langs->trans("DateModification") . '</td>';
|
||||
$out.='</tr>'."\n";
|
||||
$tmpfilelist2 = dol_sort_array($file_list['updated'], 'filename');
|
||||
@ -290,6 +295,9 @@ if (! $error && $xml)
|
||||
$out.='<td>'.$file['filename'].'</td>' . "\n";
|
||||
$out.='<td class="center">'.$file['expectedmd5'].'</td>' . "\n";
|
||||
$out.='<td class="center">'.$file['md5'].'</td>' . "\n";
|
||||
$out.='<td class="right">';
|
||||
if ($file['expectedsize']) $out.=dol_print_size($file['expectedsize']);
|
||||
$out.='</td>' . "\n";
|
||||
$size = dol_filesize(DOL_DOCUMENT_ROOT.'/'.$file['filename']);
|
||||
$totalsize += $size;
|
||||
$out.='<td class="right">'.dol_print_size($size).'</td>' . "\n";
|
||||
@ -301,6 +309,7 @@ if (! $error && $xml)
|
||||
$out.='<td>'.$langs->trans("Total").'</td>' . "\n";
|
||||
$out.='<td class="center"></td>' . "\n";
|
||||
$out.='<td class="center"></td>' . "\n";
|
||||
$out.='<td class="center"></td>' . "\n";
|
||||
$out.='<td class="right">'.dol_print_size($totalsize).'</td>' . "\n";
|
||||
$out.='<td class="right"></td>' . "\n";
|
||||
$out.="</tr>\n";
|
||||
|
||||
@ -40,7 +40,7 @@ llxHeader();
|
||||
|
||||
print load_fiche_titre($langs->trans("AvailableModules"), '', 'title_setup');
|
||||
|
||||
print $langs->trans("ToActivateModule").'<br>';
|
||||
print '<span class="opacitymedium">'.$langs->trans("ToActivateModule").'</span><br>';
|
||||
print "<br>\n";
|
||||
|
||||
$modules = array();
|
||||
|
||||
@ -39,7 +39,6 @@ print load_fiche_titre("XCache", '', 'title_setup');
|
||||
|
||||
print "<br>\n";
|
||||
|
||||
//function_exists('apc_cache_info') || function_exists('eaccelerator_info') || function_exists('xcache_info'))
|
||||
if (!function_exists('xcache_info'))
|
||||
{
|
||||
print 'XCache seems to be not installed. Function xcache_info not found.';
|
||||
|
||||
@ -1,338 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2009 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/tools/eaccelerator.php
|
||||
* \brief Page administration de eaccelerator
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
|
||||
$langs->load("admin");
|
||||
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
|
||||
|
||||
if (!function_exists('eaccelerator_info')) {
|
||||
print 'eAccelerator is not installed.';
|
||||
llxFooter();
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$info = eaccelerator_info();
|
||||
if (isset($_POST['caching'])) {
|
||||
if ($info['cache']) {
|
||||
eaccelerator_caching(false);
|
||||
} else {
|
||||
eaccelerator_caching(true);
|
||||
}
|
||||
} elseif (isset($_POST['optimizer']) && function_exists('eaccelerator_optimizer')) {
|
||||
if ($info['optimizer']) {
|
||||
eaccelerator_optimizer(false);
|
||||
} else {
|
||||
eaccelerator_optimizer(true);
|
||||
}
|
||||
} elseif (isset($_POST['clear'])) {
|
||||
eaccelerator_clear();
|
||||
} elseif (isset($_POST['clean'])) {
|
||||
eaccelerator_clean();
|
||||
} elseif (isset($_POST['purge'])) {
|
||||
eaccelerator_purge();
|
||||
}
|
||||
$info = eaccelerator_info();
|
||||
if (!is_array($info)) {
|
||||
dol_print_error('', 'An error occured getting eAccelerator information, this is caused if eAccelerator isn\'t initalised properly');
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Compare revisions
|
||||
*
|
||||
* @param array $x Parts of version 1
|
||||
* @param array $y Parts of version 2
|
||||
* @return int -1 if 1<2, 0 if 1=2, 1 if 1>2
|
||||
*/
|
||||
function compare($x, $y)
|
||||
{
|
||||
global $sortby;
|
||||
|
||||
if ( $x[$sortby] == $y[$sortby] ) {
|
||||
return 0;
|
||||
} elseif ($x[$sortby] < $y[$sortby]) {
|
||||
return -1;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare revisions
|
||||
*
|
||||
* @param array $x Parts of version 1
|
||||
* @param array $y Parts of version 2
|
||||
* @return int 1 if 1<2, 0 if 1=2, -1 if 1>2
|
||||
*/
|
||||
function revcompare($x, $y)
|
||||
{
|
||||
global $sortby;
|
||||
|
||||
if ($x[$sortby] == $y[$sortby]) {
|
||||
return 0;
|
||||
} elseif ($x[$sortby] < $y[$sortby]) {
|
||||
return 1;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Output table
|
||||
*
|
||||
* @param array $list Array of records
|
||||
* @return void
|
||||
*/
|
||||
function create_script_table($list)
|
||||
{
|
||||
global $sortby,$langs;
|
||||
|
||||
if (GETPOT('order', 'alpha') == "asc" || GETPOST('order', 'alpha') == "desc") {
|
||||
$order = GETPOST('order', 'alpha');
|
||||
} else {
|
||||
$order = "asc";
|
||||
}
|
||||
|
||||
if (GETPOST('order', 'alpha')) {
|
||||
switch (GETPOST('order', 'alpha')) {
|
||||
case "mtime":
|
||||
case "size":
|
||||
case "reloads":
|
||||
case "hits":
|
||||
$sortby = GETPOST('sort');
|
||||
($order == "asc" ? uasort($list, 'compare') : uasort($list, 'revcompare'));
|
||||
break;
|
||||
default:
|
||||
$sortby = "file";
|
||||
($order == "asc" ? uasort($list, 'compare') : uasort($list, 'revcompare'));
|
||||
}
|
||||
}
|
||||
|
||||
print '<table class="noborder">';
|
||||
print '<tr>';
|
||||
print '<th><a href="'.$_SERVER['PHP_SELF'].'?sort=file&order='.($order == "asc" ? "desc" : "asc").'">'.$langs->trans("Filename").'</a> ';
|
||||
if($sortby == "file")
|
||||
print ($order == "asc" ? "↓" : "↑").'</th>';
|
||||
print '<th><a href="'.$_SERVER['PHP_SELF'].'?sort=mtime&order='.($order == "asc" ? "desc" : "asc").'">'.$langs->trans("Date").'</a> ';
|
||||
if($sortby == "mtime")
|
||||
print ($order == "asc" ? "↓" : "↑").'</th>';
|
||||
print '<th><a href="'.$_SERVER['PHP_SELF'].'?sort=size&order='.($order == "asc" ? "desc" : "asc").'">'.$langs->trans("Size").'</a> ';
|
||||
if($sortby == "size")
|
||||
print ($order == "asc" ? "↓" : "↑").'</th>';
|
||||
print '<th><a href="'.$_SERVER['PHP_SELF'].'?sort=reloads&order='.($order == "asc" ? "desc" : "asc").'">'.$langs->trans("Reloads").'</a> ';
|
||||
if($sortby == "reloads")
|
||||
print ($order == "asc" ? "↓" : "↑").'</th>';
|
||||
print '<th><a href="'.$_SERVER['PHP_SELF'].'?sort=hits&order='.($order == "asc" ? "desc" : "asc").'">'.$langs->trans("Hits").'</a> ';
|
||||
if($sortby == "hits")
|
||||
print ($order == "asc" ? "↓" : "↑").'</th>';
|
||||
print '</tr>';
|
||||
switch ($sortby) {
|
||||
case "mtime":
|
||||
case "size":
|
||||
case "reloads":
|
||||
case "hits":
|
||||
($order == "asc" ? uasort($list, 'compare') : uasort($list, 'revcompare'));
|
||||
break;
|
||||
case "file":
|
||||
default:
|
||||
$sortby = "file";
|
||||
($order == "asc" ? uasort($list, 'compare') : uasort($list, 'revcompare'));
|
||||
}
|
||||
|
||||
foreach($list as $script) {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.dol_trunc($script['file'], 80, 'left').'</td>';
|
||||
print '<td class="nowrap center">'.dol_print_date($script['mtime'], 'dayhour').'</td>';
|
||||
print '<td class="nowrap right">'.number_format($script['size'] / 1024, 2).'KB</td>';
|
||||
print '<td class="nowrap right">'.$script['reloads'].' ('.$script['usecount'].')</td>';
|
||||
print '<td class="nowrap right">'.$script['hits'].'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Output table
|
||||
*
|
||||
* @param array $list Array of records
|
||||
* @return void
|
||||
*/
|
||||
function create_key_table($list)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
print '<table class="noborder">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th>Name</th>';
|
||||
print '<th>Created</th>';
|
||||
print '<th>'.$langs->trans("Size").'</th>';
|
||||
print '<th>ttl</th>';
|
||||
print '</tr>';
|
||||
|
||||
foreach($list as $key) {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.dol_trunc($key['name'], 80, 'left').'</td>';
|
||||
print '<td class="nowrap center">'.dol_print_date($key['created'], 'dayhour').'</td>';
|
||||
print '<td class="nowrap right">'.number_format($key['size']/1024, 3).'KB</td>';
|
||||
print '<td class="nowrap right">';
|
||||
if ($key['ttl'] == -1) {
|
||||
print 'expired';
|
||||
} elseif ($key['ttl'] == 0) {
|
||||
print 'none';
|
||||
} else {
|
||||
print dol_print_date($key['ttl'], 'dayhour');
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
|
||||
$form=new Form($db);
|
||||
print load_fiche_titre('Dolibarr eAccelerator '.$info['version'].' control panel', '', 'title_setup');
|
||||
|
||||
print '<br>';
|
||||
|
||||
print '<table class="noborder">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="2">Information</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>Caching enabled</td>';
|
||||
print '<td class="right">'.($info['cache']?'yes':'no').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>Optimizer enabled</td>';
|
||||
print '<td class="right">'.$info['optimizer']?'yes':'no'.'</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>Memory usage</td>';
|
||||
print '<td class="right">'.number_format(100 * $info['memoryAllocated']/$info['memorySize'], 2).'%('.number_format($info['memoryAllocated'] / (1024*1024), 2).'MB / '.number_format($info['memorySize']/(1024*1024), 2).'MB)</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>Free memory in reserved cache</td>';
|
||||
print '<td class="right">'.number_format($info['memoryAvailable']/(1024*1024), 2).'MB</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>Cached scripts</td>';
|
||||
print '<td class="right">'.$info['cachedScripts'].'</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>Removed scripts</td>';
|
||||
print '<td class="right">'.$info['removedScripts'].'</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>Cached keys</td>';
|
||||
print '<td class="right">'.(isset($info['cachedKeys'])?$info['cachedKeys']:'').'</td>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
|
||||
$resCached = @eaccelerator_cached_scripts(); // If success return an array
|
||||
$resRemoved = @eaccelerator_removed_scripts();
|
||||
|
||||
if (is_array($resCached) || is_array($resRemoved)) {
|
||||
print "<br>";
|
||||
print '<form name="ea_control" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<table class="noborder">';
|
||||
print '<tr class="liste_titre"><td colspan="2">Actions</td></tr>';
|
||||
|
||||
if (is_array($resCached)) {
|
||||
print '<tr class="oddeven">';
|
||||
print "<td>Caching</td>";
|
||||
print '<td class="right"><input type="submit" class="butAction" name="caching" value="'. ($info['cache']?'disable':'enable') .'" /></td>';
|
||||
print "</tr>";
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print "<td>Optimizer</td>";
|
||||
print '<td class="right"><input type="submit" class="butAction" name="optimizer" value="'. ($info['optimizer']?'disable':'enable') .'" /></td>';
|
||||
print "</tr>";
|
||||
}
|
||||
|
||||
if (is_array($resRemoved)) {
|
||||
print '<tr class="oddeven">';
|
||||
print "<td>Clear cache</td>";
|
||||
print '<td class="right"><input type="submit" class="butAction" name="clear" value="clear" title="remove all unused scripts and data from shared memory and disk cache" /></td>';
|
||||
print "</tr>";
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print "<td>Clean cache</td>";
|
||||
print '<td class="right"><input type="submit" class="butAction" name="clean" value="clean" title=" remove all expired scripts and data from shared memory and disk cache" /></td>';
|
||||
print "</tr>";
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print "<td>Purge cache</td>";
|
||||
print '<td class="right"><input type="submit" class="butAction" name="purge" value="purge" title="remove all \'removed\' scripts from shared memory" /></td>';
|
||||
print "</tr></table></form>";
|
||||
}
|
||||
|
||||
if (is_array($resCached)) {
|
||||
print "<br><br>";
|
||||
print "<b>Cached scripts</b><br>";
|
||||
create_script_table($resCached);
|
||||
}
|
||||
|
||||
if (is_array($resRemoved)) {
|
||||
print "<br><br>";
|
||||
print "<b>Removed scripts</b><br>";
|
||||
create_script_table($resRemoved);
|
||||
}
|
||||
} else {
|
||||
print "<br><br>";
|
||||
print "Check in your <b>php.ini</b> that <b>eaccelerator.allowed_admin_path</b> parameter is : ";
|
||||
print "<br><br>";
|
||||
print "<b>".$_SERVER["SCRIPT_FILENAME"]."</b>";
|
||||
print "<br><br>";
|
||||
}
|
||||
|
||||
if (function_exists('eaccelerator_get')) {
|
||||
print '<br><br>';
|
||||
print '<b>Cached keys</b><br>';
|
||||
$res=eaccelerator_list_keys();
|
||||
create_key_table($res);
|
||||
}
|
||||
|
||||
print "<br><br>";
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
@ -49,7 +49,7 @@ $form = new Form($db);
|
||||
|
||||
print load_fiche_titre($langs->trans("TriggersAvailable"), '', 'title_setup');
|
||||
|
||||
print $langs->trans("TriggersDesc")."<br>";
|
||||
print '<span class="opacitymedium">'.$langs->trans("TriggersDesc")."</span><br>";
|
||||
print "<br>\n";
|
||||
|
||||
|
||||
@ -60,8 +60,8 @@ $param = ''; $align = '';
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder">';
|
||||
print '<tr class="liste_titre">';
|
||||
print getTitleFieldOfList($langs->trans("File"), 0, $_SERVER["PHP_SELF"], 'file', "", $param, ($align?'align="'.$align.'"':''), $sortfield, $sortorder, '', 1)."\n";
|
||||
print getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], 'none', "", $param, '', $sortfield, $sortorder, '', 1)."\n";
|
||||
print getTitleFieldOfList($langs->trans("File"), 0, $_SERVER["PHP_SELF"], 'file', "", $param, ($align?'align="'.$align.'"':''), $sortfield, $sortorder, '', 1)."\n";
|
||||
print getTitleFieldOfList($langs->trans("Active"), 0, $_SERVER["PHP_SELF"], 'active', "", $param, 'align="center"', $sortfield, $sortorder, '', 1)."\n";
|
||||
print getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], 'none', "", $param, ($align?'align="'.$align.'"':''), $sortfield, $sortorder, '', 1)."\n";
|
||||
print '</tr>';
|
||||
@ -69,7 +69,7 @@ print '</tr>';
|
||||
foreach ($triggers as $trigger)
|
||||
{
|
||||
print '<tr class="oddeven">';
|
||||
print '<td valign="top" width="14" align="center">'.$trigger['picto'].'</td>';
|
||||
print '<td class="tdtop" width="32">'.$trigger['picto'].'</td>';
|
||||
print '<td class="tdtop">'.$trigger['file'].'</td>';
|
||||
print '<td valign="top" align="center">'.$trigger['status'].'</td>';
|
||||
print '<td class="tdtop">';
|
||||
|
||||
@ -148,11 +148,13 @@ class DolibarrApiAccess implements iAuthenticate
|
||||
$fuser->getrights();
|
||||
static::$user = $fuser;
|
||||
|
||||
if($fuser->societe_id)
|
||||
if ($fuser->socid) {
|
||||
static::$role = 'external';
|
||||
}
|
||||
|
||||
if($fuser->admin)
|
||||
if ($fuser->admin) {
|
||||
static::$role = 'admin';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -45,6 +45,68 @@ class Setup extends DolibarrApi
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of ordering methods.
|
||||
*
|
||||
* @param string $sortfield Sort field
|
||||
* @param string $sortorder Sort order
|
||||
* @param int $limit Number of items per page
|
||||
* @param int $page Page number {@min 0}
|
||||
* @param int $active Payment type is active or not {@min 0} {@max 1}
|
||||
* @param string $sqlfilters SQL criteria to filter with. Syntax example "(t.code:=:'CHQ')"
|
||||
*
|
||||
* @url GET dictionary/ordering_methods
|
||||
*
|
||||
* @return array [List of ordering methods]
|
||||
*
|
||||
* @throws 400 RestException
|
||||
* @throws 200 OK
|
||||
*/
|
||||
public function getOrderingMethods($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
|
||||
{
|
||||
$list = array();
|
||||
|
||||
$sql = "SELECT rowid, code, libelle as label, module";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_input_method as t";
|
||||
$sql.= " WHERE t.active = ".$active;
|
||||
// Add sql filters
|
||||
if ($sqlfilters)
|
||||
{
|
||||
if (! DolibarrApi::_checkFilters($sqlfilters))
|
||||
{
|
||||
throw new RestException(400, 'error when validating parameter sqlfilters '.$sqlfilters);
|
||||
}
|
||||
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
|
||||
$sql.= $this->db->order($sortfield, $sortorder);
|
||||
|
||||
if ($limit) {
|
||||
if ($page < 0) {
|
||||
$page = 0;
|
||||
}
|
||||
$offset = $limit * $page;
|
||||
|
||||
$sql .= $this->db->plimit($limit, $offset);
|
||||
}
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ($result) {
|
||||
$num = $this->db->num_rows($result);
|
||||
$min = min($num, ($limit <= 0 ? $num : $limit));
|
||||
for ($i = 0; $i < $min; $i++) {
|
||||
$list[] = $this->db->fetch_object($result);
|
||||
}
|
||||
} else {
|
||||
throw new RestException(400, $this->db->lasterror());
|
||||
}
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of payments types.
|
||||
*
|
||||
@ -963,7 +1025,7 @@ class Setup extends DolibarrApi
|
||||
* @param string $sortorder Sort order
|
||||
* @param int $limit Number of items per page
|
||||
* @param int $page Page number (starting from zero)
|
||||
* @param int $active Payment term is active or not {@min 0} {@max 1}
|
||||
* @param int $active Measuring unit is active or not {@min 0} {@max 1}
|
||||
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)"
|
||||
* @return array List of measuring unit
|
||||
*
|
||||
@ -1016,6 +1078,67 @@ class Setup extends DolibarrApi
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of social networks.
|
||||
*
|
||||
* @param string $sortfield Sort field
|
||||
* @param string $sortorder Sort order
|
||||
* @param int $limit Number of items per page
|
||||
* @param int $page Page number (starting from zero)
|
||||
* @param int $active Social network is active or not {@min 0} {@max 1}
|
||||
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)"
|
||||
* @return array List of social networks
|
||||
*
|
||||
* @url GET dictionary/socialnetworks
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
public function getListOfsocialNetworks($sortfield = "rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
|
||||
{
|
||||
$list = array();
|
||||
//TODO link with multicurrency module
|
||||
$sql = "SELECT t.rowid, t.entity, t.code, t.label, t.url, t.icon, t.active";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_socialnetworks as t";
|
||||
$sql.= " WHERE t.entity IN (".getEntity('c_socialnetworks').")";
|
||||
$sql.= " AND t.active = ".$active;
|
||||
// Add sql filters
|
||||
if ($sqlfilters)
|
||||
{
|
||||
if (! DolibarrApi::_checkFilters($sqlfilters))
|
||||
{
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
}
|
||||
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
|
||||
$sql.= $this->db->order($sortfield, $sortorder);
|
||||
|
||||
if ($limit) {
|
||||
if ($page < 0) {
|
||||
$page = 0;
|
||||
}
|
||||
$offset = $limit * $page;
|
||||
|
||||
$sql .= $this->db->plimit($limit, $offset);
|
||||
}
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ($result) {
|
||||
$num = $this->db->num_rows($result);
|
||||
$min = min($num, ($limit <= 0 ? $num : $limit));
|
||||
for ($i = 0; $i < $min; $i++) {
|
||||
$list[] = $this->db->fetch_object($result);
|
||||
}
|
||||
} else {
|
||||
throw new RestException(503, 'Error when retrieving list of social networks: '.$this->db->lasterror());
|
||||
}
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of tickets categories.
|
||||
*
|
||||
|
||||
@ -69,8 +69,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be inclu
|
||||
|
||||
$permissionnote=$user->rights->asset->write; // Used by the include of actions_setnotes.inc.php
|
||||
$permissiondellink=$user->rights->asset->write; // Used by the include of actions_dellink.inc.php
|
||||
$permissionedit=$user->rights->asset->write; // Used by the include of actions_lineupdown.inc.php
|
||||
$permissiontoadd=$user->rights->asset->write; // Used by the include of actions_addupdatedelete.inc.php
|
||||
$permissiontoadd=$user->rights->asset->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -152,8 +152,8 @@ if (empty($reshook))
|
||||
// Mass actions
|
||||
$objectclass='Asset';
|
||||
$objectlabel='Asset';
|
||||
$permtoread = $user->rights->asset->read;
|
||||
$permtodelete = $user->rights->asset->delete;
|
||||
$permissiontoread = $user->rights->asset->read;
|
||||
$permissiontodelete = $user->rights->asset->delete;
|
||||
$uploaddir = $conf->asset->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
}
|
||||
@ -407,9 +407,13 @@ print '</tr>'."\n";
|
||||
|
||||
// Detect if we need a fetch on each output line
|
||||
$needToFetchEachLine=0;
|
||||
foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val)
|
||||
{
|
||||
if (preg_match('/\$object/', $val)) $needToFetchEachLine++; // There is at least one compute field that use $object
|
||||
if (is_array($extrafields->attributes[$object->table_element]['computed'])) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
|
||||
if (preg_match('/\$object/', $val)) {
|
||||
// There is at least one compute field that use $object
|
||||
$needToFetchEachLine++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -72,14 +72,13 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be inclu
|
||||
// Security check - Protection if external user
|
||||
//if ($user->socid > 0) access_forbidden();
|
||||
//if ($user->socid > 0) $socid = $user->socid;
|
||||
//$isdraft = (($object->statut == BillOfMaterials::STATUS_DRAFT) ? 1 : 0);
|
||||
//$isdraft = (($object->statut == $object::STATUS_DRAFT) ? 1 : 0);
|
||||
//$result = restrictedArea($user, 'bom', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
|
||||
|
||||
$permissionnote=$user->rights->bom->write; // Used by the include of actions_setnotes.inc.php
|
||||
$permissiondellink=$user->rights->bom->write; // Used by the include of actions_dellink.inc.php
|
||||
$permissionedit=$user->rights->bom->write; // Used by the include of actions_lineupdown.inc.php
|
||||
$permissiontoadd=$user->rights->bom->write; // Used by the include of actions_addupdatedelete.inc.php
|
||||
$permissiontodelete = $user->rights->bom->delete || ($permissiontoadd && $object->status == 0);
|
||||
$permissiontoadd=$user->rights->bom->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
|
||||
$permissiontodelete = $user->rights->bom->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
|
||||
|
||||
|
||||
/*
|
||||
@ -112,6 +111,12 @@ if (empty($reshook))
|
||||
// Actions when printing a doc from card
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
||||
|
||||
// Action to move up and down lines of object
|
||||
//include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php';
|
||||
|
||||
// Action to build doc
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||
|
||||
// Actions to send emails
|
||||
$trigger_name='BOM_SENTBYMAIL';
|
||||
$autocopy='MAIN_MAIL_AUTOCOPY_BOM_TO';
|
||||
@ -146,8 +151,8 @@ if (empty($reshook))
|
||||
$bomline->fk_bom = $id;
|
||||
$bomline->fk_product = $idprod;
|
||||
$bomline->qty = $qty;
|
||||
$bomline->qty_frozen = $qty_frozen;
|
||||
$bomline->disable_stock_change = $disable_stock_change;
|
||||
$bomline->qty_frozen = (int) $qty_frozen;
|
||||
$bomline->disable_stock_change = (int) $disable_stock_change;
|
||||
$bomline->efficiency = $efficiency;
|
||||
|
||||
$result = $bomline->create($user);
|
||||
@ -184,8 +189,8 @@ if (empty($reshook))
|
||||
$bomline = new BOMLine($db);
|
||||
$bomline->fetch($lineid);
|
||||
$bomline->qty = $qty;
|
||||
$bomline->qty_frozen = $qty_frozen;
|
||||
$bomline->disable_stock_change = $disable_stock_change;
|
||||
$bomline->qty_frozen = (int) $qty_frozen;
|
||||
$bomline->disable_stock_change = (int) $disable_stock_change;
|
||||
$bomline->efficiency = $efficiency;
|
||||
|
||||
$result = $bomline->update($user);
|
||||
@ -457,7 +462,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
{
|
||||
$langs->load("projects");
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($user->rights->bom->write)
|
||||
if ($permissiontoadd)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
@ -532,7 +537,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
}
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
if (! empty($object->lines) || ($object->status == 0 && $permissiontoadd && $action != 'selectlines' && $action != 'editline'))
|
||||
if (! empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline'))
|
||||
{
|
||||
print '<table id="tablelines" class="noborder noshadow" width="100%">';
|
||||
}
|
||||
@ -555,7 +560,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($object->lines) || ($object->status == 0 && $permissiontoadd && $action != 'selectlines' && $action != 'editline'))
|
||||
if (! empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline'))
|
||||
{
|
||||
print '</table>';
|
||||
}
|
||||
@ -565,8 +570,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Buttons for actions
|
||||
|
||||
if ($action != 'presend' && $action != 'editline') {
|
||||
print '<div class="tabsAction">'."\n";
|
||||
$parameters=array();
|
||||
@ -584,7 +589,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
}
|
||||
|
||||
// Modify
|
||||
if ($user->rights->bom->write)
|
||||
if ($permissiontoadd)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit">'.$langs->trans("Modify").'</a>'."\n";
|
||||
}
|
||||
@ -619,7 +624,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
}
|
||||
|
||||
// Clone
|
||||
if ($user->rights->bom->write)
|
||||
if ($permissiontoadd)
|
||||
{
|
||||
print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=clone&object=bom">' . $langs->trans("ToClone") . '</a>';
|
||||
}
|
||||
@ -638,7 +643,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
}
|
||||
*/
|
||||
|
||||
if ($user->rights->bom->delete)
|
||||
if ($permissiontodelete)
|
||||
{
|
||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete">'.$langs->trans('Delete').'</a>'."\n";
|
||||
}
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) ---Put here your own copyright and developer email---
|
||||
*
|
||||
* 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
|
||||
@ -114,6 +113,9 @@ if (is_array($extrafields->attributes[$object->table_element]['label']) && count
|
||||
$object->fields = dol_sort_array($object->fields, 'position');
|
||||
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||
|
||||
$permissiontoread = $user->rights->bom->read;
|
||||
$permissiontoadd = $user->rights->bom->write;
|
||||
$permissiontodelete = $user->rights->bom->delete;
|
||||
|
||||
|
||||
/*
|
||||
@ -151,13 +153,123 @@ if (empty($reshook))
|
||||
// Mass actions
|
||||
$objectclass='BOM';
|
||||
$objectlabel='BillOfMaterials';
|
||||
$permtoread = $user->rights->bom->read;
|
||||
$permtodelete = $user->rights->bom->delete;
|
||||
$permissiontoread = $user->rights->bom->read;
|
||||
$permissiontodelete = $user->rights->bom->delete;
|
||||
$uploaddir = $conf->bom->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
}
|
||||
|
||||
|
||||
// Validate records
|
||||
if (! $error && $massaction == 'disable' && $permissiontoadd)
|
||||
{
|
||||
$objecttmp=new $objectclass($db);
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
$nbok = 0;
|
||||
foreach($toselect as $toselectid)
|
||||
{
|
||||
$result=$objecttmp->fetch($toselectid);
|
||||
if ($result > 0)
|
||||
{
|
||||
if ($objecttmp->status != $objecttmp::STATUS_VALIDATED)
|
||||
{
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans("ErrorObjectMustHaveStatusActiveToBeDisabled", $objecttmp->ref), null, 'errors');
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
|
||||
// Can be 'cancel()' or 'close()'
|
||||
$result = $objecttmp->cancel($user);
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
else $nbok++;
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
if ($nbok > 1) setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
|
||||
else setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
|
||||
$db->commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
}
|
||||
//var_dump($listofobjectthirdparties);exit;
|
||||
}
|
||||
}
|
||||
|
||||
// Validate records
|
||||
if (! $error && $massaction == 'enable' && $permissiontoadd)
|
||||
{
|
||||
$objecttmp=new $objectclass($db);
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
$nbok = 0;
|
||||
foreach($toselect as $toselectid)
|
||||
{
|
||||
$result=$objecttmp->fetch($toselectid);
|
||||
if ($result > 0)
|
||||
{
|
||||
if ($objecttmp->status != $objecttmp::STATUS_DRAFT && $objecttmp->status != $objecttmp::STATUS_CANCELED)
|
||||
{
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans("ErrorObjectMustHaveStatusDraftOrDisabledToBeActivated", $objecttmp->ref), null, 'errors');
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
|
||||
// Can be 'cancel()' or 'close()'
|
||||
$result = $objecttmp->validate($user);
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
else $nbok++;
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
if ($nbok > 1) setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
|
||||
else setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
|
||||
$db->commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
}
|
||||
//var_dump($listofobjectthirdparties);exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
@ -303,7 +415,8 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||
// List of mass actions available
|
||||
$arrayofmassactions = array(
|
||||
//'presend'=>$langs->trans("SendByMail"),
|
||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||
'enable'=>$langs->trans("Enable"),
|
||||
'disable'=>$langs->trans("Disable"),
|
||||
);
|
||||
if ($user->rights->bom->delete) $arrayofmassactions['predelete']='<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
||||
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions=array();
|
||||
@ -498,26 +611,8 @@ while ($i < min($num, $limit))
|
||||
}
|
||||
|
||||
// Show total line
|
||||
if (isset($totalarray['pos']))
|
||||
{
|
||||
print '<tr class="liste_total">';
|
||||
$i=0;
|
||||
while ($i < $totalarray['nbfield'])
|
||||
{
|
||||
$i++;
|
||||
if (! empty($totalarray['pos'][$i])) print '<td class="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>';
|
||||
else
|
||||
{
|
||||
if ($i == 1)
|
||||
{
|
||||
if ($num < $limit) print '<td class="left">'.$langs->trans("Total").'</td>';
|
||||
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||
}
|
||||
else print '<td></td>';
|
||||
}
|
||||
}
|
||||
print '</tr>';
|
||||
}
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
|
||||
|
||||
|
||||
// If no record found
|
||||
if ($num == 0)
|
||||
@ -539,6 +634,7 @@ print '</div>'."\n";
|
||||
|
||||
print '</form>'."\n";
|
||||
|
||||
|
||||
if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords))
|
||||
{
|
||||
$hidegeneratedfilelistifempty=1;
|
||||
|
||||
@ -91,7 +91,7 @@ class BOM extends CommonObject
|
||||
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'noteditable'=>1, 'visible'=>4, 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of BOM", 'showoncombobox'=>'1',),
|
||||
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>1, 'searchall'=>1, 'showoncombobox'=>'1',),
|
||||
'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,),
|
||||
'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:1', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'help'=>'ProductBOMHelp'),
|
||||
'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:1:(finished IS NULL or finished <> 0)', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'help'=>'ProductBOMHelp'),
|
||||
'qty' => array('type'=>'real', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>55, 'notnull'=>1, 'isameasure'=>'1', 'css'=>'maxwidth75imp'),
|
||||
'efficiency' => array('type'=>'real', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>-1, 'default'=>1, 'position'=>100, 'notnull'=>0, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLoss'),
|
||||
'duration' => array('type'=>'real', 'label'=>'EstimatedDuration', 'enabled'=>1, 'visible'=>-1, 'position'=>101, 'notnull'=>-1, 'css'=>'maxwidth50imp', 'help'=>'EstimatedDurationDesc'),
|
||||
@ -103,7 +103,8 @@ class BOM extends CommonObject
|
||||
'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>510, 'notnull'=>1, 'foreignkey'=>'user.rowid',),
|
||||
'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'position'=>511, 'notnull'=>-1,),
|
||||
'fk_user_valid' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-2, 'position'=>512, 'notnull'=>0,),
|
||||
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>900, 'notnull'=>-1,),
|
||||
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,),
|
||||
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>1010),
|
||||
'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>2, 'position'=>1000, 'notnull'=>1, 'default'=>0, 'index'=>1, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Enabled', 9=>'Disabled')),
|
||||
);
|
||||
public $rowid;
|
||||
@ -937,8 +938,7 @@ class BOM extends CommonObject
|
||||
|
||||
$modelpath = "core/modules/bom/doc/";
|
||||
|
||||
//return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
|
||||
return 1;
|
||||
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -90,7 +90,7 @@ function bomPrepareHead($object)
|
||||
if (!empty($object->note_public)) $nbNote++;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/bom/bom_note.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Notes');
|
||||
if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
|
||||
if ($nbNote > 0) $head[$h][1].= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
|
||||
$head[$h][2] = 'note';
|
||||
$h++;
|
||||
}
|
||||
@ -102,7 +102,7 @@ function bomPrepareHead($object)
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/bom/bom_document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= '<span class="badge marginleftonlyshort">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'document';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -70,7 +70,7 @@ function printBookmarksList()
|
||||
$ret.= '<select name="bookmark" id="boxbookmark" class="flat boxcombo vmenusearchselectcombo" alt="Bookmarks">';
|
||||
$ret.= '<option hidden value="listbookmarks" class="optiongrey" selected rel="'.DOL_URL_ROOT.'/bookmarks/list.php">'.$langs->trans('Bookmarks').'</option>';
|
||||
$ret.= '<option value="listbookmark" class="optionblue" rel="'.dol_escape_htmltag(DOL_URL_ROOT.'/bookmarks/list.php').'" ';
|
||||
$ret.= ' data-html="'.dol_escape_htmltag('<span class="fas fa-star"></span> '.dol_escape_htmltag($user->rights->bookmark->creer ? $langs->trans('EditBookmarks') : $langs->trans('ListOfBookmarks')).'...').'">';
|
||||
$ret.= ' data-html="'.dol_escape_htmltag(img_picto('', 'bookmark').' '.($user->rights->bookmark->creer ? $langs->trans('EditBookmarks') : $langs->trans('ListOfBookmarks')).'...').'">';
|
||||
$ret.= dol_escape_htmltag($user->rights->bookmark->creer ? $langs->trans('EditBookmarks') : $langs->trans('ListOfBookmarks')).'...</option>';
|
||||
// Url to go on create new bookmark page
|
||||
if (! empty($user->rights->bookmark->creer))
|
||||
@ -78,7 +78,7 @@ function printBookmarksList()
|
||||
//$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&urlsource='.urlencode($url).'&url='.urlencode($url);
|
||||
$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&url='.urlencode($url);
|
||||
$ret.= '<option value="newbookmark" class="optionblue" rel="'.dol_escape_htmltag($urltoadd).'"';
|
||||
$ret.= ' data-html="'.dol_escape_htmltag('<span class="fas fa-star"></span> '.$langs->trans('AddThisPageToBookmarks').'...').'">'.dol_escape_htmltag($langs->trans('AddThisPageToBookmarks').'...').'</option>';
|
||||
$ret.= ' data-html="'.dol_escape_htmltag(img_picto('', 'bookmark').' '.$langs->trans('AddThisPageToBookmarks').'...').'">'.dol_escape_htmltag($langs->trans('AddThisPageToBookmarks').'...').'</option>';
|
||||
}
|
||||
// Menu with all bookmarks
|
||||
if (! empty($conf->global->BOOKMARKS_SHOW_IN_MENU))
|
||||
@ -201,7 +201,7 @@ function printDropdownBookmarksList()
|
||||
//$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&urlsource='.urlencode($url).'&url='.urlencode($url);
|
||||
$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&url='.urlencode($url);
|
||||
$newbtn.= '<a class="top-menu-dropdown-link" title="'.$langs->trans('AddThisPageToBookmarks').'" href="'.dol_escape_htmltag($urltoadd).'" >';
|
||||
$newbtn.= '<span class="fas fa-star"></span> '.dol_escape_htmltag($langs->trans('AddThisPageToBookmarks')).'</a>';
|
||||
$newbtn.= img_picto('', 'bookmark').' '.dol_escape_htmltag($langs->trans('AddThisPageToBookmarks')).'</a>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -156,7 +156,7 @@ if ($action == 'create')
|
||||
|
||||
dol_fiche_head($head, $hselected, $langs->trans("Bookmark"), 0, 'bookmark');
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<table class="border centpercent tableforfieldcreate">';
|
||||
|
||||
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("BookmarkTitle").'</td><td><input id="titlebookmark" class="flat minwidth100" name="title" value="'.$title.'"></td><td class="hideonsmartphone">'.$langs->trans("SetHereATitleForLink").'</td></tr>';
|
||||
dol_set_focus('#titlebookmark');
|
||||
@ -229,7 +229,7 @@ if ($id > 0 && ! preg_match('/^add/i', $action))
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border" width="100%">';
|
||||
print '<table class="border centpercent tableforfield">';
|
||||
|
||||
print '<tr><td class="titlefield">';
|
||||
if ($action == 'edit') {
|
||||
|
||||
@ -277,4 +277,69 @@ class Bookmark extends CommonObject
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a link to the object card (with optionaly the picto)
|
||||
*
|
||||
* @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto)
|
||||
* @param string $option On what the link point to ('nolink', ...)
|
||||
* @param int $notooltip 1=Disable tooltip
|
||||
* @param string $morecss Add more css on link
|
||||
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
|
||||
* @return string String with URL
|
||||
*/
|
||||
public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
|
||||
{
|
||||
global $conf, $langs, $hookmanager;
|
||||
|
||||
if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
|
||||
|
||||
$result = '';
|
||||
|
||||
$label = '<u>' . $langs->trans("Bookmark") . '</u>';
|
||||
$label.= '<br>';
|
||||
$label.= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
|
||||
|
||||
$url = DOL_URL_ROOT.'/bookmarks/card.php?id='.$this->id;
|
||||
|
||||
if ($option != 'nolink')
|
||||
{
|
||||
// Add param to save lastsearch_values or not
|
||||
$add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
|
||||
if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
|
||||
if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
|
||||
}
|
||||
|
||||
$linkclose='';
|
||||
if (empty($notooltip))
|
||||
{
|
||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
||||
{
|
||||
$label=$langs->trans("ShowBookmark");
|
||||
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||
}
|
||||
$linkclose.=' title="'.dol_escape_htmltag($label, 1).'"';
|
||||
$linkclose.=' class="classfortooltip'.($morecss?' '.$morecss:'').'"';
|
||||
}
|
||||
else $linkclose = ($morecss?' class="'.$morecss.'"':'');
|
||||
|
||||
$linkstart = '<a href="'.$url.'"';
|
||||
$linkstart.=$linkclose.'>';
|
||||
$linkend='</a>';
|
||||
|
||||
$result .= $linkstart;
|
||||
if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
|
||||
if ($withpicto != 2) $result.= $this->ref;
|
||||
$result .= $linkend;
|
||||
//if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
|
||||
|
||||
global $action,$hookmanager;
|
||||
$hookmanager->initHooks(array('mybookmarkdao'));
|
||||
$parameters=array('id'=>$this->id, 'getnomurl'=>$result);
|
||||
$reshook=$hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook > 0) $result = $hookmanager->resPrint;
|
||||
else $result .= $hookmanager->resPrint;
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
@ -32,6 +32,7 @@ $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'):'myobjectlist'; // To manage different context of search
|
||||
|
||||
// Security check
|
||||
if (! $user->rights->bookmark->lire) {
|
||||
@ -39,11 +40,12 @@ if (! $user->rights->bookmark->lire) {
|
||||
}
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
$page = GETPOST('page', 'int');
|
||||
if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
@ -52,6 +54,12 @@ if (! $sortorder) $sortorder='ASC';
|
||||
|
||||
$id = GETPOST("id", 'int');
|
||||
|
||||
$object=new Bookmark($db);
|
||||
|
||||
$permissiontoread = $user->rights->bookmark->lire;
|
||||
$permissiontoadd = $user->rights->bookmark->write;
|
||||
$permissiontodelete = $user->rights->bookmark->delete;
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -59,8 +67,7 @@ $id = GETPOST("id", 'int');
|
||||
|
||||
if ($action == 'delete')
|
||||
{
|
||||
$bookmark=new Bookmark($db);
|
||||
$res=$bookmark->remove($id);
|
||||
$res=$object->remove($id);
|
||||
if ($res > 0)
|
||||
{
|
||||
header("Location: ".$_SERVER["PHP_SELF"]);
|
||||
@ -68,7 +75,7 @@ if ($action == 'delete')
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($bookmark->error, $bookmark->errors, 'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
@ -79,132 +86,182 @@ if ($action == 'delete')
|
||||
|
||||
$userstatic=new User($db);
|
||||
|
||||
llxHeader('', $langs->trans("ListOfBookmarks"));
|
||||
$title = $langs->trans("ListOfBookmarks");
|
||||
|
||||
$newcardbutton='';
|
||||
$newcardbutton.= dolGetButtonTitle($langs->trans('NewBookmark'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/bookmarks/card.php?action=create', '', !empty($user->rights->bookmark->creer));
|
||||
|
||||
|
||||
print_barre_liste($langs->trans("ListOfBookmarks"), $page, $_SERVER['PHP_SELF'], $param, $sortfield, $sortorder, '', -1, '', 'generic', 0, $newcardbutton);
|
||||
llxHeader('', $title);
|
||||
|
||||
$sql = "SELECT b.rowid, b.dateb, b.fk_user, b.url, b.target, b.title, b.favicon, b.position,";
|
||||
$sql.= " u.login, u.lastname, u.firstname";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bookmark as b LEFT JOIN ".MAIN_DB_PREFIX."user as u ON b.fk_user=u.rowid";
|
||||
$sql.= " WHERE 1=1";
|
||||
$sql.= " AND b.entity = ".$conf->entity;
|
||||
$sql.= " AND b.entity IN (".getEntity('bookmark').")";
|
||||
if (! $user->admin) $sql.= " AND (b.fk_user = ".$user->id." OR b.fk_user is NULL OR b.fk_user = 0)";
|
||||
$sql.= $db->order($sortfield.", position", $sortorder);
|
||||
$sql.= $db->plimit($limit, $offset);
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
$sql.=$db->order($sortfield.", position", $sortorder);
|
||||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
$param = "";
|
||||
if ($optioncss != '') $param ='&optioncss='.$optioncss;
|
||||
|
||||
$moreforfilter='';
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
|
||||
print "<tr class=\"liste_titre\">";
|
||||
//print "<td> </td>";
|
||||
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "b.rowid", "", $param, 'align="left"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Title", $_SERVER["PHP_SELF"], "b.title", "", $param, 'align="left"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Link", $_SERVER["PHP_SELF"], "b.url", "", $param, 'align="left"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Target", '', '', '', '', 'align="center"');
|
||||
print_liste_field_titre("Owner", $_SERVER["PHP_SELF"], "u.lastname", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "b.dateb", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Position", $_SERVER["PHP_SELF"], "b.position", "", $param, 'class="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre('');
|
||||
print "</tr>\n";
|
||||
|
||||
while ($i < $num)
|
||||
$resql = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($resql);
|
||||
if (($page * $limit) > $nbtotalofrecords) // if total of record found is smaller than page * limit, goto and load page 0
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Id
|
||||
print '<td class="left">';
|
||||
print "<a href=\"card.php?id=".$obj->rowid."\">".img_object($langs->trans("ShowBookmark"), "bookmark").' '.$obj->rowid."</a>";
|
||||
print '</td>';
|
||||
|
||||
$linkintern=0;
|
||||
$title=$obj->title;
|
||||
$link=$obj->url;
|
||||
|
||||
// Title
|
||||
print "<td>";
|
||||
$linkintern=1;
|
||||
if ($linkintern) print "<a href=\"".$obj->url."\">";
|
||||
print $title;
|
||||
if ($linkintern) print "</a>";
|
||||
print "</td>\n";
|
||||
|
||||
// Url
|
||||
print '<td class="tdoverflowmax200">';
|
||||
if (! $linkintern) print '<a href="'.$obj->url.'"'.($obj->target?' target="newlink"':'').'>';
|
||||
print $link;
|
||||
if (! $linkintern) print '</a>';
|
||||
print "</td>\n";
|
||||
|
||||
// Target
|
||||
print '<td align="center">';
|
||||
if ($obj->target == 0) print $langs->trans("BookmarkTargetReplaceWindowShort");
|
||||
if ($obj->target == 1) print $langs->trans("BookmarkTargetNewWindowShort");
|
||||
print "</td>\n";
|
||||
|
||||
// Author
|
||||
print '<td align="center">';
|
||||
if ($obj->fk_user)
|
||||
{
|
||||
$userstatic->id=$obj->fk_user;
|
||||
$userstatic->lastname=$obj->login;
|
||||
print $userstatic->getNomUrl(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("Public");
|
||||
}
|
||||
print "</td>\n";
|
||||
|
||||
// Date creation
|
||||
print '<td align="center">'.dol_print_date($db->jdate($obj->dateb), 'day')."</td>";
|
||||
|
||||
// Position
|
||||
print '<td class="right">'.$obj->position."</td>";
|
||||
|
||||
// Actions
|
||||
print '<td class="nowrap right">';
|
||||
if ($user->rights->bookmark->creer)
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT."/bookmarks/card.php?action=edit&id=".$obj->rowid."&backtopage=".urlencode($_SERVER["PHP_SELF"]).'">'.img_edit()."</a>";
|
||||
}
|
||||
if ($user->rights->bookmark->supprimer)
|
||||
{
|
||||
print "<a href=\"".$_SERVER["PHP_SELF"]."?action=delete&id=$obj->rowid\">".img_delete()."</a>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print " ";
|
||||
}
|
||||
print "</td>";
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
$page = 0;
|
||||
$offset = 0;
|
||||
}
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
$db->free($resql);
|
||||
}
|
||||
// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set.
|
||||
if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords)
|
||||
{
|
||||
$num = $nbtotalofrecords;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
$sql.= $db->plimit($limit+1, $offset);
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
}
|
||||
|
||||
$param = "";
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
|
||||
if ($optioncss != '') $param ='&optioncss='.urlencode($optioncss);
|
||||
|
||||
$moreforfilter='';
|
||||
|
||||
// List of mass actions available
|
||||
$arrayofmassactions = array(
|
||||
//'validate'=>$langs->trans("Validate"),
|
||||
//'generate_doc'=>$langs->trans("ReGeneratePDF"),
|
||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||
//'presend'=>$langs->trans("SendByMail"),
|
||||
);
|
||||
if ($permissiontodelete) $arrayofmassactions['predelete']='<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
||||
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
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="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
|
||||
$newcardbutton='';
|
||||
$newcardbutton.= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/bookmarks/card.php?action=create', '', !empty($user->rights->bookmark->creer));
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'bookmark', 0, $newcardbutton, '', $limit);
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
|
||||
print "<tr class=\"liste_titre\">";
|
||||
//print "<td> </td>";
|
||||
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "b.rowid", "", $param, 'align="left"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Title", $_SERVER["PHP_SELF"], "b.title", "", $param, 'align="left"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Link", $_SERVER["PHP_SELF"], "b.url", "", $param, 'align="left"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Target", '', '', '', '', 'align="center"');
|
||||
print_liste_field_titre("Owner", $_SERVER["PHP_SELF"], "u.lastname", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "b.dateb", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Position", $_SERVER["PHP_SELF"], "b.position", "", $param, 'class="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre('');
|
||||
print "</tr>\n";
|
||||
|
||||
$i = 0;
|
||||
while ($i < min($num, $limit))
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$object->id = $obj->rowid;
|
||||
$object->ref = $obj->rowid;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Id
|
||||
print '<td class="left">';
|
||||
print $object->getNomUrl(1);
|
||||
print '</td>';
|
||||
|
||||
$linkintern=0;
|
||||
$title=$obj->title;
|
||||
$link=$obj->url;
|
||||
|
||||
// Title
|
||||
print "<td>";
|
||||
$linkintern=1;
|
||||
if ($linkintern) print "<a href=\"".$obj->url."\">";
|
||||
print $title;
|
||||
if ($linkintern) print "</a>";
|
||||
print "</td>\n";
|
||||
|
||||
// Url
|
||||
print '<td class="tdoverflowmax200">';
|
||||
if (! $linkintern) print '<a href="'.$obj->url.'"'.($obj->target?' target="newlink"':'').'>';
|
||||
print $link;
|
||||
if (! $linkintern) print '</a>';
|
||||
print "</td>\n";
|
||||
|
||||
// Target
|
||||
print '<td align="center">';
|
||||
if ($obj->target == 0) print $langs->trans("BookmarkTargetReplaceWindowShort");
|
||||
if ($obj->target == 1) print $langs->trans("BookmarkTargetNewWindowShort");
|
||||
print "</td>\n";
|
||||
|
||||
// Author
|
||||
print '<td align="center">';
|
||||
if ($obj->fk_user)
|
||||
{
|
||||
$userstatic->id=$obj->fk_user;
|
||||
$userstatic->lastname=$obj->login;
|
||||
print $userstatic->getNomUrl(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("Public");
|
||||
}
|
||||
print "</td>\n";
|
||||
|
||||
// Date creation
|
||||
print '<td align="center">'.dol_print_date($db->jdate($obj->dateb), 'day')."</td>";
|
||||
|
||||
// Position
|
||||
print '<td class="right">'.$obj->position."</td>";
|
||||
|
||||
// Actions
|
||||
print '<td class="nowrap right">';
|
||||
if ($user->rights->bookmark->creer)
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT."/bookmarks/card.php?action=edit&id=".$obj->rowid."&backtopage=".urlencode($_SERVER["PHP_SELF"]).'">'.img_edit()."</a>";
|
||||
}
|
||||
if ($user->rights->bookmark->supprimer)
|
||||
{
|
||||
print "<a href=\"".$_SERVER["PHP_SELF"]."?action=delete&id=$obj->rowid\">".img_delete()."</a>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print " ";
|
||||
}
|
||||
print "</td>";
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
$db->free($resql);
|
||||
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
|
||||
@ -756,7 +756,7 @@ if (empty($reshook) && GETPOST('actionmove', 'alpha') == 'mupdate')
|
||||
|
||||
// Actions to delete doc
|
||||
$upload_dir = $conf->agenda->dir_output.'/'.dol_sanitizeFileName($object->ref);
|
||||
$permissioncreate = ($user->rights->agenda->allactions->create || (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->read));
|
||||
$permissiontoadd = ($user->rights->agenda->allactions->create || (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->read));
|
||||
if (empty($reshook)) {
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||
}
|
||||
|
||||
@ -102,8 +102,8 @@ if (empty($reshook))
|
||||
// Mass actions
|
||||
/*$objectclass='MyObject';
|
||||
$objectlabel='MyObject';
|
||||
$permtoread = $user->rights->mymodule->read;
|
||||
$permtodelete = $user->rights->mymodule->delete;
|
||||
$permissiontoread = $user->rights->mymodule->read;
|
||||
$permissiontodelete = $user->rights->mymodule->delete;
|
||||
$uploaddir = $conf->mymodule->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
*/
|
||||
|
||||
@ -1438,7 +1438,7 @@ if (empty($reshook))
|
||||
|
||||
// Actions to build doc
|
||||
$upload_dir = $conf->propal->multidir_output[$object->entity];
|
||||
$permissioncreate=$usercancreate;
|
||||
$permissiontoadd=$usercancreate;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||
}
|
||||
|
||||
|
||||
@ -241,9 +241,9 @@ if (empty($reshook))
|
||||
{
|
||||
$objectclass='Propal';
|
||||
$objectlabel='Proposals';
|
||||
$permtoread = $user->rights->propal->lire;
|
||||
$permtodelete = $user->rights->propal->supprimer;
|
||||
$permtoclose = $user->rights->propal->cloturer;
|
||||
$permissiontoread = $user->rights->propal->lire;
|
||||
$permissiontodelete = $user->rights->propal->supprimer;
|
||||
$permissiontoclose = $user->rights->propal->cloturer;
|
||||
$uploaddir = $conf->propal->multidir_output[$conf->entity];
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
}
|
||||
@ -947,24 +947,24 @@ if ($resql)
|
||||
{
|
||||
print '<td class="right">'.price($obj->total_ht)."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['totalhtfield']=$totalarray['nbfield'];
|
||||
$totalarray['totalht'] += $obj->total_ht;
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='p.total_ht';
|
||||
$totalarray['val']['p.total_ht'] += $obj->total_ht;
|
||||
}
|
||||
// Amount VAT
|
||||
if (! empty($arrayfields['p.total_vat']['checked']))
|
||||
{
|
||||
print '<td class="right">'.price($obj->total_vat)."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['totalvatfield']=$totalarray['nbfield'];
|
||||
$totalarray['totalvat'] += $obj->total_vat;
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='p.total_vat';
|
||||
$totalarray['val']['p.total_vat'] += $obj->total_vat;
|
||||
}
|
||||
// Amount TTC
|
||||
if (! empty($arrayfields['p.total_ttc']['checked']))
|
||||
{
|
||||
print '<td class="right">'.price($obj->total_ttc)."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['totalttcfield']=$totalarray['nbfield'];
|
||||
$totalarray['totalttc'] += $obj->total_ttc;
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='p.total_ttc';
|
||||
$totalarray['val']['p.total_ttc'] += $obj->total_ttc;
|
||||
}
|
||||
// Amount invoiced
|
||||
if(! empty($arrayfields['p.total_ht_invoiced']['checked'])) {
|
||||
@ -984,8 +984,8 @@ if ($resql)
|
||||
|
||||
print '<td class="right">'.price($totalInvoiced)."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['totalhtinvoicedfield']=$totalarray['nbfield'];
|
||||
$totalarray['totalhtinvoiced'] += $totalInvoiced;
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='p.total_ht_invoiced';
|
||||
$totalarray['val']['p.total_ht_invoiced'] += $obj->total_ht_invoiced;
|
||||
}
|
||||
// Amount invoiced
|
||||
if(! empty($arrayfields['p.total_invoiced']['checked'])) {
|
||||
@ -1005,8 +1005,8 @@ if ($resql)
|
||||
|
||||
print '<td class="right">'.price($totalInvoiced)."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['totalinvoicedfield']=$totalarray['nbfield'];
|
||||
$totalarray['totalinvoiced'] += $totalInvoiced;
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='p.total_invoiced';
|
||||
$totalarray['val']['p.total_invoiced'] += $obj->total_invoiced;
|
||||
}
|
||||
|
||||
$userstatic->id=$obj->fk_user_author;
|
||||
@ -1120,45 +1120,7 @@ if ($resql)
|
||||
}
|
||||
|
||||
// Show total line
|
||||
if (isset($totalarray['totalhtfield'])
|
||||
|| isset($totalarray['totalvatfield'])
|
||||
|| isset($totalarray['totalttcfield'])
|
||||
|| isset($totalarray['totalamfield'])
|
||||
|| isset($totalarray['totalrtpfield'])
|
||||
|| isset($totalarray['totalizable'])
|
||||
)
|
||||
{
|
||||
print '<tr class="liste_total">';
|
||||
$i=0;
|
||||
while ($i < $totalarray['nbfield'])
|
||||
{
|
||||
$i++;
|
||||
if ($i == 1)
|
||||
{
|
||||
if ($num < $limit && empty($offset)) print '<td class="left">'.$langs->trans("Total").'</td>';
|
||||
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||
}
|
||||
elseif ($totalarray['totalhtfield'] == $i) print '<td class="right">'.price($totalarray['totalht']).'</td>';
|
||||
elseif ($totalarray['totalvatfield'] == $i) print '<td class="right">'.price($totalarray['totalvat']).'</td>';
|
||||
elseif ($totalarray['totalttcfield'] == $i) print '<td class="right">'.price($totalarray['totalttc']).'</td>';
|
||||
elseif ($totalarray['totalhtinvoicedfield'] == $i) print '<td class="right">'.price($totalarray['totalhtinvoiced']).'</td>';
|
||||
elseif ($totalarray['totalinvoicedfield'] == $i) print '<td class="right">'.price($totalarray['totalinvoiced']).'</td>';
|
||||
elseif ($totalarray['totalizable']) {
|
||||
$printed = false;
|
||||
foreach ($totalarray['totalizable'] as $totalizable) {
|
||||
if ($totalizable['pos']==$i && ! $printed) {
|
||||
print '<td class="right">'.price($totalizable['total']).'</td>';
|
||||
$printed = true;
|
||||
}
|
||||
}
|
||||
if (! $printed) {
|
||||
print '<td></td>';
|
||||
}
|
||||
}
|
||||
else print '<td></td>';
|
||||
}
|
||||
print '</tr>';
|
||||
}
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
|
||||
|
||||
$db->free($resql);
|
||||
|
||||
|
||||
@ -110,7 +110,7 @@ $usercancreatepurchaseorder = $user->rights->fournisseur->commande->creer;
|
||||
|
||||
$permissionnote = $usercancreate; // Used by the include of actions_setnotes.inc.php
|
||||
$permissiondellink = $usercancreate; // Used by the include of actions_dellink.inc.php
|
||||
$permissionedit = $usercancreate; // Used by the include of actions_lineupdown.inc.php
|
||||
$permissiontoadd = $usercancreate; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
|
||||
|
||||
|
||||
/*
|
||||
@ -1411,7 +1411,7 @@ if (empty($reshook))
|
||||
|
||||
// Actions to build doc
|
||||
$upload_dir = $conf->commande->multidir_output[$object->entity];
|
||||
$permissioncreate = $usercancreate;
|
||||
$permissiontoadd = $usercancreate;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||
|
||||
// Actions to send emails
|
||||
|
||||
@ -220,8 +220,8 @@ if (empty($reshook))
|
||||
// Mass actions
|
||||
$objectclass='Commande';
|
||||
$objectlabel='Orders';
|
||||
$permtoread = $user->rights->commande->lire;
|
||||
$permtodelete = $user->rights->commande->supprimer;
|
||||
$permissiontoread = $user->rights->commande->lire;
|
||||
$permissiontodelete = $user->rights->commande->supprimer;
|
||||
$uploaddir = $conf->commande->multidir_output[$conf->entity];
|
||||
$trigger_name='ORDER_SENTBYMAIL';
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
@ -1057,24 +1057,24 @@ if ($resql)
|
||||
{
|
||||
print '<td class="right">'.price($obj->total_ht)."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['totalhtfield']=$totalarray['nbfield'];
|
||||
$totalarray['totalht'] += $obj->total_ht;
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='c.total_ht';
|
||||
$totalarray['val']['c.total_ht'] += $obj->total_ht;
|
||||
}
|
||||
// Amount VAT
|
||||
if (! empty($arrayfields['c.total_vat']['checked']))
|
||||
{
|
||||
print '<td class="right">'.price($obj->total_tva)."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['totalvatfield']=$totalarray['nbfield'];
|
||||
$totalarray['totalvat'] += $obj->total_tva;
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='c.total_tva';
|
||||
$totalarray['val']['c.total_tva'] += $obj->total_tva;
|
||||
}
|
||||
// Amount TTC
|
||||
if (! empty($arrayfields['c.total_ttc']['checked']))
|
||||
{
|
||||
print '<td class="right">'.price($obj->total_ttc)."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['totalttcfield']=$totalarray['nbfield'];
|
||||
$totalarray['totalttc'] += $obj->total_ttc;
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='c.total_ttc';
|
||||
$totalarray['val']['c.total_ttc'] += $obj->total_ttc;
|
||||
}
|
||||
|
||||
// Extra fields
|
||||
@ -1139,30 +1139,7 @@ if ($resql)
|
||||
}
|
||||
|
||||
// Show total line
|
||||
if (isset($totalarray['totalhtfield'])
|
||||
|| isset($totalarray['totalvatfield'])
|
||||
|| isset($totalarray['totalttcfield'])
|
||||
|| isset($totalarray['totalamfield'])
|
||||
|| isset($totalarray['totalrtpfield'])
|
||||
)
|
||||
{
|
||||
print '<tr class="liste_total">';
|
||||
$i=0;
|
||||
while ($i < $totalarray['nbfield'])
|
||||
{
|
||||
$i++;
|
||||
if ($i == 1)
|
||||
{
|
||||
if ($num < $limit && empty($offset)) print '<td class="left">'.$langs->trans("Total").'</td>';
|
||||
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||
}
|
||||
elseif ($totalarray['totalhtfield'] == $i) print '<td class="right">'.price($totalarray['totalht']).'</td>';
|
||||
elseif ($totalarray['totalvatfield'] == $i) print '<td class="right">'.price($totalarray['totalvat']).'</td>';
|
||||
elseif ($totalarray['totalttcfield'] == $i) print '<td class="right">'.price($totalarray['totalttc']).'</td>';
|
||||
else print '<td></td>';
|
||||
}
|
||||
print '</tr>';
|
||||
}
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
|
||||
|
||||
$db->free($resql);
|
||||
|
||||
|
||||
@ -209,8 +209,8 @@ if (empty($reshook))
|
||||
{
|
||||
$objectclass='Account';
|
||||
$objectlabel='BankTransaction';
|
||||
$permtoread = $user->rights->banque->lire;
|
||||
$permtodelete = $user->rights->banque->supprimer;
|
||||
$permissiontoread = $user->rights->banque->lire;
|
||||
$permissiontodelete = $user->rights->banque->supprimer;
|
||||
$uploaddir = $conf->bank->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
}
|
||||
@ -919,13 +919,13 @@ if ($resql)
|
||||
if (! empty($arrayfields['b.debit']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre right">';
|
||||
print '<input type="text" class="flat" name="search_debit" size="4" value="'.dol_escape_htmltag($search_debit).'">';
|
||||
print '<input type="text" class="flat width50" name="search_debit" value="'.dol_escape_htmltag($search_debit).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['b.credit']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre right">';
|
||||
print '<input type="text" class="flat" name="search_credit" size="4" value="'.dol_escape_htmltag($search_credit).'">';
|
||||
print '<input type="text" class="flat width50" name="search_credit" value="'.dol_escape_htmltag($search_credit).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['balancebefore']['checked']))
|
||||
@ -1085,6 +1085,7 @@ if ($resql)
|
||||
if ($tmpnbfieldbeforebalance)
|
||||
{
|
||||
print '<td colspan="'.$tmpnbfieldbeforebalance.'">';
|
||||
print ' ';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
@ -1110,6 +1111,7 @@ if ($resql)
|
||||
</script>';
|
||||
print '</td>';
|
||||
print '<td colspan="'.($tmpnbfieldafterbalance+2).'">';
|
||||
print ' ';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
@ -1529,7 +1531,6 @@ if ($resql)
|
||||
print ' '.img_warning($langs->trans("ReconciliationLate"));
|
||||
}
|
||||
}
|
||||
print ' ';
|
||||
if ($user->rights->banque->modifier)
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=delete&rowid='.$objp->rowid.'&id='.$objp->bankid.'&page='.$page.'">';
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2019 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
|
||||
@ -512,8 +512,7 @@ foreach ($accounts as $key=>$type)
|
||||
} else {
|
||||
print '<span class="badge badge-info classfortooltip" title="'.dol_htmlentities($langs->trans("TransactionsToConciliate")).'">'.$result->nbtodo.'</span>';
|
||||
if ($result->nbtodolate) {
|
||||
print ' ';
|
||||
print '<span title="'.dol_htmlentities($langs->trans("Late")).'" class="classfortooltip badge badge-danger">';
|
||||
print '<span title="'.dol_htmlentities($langs->trans("Late")).'" class="classfortooltip badge badge-danger marginleftonlyshort">';
|
||||
print '<i class="fa fa-exclamation-triangle"></i> '.$result->nbtodolate;
|
||||
print '</span>';
|
||||
}
|
||||
@ -564,8 +563,8 @@ foreach ($accounts as $key=>$type)
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?id='.$objecttmp->id.'">'.price($solde, 0, $langs, 0, -1, -1, $objecttmp->currency_code).'</a>';
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['totalbalancefield']=$totalarray['nbfield'];
|
||||
$totalarray['totalbalance'] += $solde;
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='balance';
|
||||
$totalarray['val']['balance'] += $solde;
|
||||
}
|
||||
|
||||
// Action column
|
||||
@ -595,22 +594,10 @@ if (! $found)
|
||||
}
|
||||
|
||||
// Show total line
|
||||
if (isset($totalarray['totalbalancefield']) && $lastcurrencycode != 'various') // If there is several currency, $lastcurrencycode is set to 'various' before
|
||||
if ($lastcurrencycode != 'various') // If there is several currency, $lastcurrencycode is set to 'various' before
|
||||
{
|
||||
print '<tr class="liste_total">';
|
||||
$i=0;
|
||||
while ($i < $totalarray['nbfield'])
|
||||
{
|
||||
$i++;
|
||||
if ($i == 1)
|
||||
{
|
||||
if ($num < $limit && empty($offset)) print '<td class="left">'.$langs->trans("Total").'</td>';
|
||||
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||
}
|
||||
elseif ($totalarray['totalbalancefield'] == $i) print '<td class="right">'.price($totalarray['totalbalance'], 0, $langs, 0, -1, -1, $lastcurrencycode).'</td>';
|
||||
else print '<td></td>';
|
||||
}
|
||||
print '</tr>';
|
||||
// Show total line
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
@ -256,15 +256,19 @@ if ($result)
|
||||
|
||||
// Ref
|
||||
print "<td>".$variousstatic->getNomUrl(1)."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
|
||||
// Label payment
|
||||
print "<td>".dol_trunc($obj->label, 40)."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
|
||||
// Date payment
|
||||
print '<td class="center">'.dol_print_date($db->jdate($obj->datep), 'day')."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
|
||||
// Type
|
||||
print '<td>'.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
|
||||
// Account
|
||||
if (! empty($conf->banque->enabled))
|
||||
@ -289,6 +293,7 @@ if ($result)
|
||||
}
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Accounting account
|
||||
@ -297,6 +302,7 @@ if ($result)
|
||||
$accountingaccount->fetch('', $obj->accountancy_code, 1);
|
||||
|
||||
print '<td>'.$accountingaccount->getNomUrl(0, 1, 1, '', 1).'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Debit
|
||||
@ -304,8 +310,10 @@ if ($result)
|
||||
if ($obj->sens == 0)
|
||||
{
|
||||
print price($obj->amount);
|
||||
$totalarray['totaldeb'] += $obj->amount;
|
||||
$totalarray['val']['total_deb'] += $obj->amount;
|
||||
}
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='total_deb';
|
||||
print "</td>";
|
||||
|
||||
// Credit
|
||||
@ -313,8 +321,10 @@ if ($result)
|
||||
if ($obj->sens == 1)
|
||||
{
|
||||
print price($obj->amount);
|
||||
$totalarray['totalcred'] += $obj->amount;
|
||||
$totalarray['val']['total_cred'] += $obj->amount;
|
||||
}
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='total_cred';
|
||||
print "</td>";
|
||||
|
||||
print "<td></td>";
|
||||
@ -326,12 +336,8 @@ if ($result)
|
||||
if (! empty($conf->banque->enabled)) $colspan++;
|
||||
if (! empty($conf->accounting->enabled)) $colspan++;
|
||||
|
||||
print '<tr class="liste_total">';
|
||||
print '<td colspan="'.$colspan.'" class="liste_total">'.$langs->trans("Total").'</td>';
|
||||
print '<td class="liste_total right">'.price($totalarray['totaldeb'])."</td>";
|
||||
print '<td class="liste_total right">'.price($totalarray['totalcred'])."</td>";
|
||||
print '<td></td>';
|
||||
print '</tr>';
|
||||
// Show total line
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
|
||||
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
@ -318,6 +318,7 @@ if ($action=="create" || $action=="start")
|
||||
print load_fiche_titre($langs->trans("CashControl")." - ".$langs->trans("New"), '', 'cash-register');
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
||||
if ($action == 'start' && GETPOST('posnumber', 'int') != '' && GETPOST('posnumber', 'int') != '' && GETPOST('posnumber', 'int') != '-1')
|
||||
{
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
|
||||
@ -168,8 +168,8 @@ if (empty($reshook))
|
||||
// Mass actions
|
||||
$objectclass='CashControl';
|
||||
$objectlabel='CashControl';
|
||||
$permtoread = ($user->rights->cashdesk->use || $user->rights->takepos->use);
|
||||
$permtodelete = ($user->rights->cashdesk->use || $user->rights->takepos->use);
|
||||
$permissiontoread = ($user->rights->cashdesk->use || $user->rights->takepos->use);
|
||||
$permissiontodelete = ($user->rights->cashdesk->use || $user->rights->takepos->use);
|
||||
|
||||
//$uploaddir = '';
|
||||
//include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
@ -516,26 +516,8 @@ while ($i < min($num, $limit))
|
||||
}
|
||||
|
||||
// Show total line
|
||||
if (isset($totalarray['pos']))
|
||||
{
|
||||
print '<tr class="liste_total">';
|
||||
$i=0;
|
||||
while ($i < $totalarray['nbfield'])
|
||||
{
|
||||
$i++;
|
||||
if (! empty($totalarray['pos'][$i])) print '<td class="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>';
|
||||
else
|
||||
{
|
||||
if ($i == 1)
|
||||
{
|
||||
if ($num < $limit) print '<td class="left">'.$langs->trans("Total").'</td>';
|
||||
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||
}
|
||||
else print '<td></td>';
|
||||
}
|
||||
}
|
||||
print '</tr>';
|
||||
}
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
|
||||
|
||||
|
||||
// If no record found
|
||||
if ($num == 0)
|
||||
|
||||
@ -216,22 +216,22 @@ if ($resql)
|
||||
if ($objp->amount < 0)
|
||||
{
|
||||
print price($objp->amount * -1);
|
||||
$totalarray['totaldeb'] += $objp->amount;
|
||||
$totalarray['val']['totaldebfield'] += $objp->amount;
|
||||
}
|
||||
print "</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['totaldebfield']=$totalarray['nbfield'];
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='totaldebfield';
|
||||
|
||||
// Credit
|
||||
print '<td class="right">';
|
||||
if ($objp->amount > 0)
|
||||
{
|
||||
print price($objp->amount);
|
||||
$totalarray['totalcred'] += $objp->amount;
|
||||
$totalarray['val']['totalcredfield'] += $objp->amount;
|
||||
}
|
||||
print "</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['totalcredfield']=$totalarray['nbfield'];
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='totalcredfield';
|
||||
|
||||
print "</tr>";
|
||||
|
||||
@ -239,24 +239,7 @@ if ($resql)
|
||||
}
|
||||
|
||||
// Show total line
|
||||
if (isset($totalarray['totaldebfield']) || isset($totalarray['totalcredfield']))
|
||||
{
|
||||
print '<tr class="liste_total">';
|
||||
$i=0;
|
||||
while ($i < $totalarray['nbfield'])
|
||||
{
|
||||
$i++;
|
||||
if ($i == 1)
|
||||
{
|
||||
if ($num < $limit && empty($offset)) print '<td class="left">'.$langs->trans("Total").'</td>';
|
||||
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||
}
|
||||
elseif ($totalarray['totaldebfield'] == $i) print '<td class="right">'.price(-1 * $totalarray['totaldeb']).'</td>';
|
||||
elseif ($totalarray['totalcredfield'] == $i) print '<td class="right">'.price($totalarray['totalcred']).'</td>';
|
||||
else print '<td></td>';
|
||||
}
|
||||
print '</tr>';
|
||||
}
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
|
||||
|
||||
print "</table>";
|
||||
|
||||
|
||||
@ -146,8 +146,8 @@ if (empty($reshook))
|
||||
// Mass actions
|
||||
/*$objectclass='MyObject';
|
||||
$objectlabel='MyObject';
|
||||
$permtoread = $user->rights->mymodule->read;
|
||||
$permtodelete = $user->rights->mymodule->delete;
|
||||
$permissiontoread = $user->rights->mymodule->read;
|
||||
$permissiontodelete = $user->rights->mymodule->delete;
|
||||
$uploaddir = $conf->mymodule->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';*/
|
||||
|
||||
@ -1364,41 +1364,43 @@ else
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0);
|
||||
print '</td>';
|
||||
if ($usercancreate && $action != 'editmulticurrencycode' && ! empty($object->brouillon))
|
||||
if ($usercancreate && $action != 'editmulticurrencycode' && ! empty($object->brouillon)) {
|
||||
print '<td class="right"><a class="editfielda" href="' . $_SERVER["PHP_SELF"] . '?action=editmulticurrencycode&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '</a></td>';
|
||||
}
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
$htmlname = (($usercancreate && $action == 'editmulticurrencycode')?'multicurrency_code':'none');
|
||||
$form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, $htmlname);
|
||||
print '</td></tr>';
|
||||
|
||||
// Multicurrency rate
|
||||
if ($object->multicurrency_code != $conf->currency || $object->multicurrency_tx != 1)
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0);
|
||||
print '</td>';
|
||||
if ($usercancreate && $action != 'editmulticurrencyrate' && ! empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) {
|
||||
print '<td class="right"><a class="editfielda" href="' . $_SERVER["PHP_SELF"] . '?action=editmulticurrencyrate&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '</a></td>';
|
||||
}
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
$htmlname = (($usercancreate && $action == 'editmulticurrencycode')?'multicurrency_code':'none');
|
||||
$form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, $htmlname);
|
||||
print '</td></tr>';
|
||||
|
||||
// Multicurrency rate
|
||||
if ($object->multicurrency_code != $conf->currency || $object->multicurrency_tx != 1)
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0);
|
||||
print '</td>';
|
||||
if ($usercancreate && $action != 'editmulticurrencyrate' && ! empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency)
|
||||
print '<td class="right"><a class="editfielda" href="' . $_SERVER["PHP_SELF"] . '?action=editmulticurrencyrate&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') {
|
||||
if($action == 'actualizemulticurrencyrate') {
|
||||
list($object->fk_multicurrency, $object->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($object->db, $object->multicurrency_code);
|
||||
}
|
||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, ($usercancreate?'multicurrency_tx':'none'), $object->multicurrency_code);
|
||||
} else {
|
||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
|
||||
if($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) {
|
||||
print '<div class="inline-block"> ';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=actualizemulticurrencyrate">'.$langs->trans("ActualizeCurrency").'</a>';
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
print '</td></tr>';
|
||||
if ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') {
|
||||
if($action == 'actualizemulticurrencyrate') {
|
||||
list($object->fk_multicurrency, $object->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($object->db, $object->multicurrency_code);
|
||||
}
|
||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, ($usercancreate?'multicurrency_tx':'none'), $object->multicurrency_code);
|
||||
} else {
|
||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
|
||||
if($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) {
|
||||
print '<div class="inline-block"> ';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=actualizemulticurrencyrate">'.$langs->trans("ActualizeCurrency").'</a>';
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
// Help of substitution key
|
||||
|
||||
@ -1151,7 +1151,7 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// Standard invoice or Deposit invoice, created from a Predefined template invoice
|
||||
if (($_POST['type'] == Facture::TYPE_STANDARD || $_POST['type'] == Facture::TYPE_DEPOSIT) && GETPOST('fac_rec') > 0)
|
||||
if (($_POST['type'] == Facture::TYPE_STANDARD || $_POST['type'] == Facture::TYPE_DEPOSIT) && GETPOST('fac_rec', 'int') > 0)
|
||||
{
|
||||
$dateinvoice = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
|
||||
if (empty($dateinvoice))
|
||||
@ -1661,6 +1661,7 @@ if (empty($reshook))
|
||||
$object->date_pointoftax = $date_pointoftax;
|
||||
$object->note_public = trim(GETPOST('note_public', 'none'));
|
||||
$object->note = trim(GETPOST('note', 'none'));
|
||||
$object->note_private = trim(GETPOST('note', 'none'));
|
||||
$object->ref_client = GETPOST('ref_client', 'alpha');
|
||||
$object->ref_int = GETPOST('ref_int', 'alpha');
|
||||
$object->modelpdf = GETPOST('model', 'alpha');
|
||||
@ -2488,7 +2489,7 @@ if (empty($reshook))
|
||||
|
||||
// Actions to build doc
|
||||
$upload_dir = $conf->facture->multidir_output[$object->entity];
|
||||
$permissioncreate=$usercancreate;
|
||||
$permissiontoadd=$usercancreate;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||
|
||||
|
||||
@ -2752,10 +2753,18 @@ if ($action == 'create')
|
||||
// Ref
|
||||
print '<tr><td class="titlefieldcreate fieldrequired">' . $langs->trans('Ref') . '</td><td colspan="2">' . $langs->trans('Draft') . '</td></tr>';
|
||||
|
||||
// Thirdparty
|
||||
print '<td class="fieldrequired">' . $langs->trans('Customer') . '</td>';
|
||||
if ($soc->id > 0 && ! GETPOST('fac_rec', 'int'))
|
||||
$exampletemplateinvoice=new FactureRec($db);
|
||||
$invoice_predefined = new FactureRec($db);
|
||||
if (empty($origin) && empty($originid) && GETPOST('fac_rec', 'int') > 0)
|
||||
{
|
||||
$invoice_predefined->fetch(GETPOST('fac_rec', 'int'));
|
||||
}
|
||||
|
||||
// Thirdparty
|
||||
if ($soc->id > 0 && (! GETPOST('fac_rec', 'int') || ! empty($invoice_predefined->frequency)))
|
||||
{
|
||||
// If thirdparty known and not a predefined invoiced without a recurring rule
|
||||
print '<tr><td class="fieldrequired">' . $langs->trans('Customer') . '</td>';
|
||||
print '<td colspan="2">';
|
||||
print $soc->getNomUrl(1);
|
||||
print '<input type="hidden" name="socid" value="' . $soc->id . '">';
|
||||
@ -2771,9 +2780,11 @@ if ($action == 'create')
|
||||
}
|
||||
print ')';
|
||||
print '</td>';
|
||||
print '</tr>' . "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td class="fieldrequired">' . $langs->trans('Customer') . '</td>';
|
||||
print '<td colspan="2">';
|
||||
print $form->select_company($soc->id, 'socid', '((s.client = 1 OR s.client = 3) AND s.status=1)', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300');
|
||||
// Option to reload page to retrieve customer informations. Note, this clear other input
|
||||
@ -2790,17 +2801,14 @@ if ($action == 'create')
|
||||
});
|
||||
</script>';
|
||||
}
|
||||
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&client=3&fournisseur=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddThirdParty").'</span><span class="fa fa-plus-circle valignmiddle paddingleft"></span></a>';
|
||||
if (! GETPOST('fac_rec', 'int')) print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&client=3&fournisseur=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddThirdParty").'</span><span class="fa fa-plus-circle valignmiddle paddingleft"></span></a>';
|
||||
print '</td>';
|
||||
print '</tr>' . "\n";
|
||||
}
|
||||
print '</tr>' . "\n";
|
||||
|
||||
$exampletemplateinvoice=new FactureRec($db);
|
||||
|
||||
// Overwrite some values if creation of invoice is from a predefined invoice
|
||||
if (empty($origin) && empty($originid) && GETPOST('fac_rec', 'int') > 0)
|
||||
{
|
||||
$invoice_predefined = new FactureRec($db);
|
||||
$invoice_predefined->fetch(GETPOST('fac_rec', 'int'));
|
||||
|
||||
$dateinvoice = $invoice_predefined->date_when; // To use next gen date by default later
|
||||
@ -2827,13 +2835,14 @@ if ($action == 'create')
|
||||
if ($num > 0)
|
||||
{
|
||||
print '<tr><td>' . $langs->trans('CreateFromRepeatableInvoice') . '</td><td>';
|
||||
print '<select class="flat" id="fac_rec" name="fac_rec">';
|
||||
//print '<input type="hidden" name="fac_rec" id="fac_rec" value="'.GETPOST('fac_rec', 'int').'">';
|
||||
print '<select class="flat" id="fac_rec" name="fac_rec">'; // We may want to change the template to use
|
||||
print '<option value="0" selected></option>';
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
print '<option value="' . $objp->rowid . '"';
|
||||
if (GETPOST('fac_rec') == $objp->rowid)
|
||||
if (GETPOST('fac_rec', 'int') == $objp->rowid)
|
||||
{
|
||||
print ' selected';
|
||||
$exampletemplateinvoice->fetch(GETPOST('fac_rec', 'int'));
|
||||
@ -2848,6 +2857,7 @@ if ($action == 'create')
|
||||
print '<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$("#fac_rec").change(function() {
|
||||
console.log("We changed the template invoice");
|
||||
var fac_rec = $(this).val();
|
||||
var socid = $(\'#socid\').val();
|
||||
// reload page
|
||||
@ -2965,7 +2975,7 @@ if ($action == 'create')
|
||||
print '<!-- replacement line -->';
|
||||
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
||||
$tmp='<input type="radio" name="type" id="radio_replacement" value="1"' . (GETPOST('type') == 1 ? ' checked' : '');
|
||||
if (! $options) $tmp.=' disabled';
|
||||
if (! $options || $invoice_predefined->id > 0) $tmp.=' disabled';
|
||||
$tmp.='> ';
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
@ -2976,7 +2986,7 @@ if ($action == 'create')
|
||||
</script>';
|
||||
$text = '<label>'.$tmp.$langs->trans("InvoiceReplacementAsk") . '</label>';
|
||||
$text .= '<select class="flat" name="fac_replacement" id="fac_replacement"';
|
||||
if (! $options)
|
||||
if (! $options || $invoice_predefined->id > 0)
|
||||
$text .= ' disabled';
|
||||
$text .= '>';
|
||||
if ($options) {
|
||||
@ -3057,7 +3067,7 @@ if ($action == 'create')
|
||||
|
||||
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
||||
$tmp='<input type="radio" id="radio_creditnote" name="type" value="2"' . (GETPOST('type') == 2 ? ' checked' : '');
|
||||
if (! $optionsav && empty($conf->global->INVOICE_CREDIT_NOTE_STANDALONE)) $tmp.=' disabled';
|
||||
if ((! $optionsav && empty($conf->global->INVOICE_CREDIT_NOTE_STANDALONE)) || $invoice_predefined->id > 0) $tmp.=' disabled';
|
||||
$tmp.= '> ';
|
||||
// Show credit note options only if we checked credit note
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
@ -3077,7 +3087,7 @@ if ($action == 'create')
|
||||
$text = '<label>'.$tmp.$langs->transnoentities("InvoiceAvoirAsk") . '</label> ';
|
||||
// $text.='<input type="text" value="">';
|
||||
$text .= '<select class="flat valignmiddle" name="fac_avoir" id="fac_avoir"';
|
||||
if (! $optionsav)
|
||||
if (! $optionsav || $invoice_predefined->id > 0)
|
||||
$text .= ' disabled';
|
||||
$text .= '>';
|
||||
if ($optionsav) {
|
||||
@ -3355,7 +3365,7 @@ if ($action == 'create')
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Lines from source
|
||||
// Lines from source (TODO Show them also when creating invoice from tempalte invoice)
|
||||
if (! empty($origin) && ! empty($originid) && is_object($objectsrc))
|
||||
{
|
||||
// TODO for compatibility
|
||||
|
||||
@ -370,7 +370,10 @@ class Facture extends CommonInvoice
|
||||
$nextdatewhen=dol_time_plus_duree($originaldatewhen, $_facrec->frequency, $_facrec->unit_frequency);
|
||||
$previousdaynextdatewhen=dol_time_plus_duree($nextdatewhen, -1, 'd');
|
||||
|
||||
$this->socid = $_facrec->socid; // Invoice created on same thirdparty than template
|
||||
if (! empty($_facrec->frequency)) // Invoice are created on same thirdparty than template when there is a recurrence, but not necessarly when there is no recurrence.
|
||||
{
|
||||
$this->socid = $_facrec->socid;
|
||||
}
|
||||
$this->entity = $_facrec->entity; // Invoice created in same entity than template
|
||||
|
||||
// Fields coming from GUI (priority on template). TODO Value of template should be used as default value on GUI so we can use here always value from GUI
|
||||
|
||||
@ -191,8 +191,8 @@ if (empty($reshook))
|
||||
// Mass actions
|
||||
/*$objectclass='MyObject';
|
||||
$objectlabel='MyObject';
|
||||
$permtoread = $user->rights->mymodule->read;
|
||||
$permtodelete = $user->rights->mymodule->delete;
|
||||
$permissiontoread = $user->rights->mymodule->read;
|
||||
$permissiontodelete = $user->rights->mymodule->delete;
|
||||
$uploaddir = $conf->mymodule->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';*/
|
||||
}
|
||||
@ -676,28 +676,9 @@ if ($resql)
|
||||
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
|
||||
}
|
||||
|
||||
//var_dump($totalarray);
|
||||
// Show total line
|
||||
if (isset($totalarray['pos']))
|
||||
{
|
||||
print '<tr class="liste_total">';
|
||||
$i=0;
|
||||
while ($i < $totalarray['nbfield'])
|
||||
{
|
||||
$i++;
|
||||
if (! empty($totalarray['pos'][$i])) print '<td class="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>';
|
||||
else
|
||||
{
|
||||
if ($i == 1)
|
||||
{
|
||||
if ($num < $limit) print '<td class="left">'.$langs->trans("Total").'</td>';
|
||||
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||
}
|
||||
else print '<td></td>';
|
||||
}
|
||||
}
|
||||
print '</tr>';
|
||||
}
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
|
||||
|
||||
|
||||
print "</table>";
|
||||
print "</div>";
|
||||
|
||||
@ -265,9 +265,9 @@ if (empty($reshook))
|
||||
{
|
||||
$objectclass='Facture';
|
||||
$objectlabel='Invoices';
|
||||
$permtoread = $user->rights->facture->lire;
|
||||
$permtocreate = $user->rights->facture->creer;
|
||||
$permtodelete = $user->rights->facture->supprimer;
|
||||
$permissiontoread = $user->rights->facture->lire;
|
||||
$permissiontoadd = $user->rights->facture->creer;
|
||||
$permissiontodelete = $user->rights->facture->supprimer;
|
||||
$uploaddir = $conf->facture->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
}
|
||||
@ -1232,40 +1232,40 @@ if ($resql)
|
||||
{
|
||||
print '<td class="right nowrap">'.price($obj->total_ht)."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['totalhtfield']=$totalarray['nbfield'];
|
||||
$totalarray['totalht'] += $obj->total_ht;
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='f.total_ht';
|
||||
$totalarray['val']['f.total_ht'] += $obj->total_ht;
|
||||
}
|
||||
// Amount VAT
|
||||
if (! empty($arrayfields['f.total_vat']['checked']))
|
||||
{
|
||||
print '<td class="right nowrap">'.price($obj->total_vat)."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['totalvatfield']=$totalarray['nbfield'];
|
||||
$totalarray['totalvat'] += $obj->total_vat;
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='f.total_vat';
|
||||
$totalarray['val']['f.total_vat'] += $obj->total_vat;
|
||||
}
|
||||
// Amount LocalTax1
|
||||
if (! empty($arrayfields['f.total_localtax1']['checked']))
|
||||
{
|
||||
print '<td class="right nowrap">'.price($obj->total_localtax1)."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['totallocaltax1field']=$totalarray['nbfield'];
|
||||
$totalarray['totallocaltax1'] += $obj->total_localtax1;
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='f.total_localtax1';
|
||||
$totalarray['val']['f.total_localtax1'] += $obj->total_localtax1;
|
||||
}
|
||||
// Amount LocalTax2
|
||||
if (! empty($arrayfields['f.total_localtax2']['checked']))
|
||||
{
|
||||
print '<td class="right nowrap">'.price($obj->total_localtax2)."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['totallocaltax2field']=$totalarray['nbfield'];
|
||||
$totalarray['totallocaltax2'] += $obj->total_localtax2;
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='f.total_localtax2';
|
||||
$totalarray['val']['f.total_localtax2'] += $obj->total_localtax2;
|
||||
}
|
||||
// Amount TTC
|
||||
if (! empty($arrayfields['f.total_ttc']['checked']))
|
||||
{
|
||||
print '<td class="right nowrap">'.price($obj->total_ttc)."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['totalttcfield']=$totalarray['nbfield'];
|
||||
$totalarray['totalttc'] += $obj->total_ttc;
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='f.total_ttc';
|
||||
$totalarray['val']['f.total_ttc'] += $obj->total_ttc;
|
||||
}
|
||||
|
||||
if(! empty($arrayfields['f.retained_warranty']['checked']))
|
||||
@ -1277,16 +1277,16 @@ if ($resql)
|
||||
{
|
||||
print '<td class="right nowrap">'.(! empty($totalpay)?price($totalpay, 0, $langs):' ').'</td>'; // TODO Use a denormalized field
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['totalamfield']=$totalarray['nbfield'];
|
||||
$totalarray['totalam'] += $totalpay;
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='totalam';
|
||||
$totalarray['val']['totalam'] += $totalpay;
|
||||
}
|
||||
|
||||
if (! empty($arrayfields['rtp']['checked']))
|
||||
{
|
||||
print '<td class="right nowrap">'.(! empty($remaintopay)?price($remaintopay, 0, $langs):' ').'</td>'; // TODO Use a denormalized field
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['totalrtpfield']=$totalarray['nbfield'];
|
||||
$totalarray['totalrtp'] += $remaintopay;
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='rtp';
|
||||
$totalarray['val']['rtp'] += $remaintopay;
|
||||
}
|
||||
|
||||
// Extra fields
|
||||
@ -1345,35 +1345,7 @@ if ($resql)
|
||||
}
|
||||
|
||||
// Show total line
|
||||
if (isset($totalarray['totalhtfield'])
|
||||
|| isset($totalarray['totalvatfield'])
|
||||
|| isset($totalarray['totallocaltax1field'])
|
||||
|| isset($totalarray['totallocaltax2field'])
|
||||
|| isset($totalarray['totalttcfield'])
|
||||
|| isset($totalarray['totalamfield'])
|
||||
|| isset($totalarray['totalrtpfield'])
|
||||
) {
|
||||
print '<tr class="liste_total">';
|
||||
$i=0;
|
||||
while ($i < $totalarray['nbfield'])
|
||||
{
|
||||
$i++;
|
||||
if ($i == 1)
|
||||
{
|
||||
if ($num < $limit && empty($offset)) print '<td class="left">'.$langs->trans("Total").'</td>';
|
||||
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||
}
|
||||
elseif ($totalarray['totalhtfield'] == $i) print '<td class="right">'.price($totalarray['totalht']).'</td>';
|
||||
elseif ($totalarray['totalvatfield'] == $i) print '<td class="right">'.price($totalarray['totalvat']).'</td>';
|
||||
elseif ($totalarray['totallocaltax1field'] == $i) print '<td class="right">'.price($totalarray['totallocaltax1']).'</td>';
|
||||
elseif ($totalarray['totallocaltax2field'] == $i) print '<td class="right">'.price($totalarray['totallocaltax2']).'</td>';
|
||||
elseif ($totalarray['totalttcfield'] == $i) print '<td class="right">'.price($totalarray['totalttc']).'</td>';
|
||||
elseif ($totalarray['totalamfield'] == $i) print '<td class="right">'.price($totalarray['totalam']).'</td>';
|
||||
elseif ($totalarray['totalrtpfield'] == $i) print '<td class="right">'.price($totalarray['totalrtp']).'</td>';
|
||||
else print '<td></td>';
|
||||
}
|
||||
print '</tr>';
|
||||
}
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
|
||||
}
|
||||
|
||||
$db->free($resql);
|
||||
|
||||
@ -373,26 +373,8 @@ if ($resql)
|
||||
}
|
||||
|
||||
// Show total line
|
||||
if (isset($totalarray['pos']))
|
||||
{
|
||||
print '<tr class="liste_total">';
|
||||
$i=0;
|
||||
while ($i < $totalarray['nbfield'])
|
||||
{
|
||||
$i++;
|
||||
if (! empty($totalarray['pos'][$i])) print '<td class="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>';
|
||||
else
|
||||
{
|
||||
if ($i == 1)
|
||||
{
|
||||
if ($num < $limit) print '<td class="left">'.$langs->trans("Total").'</td>';
|
||||
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||
}
|
||||
else print '<td></td>';
|
||||
}
|
||||
}
|
||||
print '</tr>';
|
||||
}
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
|
||||
|
||||
|
||||
print "</table>\n";
|
||||
print "</div>";
|
||||
|
||||
@ -441,13 +441,14 @@ if ($id > 0)
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneTax', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
|
||||
}
|
||||
|
||||
// Confirmation de la suppression de la charge
|
||||
|
||||
if ($action == 'paid')
|
||||
{
|
||||
$text=$langs->trans('ConfirmPaySocialContribution');
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans('PaySocialContribution'), $text, "confirm_paid", '', '', 2);
|
||||
}
|
||||
|
||||
// Confirmation of the removal of the Social Contribution
|
||||
if ($action == 'delete')
|
||||
{
|
||||
$text=$langs->trans('ConfirmDeleteSocialContribution');
|
||||
|
||||
@ -292,8 +292,8 @@ if ($resql)
|
||||
// Amount
|
||||
print '<td class="right" width="100">'.price($obj->amount).'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['totalttcfield']=$totalarray['nbfield'];
|
||||
$totalarray['totalttc'] += $obj->amount;
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='totalttcfield';
|
||||
$totalarray['val']['totalttcfield'] += $obj->amount;
|
||||
|
||||
// Due date
|
||||
print '<td width="110" align="center">'.dol_print_date($db->jdate($obj->date_ech), 'day').'</td>';
|
||||
@ -307,20 +307,7 @@ if ($resql)
|
||||
}
|
||||
|
||||
// Show total line
|
||||
if (isset($totalarray['totalttcfield']))
|
||||
{
|
||||
print '<tr class="liste_total">';
|
||||
if ($num < $limit && empty($offset)) print '<td class="left">'.$langs->trans("Total").'</td>';
|
||||
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td class="right">'.price($totalarray['totalttc']).'</td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
@ -62,6 +62,8 @@ $extrafields = new ExtraFields($db);
|
||||
// fetch optionals attributes and labels
|
||||
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
|
||||
$socialnetworks = getArrayOfSocialNetworks();
|
||||
|
||||
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
|
||||
$object->getCanvas($id);
|
||||
$objcanvas=null;
|
||||
@ -186,17 +188,25 @@ if (empty($reshook))
|
||||
$object->town = GETPOST("town", 'alpha');
|
||||
$object->country_id = GETPOST("country_id", 'int');
|
||||
$object->state_id = GETPOST("state_id", 'int');
|
||||
$object->skype = GETPOST("skype", 'alpha');
|
||||
$object->twitter = GETPOST("twitter", 'alpha');
|
||||
$object->facebook = GETPOST("facebook", 'alpha');
|
||||
$object->linkedin = GETPOST("linkedin", 'alpha');
|
||||
//$object->jabberid = GETPOST("jabberid", 'alpha');
|
||||
//$object->skype = GETPOST("skype", 'alpha');
|
||||
//$object->twitter = GETPOST("twitter", 'alpha');
|
||||
//$object->facebook = GETPOST("facebook", 'alpha');
|
||||
//$object->linkedin = GETPOST("linkedin", 'alpha');
|
||||
$object->socialnetworks = array();
|
||||
if (! empty($conf->socialnetworks->enabled)) {
|
||||
foreach ($socialnetworks as $key => $value) {
|
||||
if (GETPOSTISSET($key) && GETPOST($key, 'alphanohtml')!='') {
|
||||
$object->socialnetworks[$key] = GETPOST($key, 'alphanohtml');
|
||||
}
|
||||
}
|
||||
}
|
||||
$object->email = GETPOST("email", 'alpha');
|
||||
$object->no_email = GETPOST("no_email", "int");
|
||||
$object->phone_pro = GETPOST("phone_pro", 'alpha');
|
||||
$object->phone_perso = GETPOST("phone_perso", 'alpha');
|
||||
$object->phone_mobile = GETPOST("phone_mobile", 'alpha');
|
||||
$object->fax = GETPOST("fax", 'alpha');
|
||||
$object->jabberid = GETPOST("jabberid", 'alpha');
|
||||
$object->priv = GETPOST("priv", 'int');
|
||||
$object->note_public = GETPOST("note_public", 'none');
|
||||
$object->note_private = GETPOST("note_private", 'none');
|
||||
@ -378,19 +388,26 @@ if (empty($reshook))
|
||||
|
||||
$object->email = GETPOST("email", 'alpha');
|
||||
$object->no_email = GETPOST("no_email", "int");
|
||||
$object->skype = GETPOST("skype", 'alpha');
|
||||
$object->twitter = GETPOST("twitter", 'alpha');
|
||||
$object->facebook = GETPOST("facebook", 'alpha');
|
||||
$object->linkedin = GETPOST("linkedin", 'alpha');
|
||||
//$object->jabberid = GETPOST("jabberid", 'alpha');
|
||||
//$object->skype = GETPOST("skype", 'alpha');
|
||||
//$object->twitter = GETPOST("twitter", 'alpha');
|
||||
//$object->facebook = GETPOST("facebook", 'alpha');
|
||||
//$object->linkedin = GETPOST("linkedin", 'alpha');
|
||||
if (! empty($conf->socialnetworks->enabled)) {
|
||||
foreach ($socialnetworks as $key => $value) {
|
||||
if (GETPOSTISSET($key) && GETPOST($key, 'alphanohtml')!='') {
|
||||
$object->socialnetworks[$key] = GETPOST($key, 'alphanohtml');
|
||||
}
|
||||
}
|
||||
}
|
||||
$object->phone_pro = GETPOST("phone_pro", 'alpha');
|
||||
$object->phone_perso = GETPOST("phone_perso", 'alpha');
|
||||
$object->phone_mobile = GETPOST("phone_mobile", 'alpha');
|
||||
$object->fax = GETPOST("fax", 'alpha');
|
||||
$object->jabberid = GETPOST("jabberid", 'alpha');
|
||||
$object->priv = GETPOST("priv", 'int');
|
||||
$object->note_public = GETPOST("note_public", 'none');
|
||||
$object->note_private = GETPOST("note_private", 'none');
|
||||
$object->roles = GETPOST("roles", 'array');
|
||||
$object->note_private = GETPOST("note_private", 'none');
|
||||
$object->roles = GETPOST("roles", 'array');
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object);
|
||||
@ -727,39 +744,53 @@ else
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
if (! empty($conf->socialnetworks->enabled))
|
||||
{
|
||||
// Jabber
|
||||
if (! empty($conf->global->SOCIALNETWORKS_JABBER))
|
||||
{
|
||||
print '<tr><td><label for="skype">'.$form->editfieldkey('Jabber', 'jabberid', '', $object, 0).'</label></td>';
|
||||
print '<td colspan="3"><input type="text" name="jabberid" id="jabberid" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET("jabberid")?GETPOST("jabberid", 'alpha'):$object->jabberid).'"></td></tr>';
|
||||
}
|
||||
// Skype
|
||||
if (! empty($conf->global->SOCIALNETWORKS_SKYPE))
|
||||
{
|
||||
print '<tr><td><label for="skype">'.$form->editfieldkey('Skype', 'skype', '', $object, 0).'</label></td>';
|
||||
print '<td colspan="3"><input type="text" name="skype" id="skype" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET("skype")?GETPOST("skype", 'alpha'):$object->skype).'"></td></tr>';
|
||||
}
|
||||
// Twitter
|
||||
if (! empty($conf->global->SOCIALNETWORKS_TWITTER))
|
||||
{
|
||||
print '<tr><td><label for="twitter">'.$form->editfieldkey('Twitter', 'twitter', '', $object, 0).'</label></td>';
|
||||
print '<td colspan="3"><input type="text" name="twitter" id="twitter" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET("twitter")?GETPOST("twitter", 'alpha'):$object->twitter).'"></td></tr>';
|
||||
}
|
||||
// Facebook
|
||||
if (! empty($conf->global->SOCIALNETWORKS_FACEBOOK))
|
||||
{
|
||||
print '<tr><td><label for="facebook">'.$form->editfieldkey('Facebook', 'facebook', '', $object, 0).'</label></td>';
|
||||
print '<td colspan="3"><input type="text" name="facebook" id="facebook" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET("facebook")?GETPOST("facebook", 'alpha'):$object->facebook).'"></td></tr>';
|
||||
}
|
||||
// LinkedIn
|
||||
if (! empty($conf->global->SOCIALNETWORKS_LINKEDIN))
|
||||
{
|
||||
print '<tr><td><label for="linkedin">'.$form->editfieldkey('LinkedIn', 'linkedin', '', $object, 0).'</label></td>';
|
||||
print '<td colspan="3"><input type="text" name="linkedin" id="linkedin" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET("linkedin")?GETPOST("linkedin", 'alpha'):$object->linkedin).'"></td></tr>';
|
||||
if (! empty($conf->socialnetworks->enabled)) {
|
||||
foreach ($socialnetworks as $key => $value) {
|
||||
if ($value['active']) {
|
||||
print '<tr>';
|
||||
print '<td><label for="'.$value['label'].'">'.$form->editfieldkey($value['label'], $key, '', $object, 0).'</label></td>';
|
||||
print '<td colspan="3">';
|
||||
print '<input type="text" name="'.$key.'" id="'.$key.'" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET($key)?GETPOST($key, 'alphanohtml'):$object->socialnetworks[$key]).'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
} elseif (!empty($object->socialnetworks[$key])) {
|
||||
print '<input type="hidden" name="'.$key.'" value="'.$object->socialnetworks[$key].'">';
|
||||
}
|
||||
}
|
||||
}
|
||||
// if (! empty($conf->socialnetworks->enabled))
|
||||
// {
|
||||
// // Jabber
|
||||
// if (! empty($conf->global->SOCIALNETWORKS_JABBER))
|
||||
// {
|
||||
// print '<tr><td><label for="skype">'.$form->editfieldkey('Jabber', 'jabberid', '', $object, 0).'</label></td>';
|
||||
// print '<td colspan="3"><input type="text" name="jabberid" id="jabberid" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET("jabberid")?GETPOST("jabberid", 'alpha'):$object->jabberid).'"></td></tr>';
|
||||
// }
|
||||
// // Skype
|
||||
// if (! empty($conf->global->SOCIALNETWORKS_SKYPE))
|
||||
// {
|
||||
// print '<tr><td><label for="skype">'.$form->editfieldkey('Skype', 'skype', '', $object, 0).'</label></td>';
|
||||
// print '<td colspan="3"><input type="text" name="skype" id="skype" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET("skype")?GETPOST("skype", 'alpha'):$object->skype).'"></td></tr>';
|
||||
// }
|
||||
// // Twitter
|
||||
// if (! empty($conf->global->SOCIALNETWORKS_TWITTER))
|
||||
// {
|
||||
// print '<tr><td><label for="twitter">'.$form->editfieldkey('Twitter', 'twitter', '', $object, 0).'</label></td>';
|
||||
// print '<td colspan="3"><input type="text" name="twitter" id="twitter" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET("twitter")?GETPOST("twitter", 'alpha'):$object->twitter).'"></td></tr>';
|
||||
// }
|
||||
// // Facebook
|
||||
// if (! empty($conf->global->SOCIALNETWORKS_FACEBOOK))
|
||||
// {
|
||||
// print '<tr><td><label for="facebook">'.$form->editfieldkey('Facebook', 'facebook', '', $object, 0).'</label></td>';
|
||||
// print '<td colspan="3"><input type="text" name="facebook" id="facebook" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET("facebook")?GETPOST("facebook", 'alpha'):$object->facebook).'"></td></tr>';
|
||||
// }
|
||||
// // LinkedIn
|
||||
// if (! empty($conf->global->SOCIALNETWORKS_LINKEDIN))
|
||||
// {
|
||||
// print '<tr><td><label for="linkedin">'.$form->editfieldkey('LinkedIn', 'linkedin', '', $object, 0).'</label></td>';
|
||||
// print '<td colspan="3"><input type="text" name="linkedin" id="linkedin" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET("linkedin")?GETPOST("linkedin", 'alpha'):$object->linkedin).'"></td></tr>';
|
||||
// }
|
||||
// }
|
||||
|
||||
// Visibility
|
||||
print '<tr><td><label for="priv">'.$langs->trans("ContactVisibility").'</label></td><td colspan="3">';
|
||||
@ -1028,39 +1059,53 @@ else
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
if (! empty($conf->socialnetworks->enabled))
|
||||
{
|
||||
// Jabber ID
|
||||
if (! empty($conf->global->SOCIALNETWORKS_JABBER))
|
||||
{
|
||||
print '<tr><td><label for="jabberid">'.$form->editfieldkey('Jabber', 'jabberid', '', $object, 0).'</label></td>';
|
||||
print '<td><input type="text" name="jabberid" id="jabberid" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET("jabberid")?GETPOST("jabberid", 'alpha'):$object->jabberid).'"></td></tr>';
|
||||
}
|
||||
// Skype
|
||||
if (! empty($conf->global->SOCIALNETWORKS_SKYPE))
|
||||
{
|
||||
print '<tr><td><label for="skype">'.$form->editfieldkey('Skype', 'skype', '', $object, 0).'</label></td>';
|
||||
print '<td><input type="text" name="skype" id="skype" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET("skype")?GETPOST("skype", 'alpha'):$object->skype).'"></td></tr>';
|
||||
}
|
||||
// Twitter
|
||||
if (! empty($conf->global->SOCIALNETWORKS_TWITTER))
|
||||
{
|
||||
print '<tr><td><label for="twitter">'.$form->editfieldkey('Twitter', 'twitter', '', $object, 0).'</label></td>';
|
||||
print '<td><input type="text" name="twitter" id="twitter" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET("twitter")?GETPOST("twitter", 'alpha'):$object->twitter).'"></td></tr>';
|
||||
}
|
||||
// Facebook
|
||||
if (! empty($conf->global->SOCIALNETWORKS_FACEBOOK))
|
||||
{
|
||||
print '<tr><td><label for="facebook">'.$form->editfieldkey('Facebook', 'facebook', '', $object, 0).'</label></td>';
|
||||
print '<td><input type="text" name="facebook" id="facebook" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOST("facebook")?GETPOST("facebook", 'alpha'):$object->facebook).'"></td></tr>';
|
||||
}
|
||||
// LinkedIn
|
||||
if (! empty($conf->global->SOCIALNETWORKS_LINKEDIN))
|
||||
{
|
||||
print '<tr><td><label for="linkedin">'.$form->editfieldkey('LinkedIn', 'linkedin', '', $object, 0).'</label></td>';
|
||||
print '<td><input type="text" name="linkedin" id="linkedin" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOST("linkedin")?GETPOST("linkedin", 'alpha'):$object->linkedin).'"></td></tr>';
|
||||
if (! empty($conf->socialnetworks->enabled)) {
|
||||
foreach ($socialnetworks as $key => $value) {
|
||||
if ($value['active']) {
|
||||
print '<tr>';
|
||||
print '<td><label for="'.$value['label'].'">'.$form->editfieldkey($value['label'], $key, '', $object, 0).'</label></td>';
|
||||
print '<td colspan="3">';
|
||||
print '<input type="text" name="'.$key.'" id="'.$key.'" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET($key)?GETPOST($key, 'alphanohtml'):$object->socialnetworks[$key]).'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
} elseif (!empty($object->socialnetworks[$key])) {
|
||||
print '<input type="hidden" name="'.$key.'" value="'.$object->socialnetworks[$key].'">';
|
||||
}
|
||||
}
|
||||
}
|
||||
// if (! empty($conf->socialnetworks->enabled))
|
||||
// {
|
||||
// // Jabber ID
|
||||
// if (! empty($conf->global->SOCIALNETWORKS_JABBER))
|
||||
// {
|
||||
// print '<tr><td><label for="jabberid">'.$form->editfieldkey('Jabber', 'jabberid', '', $object, 0).'</label></td>';
|
||||
// print '<td><input type="text" name="jabberid" id="jabberid" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET("jabberid")?GETPOST("jabberid", 'alpha'):$object->jabberid).'"></td></tr>';
|
||||
// }
|
||||
// // Skype
|
||||
// if (! empty($conf->global->SOCIALNETWORKS_SKYPE))
|
||||
// {
|
||||
// print '<tr><td><label for="skype">'.$form->editfieldkey('Skype', 'skype', '', $object, 0).'</label></td>';
|
||||
// print '<td><input type="text" name="skype" id="skype" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET("skype")?GETPOST("skype", 'alpha'):$object->skype).'"></td></tr>';
|
||||
// }
|
||||
// // Twitter
|
||||
// if (! empty($conf->global->SOCIALNETWORKS_TWITTER))
|
||||
// {
|
||||
// print '<tr><td><label for="twitter">'.$form->editfieldkey('Twitter', 'twitter', '', $object, 0).'</label></td>';
|
||||
// print '<td><input type="text" name="twitter" id="twitter" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET("twitter")?GETPOST("twitter", 'alpha'):$object->twitter).'"></td></tr>';
|
||||
// }
|
||||
// // Facebook
|
||||
// if (! empty($conf->global->SOCIALNETWORKS_FACEBOOK))
|
||||
// {
|
||||
// print '<tr><td><label for="facebook">'.$form->editfieldkey('Facebook', 'facebook', '', $object, 0).'</label></td>';
|
||||
// print '<td><input type="text" name="facebook" id="facebook" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOST("facebook")?GETPOST("facebook", 'alpha'):$object->facebook).'"></td></tr>';
|
||||
// }
|
||||
// // LinkedIn
|
||||
// if (! empty($conf->global->SOCIALNETWORKS_LINKEDIN))
|
||||
// {
|
||||
// print '<tr><td><label for="linkedin">'.$form->editfieldkey('LinkedIn', 'linkedin', '', $object, 0).'</label></td>';
|
||||
// print '<td><input type="text" name="linkedin" id="linkedin" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOST("linkedin")?GETPOST("linkedin", 'alpha'):$object->linkedin).'"></td></tr>';
|
||||
// }
|
||||
// }
|
||||
|
||||
// Visibility
|
||||
print '<tr><td><label for="priv">'.$langs->trans("ContactVisibility").'</label></td><td colspan="3">';
|
||||
|
||||
@ -83,6 +83,11 @@ class Contact extends CommonObject
|
||||
public $civility_id; // In fact we store civility_code
|
||||
public $civility_code;
|
||||
public $civility;
|
||||
|
||||
/**
|
||||
* Address
|
||||
* @var string
|
||||
*/
|
||||
public $address;
|
||||
public $zip;
|
||||
public $town;
|
||||
@ -97,11 +102,60 @@ class Contact extends CommonObject
|
||||
public $statut; // 0=inactif, 1=actif
|
||||
|
||||
public $code;
|
||||
|
||||
/**
|
||||
* Email
|
||||
* @var string
|
||||
*/
|
||||
public $email;
|
||||
public $no_email; // 1 = contact has globaly unsubscribe of all mass emailings
|
||||
|
||||
/**
|
||||
* Unsuscribe all : 1 = contact has globaly unsubscribe of all mass emailings
|
||||
* @var int
|
||||
*/
|
||||
public $no_email;
|
||||
|
||||
/**
|
||||
* @var array array of socialnetworks
|
||||
*/
|
||||
public $socialnetworks;
|
||||
|
||||
/**
|
||||
* Skype username
|
||||
* @var string
|
||||
* @deprecated
|
||||
*/
|
||||
public $skype;
|
||||
public $photo;
|
||||
|
||||
/**
|
||||
* Twitter username
|
||||
* @var string
|
||||
* @deprecated
|
||||
*/
|
||||
public $twitter;
|
||||
|
||||
/**
|
||||
* Facebook username
|
||||
* @var string
|
||||
* @deprecated
|
||||
*/
|
||||
public $facebook;
|
||||
|
||||
/**
|
||||
* Linkedin username
|
||||
* @var string
|
||||
* @deprecated
|
||||
*/
|
||||
public $linkedin;
|
||||
|
||||
/**
|
||||
* Jabber username
|
||||
* @var string
|
||||
* @deprecated
|
||||
*/
|
||||
public $jabberid;
|
||||
|
||||
public $photo;
|
||||
public $phone_pro;
|
||||
public $phone_perso;
|
||||
public $phone_mobile;
|
||||
@ -123,6 +177,10 @@ class Contact extends CommonObject
|
||||
// END MODULEBUILDER PROPERTIES
|
||||
|
||||
|
||||
/**
|
||||
* Old copy
|
||||
* @var Contact
|
||||
*/
|
||||
public $oldcopy; // To contains a clone of this when we need to save old properties of object
|
||||
|
||||
public $roles=array();
|
||||
@ -345,10 +403,7 @@ class Contact extends CommonObject
|
||||
$sql .= ", poste='".$this->db->escape($this->poste)."'";
|
||||
$sql .= ", fax='".$this->db->escape($this->fax)."'";
|
||||
$sql .= ", email='".$this->db->escape($this->email)."'";
|
||||
$sql .= ", skype='".$this->db->escape($this->skype)."'";
|
||||
$sql .= ", twitter='".$this->db->escape($this->twitter)."'";
|
||||
$sql .= ", facebook='".$this->db->escape($this->facebook)."'";
|
||||
$sql .= ", linkedin='".$this->db->escape($this->linkedin)."'";
|
||||
$sql .= ", socialnetworks = '".$this->db->escape(json_encode($this->socialnetworks))."'";
|
||||
$sql .= ", photo='".$this->db->escape($this->photo)."'";
|
||||
$sql .= ", birthday=".($this->birthday ? "'".$this->db->idate($this->birthday)."'" : "null");
|
||||
$sql .= ", note_private = ".(isset($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null");
|
||||
@ -356,7 +411,6 @@ class Contact extends CommonObject
|
||||
$sql .= ", phone = ".(isset($this->phone_pro)?"'".$this->db->escape($this->phone_pro)."'":"null");
|
||||
$sql .= ", phone_perso = ".(isset($this->phone_perso)?"'".$this->db->escape($this->phone_perso)."'":"null");
|
||||
$sql .= ", phone_mobile = ".(isset($this->phone_mobile)?"'".$this->db->escape($this->phone_mobile)."'":"null");
|
||||
$sql .= ", jabberid = ".(isset($this->jabberid)?"'".$this->db->escape($this->jabberid)."'":"null");
|
||||
$sql .= ", priv = '".$this->db->escape($this->priv)."'";
|
||||
$sql .= ", statut = ".$this->db->escape($this->statut);
|
||||
$sql .= ", fk_user_modif=".($user->id > 0 ? "'".$this->db->escape($user->id)."'":"NULL");
|
||||
@ -439,29 +493,34 @@ class Contact extends CommonObject
|
||||
$tmpobj->email = $this->email;
|
||||
$usermustbemodified++;
|
||||
}
|
||||
if ($tmpobj->skype != $this->skype)
|
||||
if (!empty(array_diff($tmpobj->socialnetworks, $this->socialnetworks)))
|
||||
{
|
||||
$tmpobj->skype = $this->skype;
|
||||
$tmpobj->socialnetworks = $this->socialnetworks;
|
||||
$usermustbemodified++;
|
||||
}
|
||||
if ($tmpobj->twitter != $this->twitter)
|
||||
{
|
||||
$tmpobj->twitter = $this->twitter;
|
||||
$usermustbemodified++;
|
||||
}
|
||||
if ($tmpobj->facebook != $this->facebook)
|
||||
{
|
||||
$tmpobj->facebook = $this->facebook;
|
||||
$usermustbemodified++;
|
||||
}
|
||||
if ($tmpobj->linkedin != $this->linkedin)
|
||||
{
|
||||
$tmpobj->linkedin = $this->linkedin;
|
||||
$usermustbemodified++;
|
||||
}
|
||||
// if ($tmpobj->skype != $this->skype)
|
||||
// {
|
||||
// $tmpobj->skype = $this->skype;
|
||||
// $usermustbemodified++;
|
||||
// }
|
||||
// if ($tmpobj->twitter != $this->twitter)
|
||||
// {
|
||||
// $tmpobj->twitter = $this->twitter;
|
||||
// $usermustbemodified++;
|
||||
// }
|
||||
// if ($tmpobj->facebook != $this->facebook)
|
||||
// {
|
||||
// $tmpobj->facebook = $this->facebook;
|
||||
// $usermustbemodified++;
|
||||
// }
|
||||
// if ($tmpobj->linkedin != $this->linkedin)
|
||||
// {
|
||||
// $tmpobj->linkedin = $this->linkedin;
|
||||
// $usermustbemodified++;
|
||||
// }
|
||||
if ($usermustbemodified)
|
||||
{
|
||||
$result=$tmpobj->update($user, 0, 1, 1, 1);
|
||||
$result = $tmpobj->update($user, 0, 1, 1, 1);
|
||||
if ($result < 0) { $error++; }
|
||||
}
|
||||
}
|
||||
@ -713,7 +772,8 @@ class Contact extends CommonObject
|
||||
$sql.= " c.fk_pays as country_id,";
|
||||
$sql.= " c.fk_departement as state_id,";
|
||||
$sql.= " c.birthday,";
|
||||
$sql.= " c.poste, c.phone, c.phone_perso, c.phone_mobile, c.fax, c.email, c.jabberid, c.skype, c.twitter, c.facebook, c.linkedin,";
|
||||
$sql.= " c.poste, c.phone, c.phone_perso, c.phone_mobile, c.fax, c.email,";
|
||||
$sql.= " c.socialnetworks,";
|
||||
$sql.= " c.photo,";
|
||||
$sql.= " c.priv, c.note_private, c.note_public, c.default_lang, c.canvas,";
|
||||
$sql.= " c.import_key,";
|
||||
@ -782,11 +842,7 @@ class Contact extends CommonObject
|
||||
$this->phone_mobile = trim($obj->phone_mobile);
|
||||
|
||||
$this->email = $obj->email;
|
||||
$this->jabberid = $obj->jabberid;
|
||||
$this->skype = $obj->skype;
|
||||
$this->twitter = $obj->twitter;
|
||||
$this->facebook = $obj->facebook;
|
||||
$this->linkedin = $obj->linkedin;
|
||||
$this->socialnetworks = (array) json_decode($obj->socialnetworks, true);
|
||||
$this->photo = $obj->photo;
|
||||
$this->priv = $obj->priv;
|
||||
$this->mail = $obj->email;
|
||||
@ -1333,8 +1389,10 @@ class Contact extends CommonObject
|
||||
$this->country_code = 'FR';
|
||||
$this->country = 'France';
|
||||
$this->email = 'specimen@specimen.com';
|
||||
$this->skype = 'tom.hanson';
|
||||
|
||||
$this->skype = 'tom.hanson';
|
||||
$this->socialnetworks = array(
|
||||
'skype' => 'tom.hanson',
|
||||
);
|
||||
$this->phone_pro = '0909090901';
|
||||
$this->phone_perso = '0909090902';
|
||||
$this->phone_mobile = '0909090903';
|
||||
|
||||
@ -41,6 +41,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("companies", "suppliers", "categories"));
|
||||
|
||||
$socialnetworks = getArrayOfSocialNetworks();
|
||||
|
||||
$action=GETPOST('action', 'alpha');
|
||||
$massaction=GETPOST('massaction', 'alpha');
|
||||
$show_files=GETPOST('show_files', 'int');
|
||||
@ -71,10 +73,13 @@ $search_phone_mobile=GETPOST("search_phone_mobile", 'alpha');
|
||||
$search_fax=GETPOST("search_fax", 'alpha');
|
||||
$search_email=GETPOST("search_email", 'alpha');
|
||||
$search_no_email=GETPOST("search_no_email", 'int');
|
||||
$search_skype=GETPOST("search_skype", 'alpha');
|
||||
$search_twitter=GETPOST("search_twitter", 'alpha');
|
||||
$search_facebook=GETPOST("search_facebook", 'alpha');
|
||||
$search_linkedin=GETPOST("search_linkedin", 'alpha');
|
||||
if (! empty($conf->socialnetworks->enabled)) {
|
||||
foreach ($socialnetworks as $key => $value) {
|
||||
if ($value['active']) {
|
||||
$search_{$key} = GETPOST("search_".$key, 'alpha');
|
||||
}
|
||||
}
|
||||
}
|
||||
$search_priv=GETPOST("search_priv", 'alpha');
|
||||
$search_categ=GETPOST("search_categ", 'int');
|
||||
$search_categ_thirdparty=GETPOST("search_categ_thirdparty", 'int');
|
||||
@ -168,11 +173,6 @@ $arrayfields=array(
|
||||
'p.fax'=>array('label'=>"Fax", 'checked'=>0),
|
||||
'p.email'=>array('label'=>"EMail", 'checked'=>1),
|
||||
'p.no_email'=>array('label'=>"No_Email", 'checked'=>0, 'enabled'=>(! empty($conf->mailing->enabled))),
|
||||
'p.skype'=>array('label'=>"Skype", 'checked'=>1, 'enabled'=>(! empty($conf->socialnetworks->enabled))),
|
||||
'p.jabberid'=>array('label'=>"Jabber", 'checked'=>1, 'enabled'=>(! empty($conf->socialnetworks->enabled))),
|
||||
'p.twitter'=>array('label'=>"Twitter", 'checked'=>1, 'enabled'=>(! empty($conf->socialnetworks->enabled))),
|
||||
'p.facebook'=>array('label'=>"Facebook", 'checked'=>1, 'enabled'=>(! empty($conf->socialnetworks->enabled))),
|
||||
'p.linkedin'=>array('label'=>"LinkedIn", 'checked'=>1, 'enabled'=>(! empty($conf->socialnetworks->enabled))),
|
||||
'p.thirdparty'=>array('label'=>"ThirdParty", 'checked'=>1, 'enabled'=>empty($conf->global->SOCIETE_DISABLE_CONTACTS)),
|
||||
'p.priv'=>array('label'=>"ContactVisibility", 'checked'=>1, 'position'=>200),
|
||||
'p.datec'=>array('label'=>"DateCreationShort", 'checked'=>0, 'position'=>500),
|
||||
@ -180,6 +180,16 @@ $arrayfields=array(
|
||||
'p.statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
|
||||
'p.import_key'=>array('label'=>"ImportId", 'checked'=>0, 'position'=>1100),
|
||||
);
|
||||
if (! empty($conf->socialnetworks->enabled)) {
|
||||
foreach ($socialnetworks as $key => $value) {
|
||||
if ($value['active']) {
|
||||
$arrayfields['p.'.$key] = array(
|
||||
'label' => $value['label'],
|
||||
'checked' => 0,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
|
||||
{
|
||||
@ -236,10 +246,13 @@ if (empty($reshook))
|
||||
$search_fax="";
|
||||
$search_email="";
|
||||
$search_no_email=-1;
|
||||
$search_skype="";
|
||||
$search_twitter="";
|
||||
$search_facebook="";
|
||||
$search_linkedin="";
|
||||
if (! empty($conf->socialnetworks->enabled)) {
|
||||
foreach ($socialnetworks as $key => $value) {
|
||||
if ($value['active']) {
|
||||
$search_{$key} = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
$search_priv="";
|
||||
$search_status=-1;
|
||||
$search_categ='';
|
||||
@ -254,8 +267,8 @@ if (empty($reshook))
|
||||
// Mass actions
|
||||
$objectclass='Contact';
|
||||
$objectlabel='Contact';
|
||||
$permtoread = $user->rights->societe->lire;
|
||||
$permtodelete = $user->rights->societe->supprimer;
|
||||
$permissiontoread = $user->rights->societe->lire;
|
||||
$permissiontodelete = $user->rights->societe->supprimer;
|
||||
$uploaddir = $conf->societe->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
}
|
||||
@ -275,7 +288,8 @@ $contactstatic=new Contact($db);
|
||||
$title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
|
||||
|
||||
$sql = "SELECT s.rowid as socid, s.nom as name,";
|
||||
$sql.= " p.rowid, p.lastname as lastname, p.statut, p.firstname, p.zip, p.town, p.poste, p.email, p.no_email, p.skype,";
|
||||
$sql.= " p.rowid, p.lastname as lastname, p.statut, p.firstname, p.zip, p.town, p.poste, p.email, p.no_email,";
|
||||
$sql.= " p.socialnetworks,";
|
||||
$sql.= " p.phone as phone_pro, p.phone_mobile, p.phone_perso, p.fax, p.fk_pays, p.priv, p.datec as date_creation, p.tms as date_update,";
|
||||
$sql.= " co.label as country, co.code as country_code";
|
||||
// Add fields from extrafields
|
||||
@ -337,10 +351,14 @@ if (strlen($search_phone_perso)) $sql.= natural_search('p.phone_perso', $sear
|
||||
if (strlen($search_phone_pro)) $sql.= natural_search('p.phone', $search_phone_pro);
|
||||
if (strlen($search_phone_mobile)) $sql.= natural_search('p.phone_mobile', $search_phone_mobile);
|
||||
if (strlen($search_fax)) $sql.= natural_search('p.fax', $search_fax);
|
||||
if (strlen($search_skype)) $sql.= natural_search('p.skype', $search_skype);
|
||||
if (strlen($search_twitter)) $sql.= natural_search('p.twitter', $search_twitter);
|
||||
if (strlen($search_facebook)) $sql.= natural_search('p.facebook', $search_facebook);
|
||||
if (strlen($search_linkedin)) $sql.= natural_search('p.linkedin', $search_linkedin);
|
||||
if (! empty($conf->socialnetworks->enabled)) {
|
||||
foreach ($socialnetworks as $key => $value) {
|
||||
if ($value['active'] && strlen($search_{$key})) {
|
||||
//$sql.= natural_search("p.socialnetworks->'$.".$key."'", $search_{$key});
|
||||
$sql.= ' AND p.socialnetworks LIKE \'%"'.$key.'":"'.$search_{$key}.'%\'';
|
||||
}
|
||||
}
|
||||
}
|
||||
if (strlen($search_email)) $sql.= natural_search('p.email', $search_email);
|
||||
if (strlen($search_zip)) $sql.= natural_search("p.zip", $search_zip);
|
||||
if (strlen($search_town)) $sql.= natural_search("p.town", $search_town);
|
||||
@ -641,35 +659,17 @@ if (! empty($arrayfields['p.no_email']['checked']))
|
||||
print $form->selectarray('search_no_email', array('-1'=>'', '0'=>$langs->trans('No'), '1'=>$langs->trans('Yes')), $search_no_email);
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['p.skype']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" name="search_skype" size="6" value="'.dol_escape_htmltag($search_skype).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['p.jabberid']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" name="search_jabberid" size="6" value="'.dol_escape_htmltag($search_jabberid).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['p.twitter']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" name="search_twitter" size="6" value="'.dol_escape_htmltag($search_twitter).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['p.facebook']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" name="search_facebook" size="6" value="'.dol_escape_htmltag($search_facebook).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['p.linkedin']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" name="search_linkedin" size="6" value="'.dol_escape_htmltag($search_linkedin).'">';
|
||||
print '</td>';
|
||||
if (! empty($conf->socialnetworks->enabled)) {
|
||||
foreach ($socialnetworks as $key => $value) {
|
||||
if ($value['active']) {
|
||||
if (! empty($arrayfields['p.'.$key]['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" name="search_'.$key.'" size="6" value="'.dol_escape_htmltag($search_{$key}).'">';
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (! empty($arrayfields['p.thirdparty']['checked']))
|
||||
{
|
||||
@ -743,11 +743,13 @@ if (! empty($arrayfields['p.phone_mobile']['checked'])) print_liste_field
|
||||
if (! empty($arrayfields['p.fax']['checked'])) print_liste_field_titre($arrayfields['p.fax']['label'], $_SERVER["PHP_SELF"], "p.fax", $begin, $param, '', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['p.email']['checked'])) print_liste_field_titre($arrayfields['p.email']['label'], $_SERVER["PHP_SELF"], "p.email", $begin, $param, '', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['p.no_email']['checked'])) print_liste_field_titre($arrayfields['p.no_email']['label'], $_SERVER["PHP_SELF"], "p.no_email", $begin, $param, '', $sortfield, $sortorder, 'center ');
|
||||
if (! empty($arrayfields['p.skype']['checked'])) print_liste_field_titre($arrayfields['p.skype']['label'], $_SERVER["PHP_SELF"], "p.skype", $begin, $param, '', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['p.jabberid']['checked'])) print_liste_field_titre($arrayfields['p.jabberid']['label'], $_SERVER["PHP_SELF"], "p.jabberid", $begin, $param, '', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['p.twitter']['checked'])) print_liste_field_titre($arrayfields['p.twitter']['label'], $_SERVER["PHP_SELF"], "p.twitter", $begin, $param, '', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['p.facebook']['checked'])) print_liste_field_titre($arrayfields['p.facebook']['label'], $_SERVER["PHP_SELF"], "p.facebook", $begin, $param, '', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['p.linkedin']['checked'])) print_liste_field_titre($arrayfields['p.linkedin']['label'], $_SERVER["PHP_SELF"], "p.linkedin", $begin, $param, '', $sortfield, $sortorder);
|
||||
if (! empty($conf->socialnetworks->enabled)) {
|
||||
foreach ($socialnetworks as $key => $value) {
|
||||
if ($value['active'] && ! empty($arrayfields['p.'.$key]['checked'])) {
|
||||
print_liste_field_titre($arrayfields['p.'.$key]['label'], $_SERVER["PHP_SELF"], "p.".$key, $begin, $param, '', $sortfield, $sortorder);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (! empty($arrayfields['p.thirdparty']['checked'])) print_liste_field_titre($arrayfields['p.thirdparty']['label'], $_SERVER["PHP_SELF"], "s.nom", $begin, $param, '', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['p.priv']['checked'])) print_liste_field_titre($arrayfields['p.priv']['label'], $_SERVER["PHP_SELF"], "p.priv", $begin, $param, '', $sortfield, $sortorder, 'center ');
|
||||
// Extra fields
|
||||
@ -784,7 +786,7 @@ while ($i < min($num, $limit))
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
$arraysocialnetworks = (array) json_decode($obj->socialnetworks, true);
|
||||
$contactstatic->lastname=$obj->lastname;
|
||||
$contactstatic->firstname='';
|
||||
$contactstatic->id=$obj->rowid;
|
||||
@ -796,6 +798,7 @@ while ($i < min($num, $limit))
|
||||
$contactstatic->phone_mobile=$obj->phone_mobile;
|
||||
$contactstatic->zip=$obj->zip;
|
||||
$contactstatic->town=$obj->town;
|
||||
$contactstatic->socialnetworks = $arraysocialnetworks;
|
||||
$contactstatic->country = $obj->country;
|
||||
$contactstatic->country_code = $obj->country_code;
|
||||
|
||||
@ -896,36 +899,14 @@ while ($i < min($num, $limit))
|
||||
print '<td align="center">'.yn($obj->no_email).'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Skype
|
||||
if (! empty($arrayfields['p.skype']['checked']))
|
||||
{
|
||||
if (! empty($conf->socialnetworks->enabled)) { print '<td>'.dol_print_socialnetworks($obj->skype, $obj->rowid, $obj->socid, 'skype').'</td>'; }
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! empty($conf->socialnetworks->enabled)) {
|
||||
foreach ($socialnetworks as $key => $value) {
|
||||
if ($value['active'] && ! empty($arrayfields['p.'.$key]['checked'])) {
|
||||
print '<td>'.dol_print_socialnetworks($arraysocialnetworks[$key], $obj->rowid, $obj->socid, $key).'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Jabber
|
||||
if (! empty($arrayfields['p.jabberid']['checked']))
|
||||
{
|
||||
if (! empty($conf->socialnetworks->enabled)) { print '<td>'.dol_print_socialnetworks($obj->jabberid, $obj->rowid, $obj->socid, 'jabberid').'</td>'; }
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Twitter
|
||||
if (! empty($arrayfields['p.twitter']['checked']))
|
||||
{
|
||||
if (! empty($conf->socialnetworks->enabled)) { print '<td>'.dol_print_socialnetworks($obj->twitter, $obj->rowid, $obj->socid, 'twitter').'</td>'; }
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Facebook
|
||||
if (! empty($arrayfields['p.facebook']['checked']))
|
||||
{
|
||||
if (! empty($conf->socialnetworks->enabled)) { print '<td>'.dol_print_socialnetworks($obj->facebook, $obj->rowid, $obj->socid, 'facebook').'</td>'; }
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// LinkedIn
|
||||
if (! empty($arrayfields['p.linkedin']['checked']))
|
||||
{
|
||||
if (! empty($conf->socialnetworks->enabled)) { print '<td>'.dol_print_socialnetworks($obj->linkedin, $obj->rowid, $obj->socid, 'linkedin').'</td>'; }
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Company
|
||||
if (! empty($arrayfields['p.thirdparty']['checked']))
|
||||
{
|
||||
|
||||
@ -998,7 +998,7 @@ if (empty($reshook))
|
||||
|
||||
// Actions to build doc
|
||||
$upload_dir = $conf->contrat->dir_output;
|
||||
$permissioncreate = $user->rights->contrat->creer;
|
||||
$permissiontoadd = $user->rights->contrat->creer;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||
|
||||
// Actions to send emails
|
||||
|
||||
@ -1894,6 +1894,7 @@ class Contrat extends CommonObject
|
||||
public function LibStatut($status, $mode)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
|
||||
if (empty($this->labelStatus) || empty($this->labelStatusShort))
|
||||
{
|
||||
|
||||
@ -188,8 +188,8 @@ if (empty($reshook))
|
||||
{
|
||||
$objectclass='Contrat';
|
||||
$objectlabel='Contracts';
|
||||
$permtoread = $user->rights->contrat->lire;
|
||||
$permtodelete = $user->rights->contrat->supprimer;
|
||||
$permissiontoread = $user->rights->contrat->lire;
|
||||
$permissiontodelete = $user->rights->contrat->supprimer;
|
||||
$uploaddir = $conf->contrat->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
}
|
||||
@ -591,10 +591,10 @@ if (! empty($arrayfields['lower_planned_end_date']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['lower_planned_end_date']['label'], $_SERVER["PHP_SELF"], "lower_planned_end_date", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
}
|
||||
if (! empty($arrayfields['status']['checked'])) {
|
||||
print_liste_field_titre($staticcontratligne->LibStatut(0, 3), '', '', '', '', 'width="16"');
|
||||
print_liste_field_titre($staticcontratligne->LibStatut(4, 3, 0), '', '', '', '', 'width="16"');
|
||||
print_liste_field_titre($staticcontratligne->LibStatut(4, 3, 1), '', '', '', '', 'width="16"');
|
||||
print_liste_field_titre($staticcontratligne->LibStatut(5, 3), '', '', '', '', 'width="16"');
|
||||
print_liste_field_titre($staticcontratligne->LibStatut(0, 3, -1, 'class="nochangebackground"'), '', '', '', '', 'width="16"');
|
||||
print_liste_field_titre($staticcontratligne->LibStatut(4, 3, 0, 'class="nochangebackground"'), '', '', '', '', 'width="16"');
|
||||
print_liste_field_titre($staticcontratligne->LibStatut(4, 3, 1, 'class="nochangebackground"'), '', '', '', '', 'width="16"');
|
||||
print_liste_field_titre($staticcontratligne->LibStatut(5, 3, -1, 'class="nochangebackground"'), '', '', '', '', 'width="16"');
|
||||
}
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
@ -599,24 +599,18 @@ while ($i < min($num, $limit))
|
||||
print '<td class="right">';
|
||||
print price($obj->total_ht);
|
||||
print '</td>';
|
||||
$totalarray['totalht'] += $obj->total_ht;
|
||||
if (! $i) {
|
||||
$totalarray['displaytotalline']++;
|
||||
$totalarray['nbfield']++;
|
||||
$totalarray['totalhtfield']=$totalarray['nbfield'];
|
||||
}
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='cd.total_ht';
|
||||
$totalarray['val']['cd.total_ht'] += $obj->total_ht;
|
||||
}
|
||||
if (! empty($arrayfields['cd.total_tva']['checked']))
|
||||
{
|
||||
print '<td class="right">';
|
||||
print price($obj->total_tva);
|
||||
print '</td>';
|
||||
$totalarray['totalvat'] += $obj->total_tva;
|
||||
if (! $i) {
|
||||
$totalarray['nbfield']++;
|
||||
$totalarray['totalvatfield']=$totalarray['nbfield'];
|
||||
$totalarray['displaytotalline']++;
|
||||
}
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='cd.total_tva';
|
||||
$totalarray['val']['cd.total_tva'] += $obj->total_tva;
|
||||
}
|
||||
if (! empty($arrayfields['cd.tva_tx']['checked']))
|
||||
{
|
||||
@ -734,22 +728,7 @@ while ($i < min($num, $limit))
|
||||
}
|
||||
|
||||
// Show total line
|
||||
if (isset($totalarray['displaytotalline'])) {
|
||||
print '<tr class="liste_total">';
|
||||
$i=0;
|
||||
while ($i < $totalarray['nbfield']) {
|
||||
$i++;
|
||||
if ($i == 1) {
|
||||
if ($num < $limit && empty($offset)) print '<td class="left">'.$langs->trans("Total").'</td>';
|
||||
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||
}
|
||||
elseif ($totalarray['totalhtfield'] == $i) print '<td class="right">'.price($totalarray['totalht']).'</td>';
|
||||
elseif ($totalarray['totalvatfield'] == $i) print '<td class="right">'.price($totalarray['totalvat']).'</td>';
|
||||
elseif ($totalarray['totalttcfield'] == $i) print '<td class="right">'.price($totalarray['totalttc']).'</td>';
|
||||
else print '<td></td>';
|
||||
}
|
||||
print '</tr>';
|
||||
}
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
|
||||
|
||||
$db->free($resql);
|
||||
|
||||
|
||||
@ -30,6 +30,8 @@
|
||||
// $backtopage may be defined
|
||||
// $triggermodname may be defined
|
||||
|
||||
if (! empty($permissionedit) && empty($permissiontoadd)) $permissiontoadd = $permissionedit; // For backward compatibility
|
||||
|
||||
if ($cancel)
|
||||
{
|
||||
/*var_dump($cancel);
|
||||
@ -234,7 +236,7 @@ if ($action == 'confirm_deleteline' && $confirm == 'yes' && ! empty($permissiont
|
||||
}
|
||||
|
||||
// Action validate object
|
||||
if ($action == 'confirm_validate' && $confirm == 'yes' && $permissionedit)
|
||||
if ($action == 'confirm_validate' && $confirm == 'yes' && $permissiontoadd)
|
||||
{
|
||||
$result = $object->validate($user);
|
||||
if ($result >= 0)
|
||||
@ -263,7 +265,7 @@ if ($action == 'confirm_validate' && $confirm == 'yes' && $permissionedit)
|
||||
}
|
||||
|
||||
// Action close object
|
||||
if ($action == 'confirm_close' && $confirm == 'yes' && $permissionedit)
|
||||
if ($action == 'confirm_close' && $confirm == 'yes' && $permissiontoadd)
|
||||
{
|
||||
$result = $object->cancel($user);
|
||||
if ($result >= 0)
|
||||
@ -292,7 +294,7 @@ if ($action == 'confirm_close' && $confirm == 'yes' && $permissionedit)
|
||||
}
|
||||
|
||||
// Action setdraft object
|
||||
if ($action == 'confirm_setdraft' && $confirm == 'yes' && $permissionedit)
|
||||
if ($action == 'confirm_setdraft' && $confirm == 'yes' && $permissiontoadd)
|
||||
{
|
||||
$result = $object->setDraft($user);
|
||||
if ($result >= 0)
|
||||
@ -306,7 +308,7 @@ if ($action == 'confirm_setdraft' && $confirm == 'yes' && $permissionedit)
|
||||
}
|
||||
|
||||
// Action reopen object
|
||||
if ($action == 'confirm_reopen' && $confirm == 'yes' && $permissionedit)
|
||||
if ($action == 'confirm_reopen' && $confirm == 'yes' && $permissiontoadd)
|
||||
{
|
||||
$result = $object->reopen($user);
|
||||
if ($result >= 0)
|
||||
|
||||
@ -25,13 +25,14 @@
|
||||
// $action must be defined
|
||||
// $id must be defined
|
||||
// $object must be defined and must have a method generateDocument().
|
||||
// $permissioncreate must be defined
|
||||
// $permissiontoadd must be defined
|
||||
// $upload_dir must be defined (example $conf->projet->dir_output . "/";)
|
||||
// $hidedetails, $hidedesc, $hideref and $moreparams may have been set or not.
|
||||
|
||||
if (!empty($permissioncreate) && empty($permissiontoadd)) $permissiontoadd = $permissioncreate; // For backward compatibility
|
||||
|
||||
// Build doc
|
||||
if ($action == 'builddoc' && $permissioncreate)
|
||||
if ($action == 'builddoc' && $permissiontoadd)
|
||||
{
|
||||
if (is_numeric(GETPOST('model', 'alpha')))
|
||||
{
|
||||
@ -107,7 +108,7 @@ if ($action == 'builddoc' && $permissioncreate)
|
||||
}
|
||||
|
||||
// Delete file in doc form
|
||||
if ($action == 'remove_file' && $permissioncreate)
|
||||
if ($action == 'remove_file' && $permissiontoadd)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
// $objectclass and $objectlabel must be defined
|
||||
// $parameters, $object, $action must be defined for the hook.
|
||||
|
||||
// $permtoread, $permtocreate and $permtodelete may be defined
|
||||
// $permissiontoread, $permissiontoadd, $permissiontodelete, $permissiontoclose may be defined
|
||||
// $uploaddir may be defined (example to $conf->projet->dir_output."/";)
|
||||
// $toselect may be defined
|
||||
// $diroutputmassaction may be defined
|
||||
@ -43,6 +43,11 @@ if (empty($objectclass) || empty($uploaddir))
|
||||
exit;
|
||||
}
|
||||
|
||||
// For backward compatibility
|
||||
if (! empty($permtoread) && empty($permissiontoread)) $permissiontoread = $permtoread;
|
||||
if (! empty($permtocreate) && empty($permissiontoadd)) $permissiontoadd = $permtocreate;
|
||||
if (! empty($permtodelete) && empty($permissiontodelete)) $permissiontoread = $permtodelete;
|
||||
|
||||
|
||||
// Mass actions. Controls on number of lines checked.
|
||||
$maxformassaction=(empty($conf->global->MAIN_LIMIT_FOR_MASS_ACTIONS)?1000:$conf->global->MAIN_LIMIT_FOR_MASS_ACTIONS);
|
||||
@ -819,7 +824,7 @@ if ($massaction == 'confirm_createbills') // Create bills from orders
|
||||
// Builddoc
|
||||
$donotredirect = 1;
|
||||
$upload_dir = $conf->facture->dir_output;
|
||||
$permissioncreate=$user->rights->facture->creer;
|
||||
$permissiontoadd=$user->rights->facture->creer;
|
||||
|
||||
// Call action to build doc
|
||||
$savobject = $object;
|
||||
@ -924,7 +929,7 @@ if (!$error && $massaction == 'cancelorders')
|
||||
}
|
||||
|
||||
|
||||
if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_search'))
|
||||
if (! $error && $massaction == "builddoc" && $permissiontoread && ! GETPOST('button_search'))
|
||||
{
|
||||
if (empty($diroutputmassaction))
|
||||
{
|
||||
@ -1105,7 +1110,7 @@ if ($action == 'remove_file')
|
||||
}
|
||||
|
||||
// Validate records
|
||||
if (! $error && $massaction == 'validate' && $permtocreate)
|
||||
if (! $error && $massaction == 'validate' && $permissiontoadd)
|
||||
{
|
||||
$objecttmp=new $objectclass($db);
|
||||
|
||||
@ -1170,8 +1175,9 @@ if (! $error && $massaction == 'validate' && $permtocreate)
|
||||
//var_dump($listofobjectthirdparties);exit;
|
||||
}
|
||||
}
|
||||
|
||||
// Closed records
|
||||
if (!$error && $massaction == 'closed' && $objectclass == "Propal" && $permtoclose) {
|
||||
if (!$error && $massaction == 'closed' && $objectclass == "Propal" && $permissiontoclose) {
|
||||
$db->begin();
|
||||
|
||||
$objecttmp = new $objectclass($db);
|
||||
@ -1206,7 +1212,7 @@ if (!$error && $massaction == 'closed' && $objectclass == "Propal" && $permtoclo
|
||||
}
|
||||
}
|
||||
// Delete record from mass action (massaction = 'delete' for direct delete, action/confirm='delete'/'yes' with a confirmation step before)
|
||||
if (! $error && ($massaction == 'delete' || ($action == 'delete' && $confirm == 'yes')) && $permtodelete)
|
||||
if (! $error && ($massaction == 'delete' || ($action == 'delete' && $confirm == 'yes')) && $permissiontodelete)
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
@ -1272,7 +1278,7 @@ if (! $error && ($massaction == 'delete' || ($action == 'delete' && $confirm ==
|
||||
|
||||
// Generate document foreach object according to model linked to object
|
||||
// @TODO : propose model selection
|
||||
if (! $error && $massaction == 'generate_doc' && $permtoread)
|
||||
if (! $error && $massaction == 'generate_doc' && $permissiontoread)
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
||||
* Copyright (C) 2015-2019 Frederic France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -84,7 +84,7 @@ class box_propales extends ModeleBoxes
|
||||
|
||||
if ($user->rights->propale->lire)
|
||||
{
|
||||
$sql = "SELECT s.nom as name, s.rowid as socid, s.code_client, s.logo,";
|
||||
$sql = "SELECT s.nom as name, s.rowid as socid, s.code_client, s.logo, s.email,";
|
||||
$sql.= " p.rowid, p.ref, p.fk_statut, p.datep as dp, p.datec, p.fin_validite, p.date_cloture, p.total_ht, p.tva as total_tva, p.total as total_ttc, p.tms";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."propal as p";
|
||||
@ -121,6 +121,7 @@ class box_propales extends ModeleBoxes
|
||||
$societestatic->name = $objp->name;
|
||||
$societestatic->code_client = $objp->code_client;
|
||||
$societestatic->logo = $objp->logo;
|
||||
$societestatic->email = $objp->email;
|
||||
|
||||
$late = '';
|
||||
if ($objp->fk_statut == 1 && $dateterm < ($now - $conf->propal->cloture->warning_delay)) {
|
||||
|
||||
@ -1125,10 +1125,10 @@ class CMailFile
|
||||
$strContentAltText = '';
|
||||
if ($this->msgishtml)
|
||||
{
|
||||
// Similar code to forge a text from html is also in CMailFile.class.php
|
||||
// Similar code to forge a text from html is also in smtps.class.php
|
||||
$strContentAltText = preg_replace("/<br\s*[^>]*>/", " ", $strContent);
|
||||
$strContentAltText = html_entity_decode(strip_tags($strContentAltText));
|
||||
$strContentAltText = rtrim(wordwrap($strContentAltText, 75, empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA)?"\r\n":"\n"));
|
||||
$strContentAltText = trim(wordwrap($strContentAltText, 75, empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA)?"\r\n":"\n"));
|
||||
|
||||
// Check if html header already in message, if not complete the message
|
||||
$strContent = $this->checkIfHTML($strContent);
|
||||
|
||||
@ -692,16 +692,23 @@ abstract class CommonObject
|
||||
$out.='<div style="clear: both;">';
|
||||
if (! empty($conf->socialnetworks->enabled))
|
||||
{
|
||||
if ($this->skype) $out.=dol_print_socialnetworks($this->skype, $this->id, $object->id, 'skype');
|
||||
$outdone++;
|
||||
if ($this->jabberid) $out.=dol_print_socialnetworks($this->jabberid, $this->id, $object->id, 'jabber');
|
||||
$outdone++;
|
||||
if ($this->twitter) $out.=dol_print_socialnetworks($this->twitter, $this->id, $object->id, 'twitter');
|
||||
$outdone++;
|
||||
if ($this->facebook) $out.=dol_print_socialnetworks($this->facebook, $this->id, $object->id, 'facebook');
|
||||
$outdone++;
|
||||
if ($this->linkedin) $out.=dol_print_socialnetworks($this->linkedin, $this->id, $object->id, 'linkedin');
|
||||
$outdone++;
|
||||
if (is_array($this->socialnetworks) && count($this->socialnetworks)>0) {
|
||||
foreach ($this->socialnetworks as $key => $value) {
|
||||
$out.=dol_print_socialnetworks($value, $this->id, $object->id, $key);
|
||||
$outdone++;
|
||||
}
|
||||
} else {
|
||||
if ($this->skype) $out.=dol_print_socialnetworks($this->skype, $this->id, $object->id, 'skype');
|
||||
$outdone++;
|
||||
if ($this->jabberid) $out.=dol_print_socialnetworks($this->jabberid, $this->id, $object->id, 'jabber');
|
||||
$outdone++;
|
||||
if ($this->twitter) $out.=dol_print_socialnetworks($this->twitter, $this->id, $object->id, 'twitter');
|
||||
$outdone++;
|
||||
if ($this->facebook) $out.=dol_print_socialnetworks($this->facebook, $this->id, $object->id, 'facebook');
|
||||
$outdone++;
|
||||
if ($this->linkedin) $out.=dol_print_socialnetworks($this->linkedin, $this->id, $object->id, 'linkedin');
|
||||
$outdone++;
|
||||
}
|
||||
}
|
||||
$out.='</div>';
|
||||
|
||||
@ -7425,7 +7432,7 @@ abstract class CommonObject
|
||||
unset($fieldvalues['rowid']); // The field 'rowid' is reserved field name for autoincrement field so we don't need it into insert.
|
||||
if (array_key_exists('ref', $fieldvalues)) $fieldvalues['ref']=dol_string_nospecial($fieldvalues['ref']); // If field is a ref,we sanitize data
|
||||
|
||||
$keys=array();
|
||||
$keys = array();
|
||||
$values = array();
|
||||
foreach ($fieldvalues as $k => $v) {
|
||||
$keys[$k] = $k;
|
||||
@ -7656,8 +7663,9 @@ abstract class CommonObject
|
||||
if (array_key_exists('fk_user_modif', $fieldvalues) && ! ($fieldvalues['fk_user_modif'] > 0)) $fieldvalues['fk_user_modif']=$user->id;
|
||||
unset($fieldvalues['rowid']); // The field 'rowid' is reserved field name for autoincrement field so we don't need it into update.
|
||||
|
||||
$keys=array();
|
||||
$keys = array();
|
||||
$values = array();
|
||||
$tmp = array();
|
||||
foreach ($fieldvalues as $k => $v) {
|
||||
$keys[$k] = $k;
|
||||
$value = $this->fields[$k];
|
||||
@ -8027,7 +8035,8 @@ abstract class CommonObject
|
||||
|
||||
if (! $this->db->query($sql))
|
||||
{
|
||||
$this->db->rollback();die($sql);
|
||||
$this->error = $this->db->lasterror();
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2015-2018 Frédéric France <frederic.france@free.fr>
|
||||
/* Copyright (C) 2015-2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -37,67 +37,83 @@
|
||||
* <dol_underline_2dots> </dol_underline_2dots> Underline with double line
|
||||
* <dol_emphasized> </dol_emphasized> Emphasized text
|
||||
* <dol_switch_colors> </dol_switch_colors> Print in white on black
|
||||
* <dol_print_barcode> Print barcode
|
||||
* <dol_print_barcode_customer_id> Print barcode customer id
|
||||
* <dol_set_print_width_57> Ticket print width of 57mm
|
||||
* <dol_cut_paper_full> Cut ticket completely
|
||||
* <dol_cut_paper_partial> Cut ticket partially
|
||||
* <dol_open_drawer> Open cash drawer
|
||||
* <dol_activate_buzzer> Activate buzzer
|
||||
*
|
||||
* Code which can be placed everywhere
|
||||
* <dol_print_barcode> Print barcode
|
||||
* <dol_print_qrcode> Print QR Code
|
||||
* <dol_print_date> Print date AAAA-MM-DD
|
||||
* <dol_print_date_time> Print date and time AAAA-MM-DD HH:MM:SS
|
||||
* <dol_print_year> Print Year
|
||||
* <dol_print_month_letters> Print month in letters (example : november)
|
||||
* <dol_print_month> Print month number
|
||||
* <dol_print_day> Print day number
|
||||
* <dol_print_day_letters> Print day number
|
||||
* <dol_print_table> Print table number (for restaurant, bar...)
|
||||
* <dol_print_cutlery> Print number of cutlery (for restaurant)
|
||||
* <dol_print_payment> Print payment method
|
||||
* <dol_print_logo> Print logo stored on printer. Example : <print_logo>32|32
|
||||
* <dol_print_logo_old> Print logo stored on printer. Must be followed by logo code. For old printers.
|
||||
* <dol_print_order_lines> Print order lines
|
||||
* <dol_print_order_tax> Print order total tax
|
||||
* <dol_print_order_local_tax> Print order local tax
|
||||
* <dol_print_order_total> Print order total
|
||||
* <dol_print_order_number> Print order number
|
||||
* <dol_print_order_number_unique> Print order number after validation
|
||||
* <dol_print_customer_firstname> Print customer firstname
|
||||
* <dol_print_customer_lastname> Print customer name
|
||||
* <dol_print_customer_mail> Print customer mail
|
||||
* <dol_print_customer_phone> Print customer phone
|
||||
* <dol_print_customer_mobile> Print customer mobile
|
||||
* <dol_print_customer_skype> Print customer skype
|
||||
* <dol_print_customer_tax_number> Print customer VAT number
|
||||
* <dol_print_customer_account_balance> Print customer account balance
|
||||
* <dol_print_vendor_lastname> Print vendor name
|
||||
* <dol_print_vendor_firstname> Print vendor firstname
|
||||
* <dol_print_vendor_mail> Print vendor mail
|
||||
* <dol_print_customer_points> Print customer points
|
||||
* <dol_print_order_points> Print number of points for this order
|
||||
* <dol_print_object_lines> Print object lines
|
||||
* <dol_print_object_tax> Print object total tax
|
||||
* <dol_print_object_local_tax> Print object local tax
|
||||
* <dol_print_object_total> Print object total
|
||||
* <dol_print_payment> Print payment method
|
||||
*
|
||||
* Conditional code at line start (if<EFBFBD>then Print)
|
||||
* <dol_print_if_customer> Print the line IF a customer is affected to the order
|
||||
* <dol_print_if_vendor> Print the line IF a vendor is affected to the order
|
||||
* Code which can be placed everywhere
|
||||
* <dol_value_date> Replaced by date AAAA-MM-DD
|
||||
* <dol_value_date_time> Replaced by date and time AAAA-MM-DD HH:MM:SS
|
||||
* <dol_value_year> Replaced by Year
|
||||
* <dol_value_month_letters> Replaced by month in letters (example : november)
|
||||
* <dol_value_month> Replaced by month number
|
||||
* <dol_value_day> Replaced by day number
|
||||
* <dol_value_day_letters> Replaced by day number
|
||||
* <dol_value_table> Replaced by table number (for restaurant, bar...)
|
||||
* <dol_value_cutlery> Replaced by number of cutlery (for restaurant)
|
||||
* <dol_object_id> Replaced by object id
|
||||
* <dol_object_ref> Replaced by object ref
|
||||
* <dol_value_customer_firstname> Replaced by customer firstname
|
||||
* <dol_value_customer_lastname> Replaced by customer name
|
||||
* <dol_value_customer_mail> Replaced by customer mail
|
||||
* <dol_value_customer_phone> Replaced by customer phone
|
||||
* <dol_value_customer_mobile> Replaced by customer mobile
|
||||
* <dol_value_customer_skype> Replaced by customer skype
|
||||
* <dol_value_customer_tax_number> Replaced by customer VAT number
|
||||
* <dol_value_customer_account_balance> Replaced by customer account balance
|
||||
* <dol_value_mysoc_name> Replaced by mysoc name
|
||||
* <dol_value_mysoc_address> Replaced by mysoc address
|
||||
* <dol_value_mysoc_zip> Replaced by mysoc zip
|
||||
* <dol_value_mysoc_town> Replaced by mysoc town
|
||||
* <dol_value_mysoc_country> Replaced by mysoc country
|
||||
* <dol_value_mysoc_idprof1> Replaced by mysoc idprof1
|
||||
* <dol_value_mysoc_idprof2> Replaced by mysoc idprof2
|
||||
* <dol_value_mysoc_idprof3> Replaced by mysoc idprof3
|
||||
* <dol_value_mysoc_idprof4> Replaced by mysoc idprof4
|
||||
* <dol_value_mysoc_idprof5> Replaced by mysoc idprof5
|
||||
* <dol_value_mysoc_idprof6> Replaced by mysoc idprof6
|
||||
* <dol_value_vendor_lastname> Replaced by vendor name
|
||||
* <dol_value_vendor_firstname> Replaced by vendor firstname
|
||||
* <dol_value_vendor_mail> Replaced by vendor mail
|
||||
* <dol_value_customer_points> Replaced by customer points
|
||||
* <dol_value_object_points> Replaced by number of points for this object
|
||||
*
|
||||
* Conditional code at line start (if then Print)
|
||||
* <dol_print_if_customer> Print the line IF a customer is affected to the object
|
||||
* <dol_print_if_vendor> Print the line IF a vendor is affected to the object
|
||||
* <dol_print_if_happy_hour> Print the line IF Happy Hour
|
||||
* <dol_print_if_num_order_unique> Print the line IF order is validated
|
||||
* <dol_print_if_num_object_unique> Print the line IF object is validated
|
||||
* <dol_print_if_customer_points> Print the line IF customer points > 0
|
||||
* <dol_print_if_order_points> Print the line IF points of the order > 0
|
||||
* <dol_print_if_object_points> Print the line IF points of the object > 0
|
||||
* <dol_print_if_customer_tax_number> Print the line IF customer has vat number
|
||||
* <dol_print_if_customer_account_balance_positive> Print the line IF customer balance > 0
|
||||
*
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT .'/includes/mike42/escpos-php/Escpos.php';
|
||||
require_once DOL_DOCUMENT_ROOT .'/includes/mike42/escpos-php/autoload.php';
|
||||
use Mike42\Escpos\PrintConnectors\FilePrintConnector;
|
||||
use Mike42\Escpos\PrintConnectors\NetworkPrintConnector;
|
||||
use Mike42\Escpos\PrintConnectors\WindowsPrintConnector;
|
||||
use Mike42\Escpos\CapabilityProfile;
|
||||
use Mike42\Escpos\Printer;
|
||||
use Mike42\Escpos\EscposImage;
|
||||
|
||||
|
||||
/**
|
||||
* Class to manage Receipt Printers
|
||||
*/
|
||||
class dolReceiptPrinter extends Escpos
|
||||
class dolReceiptPrinter extends Printer
|
||||
{
|
||||
const CONNECTOR_DUMMY = 1;
|
||||
const CONNECTOR_FILE_PRINT = 2;
|
||||
@ -110,6 +126,9 @@ class dolReceiptPrinter extends Escpos
|
||||
*/
|
||||
public $db;
|
||||
|
||||
/*
|
||||
* @var string[] array of tags
|
||||
*/
|
||||
public $tags;
|
||||
public $printer;
|
||||
public $template;
|
||||
@ -124,8 +143,6 @@ class dolReceiptPrinter extends Escpos
|
||||
*/
|
||||
public $errors = array();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@ -135,6 +152,8 @@ class dolReceiptPrinter extends Escpos
|
||||
{
|
||||
$this->db=$db;
|
||||
$this->tags = array(
|
||||
'dol_line_feed',
|
||||
'dol_line_feed_reverse',
|
||||
'dol_align_left',
|
||||
'dol_align_center',
|
||||
'dol_align_right',
|
||||
@ -155,51 +174,65 @@ class dolReceiptPrinter extends Escpos
|
||||
'/dol_emphasized',
|
||||
'dol_switch_colors',
|
||||
'/dol_switch_colors',
|
||||
'dol_print_barcode',
|
||||
'dol_print_barcode_customer_id',
|
||||
'dol_set_print_width_57',
|
||||
'dol_cut_paper_full',
|
||||
'dol_cut_paper_partial',
|
||||
'dol_open_drawer',
|
||||
'dol_activate_buzzer',
|
||||
//'dol_activate_buzzer',
|
||||
'dol_print_text',
|
||||
'dol_print_qrcode',
|
||||
'dol_print_date',
|
||||
'dol_print_date_time',
|
||||
'dol_print_year',
|
||||
'dol_print_month_letters',
|
||||
'dol_print_month',
|
||||
'dol_print_day',
|
||||
'dol_print_day_letters',
|
||||
'dol_print_table',
|
||||
'dol_print_cutlery',
|
||||
'dol_print_barcode',
|
||||
'dol_value_date',
|
||||
'dol_value_date_time',
|
||||
'dol_value_year',
|
||||
'dol_value_month_letters',
|
||||
'dol_value_month',
|
||||
'dol_value_day',
|
||||
'dol_value_day_letters',
|
||||
'dol_value_table',
|
||||
'dol_value_cutlery',
|
||||
'dol_print_payment',
|
||||
'dol_print_logo',
|
||||
'dol_print_logo_old',
|
||||
'dol_print_order_lines',
|
||||
'dol_print_order_tax',
|
||||
'dol_print_order_local_tax',
|
||||
'dol_print_order_total',
|
||||
'dol_print_order_number',
|
||||
'dol_print_order_number_unique',
|
||||
'dol_print_customer_firstname',
|
||||
'dol_print_customer_lastname',
|
||||
'dol_print_customer_mail',
|
||||
'dol_print_customer_phone',
|
||||
'dol_print_customer_mobile',
|
||||
'dol_print_customer_skype',
|
||||
'dol_print_customer_tax_number',
|
||||
'dol_print_customer_account_balance',
|
||||
'dol_print_vendor_lastname',
|
||||
'dol_print_vendor_firstname',
|
||||
'dol_print_vendor_mail',
|
||||
'dol_print_customer_points',
|
||||
'dol_print_order_points',
|
||||
'dol_value_object_id',
|
||||
'dol_value_object_ref',
|
||||
'dol_print_object_lines',
|
||||
'dol_print_object_tax',
|
||||
'dol_print_object_local_tax',
|
||||
'dol_print_object_total',
|
||||
'dol_print_object_number',
|
||||
'dol_value_customer_firstname',
|
||||
'dol_value_customer_lastname',
|
||||
'dol_value_customer_mail',
|
||||
'dol_value_customer_phone',
|
||||
'dol_value_customer_mobile',
|
||||
'dol_value_customer_skype',
|
||||
'dol_value_customer_tax_number',
|
||||
'dol_value_customer_account_balance',
|
||||
'dol_value_mysoc_name',
|
||||
'dol_value_mysoc_address',
|
||||
'dol_value_mysoc_zip',
|
||||
'dol_value_mysoc_town',
|
||||
'dol_value_mysoc_country',
|
||||
'dol_value_mysoc_idprof1',
|
||||
'dol_value_mysoc_idprof2',
|
||||
'dol_value_mysoc_idprof3',
|
||||
'dol_value_mysoc_idprof4',
|
||||
'dol_value_mysoc_idprof5',
|
||||
'dol_value_mysoc_idprof6',
|
||||
'dol_value_mysoc_tva_intra',
|
||||
'dol_value_mysoc_capital',
|
||||
'dol_value_vendor_lastname',
|
||||
'dol_value_vendor_firstname',
|
||||
'dol_value_vendor_mail',
|
||||
'dol_value_customer_points',
|
||||
'dol_value_object_points',
|
||||
'dol_print_if_customer',
|
||||
'dol_print_if_vendor',
|
||||
'dol_print_if_happy_hour',
|
||||
'dol_print_if_num_order_unique',
|
||||
'dol_print_if_num_object_unique',
|
||||
'dol_print_if_customer_points',
|
||||
'dol_print_if_order_points',
|
||||
'dol_print_if_object_points',
|
||||
'dol_print_if_customer_tax_number',
|
||||
'dol_print_if_customer_account_balance_positive',
|
||||
);
|
||||
@ -318,7 +351,7 @@ class dolReceiptPrinter extends Escpos
|
||||
1 => $langs->trans('CONNECTOR_DUMMY'),
|
||||
2 => $langs->trans('CONNECTOR_FILE_PRINT'),
|
||||
3 => $langs->trans('CONNECTOR_NETWORK_PRINT'),
|
||||
4 => $langs->trans('CONNECTOR_WINDOWS_PRINT')
|
||||
4 => $langs->trans('CONNECTOR_WINDOWS_PRINT'),
|
||||
);
|
||||
|
||||
$this->resprint = Form::selectarray($htmlname, $options, $selected);
|
||||
@ -343,7 +376,7 @@ class dolReceiptPrinter extends Escpos
|
||||
1 => $langs->trans('PROFILE_SIMPLE'),
|
||||
2 => $langs->trans('PROFILE_EPOSTEP'),
|
||||
3 => $langs->trans('PROFILE_P822D'),
|
||||
4 => $langs->trans('PROFILE_STAR')
|
||||
4 => $langs->trans('PROFILE_STAR'),
|
||||
);
|
||||
|
||||
$this->profileresprint = Form::selectarray($htmlname, $options, $selected);
|
||||
@ -423,6 +456,29 @@ class dolReceiptPrinter extends Escpos
|
||||
return $error;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to add a printer template in db
|
||||
*
|
||||
* @param string $name Template name
|
||||
* @param int $template Template
|
||||
* @return int 0 if OK; >0 if KO
|
||||
*/
|
||||
public function addTemplate($name, $template)
|
||||
{
|
||||
global $conf;
|
||||
$error = 0;
|
||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'printer_receipt_template';
|
||||
$sql.= ' (name, template, entity) VALUES ("'.$this->db->escape($name).'"';
|
||||
$sql.= ', "'.$this->db->escape($template).'", '.$conf->entity.')';
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) {
|
||||
$error++;
|
||||
$this->errors[] = $this->db->lasterror;
|
||||
}
|
||||
return $error;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function to Update a printer template in db
|
||||
*
|
||||
@ -458,16 +514,18 @@ class dolReceiptPrinter extends Escpos
|
||||
{
|
||||
global $conf;
|
||||
$error = 0;
|
||||
$img = new EscposImage(DOL_DOCUMENT_ROOT .'/theme/common/dolibarr_logo_bw.png');
|
||||
$img = EscposImage::load(DOL_DOCUMENT_ROOT .'/theme/common/dolibarr_logo_bw.png');
|
||||
//$this->profile = CapabilityProfile::load("TM-T88IV");
|
||||
$ret = $this->initPrinter($printerid);
|
||||
if ($ret>0) {
|
||||
setEventMessages($this->error, $this->errors, 'errors');
|
||||
} else {
|
||||
try {
|
||||
$this->printer->graphics($img);
|
||||
$this->printer->bitImage($img);
|
||||
$this->printer->text("Hello World!\n");
|
||||
$testStr = "Testing 123";
|
||||
$this->printer->qrCode($testStr);
|
||||
$testStr = "1234567890";
|
||||
$this->printer->barcode($testStr);
|
||||
//$this->printer->qrcode($testStr, Printer::QR_ECLEVEL_M, 5, Printer::QR_MODEL_1);
|
||||
$this->printer->text("Most simple example\n");
|
||||
$this->printer->feed();
|
||||
$this->printer->cut();
|
||||
@ -491,34 +549,48 @@ class dolReceiptPrinter extends Escpos
|
||||
*/
|
||||
public function sendToPrinter($object, $templateid, $printerid)
|
||||
{
|
||||
global $conf;
|
||||
global $conf, $mysoc, $langs;
|
||||
$error = 0;
|
||||
$ret = $this->loadTemplate($templateid);
|
||||
|
||||
// tags a remplacer par leur valeur avant de parser
|
||||
$this->template = str_replace('<dol_print_num_order>', $object->id, $this->template);
|
||||
$this->template = str_replace('<dol_print_customer_firstname>', $object->customer_firstname, $this->template);
|
||||
$this->template = str_replace('<dol_print_customer_lastname>', $object->customer_lastname, $this->template);
|
||||
$this->template = str_replace('<dol_print_customer_mail>', $object->customer_mail, $this->template);
|
||||
$this->template = str_replace('<dol_print_customer_phone>', $object->customer_phone, $this->template);
|
||||
$this->template = str_replace('<dol_print_customer_mobile>', $object->customer_mobile, $this->template);
|
||||
$this->template = str_replace('<dol_print_customer_skype>', $object->customer_skype, $this->template);
|
||||
$this->template = str_replace('<dol_print_customer_tax_number>', $object->customer_tax_number, $this->template);
|
||||
$this->template = str_replace('<dol_print_customer_account_balance>', $object->customer_account_balance, $this->template);
|
||||
$this->template = str_replace('<dol_print_customer_points>', $object->customer_points, $this->template);
|
||||
$this->template = str_replace('<dol_print_order_points>', $object->order_points, $this->template);
|
||||
$this->template = str_replace('<dol_print_vendor_firstname>', $object->vendor_firstname, $this->template);
|
||||
$this->template = str_replace('<dol_print_vendor_lastname>', $object->vendor_lastname, $this->template);
|
||||
$this->template = str_replace('<dol_print_vendor_mail>', $object->vendor_mail, $this->template);
|
||||
$this->template = str_replace('<dol_print_date>', $object->date, $this->template);
|
||||
$this->template = str_replace('<dol_print_date_time>', $object->date_time, $this->template);
|
||||
$this->template = str_replace('<dol_print_year>', $object->date_time, $this->template);
|
||||
$this->template = str_replace('<dol_print_month_letters>', $object->date_time, $this->template);
|
||||
$this->template = str_replace('<dol_print_month>', $object->date_time, $this->template);
|
||||
$this->template = str_replace('<dol_print_day>', $object->date_time, $this->template);
|
||||
$this->template = str_replace('<dol_print_day_letters>', $object->date_time, $this->template);
|
||||
$this->template = str_replace('<dol_print_table>', $object->table, $this->template);
|
||||
$this->template = str_replace('<dol_print_cutlery>', $object->cutlery, $this->template);
|
||||
// tags a remplacer par leur valeur avant de parser (dol_value_xxx)
|
||||
$this->template = str_replace('<dol_value_object_id>', $object->id, $this->template);
|
||||
$this->template = str_replace('<dol_value_object_ref>', $object->ref, $this->template);
|
||||
$this->template = str_replace('<dol_value_object_points>', $object->points, $this->template);
|
||||
$this->template = str_replace('<dol_value_customer_firstname>', $object->customer_firstname, $this->template);
|
||||
$this->template = str_replace('<dol_value_customer_lastname>', $object->customer_lastname, $this->template);
|
||||
$this->template = str_replace('<dol_value_customer_mail>', $object->customer_mail, $this->template);
|
||||
$this->template = str_replace('<dol_value_customer_phone>', $object->customer_phone, $this->template);
|
||||
$this->template = str_replace('<dol_value_customer_mobile>', $object->customer_mobile, $this->template);
|
||||
$this->template = str_replace('<dol_value_customer_skype>', $object->customer_skype, $this->template);
|
||||
$this->template = str_replace('<dol_value_customer_tax_number>', $object->customer_tax_number, $this->template);
|
||||
$this->template = str_replace('<dol_value_customer_account_balance>', $object->customer_account_balance, $this->template);
|
||||
$this->template = str_replace('<dol_value_customer_points>', $object->customer_points, $this->template);
|
||||
$this->template = str_replace('<dol_value_mysoc_name>', $mysoc->name, $this->template);
|
||||
$this->template = str_replace('<dol_value_mysoc_address>', $mysoc->address, $this->template);
|
||||
$this->template = str_replace('<dol_value_mysoc_zip>', $mysoc->zip, $this->template);
|
||||
$this->template = str_replace('<dol_value_mysoc_town>', $mysoc->town, $this->template);
|
||||
$this->template = str_replace('<dol_value_mysoc_country>', $mysoc->country, $this->template);
|
||||
$this->template = str_replace('<dol_value_mysoc_idprof1>', $mysoc->idprof1, $this->template);
|
||||
$this->template = str_replace('<dol_value_mysoc_idprof2>', $mysoc->idprof2, $this->template);
|
||||
$this->template = str_replace('<dol_value_mysoc_idprof3>', $mysoc->idprof3, $this->template);
|
||||
$this->template = str_replace('<dol_value_mysoc_idprof4>', $mysoc->idprof4, $this->template);
|
||||
$this->template = str_replace('<dol_value_mysoc_idprof5>', $mysoc->idprof5, $this->template);
|
||||
$this->template = str_replace('<dol_value_mysoc_idprof6>', $mysoc->idprof6, $this->template);
|
||||
$this->template = str_replace('<dol_value_mysoc_tva_intra>', $mysoc->tva_intra, $this->template);
|
||||
$this->template = str_replace('<dol_value_mysoc_capital>', $mysoc->capital, $this->template);
|
||||
$this->template = str_replace('<dol_value_vendor_firstname>', $object->vendor_firstname, $this->template);
|
||||
$this->template = str_replace('<dol_value_vendor_lastname>', $object->vendor_lastname, $this->template);
|
||||
$this->template = str_replace('<dol_value_vendor_mail>', $object->vendor_mail, $this->template);
|
||||
$this->template = str_replace('<dol_value_date>', $object->date, $this->template);
|
||||
$this->template = str_replace('<dol_value_date_time>', $object->date_time, $this->template);
|
||||
$this->template = str_replace('<dol_value_year>', $object->date_time, $this->template);
|
||||
$this->template = str_replace('<dol_value_month_letters>', $object->date_time, $this->template);
|
||||
$this->template = str_replace('<dol_value_month>', $object->date_time, $this->template);
|
||||
$this->template = str_replace('<dol_value_day>', $object->date_time, $this->template);
|
||||
$this->template = str_replace('<dol_value_day_letters>', $object->date_time, $this->template);
|
||||
$this->template = str_replace('<dol_value_table>', $object->table, $this->template);
|
||||
$this->template = str_replace('<dol_value_cutlery>', $object->cutlery, $this->template);
|
||||
|
||||
// parse template
|
||||
$p = xml_parser_create();
|
||||
@ -528,78 +600,119 @@ class dolReceiptPrinter extends Escpos
|
||||
//print '<pre>'.print_r($vals, true).'</pre>';
|
||||
// print ticket
|
||||
$level = 0;
|
||||
$html = '<table border="1" style="width:210px"><pre>';
|
||||
$nbcharactbyline = 48;
|
||||
$ret = $this->initPrinter($printerid);
|
||||
if ($ret>0) {
|
||||
setEventMessages($this->error, $this->errors, 'errors');
|
||||
} else {
|
||||
$nboflines = count($vals);
|
||||
for ($line=0; $line < $nboflines; $line++) {
|
||||
switch ($vals[$line]['tag']) {
|
||||
for ($tplline=0; $tplline < $nboflines; $tplline++) {
|
||||
//var_dump($vals[$tplline]['value']);
|
||||
switch ($vals[$tplline]['tag']) {
|
||||
case 'DOL_PRINT_TEXT':
|
||||
$this->printer->text($vals[$tplline]['value']);
|
||||
break;
|
||||
case 'DOL_PRINT_OBJECT_LINES':
|
||||
foreach ($object->lines as $line) {
|
||||
//var_dump($line);
|
||||
$spacestoadd = $nbcharactbyline - strlen($line->ref)- strlen($line->qty) - 10 - 1;
|
||||
$spaces = str_repeat(' ', $spacestoadd);
|
||||
$this->printer->text($line->ref.$spaces.$line->qty.' '.str_pad(price($line->total_ttc), 10, ' ', STR_PAD_LEFT)."\n");
|
||||
$this->printer->text(strip_tags(htmlspecialchars_decode($line->desc))."\n");
|
||||
}
|
||||
break;
|
||||
case 'DOL_PRINT_OBJECT_TAX':
|
||||
//var_dump($object);
|
||||
$vatarray = array();
|
||||
foreach ($object->lines as $line) {
|
||||
$vatarray[$line->tva_tx] += $line->total_tva;
|
||||
}
|
||||
foreach($vatarray as $vatkey => $vatvalue) {
|
||||
$spacestoadd = $nbcharactbyline - strlen($vatkey)- 12;
|
||||
$spaces = str_repeat(' ', $spacestoadd);
|
||||
$this->printer->text($spaces. $vatkey.'% '.str_pad(price($vatvalue), 10, ' ', STR_PAD_LEFT)."\n");
|
||||
}
|
||||
break;
|
||||
case 'DOL_PRINT_OBJECT_TOTAL':
|
||||
$title = $langs->trans('TotalHT');
|
||||
$spacestoadd = $nbcharactbyline - strlen($title) - 10;
|
||||
$spaces = str_repeat(' ', $spacestoadd);
|
||||
$this->printer->text($title.$spaces.str_pad(price($object->total_ht), 10, ' ', STR_PAD_LEFT)."\n");
|
||||
$title = $langs->trans('TotalVAT');
|
||||
$spacestoadd = $nbcharactbyline - strlen($title) - 10;
|
||||
$spaces = str_repeat(' ', $spacestoadd);
|
||||
$this->printer->text($title.$spaces.str_pad(price($object->total_tva), 10, ' ', STR_PAD_LEFT)."\n");
|
||||
$title = $langs->trans('TotalTTC');
|
||||
$spacestoadd = $nbcharactbyline - strlen($title) - 10;
|
||||
$spaces = str_repeat(' ', $spacestoadd);
|
||||
$this->printer->text($title.$spaces.str_pad(price($object->total_ttc), 10, ' ', STR_PAD_LEFT)."\n");
|
||||
break;
|
||||
case 'DOL_LINE_FEED':
|
||||
$this->printer->feed();
|
||||
break;
|
||||
case 'DOL_LINE_FEED_REVERSE':
|
||||
$this->printer->feedReverse();
|
||||
break;
|
||||
case 'DOL_ALIGN_CENTER':
|
||||
$this->printer->setJustification(Escpos::JUSTIFY_CENTER);
|
||||
$html.='<center>';
|
||||
$this->printer->text($vals[$line]['value']);
|
||||
$this->printer->setJustification(Printer::JUSTIFY_CENTER);
|
||||
break;
|
||||
case 'DOL_ALIGN_RIGHT':
|
||||
$this->printer->setJustification(Escpos::JUSTIFY_RIGHT);
|
||||
$html.='<right>';
|
||||
$this->printer->setJustification(Printer::JUSTIFY_RIGHT);
|
||||
break;
|
||||
case 'DOL_ALIGN_LEFT':
|
||||
$this->printer->setJustification(Escpos::JUSTIFY_LEFT);
|
||||
$html.='<left>';
|
||||
$this->printer->setJustification(Printer::JUSTIFY_LEFT);
|
||||
break;
|
||||
case 'DOL_OPEN_DRAWER':
|
||||
$this->printer->pulse();
|
||||
$html.= ' ϟ'.nl2br($vals[$line]['value']);
|
||||
break;
|
||||
case 'DOL_ACTIVATE_BUZZER':
|
||||
//$this->printer->buzzer();
|
||||
$html.= ' ♫'.nl2br($vals[$line]['value']);
|
||||
break;
|
||||
case 'DOL_PRINT_BARCODE':
|
||||
// $vals[$line]['value'] -> barcode($content, $type)
|
||||
$this->printer->barcode($object->barcode);
|
||||
// $vals[$tplline]['value'] -> barcode($content, $type)
|
||||
// var_dump($vals[$tplline]['value']);
|
||||
try {
|
||||
$this->printer->barcode($vals[$tplline]['value']);
|
||||
} catch (Exception $e) {
|
||||
$this->errors[] = 'Invalid Barcode value: '.$vals[$tplline]['value'];
|
||||
$error++;
|
||||
}
|
||||
break;
|
||||
case 'DOL_PRINT_BARCODE_CUSTOMER_ID':
|
||||
// $vals[$line]['value'] -> barcode($content, $type)
|
||||
$this->printer->barcode($object->customer_id);
|
||||
case 'DOL_PRINT_LOGO':
|
||||
$img = EscposImage::load(DOL_DATA_ROOT .'/mycompany/logos/'.$mysoc->logo);
|
||||
$this->printer->graphics($img);
|
||||
break;
|
||||
case 'DOL_PRINT_LOGO_OLD':
|
||||
$img = EscposImage::load(DOL_DATA_ROOT .'/mycompany/logos/'.$mysoc->logo);
|
||||
$this->printer->bitImage($img);
|
||||
break;
|
||||
case 'DOL_PRINT_QRCODE':
|
||||
// $vals[$line]['value'] -> qrCode($content, $ec, $size, $model)
|
||||
$this->printer->qrcode($vals[$line]['value']);
|
||||
$html.='QRCODE: '.$vals[$line]['value'];
|
||||
// $vals[$tplline]['value'] -> qrCode($content, $ec, $size, $model)
|
||||
$this->printer->qrcode($vals[$tplline]['value']);
|
||||
break;
|
||||
case 'DOL_CUT_PAPER_FULL':
|
||||
$this->printer->cut(Escpos::CUT_FULL);
|
||||
$html.= ' ✂'.nl2br($vals[$line]['value']);
|
||||
$this->printer->cut(Printer::CUT_FULL);
|
||||
break;
|
||||
case 'DOL_CUT_PAPER_PARTIAL':
|
||||
$this->printer->cut(Escpos::CUT_PARTIAL);
|
||||
$html.= ' ✂'.nl2br($vals[$line]['value']);
|
||||
$this->printer->cut(Printer::CUT_PARTIAL);
|
||||
break;
|
||||
case 'DOL_USE_FONT_A':
|
||||
$this->printer->setFont(Escpos::FONT_A);
|
||||
$this->printer->text($vals[$line]['value']);
|
||||
$this->printer->setFont(Printer::FONT_A);
|
||||
break;
|
||||
case 'DOL_USE_FONT_B':
|
||||
$this->printer->setFont(Escpos::FONT_B);
|
||||
$this->printer->text($vals[$line]['value']);
|
||||
$this->printer->setFont(Printer::FONT_B);
|
||||
break;
|
||||
case 'DOL_USE_FONT_C':
|
||||
$this->printer->setFont(Escpos::FONT_C);
|
||||
$this->printer->text($vals[$line]['value']);
|
||||
$this->printer->setFont(Printer::FONT_C);
|
||||
break;
|
||||
default:
|
||||
$this->printer->text($vals[$line]['value']);
|
||||
$html.= nl2br($vals[$line]['value']);
|
||||
$this->errors[] = 'UnknowTag: <'.strtolower($vals[$line]['tag']).'>';
|
||||
$this->printer->text($vals[$tplline]['tag']);
|
||||
$this->printer->text($vals[$tplline]['value']);
|
||||
$this->errors[] = 'UnknowTag: <'.strtolower($vals[$tplline]['tag']).'>';
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$html.= '</pre></table>';
|
||||
print $html;
|
||||
// Close and print
|
||||
// uncomment next line to see content sent to printer
|
||||
//print '<pre>'.print_r($this->connector, true).'</pre>';
|
||||
@ -687,7 +800,7 @@ class dolReceiptPrinter extends Escpos
|
||||
$this->connector = 'CONNECTOR_UNKNOWN';
|
||||
break;
|
||||
}
|
||||
$this->printer = new Escpos($this->connector);
|
||||
$this->printer = new Printer($this->connector, $this->profile);
|
||||
} catch (Exception $e) {
|
||||
$this->errors[] = $e->getMessage();
|
||||
$error++;
|
||||
|
||||
@ -224,9 +224,10 @@ class ExtraFields
|
||||
* @param string $entity Entity of extrafields (for multicompany modules)
|
||||
* @param string $langfile Language file
|
||||
* @param string $enabled Condition to have the field enabled or not
|
||||
* @param int $totalizable Is a measure. Must show a total on lists
|
||||
* @return int <=0 if KO, >0 if OK
|
||||
*/
|
||||
public function addExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique = 0, $required = 0, $default_value = '', $param = '', $alwayseditable = 0, $perms = '', $list = '-1', $help = '', $computed = '', $entity = '', $langfile = '', $enabled = '1')
|
||||
public function addExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique = 0, $required = 0, $default_value = '', $param = '', $alwayseditable = 0, $perms = '', $list = '-1', $help = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0)
|
||||
{
|
||||
if (empty($attrname)) return -1;
|
||||
if (empty($label)) return -1;
|
||||
@ -243,7 +244,7 @@ class ExtraFields
|
||||
if ($result > 0 || $err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS' || $type == 'separate')
|
||||
{
|
||||
// Add declaration of field into table
|
||||
$result2=$this->create_label($attrname, $label, $type, $pos, $size, $elementtype, $unique, $required, $param, $alwayseditable, $perms, $list, $help, $default_value, $computed, $entity, $langfile, $enabled);
|
||||
$result2=$this->create_label($attrname, $label, $type, $pos, $size, $elementtype, $unique, $required, $param, $alwayseditable, $perms, $list, $help, $default_value, $computed, $entity, $langfile, $enabled, $totalizable);
|
||||
$err2=$this->errno;
|
||||
if ($result2 > 0 || ($err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS' && $err2 == 'DB_ERROR_RECORD_ALREADY_EXISTS'))
|
||||
{
|
||||
@ -371,9 +372,10 @@ class ExtraFields
|
||||
* @param string $entity Entity of extrafields
|
||||
* @param string $langfile Language file
|
||||
* @param string $enabled Condition to have the field enabled or not
|
||||
* @param int $totalizable Is a measure. Must show a total on lists
|
||||
* @return int <=0 if KO, >0 if OK
|
||||
*/
|
||||
private function create_label($attrname, $label = '', $type = '', $pos = 0, $size = 0, $elementtype = 'member', $unique = 0, $required = 0, $param = '', $alwayseditable = 0, $perms = '', $list = '-1', $help = '', $default = '', $computed = '', $entity = '', $langfile = '', $enabled = '1')
|
||||
private function create_label($attrname, $label = '', $type = '', $pos = 0, $size = 0, $elementtype = 'member', $unique = 0, $required = 0, $param = '', $alwayseditable = 0, $perms = '', $list = '-1', $help = '', $default = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf,$user;
|
||||
@ -424,7 +426,8 @@ class ExtraFields
|
||||
$sql.= " fk_user_modif,";
|
||||
$sql.= " datec,";
|
||||
$sql.= " enabled,";
|
||||
$sql.= " help";
|
||||
$sql.= " help,";
|
||||
$sql.= " totalizable";
|
||||
$sql.= " )";
|
||||
$sql.= " VALUES('".$attrname."',";
|
||||
$sql.= " '".$this->db->escape($label)."',";
|
||||
@ -446,7 +449,8 @@ class ExtraFields
|
||||
$sql .= " " . (is_object($user) ? $user->id : 0). ",";
|
||||
$sql .= "'" . $this->db->idate(dol_now()) . "',";
|
||||
$sql.= " ".($enabled?"'".$this->db->escape($enabled)."'":"1").",";
|
||||
$sql.= " ".($help?"'".$this->db->escape($help)."'":"null");
|
||||
$sql.= " ".($help?"'".$this->db->escape($help)."'":"null").",";
|
||||
$sql.= " ".($totalizable?'1':'0');
|
||||
$sql.=')';
|
||||
|
||||
dol_syslog(get_class($this)."::create_label", LOG_DEBUG);
|
||||
|
||||
@ -5962,7 +5962,7 @@ class Form
|
||||
* @param int $forcecombo Force to load all values and output a standard combobox (with no beautification)
|
||||
* @param int $outputmode 0=HTML select string, 1=Array
|
||||
* @param int $disabled 1=Html component is disabled
|
||||
* @return string Return HTML string
|
||||
* @return string|array Return HTML string
|
||||
* @see selectForForms()
|
||||
*/
|
||||
public function selectForFormsList($objecttmp, $htmlname, $preselectedvalue, $showempty = '', $searchkey = '', $placeholder = '', $morecss = '', $moreparams = '', $forcecombo = 0, $outputmode = 0, $disabled = 0)
|
||||
@ -5975,8 +5975,7 @@ class Form
|
||||
if ($prefixforautocompletemode == 'societe') $prefixforautocompletemode='company';
|
||||
$confkeyforautocompletemode=strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
|
||||
|
||||
$fieldstoshow='t.ref';
|
||||
if (! empty($objecttmp->fields)) // For object that declare it, it is better to use declared fields ( like societe, contact, ...)
|
||||
if (! empty($objecttmp->fields)) // For object that declare it, it is better to use declared fields (like societe, contact, ...)
|
||||
{
|
||||
$tmpfieldstoshow='';
|
||||
foreach($objecttmp->fields as $key => $val)
|
||||
@ -5985,6 +5984,18 @@ class Form
|
||||
}
|
||||
if ($tmpfieldstoshow) $fieldstoshow = $tmpfieldstoshow;
|
||||
}
|
||||
if (empty($fieldstoshow))
|
||||
{
|
||||
if (isset($objecttmp->fields['ref'])) {
|
||||
$fieldstoshow='t.ref';
|
||||
}
|
||||
else
|
||||
{
|
||||
$langs->load("errors");
|
||||
$this->error = $langs->trans("ErrorNoFieldWithAttributeShowoncombobox");
|
||||
return $langs->trans('ErrorNoFieldWithAttributeShowoncombobox');
|
||||
}
|
||||
}
|
||||
|
||||
$out='';
|
||||
$outarray=array();
|
||||
|
||||
@ -667,21 +667,27 @@ class FormFile
|
||||
{
|
||||
$submodulepart = $modulepart;
|
||||
|
||||
// For normalized standard modules
|
||||
$file=dol_buildpath('/core/modules/'.$modulepart.'/modules_'.$modulepart.'.php', 0);
|
||||
// modulepart = 'nameofmodule' or 'nameofmodule:nameofsubmodule'
|
||||
$tmp=explode(':', $modulepart);
|
||||
if (! empty($tmp[1])) {
|
||||
$modulepart=$tmp[0];
|
||||
$submodulepart=$tmp[1];
|
||||
}
|
||||
|
||||
// For normalized standard modules
|
||||
$file=dol_buildpath('/core/modules/'.$modulepart.'/modules_'.$submodulepart.'.php', 0);
|
||||
if (file_exists($file))
|
||||
{
|
||||
$res=include_once $file;
|
||||
}
|
||||
// For normalized external modules. modulepart = 'nameofmodule' or 'nameofmodule:nameofsubmodule'
|
||||
// For normalized external modules.
|
||||
else
|
||||
{
|
||||
$tmp=explode(':', $modulepart);
|
||||
if (! empty($tmp[2])) $submodulepart=$tmp[2];
|
||||
$file=dol_buildpath('/'.$modulepart.'/core/modules/'.$modulepart.'/modules_'.$submodulepart.'.php', 0);
|
||||
$file=dol_buildpath('/'.$modulepart.'/core/modules/'.$modulepart.'/modules_'.$submodulepart.'.php', 0);
|
||||
$res=include_once $file;
|
||||
}
|
||||
$class='ModelePDF'.ucfirst($submodulepart);
|
||||
|
||||
if (class_exists($class))
|
||||
{
|
||||
$modellist=call_user_func($class.'::liste_modeles', $this->db);
|
||||
@ -1465,7 +1471,7 @@ class FormFile
|
||||
* @param string $param Parameters on sort links
|
||||
* @param int $forcedownload Force to open dialog box "Save As" when clicking on file
|
||||
* @param string $relativepath Relative path of docs (autodefined if not provided)
|
||||
* @param int $permtodelete Permission to delete
|
||||
* @param int $permissiontodelete Permission to delete
|
||||
* @param int $useinecm Change output for use in ecm module
|
||||
* @param int $textifempty Text to show if filearray is empty
|
||||
* @param int $maxlength Maximum length of file name shown
|
||||
@ -1474,7 +1480,7 @@ class FormFile
|
||||
* @return int <0 if KO, nb of files shown if OK
|
||||
* @see list_of_documents()
|
||||
*/
|
||||
public function list_of_autoecmfiles($upload_dir, $filearray, $modulepart, $param, $forcedownload = 0, $relativepath = '', $permtodelete = 1, $useinecm = 0, $textifempty = '', $maxlength = 0, $url = '', $addfilterfields = 0)
|
||||
public function list_of_autoecmfiles($upload_dir, $filearray, $modulepart, $param, $forcedownload = 0, $relativepath = '', $permissiontodelete = 1, $useinecm = 0, $textifempty = '', $maxlength = 0, $url = '', $addfilterfields = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $user, $conf, $langs, $form;
|
||||
@ -1697,7 +1703,7 @@ class FormFile
|
||||
//if ($forcedownload) print '&attachment=1';
|
||||
//print '&file='.urlencode($relativefile).'">';
|
||||
//print img_view().'</a> ';
|
||||
//if ($permtodelete) print '<a href="'.$url.'?id='.$object->id.'§ion='.$_REQUEST["section"].'&action=delete&urlfile='.urlencode($file['name']).'">'.img_delete().'</a>';
|
||||
//if ($permissiontodelete) print '<a href="'.$url.'?id='.$object->id.'§ion='.$_REQUEST["section"].'&action=delete&urlfile='.urlencode($file['name']).'">'.img_delete().'</a>';
|
||||
//else print ' ';
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
@ -1752,13 +1758,13 @@ class FormFile
|
||||
* Show array with linked files
|
||||
*
|
||||
* @param Object $object Object
|
||||
* @param int $permtodelete Deletion is allowed
|
||||
* @param int $permissiontodelete Deletion is allowed
|
||||
* @param string $action Action
|
||||
* @param string $selected ???
|
||||
* @param string $param More param to add into URL
|
||||
* @return int Number of links
|
||||
*/
|
||||
public function listOfLinks($object, $permtodelete = 1, $action = null, $selected = null, $param = '')
|
||||
public function listOfLinks($object, $permissiontodelete = 1, $action = null, $selected = null, $param = '')
|
||||
{
|
||||
global $user, $conf, $langs, $user;
|
||||
global $sortfield, $sortorder;
|
||||
@ -1872,7 +1878,7 @@ class FormFile
|
||||
print '<td class="center"></td>';
|
||||
print '<td class="right">';
|
||||
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=update&linkid=' . $link->id . $param . '" class="editfilelink reposition" >' . img_edit() . '</a>'; // id= is included into $param
|
||||
if ($permtodelete) {
|
||||
if ($permissiontodelete) {
|
||||
print ' <a href="'. $_SERVER['PHP_SELF'] .'?action=delete&linkid=' . $link->id . $param . '" class="deletefilelink">' . img_delete() . '</a>'; // id= is included into $param
|
||||
} else {
|
||||
print ' ';
|
||||
|
||||
@ -243,7 +243,7 @@ class FormTicket
|
||||
}
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
|
||||
$uselocalbrowser = true;
|
||||
$doleditor = new DolEditor('message', $msg, '100%', 230, $toolbarname, 'In', true, $uselocalbrowser, $conf->global->FCKEDITOR_ENABLE_TICKET);
|
||||
$doleditor = new DolEditor('message', $msg, '100%', 230, $toolbarname, 'In', true, $uselocalbrowser, $conf->global->FCKEDITOR_ENABLE_TICKET, ROWS_8, '90%');
|
||||
$doleditor->Create();
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
@ -343,7 +343,7 @@ class Interfaces
|
||||
}
|
||||
|
||||
// We set info of modules
|
||||
$triggers[$j]['picto'] = $objMod->picto?img_object('', $objMod->picto):img_object('', 'generic');
|
||||
$triggers[$j]['picto'] = $objMod->picto?img_object('', $objMod->picto, 'class="valignmiddle pictomodule "'):img_object('', 'generic', 'class="valignmiddle pictomodule "');
|
||||
$triggers[$j]['file'] = $files[$key];
|
||||
$triggers[$j]['fullpath'] = $fullpath[$key];
|
||||
$triggers[$j]['relpath'] = $relpath[$key];
|
||||
|
||||
@ -1385,7 +1385,7 @@ class SMTPs
|
||||
// Similar code to forge a text from html is also in CMailFile.class.php
|
||||
$strContentAltText = preg_replace("/<br\s*[^>]*>/", " ", $strContent);
|
||||
$strContentAltText = html_entity_decode(strip_tags($strContentAltText));
|
||||
$strContentAltText = rtrim(wordwrap($strContentAltText, 75, "\r\n"));
|
||||
$strContentAltText = trim(wordwrap($strContentAltText, 75, "\r\n"));
|
||||
}
|
||||
|
||||
// Make RFC2045 Compliant
|
||||
|
||||
@ -663,7 +663,7 @@ function security_prepare_head()
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/perms.php";
|
||||
$head[$h][1] = $langs->trans("DefaultRights");
|
||||
if ($nbPerms > 0) $head[$h][1].= ' <span class="badge">'.$nbPerms.'</span>';
|
||||
if ($nbPerms > 0) $head[$h][1].= '<span class="badge marginleftonlyshort">'.$nbPerms.'</span>';
|
||||
$head[$h][2] = 'default';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -473,7 +473,7 @@ function actions_prepare_head($object)
|
||||
$listofresourcelinked = $resource->getElementResources($object->element, $object->id);
|
||||
$nbResources=(is_array($listofresourcelinked)?count($listofresourcelinked):0);
|
||||
$head[$h][1] = $langs->trans("Resources");
|
||||
if ($nbResources > 0) $head[$h][1].= ' <span class="badge">'.($nbResources).'</span>';
|
||||
if ($nbResources > 0) $head[$h][1].= '<span class="badge marginleftonlyshort">'.($nbResources).'</span>';
|
||||
$head[$h][2] = 'resources';
|
||||
$h++;
|
||||
}
|
||||
|
||||
@ -102,7 +102,7 @@ function asset_prepare_head(Asset $object)
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/asset/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= '<span class="badge marginleftonlyshort">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
@ -111,7 +111,7 @@ function asset_prepare_head(Asset $object)
|
||||
if(!empty($object->note_public)) $nbNote++;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/asset/note.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Notes");
|
||||
if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
|
||||
if ($nbNote > 0) $head[$h][1].= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
|
||||
$head[$h][2] = 'note';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -85,7 +85,7 @@ function bank_prepare_head(Account $object)
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/compta/bank/releve.php?account=".$object->id;
|
||||
$head[$h][1] = $langs->trans("AccountStatements");
|
||||
if (($nbReceipts) > 0) $head[$h][1].= ' <span class="badge">'.($nbReceipts).'</span>';
|
||||
if (($nbReceipts) > 0) $head[$h][1].= '<span class="badge marginleftonlyshort">'.($nbReceipts).'</span>';
|
||||
$head[$h][2] = 'statement';
|
||||
$h++;
|
||||
}
|
||||
@ -98,7 +98,7 @@ function bank_prepare_head(Account $object)
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT . "/compta/bank/document.php?account=" . $object->id;
|
||||
$head[$h][1] = $langs->trans("Documents");
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= '<span class="badge marginleftonlyshort">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'document';
|
||||
$h++;
|
||||
|
||||
@ -228,7 +228,7 @@ function various_payment_prepare_head($object)
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/bank/various_payment/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= '<span class="badge marginleftonlyshort">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -69,7 +69,7 @@ function societe_prepare_head(Societe $object)
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/societe/contact.php?socid='.$object->id;
|
||||
$head[$h][1] = $langs->trans('ContactsAddresses');
|
||||
if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>';
|
||||
if ($nbContact > 0) $head[$h][1].= '<span class="badge marginleftonlyshort">'.$nbContact.'</span>';
|
||||
$head[$h][2] = 'contact';
|
||||
$h++;
|
||||
}
|
||||
@ -79,7 +79,7 @@ function societe_prepare_head(Societe $object)
|
||||
$head[$h][0] = DOL_URL_ROOT.'/societe/societecontact.php?socid='.$object->id;
|
||||
$nbContact = count($object->liste_contact(-1, 'internal')) + count($object->liste_contact(-1, 'external'));
|
||||
$head[$h][1] = $langs->trans("ContactsAddresses");
|
||||
if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>';
|
||||
if ($nbContact > 0) $head[$h][1].= '<span class="badge marginleftonlyshort">'.$nbContact.'</span>';
|
||||
$head[$h][2] = 'contact';
|
||||
$h++;
|
||||
}
|
||||
@ -136,7 +136,7 @@ function societe_prepare_head(Societe $object)
|
||||
else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
|
||||
if ($nbNote > 0) $head[$h][1].= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
|
||||
$head[$h][2] = 'project';
|
||||
$h++;
|
||||
}
|
||||
@ -229,7 +229,7 @@ function societe_prepare_head(Societe $object)
|
||||
$head[$h][0] = DOL_URL_ROOT .'/societe/paymentmodes.php?socid='.$object->id;
|
||||
$head[$h][1] = $title;
|
||||
if ($foundonexternalonlinesystem) $head[$h][1].= ' <span class="badge">...</span>';
|
||||
elseif ($nbBankAccount > 0) $head[$h][1].= ' <span class="badge">'.$nbBankAccount.'</span>';
|
||||
elseif ($nbBankAccount > 0) $head[$h][1].= '<span class="badge marginleftonlyshort">'.$nbBankAccount.'</span>';
|
||||
$head[$h][2] = 'rib';
|
||||
$h++;
|
||||
}
|
||||
@ -257,7 +257,7 @@ function societe_prepare_head(Societe $object)
|
||||
else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
|
||||
if ($nbNote > 0) $head[$h][1].= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
|
||||
$head[$h][2] = 'website';
|
||||
$h++;
|
||||
}
|
||||
@ -295,7 +295,7 @@ function societe_prepare_head(Societe $object)
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/societe/notify/card.php?socid='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Notifications");
|
||||
if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
|
||||
if ($nbNote > 0) $head[$h][1].= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
|
||||
$head[$h][2] = 'notify';
|
||||
$h++;
|
||||
}
|
||||
@ -306,7 +306,7 @@ function societe_prepare_head(Societe $object)
|
||||
if(!empty($object->note_public)) $nbNote++;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/societe/note.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Notes");
|
||||
if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
|
||||
if ($nbNote > 0) $head[$h][1].= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
|
||||
$head[$h][2] = 'note';
|
||||
$h++;
|
||||
|
||||
@ -319,7 +319,7 @@ function societe_prepare_head(Societe $object)
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/societe/document.php?socid='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Documents");
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= '<span class="badge marginleftonlyshort">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'document';
|
||||
$h++;
|
||||
}
|
||||
@ -876,6 +876,8 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '')
|
||||
$search_poste = GETPOST("search_poste", 'alpha');
|
||||
$search_roles = GETPOST("search_roles", 'array');
|
||||
|
||||
$socialnetworks = getArrayOfSocialNetworks();
|
||||
|
||||
$searchAddressPhoneDBFields = array(
|
||||
//Address
|
||||
't.address',
|
||||
@ -892,18 +894,13 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '')
|
||||
|
||||
//E-mail
|
||||
't.email',
|
||||
|
||||
//Social media
|
||||
"t.skype",
|
||||
"t.jabberid",
|
||||
"t.twitter",
|
||||
"t.facebook",
|
||||
"t.linkedin",
|
||||
"t.whatsapp",
|
||||
"t.youtube",
|
||||
"t.snapchat",
|
||||
"t.instagram"
|
||||
);
|
||||
//Social media
|
||||
foreach ($socialnetworks as $key => $value) {
|
||||
if ($value['active']) {
|
||||
$searchAddressPhoneDBFields['t.'.$key] = "t.socialnetworks->'$.".$key."'";
|
||||
}
|
||||
}
|
||||
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
if (! $sortfield) $sortfield="t.lastname";
|
||||
@ -919,11 +916,11 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '')
|
||||
$extrafields->fetch_name_optionals_label($contactstatic->table_element);
|
||||
|
||||
$contactstatic->fields=array(
|
||||
'name' =>array('type'=>'varchar(128)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1),
|
||||
'poste' =>array('type'=>'varchar(128)', 'label'=>'PostOrFunction', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>20),
|
||||
'address' =>array('type'=>'varchar(128)', 'label'=>'Address', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>30),
|
||||
'role' =>array('type'=>'checkbox', 'label'=>'Role', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>40),
|
||||
'statut' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>0, 'index'=>1, 'position'=>50, 'arrayofkeyval'=>array(0=>$contactstatic->LibStatut(0, 1), 1=>$contactstatic->LibStatut(1, 1))),
|
||||
'name' =>array('type'=>'varchar(128)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1),
|
||||
'poste' =>array('type'=>'varchar(128)', 'label'=>'PostOrFunction', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>20),
|
||||
'address' =>array('type'=>'varchar(128)', 'label'=>'Address', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>30),
|
||||
'role' =>array('type'=>'checkbox', 'label'=>'Role', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>40),
|
||||
'statut' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>0, 'index'=>1, 'position'=>50, 'arrayofkeyval'=>array(0=>$contactstatic->LibStatut(0, 1), 1=>$contactstatic->LibStatut(1, 1))),
|
||||
);
|
||||
|
||||
// Definition of fields for list
|
||||
@ -1020,7 +1017,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '')
|
||||
$extrafieldsobjectkey=$contactstatic->table_element;
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||
|
||||
$sql = "SELECT t.rowid, t.lastname, t.firstname, t.fk_pays as country_id, t.civility, t.poste, t.phone as phone_pro, t.phone_mobile, t.phone_perso, t.fax, t.email, t.skype, t.statut, t.photo,";
|
||||
$sql = "SELECT t.rowid, t.lastname, t.firstname, t.fk_pays as country_id, t.civility, t.poste, t.phone as phone_pro, t.phone_mobile, t.phone_perso, t.fax, t.email, t.socialnetworks, t.statut, t.photo,";
|
||||
$sql .= " t.civility as civility_id, t.address, t.zip, t.town";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as t";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople_extrafields as ef on (t.rowid = ef.fk_object)";
|
||||
@ -1028,7 +1025,9 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '')
|
||||
if ($search_status!='' && $search_status != '-1') $sql .= " AND t.statut = ".$db->escape($search_status);
|
||||
if ($search_name) $sql .= natural_search(array('t.lastname', 't.firstname'), $search_name);
|
||||
if ($search_poste) $sql .= natural_search('t.poste', $search_poste);
|
||||
if ($search_address) $sql .= natural_search($searchAddressPhoneDBFields, $search_address);
|
||||
if ($search_address) {
|
||||
$sql .= natural_search($searchAddressPhoneDBFields, $search_address);
|
||||
}
|
||||
if (count($search_roles)>0) {
|
||||
$sql .= " AND t.rowid IN (SELECT sc.fk_socpeople FROM ".MAIN_DB_PREFIX."societe_contacts as sc WHERE sc.fk_c_type_contact IN (".implode(',', $search_roles)."))";
|
||||
}
|
||||
@ -1132,7 +1131,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '')
|
||||
$contactstatic->phone_perso = $obj->phone_perso;
|
||||
$contactstatic->email = $obj->email;
|
||||
$contactstatic->web = $obj->web;
|
||||
$contactstatic->skype = $obj->skype;
|
||||
$contactstatic->socialnetworks = $obj->socialnetworks;
|
||||
$contactstatic->photo = $obj->photo;
|
||||
|
||||
$country_code = getCountry($obj->country_id, 2);
|
||||
|
||||
@ -78,7 +78,7 @@ function contact_prepare_head(Contact $object)
|
||||
$nbNote = (empty($object->note_private)?0:1)+(empty($object->note_public)?0:1);
|
||||
$head[$tab][0] = DOL_URL_ROOT.'/contact/note.php?id='.$object->id;
|
||||
$head[$tab][1] = $langs->trans("Note");
|
||||
if($nbNote > 0) $head[$tab][1].= ' <span class="badge">'.$nbNote.'</span>';
|
||||
if($nbNote > 0) $head[$tab][1].= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
|
||||
$head[$tab][2] = 'note';
|
||||
$tab++;
|
||||
}
|
||||
@ -90,7 +90,7 @@ function contact_prepare_head(Contact $object)
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$tab][0] = DOL_URL_ROOT.'/contact/document.php?id='.$object->id;
|
||||
$head[$tab][1] = $langs->trans("Documents");
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$tab][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$tab][1].= '<span class="badge marginleftonlyshort">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$tab][2] = 'documents';
|
||||
$tab++;
|
||||
|
||||
|
||||
@ -45,7 +45,7 @@ function contract_prepare_head(Contrat $object)
|
||||
$nbContact = count($object->liste_contact(-1, 'internal')) + count($object->liste_contact(-1, 'external'));
|
||||
$head[$h][0] = DOL_URL_ROOT.'/contrat/contact.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("ContactsAddresses");
|
||||
if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>';
|
||||
if ($nbContact > 0) $head[$h][1].= '<span class="badge marginleftonlyshort">'.$nbContact.'</span>';
|
||||
$head[$h][2] = 'contact';
|
||||
$h++;
|
||||
}
|
||||
@ -63,7 +63,7 @@ function contract_prepare_head(Contrat $object)
|
||||
if(!empty($object->note_public)) $nbNote++;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/contrat/note.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Notes");
|
||||
if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
|
||||
if ($nbNote > 0) $head[$h][1].= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
|
||||
$head[$h][2] = 'note';
|
||||
$h++;
|
||||
}
|
||||
@ -75,7 +75,7 @@ function contract_prepare_head(Contrat $object)
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/contrat/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Documents");
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= '<span class="badge marginleftonlyshort">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -85,7 +85,7 @@ function donation_prepare_head($object)
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/don/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= '<span class="badge marginleftonlyshort">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
@ -94,7 +94,7 @@ function donation_prepare_head($object)
|
||||
if(!empty($object->note_public)) $nbNote++;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/don/note.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Notes");
|
||||
if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
|
||||
if ($nbNote > 0) $head[$h][1].= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
|
||||
$head[$h][2] = 'note';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -43,7 +43,7 @@ function emailing_prepare_head(Mailing $object)
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT."/comm/mailing/cibles.php?id=".$object->id;
|
||||
$head[$h][1] = $langs->trans("MailRecipients");
|
||||
if ($object->nbemail > 0) $head[$h][1].= ' <span class="badge">'.$object->nbemail.'</span>';
|
||||
if ($object->nbemail > 0) $head[$h][1].= '<span class="badge marginleftonlyshort">'.$object->nbemail.'</span>';
|
||||
$head[$h][2] = 'targets';
|
||||
$h++;
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ function expensereport_prepare_head($object)
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/expensereport/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= '<span class="badge marginleftonlyshort">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
@ -63,7 +63,7 @@ function expensereport_prepare_head($object)
|
||||
if(!empty($object->note_public)) $nbNote++;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/expensereport/note.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Notes');
|
||||
if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
|
||||
if ($nbNote > 0) $head[$h][1].= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
|
||||
$head[$h][2] = 'note';
|
||||
$h++;
|
||||
}
|
||||
|
||||
@ -51,7 +51,7 @@ function fichinter_prepare_head($object)
|
||||
$nbContact = count($object->liste_contact(-1, 'internal')) + count($object->liste_contact(-1, 'external'));
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fichinter/contact.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('InterventionContact');
|
||||
if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>';
|
||||
if ($nbContact > 0) $head[$h][1].= '<span class="badge marginleftonlyshort">'.$nbContact.'</span>';
|
||||
$head[$h][2] = 'contact';
|
||||
$h++;
|
||||
}
|
||||
@ -83,7 +83,7 @@ function fichinter_prepare_head($object)
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/resource/element_resource.php?element=fichinter&element_id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Resources");
|
||||
if ($nbResource > 0) $head[$h][1].= ' <span class="badge">'.$nbResource.'</span>';
|
||||
if ($nbResource > 0) $head[$h][1].= '<span class="badge marginleftonlyshort">'.$nbResource.'</span>';
|
||||
$head[$h][2] = 'resource';
|
||||
$h++;
|
||||
}
|
||||
@ -95,7 +95,7 @@ function fichinter_prepare_head($object)
|
||||
if(!empty($object->note_public)) $nbNote++;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fichinter/note.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Notes');
|
||||
if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
|
||||
if ($nbNote > 0) $head[$h][1].= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
|
||||
$head[$h][2] = 'note';
|
||||
$h++;
|
||||
}
|
||||
@ -107,7 +107,7 @@ function fichinter_prepare_head($object)
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fichinter/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Documents");
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= '<span class="badge marginleftonlyshort">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -3072,13 +3072,14 @@ function getFilesUpdated(&$file_list, SimpleXMLElement $dir, $path = '', $pathre
|
||||
{
|
||||
$filename = $path.$file['name'];
|
||||
$file_list['insignature'][] = $filename;
|
||||
$expectedsize = (empty($file['size']) ? '' : $file['size']);
|
||||
$expectedmd5 = (string) $file;
|
||||
|
||||
//if (preg_match('#'.$exclude.'#', $filename)) continue;
|
||||
|
||||
if (!file_exists($pathref.'/'.$filename))
|
||||
{
|
||||
$file_list['missing'][] = array('filename'=>$filename, 'expectedmd5'=>$expectedmd5);
|
||||
$file_list['missing'][] = array('filename'=>$filename, 'expectedmd5'=>$expectedmd5, 'expectedsize'=>$expectedsize);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -3090,7 +3091,7 @@ function getFilesUpdated(&$file_list, SimpleXMLElement $dir, $path = '', $pathre
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($md5_local != $expectedmd5) $file_list['updated'][] = array('filename'=>$filename, 'expectedmd5'=>$expectedmd5, 'md5'=>(string) $md5_local);
|
||||
if ($md5_local != $expectedmd5) $file_list['updated'][] = array('filename'=>$filename, 'expectedmd5'=>$expectedmd5, 'expectedsize'=>$expectedsize, 'md5'=>(string) $md5_local);
|
||||
$checksumconcat[] = $md5_local;
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,7 +48,7 @@ function facturefourn_prepare_head($object)
|
||||
$nbContact = count($object->liste_contact(-1, 'internal')) + count($object->liste_contact(-1, 'external'));
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fourn/facture/contact.php?facid='.$object->id;
|
||||
$head[$h][1] = $langs->trans('ContactsAddresses');
|
||||
if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>';
|
||||
if ($nbContact > 0) $head[$h][1].= '<span class="badge marginleftonlyshort">'.$nbContact.'</span>';
|
||||
$head[$h][2] = 'contact';
|
||||
$h++;
|
||||
}
|
||||
@ -66,7 +66,7 @@ function facturefourn_prepare_head($object)
|
||||
if(!empty($object->note_public)) $nbNote++;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fourn/facture/note.php?facid='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Notes');
|
||||
if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
|
||||
if ($nbNote > 0) $head[$h][1].= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
|
||||
$head[$h][2] = 'note';
|
||||
$h++;
|
||||
}
|
||||
@ -78,7 +78,7 @@ function facturefourn_prepare_head($object)
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fourn/facture/document.php?facid='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= '<span class="badge marginleftonlyshort">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
@ -116,7 +116,7 @@ function ordersupplier_prepare_head($object)
|
||||
$nbContact = count($object->liste_contact(-1, 'internal')) + count($object->liste_contact(-1, 'external'));
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fourn/commande/contact.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('ContactsAddresses');
|
||||
if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>';
|
||||
if ($nbContact > 0) $head[$h][1].= '<span class="badge marginleftonlyshort">'.$nbContact.'</span>';
|
||||
$head[$h][2] = 'contact';
|
||||
$h++;
|
||||
}
|
||||
@ -143,7 +143,7 @@ function ordersupplier_prepare_head($object)
|
||||
if(!empty($object->note_public)) $nbNote++;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fourn/commande/note.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Notes");
|
||||
if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
|
||||
if ($nbNote > 0) $head[$h][1].= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
|
||||
$head[$h][2] = 'note';
|
||||
$h++;
|
||||
}
|
||||
@ -155,7 +155,7 @@ function ordersupplier_prepare_head($object)
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fourn/commande/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= '<span class="badge marginleftonlyshort">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -1899,7 +1899,7 @@ function dol_print_date($time, $format = '', $tzoutput = 'tzserver', $outputlang
|
||||
|
||||
|
||||
/**
|
||||
* Return an array with locale date info.
|
||||
* Return an array with locale date info.
|
||||
* PHP getdate is restricted to the years 1901-2038 on Unix and 1970-2038 on Windows
|
||||
* WARNING: This function always use PHP server timezone to return locale informations !!!
|
||||
* Usage must be avoid.
|
||||
@ -2037,9 +2037,9 @@ function dol_mktime($hour, $minute, $second, $month, $day, $year, $gm = false, $
|
||||
|
||||
|
||||
/**
|
||||
* Return date for now. In most cases, we use this function without parameters (that means GMT time).
|
||||
* Return date for now. In most cases, we use this function without parameters (that means GMT time).
|
||||
*
|
||||
* @param string $mode 'gmt' => we return GMT timestamp,
|
||||
* @param string $mode 'gmt' => we return GMT timestamp,
|
||||
* 'tzserver' => we add the PHP server timezone
|
||||
* 'tzref' => we add the company timezone
|
||||
* 'tzuser' => we add the user timezone
|
||||
@ -2198,6 +2198,32 @@ function dol_print_email($email, $cid = 0, $socid = 0, $addlink = 0, $max = 64,
|
||||
return $rep;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get array of social network dictionary
|
||||
*
|
||||
* @return array Array of Social Networks Dictionary
|
||||
*/
|
||||
function getArrayOfSocialNetworks()
|
||||
{
|
||||
global $conf, $db;
|
||||
$sql = "SELECT rowid, code, label, url, icon, active FROM ".MAIN_DB_PREFIX."c_socialnetworks";
|
||||
$sql.= " WHERE entity=".$conf->entity;
|
||||
$socialnetworks = array();
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
while ($obj = $db->fetch_object($resql)) {
|
||||
$socialnetworks[$obj->code] = array(
|
||||
'rowid' => $obj->rowid,
|
||||
'label' => $obj->label,
|
||||
'url' => $obj->url,
|
||||
'icon' => $obj->icon,
|
||||
'active' => $obj->active,
|
||||
);
|
||||
}
|
||||
}
|
||||
return $socialnetworks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show social network link
|
||||
*
|
||||
@ -2211,42 +2237,43 @@ function dol_print_socialnetworks($value, $cid, $socid, $type)
|
||||
{
|
||||
global $conf,$user,$langs;
|
||||
|
||||
$newskype=$value;
|
||||
$htmllink=$value;
|
||||
|
||||
if (empty($value)) return ' ';
|
||||
|
||||
if (! empty($type))
|
||||
{
|
||||
$newskype ='<div class="divsocialnetwork inline-block valignmiddle">';
|
||||
$newskype.=img_picto($langs->trans(strtoupper($type)), $type.'.png', '', false, 0, 0, '', 'paddingright', 0);
|
||||
$newskype.=$value;
|
||||
$htmllink = '<div class="divsocialnetwork inline-block valignmiddle">';
|
||||
$htmllink .= img_picto($langs->trans(strtoupper($type)), $type.'.png', '', false, 0, 0, '', 'paddingright', 0);
|
||||
$htmllink .= $value;
|
||||
if ($type == 'skype')
|
||||
{
|
||||
$newskype.= ' ';
|
||||
$newskype.='<a href="skype:';
|
||||
$newskype.=$value;
|
||||
$newskype.='?call" alt="'.$langs->trans("Call").' '.$value.'" title="'.$langs->trans("Call").' '.$value.'">';
|
||||
$newskype.='<img src="'.DOL_URL_ROOT.'/theme/common/skype_callbutton.png" border="0">';
|
||||
$newskype.='</a><a href="skype:';
|
||||
$newskype.=$value;
|
||||
$newskype.='?chat" alt="'.$langs->trans("Chat").' '.$value.'" title="'.$langs->trans("Chat").' '.$value.'">';
|
||||
$newskype.='<img class="paddingleft" src="'.DOL_URL_ROOT.'/theme/common/skype_chatbutton.png" border="0">';
|
||||
$newskype.='</a>';
|
||||
$htmllink.= ' ';
|
||||
$htmllink.='<a href="skype:';
|
||||
$htmllink.=$value;
|
||||
$htmllink.='?call" alt="'.$langs->trans("Call").' '.$value.'" title="'.$langs->trans("Call").' '.$value.'">';
|
||||
$htmllink.='<img src="'.DOL_URL_ROOT.'/theme/common/skype_callbutton.png" border="0">';
|
||||
$htmllink.='</a><a href="skype:';
|
||||
$htmllink.=$value;
|
||||
$htmllink.='?chat" alt="'.$langs->trans("Chat").' '.$value.'" title="'.$langs->trans("Chat").' '.$value.'">';
|
||||
$htmllink.='<img class="paddingleft" src="'.DOL_URL_ROOT.'/theme/common/skype_chatbutton.png" border="0">';
|
||||
$htmllink.='</a>';
|
||||
}
|
||||
if (($cid || $socid) && ! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create && $type=='skype')
|
||||
{
|
||||
$addlink='AC_SKYPE'; $link='';
|
||||
$addlink='AC_SKYPE';
|
||||
$link='';
|
||||
if (! empty($conf->global->AGENDA_ADDACTIONFORSKYPE)) $link='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&backtopage=1&actioncode='.$addlink.'&contactid='.$cid.'&socid='.$socid.'">'.img_object($langs->trans("AddAction"), "calendar").'</a>';
|
||||
$newskype.=($link?' '.$link:'');
|
||||
$htmllink.=($link?' '.$link:'');
|
||||
}
|
||||
$newskype.='</div>';
|
||||
$htmllink.='</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$langs->load("errors");
|
||||
$newskype.=img_warning($langs->trans("ErrorBadSocialNetworkValue", $value));
|
||||
$htmllink.=img_warning($langs->trans("ErrorBadSocialNetworkValue", $value));
|
||||
}
|
||||
return $newskype;
|
||||
return $htmllink;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3029,23 +3056,31 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
'1downarrow', '1uparrow', '1leftarrow', '1rightarrow', '1uparrow_selected', '1downarrow_selected', '1leftarrow_selected', '1rightarrow_selected',
|
||||
'address', 'bank', 'bookmark', 'building', 'cash-register', 'close_title', 'cubes', 'delete', 'dolly', 'edit', 'ellipsis-h',
|
||||
'filter', 'file-code', 'grip', 'grip_title', 'list', 'listlight', 'note',
|
||||
'object_list','object_calendar', 'object_calendarweek', 'object_calendarmonth', 'object_calendarday', 'object_calendarperuser',
|
||||
'object_bookmark', 'object_list','object_calendar', 'object_calendarweek', 'object_calendarmonth', 'object_calendarday', 'object_calendarperuser',
|
||||
'off', 'on', 'play', 'playdisabled', 'printer', 'resize', 'stats',
|
||||
'note', 'setup', 'sign-out', 'split', 'switch_off', 'switch_on', 'tools', 'unlink', 'uparrow', 'user', 'wrench', 'globe',
|
||||
'jabber','skype','twitter','facebook','linkedin',
|
||||
'instagram', 'snapchat', 'youtube', 'google-plus-g','whatsapp',
|
||||
'chevron-left','chevron-right','chevron-down','chevron-top',
|
||||
'home', 'companies', 'products', 'commercial', 'invoicing', 'accountancy', 'project', 'hrm', 'members', 'ticket', 'generic',
|
||||
'error','warning',
|
||||
'title_setup', 'title_accountancy', 'title_bank', 'title_hrm', 'title_agenda'
|
||||
)
|
||||
)) {
|
||||
$fakey = $pictowithouttext;
|
||||
$facolor = ''; $fasize = '';
|
||||
$fa='fas';
|
||||
$fakey = $pictowithouttext;
|
||||
$facolor = ''; $fasize = '';
|
||||
if (in_array($pictowithouttext, array('off', 'on', 'object_bookmark', 'bookmark'))) {
|
||||
$fa='far';
|
||||
}
|
||||
if (in_array($pictowithouttext, array('skype', 'twitter', 'facebook', 'linkedin', 'instagram','snapchat','youtube','google-plus-g','whatsapp'))) {
|
||||
$fa='fab';
|
||||
}
|
||||
|
||||
$arrayconvpictotofa = array(
|
||||
'address'=> 'address-book', 'setup'=>'cog', 'companies'=>'building', 'products'=>'cube', 'commercial'=>'suitcase', 'invoicing'=>'coins', 'accountancy'=>'money-check-alt', 'project'=>'sitemap',
|
||||
'hrm'=>'umbrella-beach', 'members'=>'users', 'ticket'=>'ticket-alt', 'generic'=>'folder-open',
|
||||
'switch_off'=>'toggle-off', 'switch_on'=>'toggle-on', 'bookmark'=>'star', 'stats' => 'chart-bar',
|
||||
'switch_off'=>'toggle-off', 'switch_on'=>'toggle-on', 'object_bookmark'=>'star', 'bookmark'=>'star', 'stats' => 'chart-bar',
|
||||
'bank'=>'university', 'close_title'=>'window-close', 'delete'=>'trash', 'edit'=>'pencil', 'filter'=>'filter', 'split'=>'code-fork',
|
||||
'object_list'=>'list-alt','object_calendar'=>'calendar-alt', 'object_calendarweek'=>'calendar-week', 'object_calendarmonth'=>'calendar-alt', 'object_calendarday'=>'calendar-day', 'object_calendarperuser'=>'table',
|
||||
'error'=>'exclamation-triangle', 'warning'=>'exclamation-triangle',
|
||||
@ -3066,12 +3101,10 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
}
|
||||
elseif ($pictowithouttext == 'off') {
|
||||
$fakey = 'fa-square';
|
||||
$fa='far';
|
||||
$fasize = '1.3em';
|
||||
}
|
||||
elseif ($pictowithouttext == 'on') {
|
||||
$fakey = 'fa-check-square';
|
||||
$fa='far';
|
||||
$fasize = '1.3em';
|
||||
}
|
||||
elseif ($pictowithouttext == 'bank') {
|
||||
@ -3093,10 +3126,6 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
elseif ($pictowithouttext == 'grip_title' || $pictowithouttext == 'grip') {
|
||||
$fakey = 'fa-arrows-alt';
|
||||
}
|
||||
elseif ($pictowithouttext == 'bookmark') {
|
||||
$fakey = 'fa-'.$arrayconvpictotofa[$pictowithouttext];
|
||||
$fa='far';
|
||||
}
|
||||
elseif ($pictowithouttext == 'listlight') {
|
||||
$fakey = 'fa-download';
|
||||
$facolor = '#999';
|
||||
@ -3146,10 +3175,6 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
elseif ($pictowithouttext == 'jabber') {
|
||||
$fakey = 'fa-comment-o';
|
||||
}
|
||||
elseif (in_array($pictowithouttext, array('skype', 'twitter', 'facebook', 'linkedin'))) {
|
||||
$fakey = 'fa-'.$pictowithouttext;
|
||||
$fa = 'fab';
|
||||
}
|
||||
// Img for type of views
|
||||
elseif (in_array($pictowithouttext, array('object_list', 'object_calendar', 'object_calendarweek', 'object_calendarmonth', 'object_calendarday', 'object_calendarperuser'))) {
|
||||
$fakey = 'imgforviewmode fa-'.$arrayconvpictotofa[$pictowithouttext];
|
||||
|
||||
@ -47,7 +47,7 @@ function holiday_prepare_head($object)
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/holiday/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= '<span class="badge marginleftonlyshort">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -50,7 +50,7 @@ function facture_prepare_head($object)
|
||||
$nbContact = count($object->liste_contact(-1, 'internal')) + count($object->liste_contact(-1, 'external'));
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/contact.php?facid='.$object->id;
|
||||
$head[$h][1] = $langs->trans('ContactsAddresses');
|
||||
if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>';
|
||||
if ($nbContact > 0) $head[$h][1].= '<span class="badge marginleftonlyshort">'.$nbContact.'</span>';
|
||||
$head[$h][2] = 'contact';
|
||||
$h++;
|
||||
}
|
||||
@ -71,7 +71,7 @@ function facture_prepare_head($object)
|
||||
else dol_print_error($db);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$object->id;
|
||||
$head[$h][1] = $langs->trans('StandingOrders');
|
||||
if ($nbStandingOrders > 0) $head[$h][1].= ' <span class="badge">'.$nbStandingOrders.'</span>';
|
||||
if ($nbStandingOrders > 0) $head[$h][1].= '<span class="badge marginleftonlyshort">'.$nbStandingOrders.'</span>';
|
||||
$head[$h][2] = 'standingorders';
|
||||
$h++;
|
||||
}
|
||||
@ -89,7 +89,7 @@ function facture_prepare_head($object)
|
||||
if(!empty($object->note_public)) $nbNote++;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/note.php?facid='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Notes');
|
||||
if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
|
||||
if ($nbNote > 0) $head[$h][1].= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
|
||||
$head[$h][2] = 'note';
|
||||
$h++;
|
||||
}
|
||||
@ -101,7 +101,7 @@ function facture_prepare_head($object)
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/document.php?facid='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= '<span class="badge marginleftonlyshort">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -59,7 +59,7 @@ function loan_prepare_head($object)
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$tab][0] = DOL_URL_ROOT.'/loan/document.php?id='.$object->id;
|
||||
$head[$tab][1] = $langs->trans("Documents");
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$tab][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$tab][1].= '<span class="badge marginleftonlyshort">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$tab][2] = 'documents';
|
||||
$tab++;
|
||||
|
||||
@ -68,7 +68,7 @@ function loan_prepare_head($object)
|
||||
$nbNote = (empty($object->note_private)?0:1)+(empty($object->note_public)?0:1);
|
||||
$head[$tab][0] = DOL_URL_ROOT."/loan/note.php?id=".$object->id;
|
||||
$head[$tab][1] = $langs->trans("Notes");
|
||||
if($nbNote > 0) $head[$tab][1].= ' <span class="badge">'.$nbNote.'</span>';
|
||||
if($nbNote > 0) $head[$tab][1].= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
|
||||
$head[$tab][2] = 'note';
|
||||
$tab++;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user