Merge branch 'develop' of github.com:Dolibarr/dolibarr into develop
This commit is contained in:
commit
b42d2aa41e
@ -31,7 +31,6 @@ addons:
|
||||
- pgloader
|
||||
|
||||
php:
|
||||
- '5.4'
|
||||
- '5.5'
|
||||
- '5.6'
|
||||
- '7.0'
|
||||
@ -62,8 +61,6 @@ matrix:
|
||||
- php: nightly
|
||||
# We exclude some combinations not usefull to save Travis CPU
|
||||
exclude:
|
||||
- php: '5.5'
|
||||
env: DB=mariadb
|
||||
- php: '5.6'
|
||||
env: DB=mariadb
|
||||
- php: '7.0'
|
||||
@ -72,8 +69,6 @@ matrix:
|
||||
env: DB=mariadb
|
||||
- php: '7.2'
|
||||
env: DB=mariadb
|
||||
- php: '5.5'
|
||||
env: DB=postgresql
|
||||
- php: '5.6'
|
||||
env: DB=postgresql
|
||||
- php: '7.0'
|
||||
|
||||
@ -150,6 +150,7 @@ if (dol_strlen($search_year)) {
|
||||
$sql .= " AND ( bk.doc_date BETWEEN '" . $db->idate($date_start) . "' AND '" . $db->idate($date_end) . "' )";
|
||||
}
|
||||
|
||||
$sql.= ' AND bk.entity IN ('.getEntity('accountingbookkeeping').')';
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
$debit = 0;
|
||||
|
||||
@ -142,13 +142,12 @@ $sql .= " bk.subledger_account, bk.numero_compte , bk.label_compte, bk.debit, ";
|
||||
$sql .= " bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.lettering_code ";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
|
||||
$sql .= " WHERE (bk.subledger_account = '" . $object->code_compta_fournisseur . "' AND bk.numero_compte = '" . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . "' )";
|
||||
|
||||
if (dol_strlen($search_year)) {
|
||||
$date_start = dol_mktime(0, 0, 0, 1, 1, $search_year);
|
||||
$date_end = dol_mktime(23, 59, 59, 12, 31, $search_year);
|
||||
$sql .= " AND ( bk.doc_date BETWEEN '".$db->idate($date_start)."' AND '".$db->idate($date_end)."' )";
|
||||
}
|
||||
|
||||
$sql.= ' AND bk.entity IN ('.getEntity('accountingbookkeeping').')';
|
||||
$sql.= $db->order($sortfield, $sortorder);
|
||||
|
||||
$debit = 0;
|
||||
|
||||
@ -341,7 +341,7 @@ if ($result) {
|
||||
//'presend'=>$langs->trans("SendByMail"),
|
||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
//if ($user->rights->mymodule->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete");
|
||||
//if ($user->rights->mymodule->supprimer) $arrayofmassactions['predelete']='<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
||||
//if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('ventil', $arrayofmassactions, 1);
|
||||
|
||||
|
||||
@ -273,7 +273,7 @@ if ($result) {
|
||||
//'presend'=>$langs->trans("SendByMail"),
|
||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
//if ($user->rights->mymodule->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete");
|
||||
//if ($user->rights->mymodule->supprimer) $arrayofmassactions['predelete']='<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
||||
//if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('ventil', $arrayofmassactions, 1);
|
||||
|
||||
|
||||
@ -340,7 +340,7 @@ if ($result) {
|
||||
//'presend'=>$langs->trans("SendByMail"),
|
||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
//if ($user->rights->mymodule->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete");
|
||||
//if ($user->rights->mymodule->supprimer) $arrayofmassactions['predelete']='<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
||||
//if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('ventil', $arrayofmassactions, 1);
|
||||
|
||||
|
||||
@ -358,7 +358,7 @@ $arrayofmassactions = array(
|
||||
//'presend'=>$langs->trans("SendByMail"),
|
||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
if ($user->rights->adherent->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete");
|
||||
if ($user->rights->adherent->supprimer) $arrayofmassactions['predelete']='<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
||||
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
|
||||
@ -240,7 +240,7 @@ $arrayofmassactions = array(
|
||||
//'presend'=>$langs->trans("SendByMail"),
|
||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
//if ($user->rights->adherent->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete");
|
||||
//if ($user->rights->adherent->supprimer) $arrayofmassactions['predelete']='<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
||||
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
|
||||
@ -75,6 +75,8 @@ 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);
|
||||
|
||||
$debuginfo='';
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -180,11 +182,13 @@ if ($action == 'confirm_collect')
|
||||
$res = $object->doCollectOneCollector();
|
||||
if ($res > 0)
|
||||
{
|
||||
$debuginfo = $object->debuginfo;
|
||||
setEventMessages($object->lastresult, null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($object->error, null, 'errors');
|
||||
$debuginfo = $object->debuginfo;
|
||||
setEventMessages($object->error, null, 'errors');
|
||||
}
|
||||
|
||||
$action = '';
|
||||
@ -443,22 +447,45 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>';
|
||||
$arrayoftypes=array(
|
||||
'from'=>'MailFrom',
|
||||
'to'=>'MailTo',
|
||||
'cc'=>'Cc',
|
||||
'bcc'=>'Bcc',
|
||||
'subject'=>'Subject',
|
||||
'body'=>'Body',
|
||||
'from'=>array('label'=>'MailFrom', 'data-placeholder'=>'SearchString'),
|
||||
'to'=>array('label'=>'MailTo', 'data-placeholder'=>'SearchString'),
|
||||
'cc'=>array('label'=>'Cc', 'data-placeholder'=>'SearchString'),
|
||||
'bcc'=>array('label'=>'Bcc', 'data-placeholder'=>'SearchString'),
|
||||
'subject'=>array('label'=>'Subject', 'data-placeholder'=>'SearchString'),
|
||||
'body'=>array('label'=>'Body', 'data-placeholder'=>'SearchString'),
|
||||
'header'=>array('label'=>'Header', 'data-placeholder'=>'HeaderKey SearchString'), // HEADER key value
|
||||
'X1'=>'---',
|
||||
'seen'=>'AlreadyRead',
|
||||
'unseen'=>'NotRead',
|
||||
'seen'=>array('label'=>'AlreadyRead', 'data-noparam'=>1),
|
||||
'unseen'=>array('label'=>'NotRead', 'data-noparam'=>1),
|
||||
'smaller'=>array('label'=>'SmallerThan', 'data-placeholder'=>'NumberOfBytes'),
|
||||
'larger'=>array('label'=>'LargerThan', 'data-placeholder'=>'NumberOfBytes'),
|
||||
'X2'=>'---',
|
||||
'withtrackingid'=>'WithDolTrackingID',
|
||||
'withouttrackingid'=>'WithoutDolTrackingID'
|
||||
'withtrackingid'=>array('label'=>'WithDolTrackingID', 'data-noparam'=>1),
|
||||
'withouttrackingid'=>array('label'=>'WithoutDolTrackingID', 'data-noparam'=>1)
|
||||
);
|
||||
print $form->selectarray('filtertype', $arrayoftypes, '', 1, 0, 0, '', 1, 0, 0, '', '', 0, '', 2);
|
||||
|
||||
print "\n";
|
||||
print '<script>';
|
||||
print 'jQuery("#filtertype").change(function() {
|
||||
console.log("We change a filter");
|
||||
if (jQuery("#filtertype option:selected").attr("data-noparam")) {
|
||||
jQuery("#rulevalue").attr("placeholder", "");
|
||||
jQuery("#rulevalue").text(""); jQuery("#rulevalue").prop("disabled", true);
|
||||
}
|
||||
else { jQuery("#rulevalue").prop("disabled", false); }
|
||||
jQuery("#rulevalue").attr("placeholder", (jQuery("#filtertype option:selected").attr("data-placeholder")));
|
||||
';
|
||||
$noparam=array();
|
||||
foreach($arrayoftypes as $key => $value)
|
||||
{
|
||||
if ($value['noparam']) $noparam[]=$key;
|
||||
}
|
||||
print '})';
|
||||
print '</script>'."\n";
|
||||
|
||||
print '</td><td>';
|
||||
print '<input type="text" name="rulevalue">';
|
||||
print '<input type="text" name="rulevalue" id="rulevalue">';
|
||||
print '</td>';
|
||||
print '<td class="right"><input type="submit" name="addfilter" id="addfilter" class="flat button" value="'.$langs->trans("Add").'"></td>';
|
||||
print '</tr>';
|
||||
@ -470,7 +497,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>';
|
||||
print $langs->trans($arrayoftypes[$rulefilter['type']]);
|
||||
print $langs->trans($arrayoftypes[$rulefilter['type']]['label']);
|
||||
print '</td>';
|
||||
print '<td>'.$rulefilter['rulevalue'].'</td>';
|
||||
print '<td class="right">';
|
||||
@ -492,8 +519,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
// Add operation
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>';
|
||||
$arrayoftypes=array('loadthirdparty'=>'LoadThirdPartyFromName', 'loadandcreatethirdparty'=>'LoadThirdPartyFromNameOrCreate', 'recordevent'=>'RecordEvent');
|
||||
$arrayoftypes=array(
|
||||
'loadthirdparty'=>'LoadThirdPartyFromName',
|
||||
'loadandcreatethirdparty'=>'LoadThirdPartyFromNameOrCreate',
|
||||
'recordevent'=>'RecordEvent');
|
||||
if ($conf->projet->enabled) $arrayoftypes['project']='CreateLeadAndThirdParty';
|
||||
if ($conf->ticket->enabled) $arrayoftypes['ticket']='CreateTicketAndThirdParty';
|
||||
print $form->selectarray('operationtype', $arrayoftypes, '', 1, 0, 0, '', 1);
|
||||
print '</td><td>';
|
||||
print '<input type="text" name="operationparam">';
|
||||
@ -517,6 +548,10 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
print '<tr class="drag drop oddeven" id="row-'.$ruleaction['id'].'">';
|
||||
print '<td>';
|
||||
print $langs->trans($arrayoftypes[$ruleaction['type']]);
|
||||
if (in_array($ruleaction['type'], array('recordevent')))
|
||||
{
|
||||
print $form->textwithpicto('', $langs->transnoentitiesnoconv('IfTrackingIDFoundEventWillBeLinked'));
|
||||
}
|
||||
print '</td>';
|
||||
print '<td>'.$ruleaction['actionparam'].'</td>';
|
||||
print '<td class="right">';
|
||||
@ -571,6 +606,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
print '</div>' . "\n";
|
||||
}
|
||||
|
||||
if (! empty($debuginfo))
|
||||
{
|
||||
print info_admin($debuginfo);
|
||||
}
|
||||
|
||||
|
||||
// Select mail models is same action as presend
|
||||
if (GETPOST('modelselected')) {
|
||||
$action = 'presend';
|
||||
|
||||
@ -304,7 +304,7 @@ $arrayofmassactions = array(
|
||||
//'presend'=>$langs->trans("SendByMail"),
|
||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
if ($user->rights->emailcollector->delete) $arrayofmassactions['predelete']=$langs->trans("Delete");
|
||||
if ($user->rights->emailcollector->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();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
|
||||
@ -291,7 +291,7 @@ $arrayofmassactions = array(
|
||||
//'presend'=>$langs->trans("SendByMail"),
|
||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
if ($user->rights->monmodule->delete) $arrayofmassactions['predelete']=$langs->trans("Delete");
|
||||
if ($user->rights->monmodule->delete) $arrayofmassactions['predelete']='<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
||||
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
|
||||
@ -286,7 +286,8 @@ $configfileparameters=array(
|
||||
'dolibarr_main_document_root'=> $langs->trans("DocumentRootServer"),
|
||||
'?dolibarr_main_document_root_alt' => $langs->trans("DocumentRootServer").' (alt)',
|
||||
'dolibarr_main_data_root' => $langs->trans("DataRootServer"),
|
||||
'separator1' => '',
|
||||
'dolibarr_main_instance_unique_id' => $langs->trans("InstanceUniqueID"),
|
||||
'separator1' => '',
|
||||
'dolibarr_main_db_host' => $langs->trans("DatabaseServer"),
|
||||
'dolibarr_main_db_port' => $langs->trans("DatabasePort"),
|
||||
'dolibarr_main_db_name' => $langs->trans("DatabaseName"),
|
||||
@ -391,7 +392,20 @@ foreach($configfileparameters as $key => $value)
|
||||
++$i;
|
||||
}
|
||||
}
|
||||
else print ${$newkey};
|
||||
elseif ($newkey == 'dolibarr_main_instance_unique_id')
|
||||
{
|
||||
//print $conf->file->instance_unique_id;
|
||||
global $dolibarr_main_cookie_cryptkey;
|
||||
$valuetoshow = ${$newkey} ? ${$newkey} : $dolibarr_main_cookie_cryptkey;
|
||||
print $valuetoshow;
|
||||
if (empty($valuetoshow)) {
|
||||
print img_warning("EditConfigFileToAddEntry", 'dolibarr_main_instance_unique_id');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print ${$newkey};
|
||||
}
|
||||
if ($newkey == 'dolibarr_main_url_root' && ${$newkey} != DOL_MAIN_URL_ROOT) print ' (currently overwritten by autodetected value: '.DOL_MAIN_URL_ROOT.')';
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@ if ($action == 'updateMask') {
|
||||
// TODO Verifier si module numerotation choisi peut etre active
|
||||
// par appel methode canBeActivated
|
||||
|
||||
dolibarr_set_const($db, "TICKETSUP_ADDON", $value, 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "TICKET_ADDON", $value, 'chaine', 0, '', $conf->entity);
|
||||
} elseif ($action == 'setvar') {
|
||||
include_once DOL_DOCUMENT_ROOT . "/core/lib/files.lib.php";
|
||||
|
||||
@ -256,7 +256,7 @@ foreach ($dirmodels as $reldir) {
|
||||
print '</td>' . "\n";
|
||||
|
||||
print '<td align="center">';
|
||||
if ($conf->global->TICKETSUP_ADDON == 'mod_' . $classname) {
|
||||
if ($conf->global->TICKET_ADDON == 'mod_' . $classname) {
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
} else {
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=setmod&value=mod_' . $classname . '" alt="' . $langs->trans("Default") . '">' . img_picto($langs->trans("Disabled"), 'switch_off') . '</a>';
|
||||
|
||||
@ -291,7 +291,7 @@ $arrayofmassactions = array(
|
||||
//'presend'=>$langs->trans("SendByMail"),
|
||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
if ($user->rights->asset->delete) $arrayofmassactions['predelete']=$langs->trans("Delete");
|
||||
if ($user->rights->asset->delete) $arrayofmassactions['predelete']='<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
||||
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
|
||||
@ -299,7 +299,7 @@ $arrayofmassactions = array(
|
||||
//'presend'=>$langs->trans("SendByMail"),
|
||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
if ($user->rights->bom->delete) $arrayofmassactions['predelete']=$langs->trans("Delete");
|
||||
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();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
|
||||
@ -142,7 +142,11 @@ class Facturation
|
||||
$this->montantRemise($montant_remise_ht);
|
||||
|
||||
$newcartarray=$_SESSION['poscart'];
|
||||
$i=count($newcartarray);
|
||||
|
||||
$i = 0;
|
||||
if (!is_null($newcartarray) && !empty($newcartarray)) {
|
||||
$i=count($newcartarray);
|
||||
}
|
||||
|
||||
$newcartarray[$i]['id']=$i;
|
||||
$newcartarray[$i]['ref']=$product->ref;
|
||||
|
||||
@ -983,19 +983,43 @@ class Categorie extends CommonObject
|
||||
* fulllabel = nom avec chemin complet de la categorie
|
||||
* fullpath = chemin complet compose des id
|
||||
*
|
||||
* @param string $type Type of categories ('customer', 'supplier', 'contact', 'product', 'member') or (0, 1, 2, ...).
|
||||
* @param int $markafterid Removed all categories including the leaf $markafterid in category tree.
|
||||
* @param int $keeponlyifinleafid Keep only of category is inside the leaf starting with this id.
|
||||
* @return array|int Array of categories. this->cats and this->motherof are set, -1 on error
|
||||
* @param string $type Type of categories ('customer', 'supplier', 'contact', 'product', 'member') or (0, 1, 2, ...).
|
||||
* @param int|string|array $markafterid Keep only or removed all categories including the leaf $markafterid in category tree (exclude) or Keep only of category is inside the leaf starting with this id.
|
||||
* $markafterid can be an :
|
||||
* - int (id of category)
|
||||
* - string (categories ids seprated by comma)
|
||||
* - array (list of categories ids)
|
||||
* @param int $include [=0] Removed or 1=Keep only
|
||||
* @return array|int Array of categories. this->cats and this->motherof are set, -1 on error
|
||||
*/
|
||||
public function get_full_arbo($type, $markafterid = 0, $keeponlyifinleafid = 0)
|
||||
public function get_full_arbo($type, $markafterid = 0, $include = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf, $langs;
|
||||
|
||||
if (! is_numeric($type)) $type = $this->MAP_ID[$type];
|
||||
|
||||
$this->cats = array();
|
||||
if (is_string($markafterid))
|
||||
{
|
||||
$markafterid = explode(',', $markafterid);
|
||||
}
|
||||
elseif (is_numeric($markafterid))
|
||||
{
|
||||
if ($markafterid > 0)
|
||||
{
|
||||
$markafterid = array($markafterid);
|
||||
}
|
||||
else
|
||||
{
|
||||
$markafterid = array();
|
||||
}
|
||||
}
|
||||
elseif (!is_array($markafterid))
|
||||
{
|
||||
$markafterid = array();
|
||||
}
|
||||
|
||||
$this->cats = array();
|
||||
|
||||
// Init this->motherof that is array(id_son=>id_parent, ...)
|
||||
$this->load_motherof();
|
||||
@ -1040,39 +1064,22 @@ class Categorie extends CommonObject
|
||||
$this->build_path_from_id_categ($key, 0); // Process a branch from the root category key (this category has no parent)
|
||||
}
|
||||
|
||||
// Exclude leaf including $markafterid from tree
|
||||
if ($markafterid)
|
||||
// Include or exclude leaf including $markafterid from tree
|
||||
if (count($markafterid) > 0)
|
||||
{
|
||||
$keyfiltercatid = implode('|', $markafterid);
|
||||
|
||||
//print "Look to discard category ".$markafterid."\n";
|
||||
$keyfilter1='^'.$markafterid.'$';
|
||||
$keyfilter2='_'.$markafterid.'$';
|
||||
$keyfilter3='^'.$markafterid.'_';
|
||||
$keyfilter4='_'.$markafterid.'_';
|
||||
$keyfilter1 = '^' . $keyfiltercatid . '$';
|
||||
$keyfilter2 = '_' . $keyfiltercatid . '$';
|
||||
$keyfilter3 = '^' . $keyfiltercatid . '_';
|
||||
$keyfilter4 = '_' . $keyfiltercatid . '_';
|
||||
foreach($this->cats as $key => $val)
|
||||
{
|
||||
if (preg_match('/'.$keyfilter1.'/', $val['fullpath']) || preg_match('/'.$keyfilter2.'/', $val['fullpath'])
|
||||
|| preg_match('/'.$keyfilter3.'/', $val['fullpath']) || preg_match('/'.$keyfilter4.'/', $val['fullpath']))
|
||||
{
|
||||
unset($this->cats[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Exclude leaf including $markafterid from tree
|
||||
if ($keeponlyifinleafid)
|
||||
{
|
||||
//print "Look to discard category ".$keeponlyifinleafid."\n";
|
||||
$keyfilter1='^'.$keeponlyifinleafid.'$';
|
||||
$keyfilter2='_'.$keeponlyifinleafid.'$';
|
||||
$keyfilter3='^'.$keeponlyifinleafid.'_';
|
||||
$keyfilter4='_'.$keeponlyifinleafid.'_';
|
||||
foreach($this->cats as $key => $val)
|
||||
{
|
||||
if (preg_match('/'.$keyfilter1.'/', $val['fullpath']) || preg_match('/'.$keyfilter2.'/', $val['fullpath'])
|
||||
|| preg_match('/'.$keyfilter3.'/', $val['fullpath']) || preg_match('/'.$keyfilter4.'/', $val['fullpath']))
|
||||
{
|
||||
// We keep
|
||||
}
|
||||
else
|
||||
$test = (preg_match('/' . $keyfilter1 . '/', $val['fullpath']) || preg_match('/' . $keyfilter2 . '/', $val['fullpath'])
|
||||
|| preg_match('/' . $keyfilter3 . '/', $val['fullpath']) || preg_match('/' . $keyfilter4 . '/', $val['fullpath']));
|
||||
|
||||
if (($test && !$include) || (!$test && $include))
|
||||
{
|
||||
unset($this->cats[$key]);
|
||||
}
|
||||
|
||||
@ -668,7 +668,7 @@ class Mailing extends CommonObject
|
||||
*
|
||||
* @param int $statut Id statut
|
||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||
* @param strin $desc Desc error
|
||||
* @param string $desc Desc error
|
||||
* @return string Label
|
||||
*/
|
||||
public static function libStatutDest($statut, $mode = 0, $desc = '')
|
||||
|
||||
@ -623,7 +623,7 @@ if (empty($reshook))
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
$result=$object->cloture($user, 4, '');
|
||||
$result=$object->cloture($user, Propal::STATUS_BILLED, '');
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
|
||||
@ -430,7 +430,7 @@ if ($resql)
|
||||
'presend'=>$langs->trans("SendByMail"),
|
||||
'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
if ($user->rights->propal->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete");
|
||||
if ($user->rights->propal->supprimer) $arrayofmassactions['predelete']='<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
||||
if ($user->rights->propal->cloturer) $arrayofmassactions['closed']=$langs->trans("Close");
|
||||
if (in_array($massaction, array('presend','predelete','closed'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
@ -161,7 +161,7 @@ class Commande extends CommonOrder
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see date
|
||||
* @see $date
|
||||
*/
|
||||
public $date_commande;
|
||||
|
||||
@ -1331,7 +1331,7 @@ class Commande extends CommonOrder
|
||||
* @param double $pu_ht_devise Unit price in currency
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*
|
||||
* @see add_product
|
||||
* @see add_product()
|
||||
*
|
||||
* Les parametres sont deja cense etre juste et avec valeurs finales a l'appel
|
||||
* de cette methode. Aussi, pour le taux tva, il doit deja avoir ete defini
|
||||
@ -3905,7 +3905,7 @@ class OrderLine extends CommonOrderLine
|
||||
* Id of parent order
|
||||
* @var int
|
||||
* @deprecated Use fk_commande
|
||||
* @see fk_commande
|
||||
* @see $fk_commande
|
||||
*/
|
||||
public $commande_id;
|
||||
|
||||
@ -3932,7 +3932,7 @@ class OrderLine extends CommonOrderLine
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see remise_percent, fk_remise_except
|
||||
* @see $remise_percent, $fk_remise_except
|
||||
*/
|
||||
public $remise;
|
||||
|
||||
|
||||
@ -434,7 +434,7 @@ if ($resql)
|
||||
|
||||
);
|
||||
if($user->rights->facture->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer");
|
||||
if ($user->rights->commande->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete");
|
||||
if ($user->rights->commande->supprimer) $arrayofmassactions['predelete']='<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
||||
if (in_array($massaction, array('presend','predelete','createbills'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
|
||||
@ -282,7 +282,7 @@ if ($mode == 'customer')
|
||||
Commande::STATUS_CLOSED=>$langs->trans("StatusOrderDelivered"),
|
||||
Commande::STATUS_CANCELED=>$langs->trans("StatusOrderCanceled")
|
||||
);
|
||||
print $form->selectarray('object_status', $liststatus, GETPOST('object_status'), -4);
|
||||
print $form->selectarray('object_status', $liststatus, GETPOST('object_status', 'int'), -4);
|
||||
}
|
||||
if ($mode == 'supplier')
|
||||
{
|
||||
|
||||
@ -564,7 +564,7 @@ if ($resql)
|
||||
//'presend'=>$langs->trans("SendByMail"),
|
||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
//if ($user->rights->bank->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete");
|
||||
//if ($user->rights->bank->supprimer) $arrayofmassactions['predelete']='<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
||||
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
|
||||
@ -220,7 +220,7 @@ $arrayofmassactions = array(
|
||||
// 'presend'=>$langs->trans("SendByMail"),
|
||||
// 'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
if ($user->rights->banque->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete");
|
||||
if ($user->rights->banque->supprimer) $arrayofmassactions['predelete']='<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
||||
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
|
||||
@ -320,7 +320,7 @@ $arrayofmassactions = array(
|
||||
//'presend'=>$langs->trans("SendByMail"),
|
||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
if ($user->rights->monmodule->delete) $arrayofmassactions['predelete']=$langs->trans("Delete");
|
||||
if ($user->rights->monmodule->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();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
|
||||
@ -936,7 +936,7 @@ class Invoices extends DolibarrApi
|
||||
*/
|
||||
public function markAsCreditAvailable($id)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->facture->creer) {
|
||||
if( ! DolibarrApiAccess::$user->rights->facture->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
@ -949,89 +949,145 @@ class Invoices extends DolibarrApi
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$result = $this->invoice->fetch_thirdparty();
|
||||
if( ! $result ) {
|
||||
throw new RestException(404, 'Thirdparty not found');
|
||||
if ($this->invoice->paye) {
|
||||
throw new RestException(500, 'Alreay payed');
|
||||
}
|
||||
|
||||
if (! $this->invoice->paye) // protection against multiple submit
|
||||
{
|
||||
$this->db->begin();
|
||||
$this->invoice->fetch($id);
|
||||
$this->invoice->fetch_thirdparty();
|
||||
|
||||
$this->invoice->fetch_lines();
|
||||
// Check if there is already a discount (protection to avoid duplicate creation when resubmit post)
|
||||
$discountcheck=new DiscountAbsolute($this->db);
|
||||
$result=$discountcheck->fetch(0, $this->invoice->id);
|
||||
|
||||
$amount_ht = $amount_tva = $amount_ttc = array();
|
||||
$canconvert=0;
|
||||
if ($this->invoice->type == Facture::TYPE_DEPOSIT && empty($discountcheck->id)) $canconvert=1; // we can convert deposit into discount if deposit is payed (completely, partially or not at all) and not already converted (see real condition into condition used to show button converttoreduc)
|
||||
if (($this->invoice->type == Facture::TYPE_CREDIT_NOTE || $this->invoice->type == Facture::TYPE_STANDARD) && $this->invoice->paye == 0 && empty($discountcheck->id)) $canconvert=1; // we can convert credit note into discount if credit note is not payed back and not already converted and amount of payment is 0 (see real condition into condition used to show button converttoreduc)
|
||||
if ($canconvert)
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
// Loop on each vat rate
|
||||
$i=0;
|
||||
$amount_ht = array();
|
||||
$amount_tva = array();
|
||||
$amount_ttc = array();
|
||||
foreach($this->invoice->lines as $line)
|
||||
{
|
||||
$amount_ht[$line->tva_tx]+=$line->total_ht;
|
||||
$amount_tva[$line->tva_tx]+=$line->total_tva;
|
||||
$amount_ttc[$line->tva_tx]+=$line->total_ttc;
|
||||
$i++;
|
||||
}
|
||||
$amount_ht = $amount_tva = $amount_ttc = array();
|
||||
$multicurrency_amount_ht = $multicurrency_amount_tva = $multicurrency_amount_ttc = array();
|
||||
|
||||
// Insert one discount by VAT rate category
|
||||
$discount = new DiscountAbsolute($this->db);
|
||||
if ($this->invoice->type == 2) $discount->description='(CREDIT_NOTE)';
|
||||
elseif ($this->invoice->type == 3) $discount->description='(DEPOSIT)';
|
||||
else {
|
||||
$this->error="CantConvertToReducAnInvoiceOfThisType";
|
||||
return -1;
|
||||
}
|
||||
$discount->tva_tx=abs($this->invoice->total_ttc);
|
||||
$discount->fk_soc=$this->invoice->socid;
|
||||
$discount->fk_facture_source=$this->invoice->id;
|
||||
// Loop on each vat rate
|
||||
$i = 0;
|
||||
foreach ($this->invoice->lines as $line)
|
||||
{
|
||||
if ($line->product_type < 9 && $line->total_ht != 0) // Remove lines with product_type greater than or equal to 9
|
||||
{ // no need to create discount if amount is null
|
||||
$amount_ht[$line->tva_tx] += $line->total_ht;
|
||||
$amount_tva[$line->tva_tx] += $line->total_tva;
|
||||
$amount_ttc[$line->tva_tx] += $line->total_ttc;
|
||||
$multicurrency_amount_ht[$line->tva_tx] += $line->multicurrency_total_ht;
|
||||
$multicurrency_amount_tva[$line->tva_tx] += $line->multicurrency_total_tva;
|
||||
$multicurrency_amount_ttc[$line->tva_tx] += $line->multicurrency_total_ttc;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
$error=0;
|
||||
foreach($amount_ht as $tva_tx => $xxx)
|
||||
{
|
||||
$discount->amount_ht=abs($amount_ht[$tva_tx]);
|
||||
$discount->amount_tva=abs($amount_tva[$tva_tx]);
|
||||
$discount->amount_ttc=abs($amount_ttc[$tva_tx]);
|
||||
$discount->tva_tx=abs($tva_tx);
|
||||
// Insert one discount by VAT rate category
|
||||
$discount = new DiscountAbsolute($this->db);
|
||||
if ($this->invoice->type == Facture::TYPE_CREDIT_NOTE) {
|
||||
$discount->description = '(CREDIT_NOTE)';
|
||||
}
|
||||
elseif ($this->invoice->type == Facture::TYPE_DEPOSIT) {
|
||||
$discount->description = '(DEPOSIT)';
|
||||
}
|
||||
elseif ($this->invoice->type == Facture::TYPE_STANDARD || $this->invoice->type == Facture::TYPE_REPLACEMENT || $this->invoice->type == Facture::TYPE_SITUATION) {
|
||||
$discount->description = '(EXCESS RECEIVED)';
|
||||
}
|
||||
else {
|
||||
throw new RestException(500, 'Cant convert to reduc an Invoice of this type');
|
||||
}
|
||||
|
||||
$result=$discount->create(DolibarrApiAccess::$user);
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$discount->fk_soc = $this->invoice->socid;
|
||||
$discount->fk_facture_source = $this->invoice->id;
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
// Classe facture
|
||||
$result=$this->invoice->set_paid(DolibarrApiAccess::$user);
|
||||
if ($result > 0)
|
||||
{
|
||||
//$mesg='OK'.$discount->id;
|
||||
$this->db->commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
throw new RestException(500, 'Could not set paid');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
throw new RestException(500, 'Discount creation error');
|
||||
}
|
||||
}
|
||||
$error = 0;
|
||||
|
||||
$result = $this->invoice->fetch($id);
|
||||
if( ! $result ) {
|
||||
throw new RestException(404, 'Invoice not found');
|
||||
}
|
||||
if ($this->invoice->type == Facture::TYPE_STANDARD || $this->invoice->type == Facture::TYPE_REPLACEMENT || $this->invoice->type == Facture::TYPE_SITUATION)
|
||||
{
|
||||
// If we're on a standard invoice, we have to get excess received to create a discount in TTC without VAT
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('facture', $this->invoice->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
// Total payments
|
||||
$sql = 'SELECT SUM(pf.amount) as total_paiements';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiement_facture as pf, '.MAIN_DB_PREFIX.'paiement as p';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as c ON p.fk_paiement = c.id';
|
||||
$sql.= ' WHERE pf.fk_facture = '.$this->invoice->id;
|
||||
$sql.= ' AND pf.fk_paiement = p.rowid';
|
||||
$sql.= ' AND p.entity IN ('.getEntity('invoice').')';
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) dol_print_error($this->db);
|
||||
|
||||
$res = $this->db->fetch_object($resql);
|
||||
$total_paiements = $res->total_paiements;
|
||||
|
||||
// Total credit note and deposit
|
||||
$total_creditnote_and_deposit = 0;
|
||||
$sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,";
|
||||
$sql .= " re.description, re.fk_facture_source";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "societe_remise_except as re";
|
||||
$sql .= " WHERE fk_facture = " . $this->invoice->id;
|
||||
$resql = $this->db->query($sql);
|
||||
if (!empty($resql)) {
|
||||
while ($obj = $this->db->fetch_object($resql)) $total_creditnote_and_deposit += $obj->amount_ttc;
|
||||
} else dol_print_error($this->db);
|
||||
|
||||
$discount->amount_ht = $discount->amount_ttc = $total_paiements + $total_creditnote_and_deposit - $this->invoice->total_ttc;
|
||||
$discount->amount_tva = 0;
|
||||
$discount->tva_tx = 0;
|
||||
|
||||
$result = $discount->create(DolibarrApiAccess::$user);
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
if ($this->invoice->type == Facture::TYPE_CREDIT_NOTE || $this->invoice->type == Facture::TYPE_DEPOSIT)
|
||||
{
|
||||
foreach ($amount_ht as $tva_tx => $xxx)
|
||||
{
|
||||
$discount->amount_ht = abs($amount_ht[$tva_tx]);
|
||||
$discount->amount_tva = abs($amount_tva[$tva_tx]);
|
||||
$discount->amount_ttc = abs($amount_ttc[$tva_tx]);
|
||||
$discount->multicurrency_amount_ht = abs($multicurrency_amount_ht[$tva_tx]);
|
||||
$discount->multicurrency_amount_tva = abs($multicurrency_amount_tva[$tva_tx]);
|
||||
$discount->multicurrency_amount_ttc = abs($multicurrency_amount_ttc[$tva_tx]);
|
||||
$discount->tva_tx = abs($tva_tx);
|
||||
|
||||
$result = $discount->create(DolibarrApiAccess::$user);
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($error))
|
||||
{
|
||||
if($this->invoice->type != Facture::TYPE_DEPOSIT) {
|
||||
// Classe facture
|
||||
$result = $this->invoice->set_paid(DolibarrApiAccess::$user);
|
||||
if ($result >= 0)
|
||||
{
|
||||
$this->db->commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
throw new RestException(500, 'Could not set paid');
|
||||
}
|
||||
} else {
|
||||
$this->db->commit();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
throw new RestException(500, 'Discount creation error');
|
||||
}
|
||||
}
|
||||
|
||||
return $this->_cleanObjectDatas($this->invoice);
|
||||
|
||||
@ -773,7 +773,7 @@ class RemiseCheque extends CommonObject
|
||||
* Reopen linked invoices and create a new negative payment.
|
||||
*
|
||||
* @param int $bank_id Id of bank transaction line concerned
|
||||
* @param date $rejection_date Date to use on the negative payment
|
||||
* @param integer $rejection_date Date to use on the negative payment
|
||||
* @return int Id of negative payment line created
|
||||
*/
|
||||
public function rejectCheck($bank_id, $rejection_date)
|
||||
|
||||
@ -58,13 +58,13 @@ class Paiement extends CommonObject
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see amount, amounts
|
||||
* @see $amount, $amounts
|
||||
*/
|
||||
public $total;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see amount, amounts
|
||||
* @see $amount, $amounts
|
||||
*/
|
||||
public $montant;
|
||||
|
||||
|
||||
@ -121,7 +121,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes')
|
||||
$result=$object->delete($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
header("Location: index.php");
|
||||
header("Location: list.php");
|
||||
exit;
|
||||
}
|
||||
else
|
||||
|
||||
@ -154,7 +154,7 @@ abstract class ActionsContactCardCommon
|
||||
if ($user->admin) $this->tpl['info_admin'] = info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
|
||||
|
||||
// State
|
||||
if ($this->object->country_id) $this->tpl['select_state'] = $formcompany->select_state($this->object->fk_departement, $this->object->country_code);
|
||||
if ($this->object->country_id) $this->tpl['select_state'] = $formcompany->select_state($this->object->state_id, $this->object->country_code);
|
||||
else $this->tpl['select_state'] = $countrynotdefined;
|
||||
|
||||
// Public or private
|
||||
@ -289,7 +289,6 @@ abstract class ActionsContactCardCommon
|
||||
$this->object->address = $_POST["address"];
|
||||
$this->object->zip = $_POST["zipcode"];
|
||||
$this->object->town = $_POST["town"];
|
||||
$this->object->fk_departement = $_POST["state_id"];
|
||||
$this->object->country_id = $_POST["country_id"]?$_POST["country_id"]:$mysoc->country_id;
|
||||
$this->object->state_id = $_POST["state_id"];
|
||||
$this->object->phone_pro = $_POST["phone_pro"];
|
||||
|
||||
@ -356,7 +356,6 @@ if (empty($reshook))
|
||||
$object->zip = GETPOST("zipcode", 'alpha');
|
||||
$object->town = GETPOST("town", 'alpha');
|
||||
$object->state_id = GETPOST("state_id", 'int');
|
||||
$object->fk_departement = GETPOST("state_id", 'int'); // For backward compatibility
|
||||
$object->country_id = GETPOST("country_id", 'int');
|
||||
|
||||
$object->email = GETPOST("email", 'alpha');
|
||||
|
||||
@ -337,7 +337,6 @@ class Contact extends CommonObject
|
||||
$this->zip=(empty($this->zip)?'':$this->zip);
|
||||
$this->town=(empty($this->town)?'':$this->town);
|
||||
$this->country_id=($this->country_id > 0?$this->country_id:$this->country_id);
|
||||
$this->state_id=($this->state_id > 0?$this->state_id:$this->fk_departement);
|
||||
if (empty($this->statut)) $this->statut = 0;
|
||||
|
||||
$this->db->begin();
|
||||
@ -709,7 +708,7 @@ class Contact extends CommonObject
|
||||
$sql = "SELECT c.rowid, c.entity, c.fk_soc, c.ref_ext, c.civility as civility_id, c.lastname, c.firstname,";
|
||||
$sql.= " c.address, c.statut, c.zip, c.town,";
|
||||
$sql.= " c.fk_pays as country_id,";
|
||||
$sql.= " c.fk_departement,";
|
||||
$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.photo,";
|
||||
@ -759,12 +758,9 @@ class Contact extends CommonObject
|
||||
$this->date_creation = $this->db->jdate($obj->date_creation);
|
||||
$this->date_modification = $this->db->jdate($obj->date_modification);
|
||||
|
||||
$this->fk_departement = $obj->fk_departement; // deprecated
|
||||
$this->state_id = $obj->fk_departement;
|
||||
$this->departement_code = $obj->state_code; // deprecated
|
||||
$this->state_id = $obj->state_id;
|
||||
$this->state_code = $obj->state_code;
|
||||
$this->departement = $obj->state; // deprecated
|
||||
$this->state = $obj->state;
|
||||
$this->state = $obj->state;
|
||||
|
||||
$this->country_id = $obj->country_id;
|
||||
$this->country_code = $obj->country_id?$obj->country_code:'';
|
||||
|
||||
@ -446,7 +446,7 @@ $arrayofmassactions = array(
|
||||
// 'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
//if($user->rights->societe->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer");
|
||||
if ($user->rights->societe->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete");
|
||||
if ($user->rights->societe->supprimer) $arrayofmassactions['predelete']='<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
||||
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
|
||||
@ -165,7 +165,7 @@ class Contrat extends CommonObject
|
||||
|
||||
/**
|
||||
* @deprecated Use fk_project instead
|
||||
* @see fk_project
|
||||
* @see $fk_project
|
||||
*/
|
||||
public $fk_projet;
|
||||
|
||||
@ -305,7 +305,7 @@ class Contrat extends CommonObject
|
||||
* @param int $notrigger 1=Does not execute triggers, 0=Execute triggers
|
||||
* @param string $comment Comment
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @see closeAll
|
||||
* @see ()
|
||||
*/
|
||||
public function activateAll($user, $date_start = '', $notrigger = 0, $comment = '')
|
||||
{
|
||||
@ -361,7 +361,7 @@ class Contrat extends CommonObject
|
||||
* @param int $notrigger 1=Does not execute triggers, 0=Execute triggers
|
||||
* @param string $comment Comment
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @see activateAll
|
||||
* @see activateAll()
|
||||
*/
|
||||
public function closeAll(User $user, $notrigger = 0, $comment = '')
|
||||
{
|
||||
|
||||
@ -369,7 +369,7 @@ $arrayofmassactions = array(
|
||||
'presend'=>$langs->trans("SendByMail"),
|
||||
'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
if ($user->rights->contrat->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete");
|
||||
if ($user->rights->contrat->supprimer) $arrayofmassactions['predelete']='<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
||||
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
|
||||
@ -313,7 +313,7 @@ $arrayofmassactions = array(
|
||||
//'presend'=>$langs->trans("SendByMail"),
|
||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
//if ($user->rights->contrat->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete");
|
||||
//if ($user->rights->contrat->supprimer) $arrayofmassactions['predelete']='<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
||||
//if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
|
||||
@ -1069,4 +1069,54 @@ abstract class CommonDocGenerator
|
||||
}
|
||||
else return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Print standard column content
|
||||
*
|
||||
* @param PDF $pdf Pdf object
|
||||
* @param float $tab_top Tab top position
|
||||
* @param float $tab_height Default tab height
|
||||
* @param Translate $outputlangs Output language
|
||||
* @param int $hidetop Hide top
|
||||
* @return float Height of col tab titles
|
||||
*/
|
||||
public function pdfTabTitles(&$pdf, $tab_top, $tab_height, $outputlangs, $hidetop = 0)
|
||||
{
|
||||
global $hookmanager;
|
||||
|
||||
foreach ($this->cols as $colKey => $colDef) {
|
||||
|
||||
$parameters = array(
|
||||
'colKey' => $colKey,
|
||||
'pdf' => $pdf,
|
||||
'outputlangs' => $outputlangs,
|
||||
'tab_top' => $tab_top,
|
||||
'tab_height' => $tab_height,
|
||||
'hidetop' => $hidetop
|
||||
);
|
||||
|
||||
$reshook = $hookmanager->executeHooks('pdfTabTitles', $parameters, $this); // Note that $object may have been modified by hook
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
} elseif (empty($reshook)) {
|
||||
if (!$this->getColumnStatus($colKey)) continue;
|
||||
|
||||
// get title label
|
||||
$colDef['title']['label'] = !empty($colDef['title']['label']) ? $colDef['title']['label'] : $outputlangs->transnoentities($colDef['title']['textkey']);
|
||||
|
||||
// Add column separator
|
||||
if (!empty($colDef['border-left'])) {
|
||||
$pdf->line($colDef['xStartPos'], $tab_top, $colDef['xStartPos'], $tab_top + $tab_height);
|
||||
}
|
||||
|
||||
if (empty($hidetop)) {
|
||||
$pdf->SetXY($colDef['xStartPos'] + $colDef['title']['padding'][3], $tab_top + $colDef['title']['padding'][0]);
|
||||
$textWidth = $colDef['width'] - $colDef['title']['padding'][3] - $colDef['title']['padding'][1];
|
||||
$pdf->MultiCell($textWidth, 2, $colDef['title']['label'], '', $colDef['title']['align']);
|
||||
$this->tabTitleHeight = max($pdf->GetY() - $tab_top + $colDef['title']['padding'][2], $this->tabTitleHeight);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $this->tabTitleHeight;
|
||||
}
|
||||
}
|
||||
|
||||
@ -447,7 +447,7 @@ class Conf
|
||||
if (empty($this->global->SOCIETE_CODECOMPTA_ADDON)) $this->global->SOCIETE_CODECOMPTA_ADDON="mod_codecompta_panicum";
|
||||
|
||||
if (empty($this->global->CHEQUERECEIPTS_ADDON)) $this->global->CHEQUERECEIPTS_ADDON='mod_chequereceipt_mint';
|
||||
if (empty($conf->global->TICKETSUP_ADDON)) $this->global->TICKETSUP_ADDON='mod_ticket_simple';
|
||||
if (empty($conf->global->TICKET_ADDON)) $this->global->TICKET_ADDON='mod_ticket_simple';
|
||||
|
||||
// Security
|
||||
if (empty($this->global->USER_PASSWORD_GENERATED)) $this->global->USER_PASSWORD_GENERATED='standard'; // Default password generator
|
||||
|
||||
@ -1180,6 +1180,8 @@ class ExtraFields
|
||||
// 2 : key fields name (if differ of rowid)
|
||||
// 3 : key field parent (for dependent lists)
|
||||
// 4 : where clause filter on column or table extrafield, syntax field='value' or extra.field=value
|
||||
// 5 : id category type
|
||||
// 6 : ids categories list separated by comma for category root
|
||||
$keyList=(empty($InfoFieldList[2])?'rowid':$InfoFieldList[2].' as rowid');
|
||||
|
||||
|
||||
@ -1198,136 +1200,130 @@ class ExtraFields
|
||||
$keyList.= ', '.$parentField;
|
||||
}
|
||||
|
||||
$fields_label = explode('|', $InfoFieldList[1]);
|
||||
if (is_array($fields_label))
|
||||
{
|
||||
$keyList .=', ';
|
||||
$keyList .= implode(', ', $fields_label);
|
||||
}
|
||||
$filter_categorie = false;
|
||||
if (count($InfoFieldList) > 5) {
|
||||
if ($InfoFieldList[0] == 'categorie') {
|
||||
$filter_categorie = true;
|
||||
}
|
||||
}
|
||||
|
||||
$sqlwhere='';
|
||||
$sql = 'SELECT '.$keyList;
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX .$InfoFieldList[0];
|
||||
if (!empty($InfoFieldList[4]))
|
||||
{
|
||||
// can use curent entity filter
|
||||
if (strpos($InfoFieldList[4], '$ENTITY$')!==false) {
|
||||
$InfoFieldList[4]=str_replace('$ENTITY$', $conf->entity, $InfoFieldList[4]);
|
||||
}
|
||||
// can use SELECT request
|
||||
if (strpos($InfoFieldList[4], '$SEL$')!==false) {
|
||||
$InfoFieldList[4]=str_replace('$SEL$', 'SELECT', $InfoFieldList[4]);
|
||||
}
|
||||
if ($filter_categorie === false) {
|
||||
$fields_label = explode('|', $InfoFieldList[1]);
|
||||
if (is_array($fields_label)) {
|
||||
$keyList .= ', ';
|
||||
$keyList .= implode(', ', $fields_label);
|
||||
}
|
||||
|
||||
// current object id can be use into filter
|
||||
if (strpos($InfoFieldList[4], '$ID$')!==false && !empty($objectid)) {
|
||||
$InfoFieldList[4]=str_replace('$ID$', $objectid, $InfoFieldList[4]);
|
||||
} else {
|
||||
$InfoFieldList[4]=str_replace('$ID$', '0', $InfoFieldList[4]);
|
||||
}
|
||||
//We have to join on extrafield table
|
||||
if (strpos($InfoFieldList[4], 'extra')!==false)
|
||||
{
|
||||
$sql.= ' as main, '.MAIN_DB_PREFIX .$InfoFieldList[0].'_extrafields as extra';
|
||||
$sqlwhere.= ' WHERE extra.fk_object=main.'.$InfoFieldList[2]. ' AND '.$InfoFieldList[4];
|
||||
}
|
||||
else
|
||||
{
|
||||
$sqlwhere.= ' WHERE '.$InfoFieldList[4];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$sqlwhere.= ' WHERE 1=1';
|
||||
}
|
||||
// Some tables may have field, some other not. For the moment we disable it.
|
||||
if (in_array($InfoFieldList[0], array('tablewithentity')))
|
||||
{
|
||||
$sqlwhere.= ' AND entity = '.$conf->entity;
|
||||
}
|
||||
$sql.=$sqlwhere;
|
||||
//print $sql;
|
||||
$sqlwhere = '';
|
||||
$sql = 'SELECT ' . $keyList;
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $InfoFieldList[0];
|
||||
if (!empty($InfoFieldList[4])) {
|
||||
// can use curent entity filter
|
||||
if (strpos($InfoFieldList[4], '$ENTITY$') !== false) {
|
||||
$InfoFieldList[4] = str_replace('$ENTITY$', $conf->entity, $InfoFieldList[4]);
|
||||
}
|
||||
// can use SELECT request
|
||||
if (strpos($InfoFieldList[4], '$SEL$') !== false) {
|
||||
$InfoFieldList[4] = str_replace('$SEL$', 'SELECT', $InfoFieldList[4]);
|
||||
}
|
||||
|
||||
$sql .= ' ORDER BY ' . implode(', ', $fields_label);
|
||||
// current object id can be use into filter
|
||||
if (strpos($InfoFieldList[4], '$ID$') !== false && !empty($objectid)) {
|
||||
$InfoFieldList[4] = str_replace('$ID$', $objectid, $InfoFieldList[4]);
|
||||
} else {
|
||||
$InfoFieldList[4] = str_replace('$ID$', '0', $InfoFieldList[4]);
|
||||
}
|
||||
//We have to join on extrafield table
|
||||
if (strpos($InfoFieldList[4], 'extra') !== false) {
|
||||
$sql .= ' as main, ' . MAIN_DB_PREFIX . $InfoFieldList[0] . '_extrafields as extra';
|
||||
$sqlwhere .= ' WHERE extra.fk_object=main.' . $InfoFieldList[2] . ' AND ' . $InfoFieldList[4];
|
||||
} else {
|
||||
$sqlwhere .= ' WHERE ' . $InfoFieldList[4];
|
||||
}
|
||||
} else {
|
||||
$sqlwhere .= ' WHERE 1=1';
|
||||
}
|
||||
// Some tables may have field, some other not. For the moment we disable it.
|
||||
if (in_array($InfoFieldList[0], array('tablewithentity'))) {
|
||||
$sqlwhere .= ' AND entity = ' . $conf->entity;
|
||||
}
|
||||
$sql .= $sqlwhere;
|
||||
//print $sql;
|
||||
|
||||
dol_syslog(get_class($this).'::showInputField type=sellist', LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$out.='<option value="0"> </option>';
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$labeltoshow='';
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$sql .= ' ORDER BY ' . implode(', ', $fields_label);
|
||||
|
||||
// Several field into label (eq table:code|libelle:rowid)
|
||||
$notrans = false;
|
||||
$fields_label = explode('|', $InfoFieldList[1]);
|
||||
if (is_array($fields_label))
|
||||
{
|
||||
$notrans = true;
|
||||
foreach ($fields_label as $field_toshow)
|
||||
{
|
||||
$labeltoshow.= $obj->$field_toshow.' ';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$labeltoshow=$obj->{$InfoFieldList[1]};
|
||||
}
|
||||
$labeltoshow=dol_trunc($labeltoshow, 45);
|
||||
dol_syslog(get_class($this) . '::showInputField type=sellist', LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$out .= '<option value="0"> </option>';
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$labeltoshow = '';
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
if ($value == $obj->rowid)
|
||||
{
|
||||
foreach ($fields_label as $field_toshow)
|
||||
{
|
||||
$translabel=$langs->trans($obj->$field_toshow);
|
||||
if ($translabel!=$obj->$field_toshow) {
|
||||
$labeltoshow=dol_trunc($translabel, 18).' ';
|
||||
}else {
|
||||
$labeltoshow=dol_trunc($obj->$field_toshow, 18).' ';
|
||||
}
|
||||
}
|
||||
$out.='<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>';
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! $notrans)
|
||||
{
|
||||
$translabel=$langs->trans($obj->{$InfoFieldList[1]});
|
||||
if ($translabel!=$obj->{$InfoFieldList[1]}) {
|
||||
$labeltoshow=dol_trunc($translabel, 18);
|
||||
}
|
||||
else {
|
||||
$labeltoshow=dol_trunc($obj->{$InfoFieldList[1]}, 18);
|
||||
}
|
||||
}
|
||||
if (empty($labeltoshow)) $labeltoshow='(not defined)';
|
||||
if ($value==$obj->rowid)
|
||||
{
|
||||
$out.='<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>';
|
||||
}
|
||||
// Several field into label (eq table:code|libelle:rowid)
|
||||
$notrans = false;
|
||||
$fields_label = explode('|', $InfoFieldList[1]);
|
||||
if (is_array($fields_label)) {
|
||||
$notrans = true;
|
||||
foreach ($fields_label as $field_toshow) {
|
||||
$labeltoshow .= $obj->$field_toshow . ' ';
|
||||
}
|
||||
} else {
|
||||
$labeltoshow = $obj->{$InfoFieldList[1]};
|
||||
}
|
||||
$labeltoshow = dol_trunc($labeltoshow, 45);
|
||||
|
||||
if (!empty($InfoFieldList[3]) && $parentField)
|
||||
{
|
||||
$parent = $parentName.':'.$obj->{$parentField};
|
||||
}
|
||||
if ($value == $obj->rowid) {
|
||||
foreach ($fields_label as $field_toshow) {
|
||||
$translabel = $langs->trans($obj->$field_toshow);
|
||||
if ($translabel != $obj->$field_toshow) {
|
||||
$labeltoshow = dol_trunc($translabel, 18) . ' ';
|
||||
} else {
|
||||
$labeltoshow = dol_trunc($obj->$field_toshow, 18) . ' ';
|
||||
}
|
||||
}
|
||||
$out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>';
|
||||
} else {
|
||||
if (!$notrans) {
|
||||
$translabel = $langs->trans($obj->{$InfoFieldList[1]});
|
||||
if ($translabel != $obj->{$InfoFieldList[1]}) {
|
||||
$labeltoshow = dol_trunc($translabel, 18);
|
||||
} else {
|
||||
$labeltoshow = dol_trunc($obj->{$InfoFieldList[1]}, 18);
|
||||
}
|
||||
}
|
||||
if (empty($labeltoshow)) $labeltoshow = '(not defined)';
|
||||
if ($value == $obj->rowid) {
|
||||
$out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>';
|
||||
}
|
||||
|
||||
$out.='<option value="'.$obj->rowid.'"';
|
||||
$out.= ($value==$obj->rowid?' selected':'');
|
||||
$out.= (!empty($parent)?' parent="'.$parent.'"':'');
|
||||
$out.='>'.$labeltoshow.'</option>';
|
||||
}
|
||||
if (!empty($InfoFieldList[3]) && $parentField) {
|
||||
$parent = $parentName . ':' . $obj->{$parentField};
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
}
|
||||
else {
|
||||
print 'Error in request '.$sql.' '.$this->db->lasterror().'. Check setup of extra parameters.<br>';
|
||||
}
|
||||
$out .= '<option value="' . $obj->rowid . '"';
|
||||
$out .= ($value == $obj->rowid ? ' selected' : '');
|
||||
$out .= (!empty($parent) ? ' parent="' . $parent . '"' : '');
|
||||
$out .= '>' . $labeltoshow . '</option>';
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
} else {
|
||||
print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>';
|
||||
}
|
||||
} else {
|
||||
$data = $form->select_all_categories(Categorie::$MAP_ID_TO_CODE[$InfoFieldList[5]], '', 'parent', 64, $InfoFieldList[6], 1, 1);
|
||||
$out .= '<option value="0"> </option>';
|
||||
foreach ($data as $data_key => $data_value) {
|
||||
$out .= '<option value="' . $data_key . '"';
|
||||
$out .= ($value == $data_key ? ' selected' : '');
|
||||
$out .= '>' . $data_value . '</option>';
|
||||
}
|
||||
}
|
||||
}
|
||||
$out.='</select>';
|
||||
}
|
||||
@ -1367,6 +1363,8 @@ class ExtraFields
|
||||
// 2 : key fields name (if differ of rowid)
|
||||
// 3 : key field parent (for dependent lists)
|
||||
// 4 : where clause filter on column or table extrafield, syntax field='value' or extra.field=value
|
||||
// 5 : id category type
|
||||
// 6 : ids categories list separated by comma for category root
|
||||
$keyList = (empty($InfoFieldList[2]) ? 'rowid' : $InfoFieldList[2] . ' as rowid');
|
||||
|
||||
if (count($InfoFieldList) > 3 && ! empty($InfoFieldList[3])) {
|
||||
@ -1381,166 +1379,173 @@ class ExtraFields
|
||||
}
|
||||
}
|
||||
|
||||
$fields_label = explode('|', $InfoFieldList[1]);
|
||||
if (is_array($fields_label)) {
|
||||
$keyList .= ', ';
|
||||
$keyList .= implode(', ', $fields_label);
|
||||
}
|
||||
$filter_categorie = false;
|
||||
if (count($InfoFieldList) > 5) {
|
||||
if ($InfoFieldList[0] == 'categorie') {
|
||||
$filter_categorie = true;
|
||||
}
|
||||
}
|
||||
|
||||
$sqlwhere = '';
|
||||
$sql = 'SELECT ' . $keyList;
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $InfoFieldList[0];
|
||||
if (! empty($InfoFieldList[4])) {
|
||||
if ($filter_categorie === false) {
|
||||
$fields_label = explode('|', $InfoFieldList[1]);
|
||||
if (is_array($fields_label)) {
|
||||
$keyList .= ', ';
|
||||
$keyList .= implode(', ', $fields_label);
|
||||
}
|
||||
|
||||
// can use SELECT request
|
||||
if (strpos($InfoFieldList[4], '$SEL$')!==false) {
|
||||
$InfoFieldList[4]=str_replace('$SEL$', 'SELECT', $InfoFieldList[4]);
|
||||
}
|
||||
$sqlwhere = '';
|
||||
$sql = 'SELECT ' . $keyList;
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $InfoFieldList[0];
|
||||
if (!empty($InfoFieldList[4])) {
|
||||
|
||||
// current object id can be use into filter
|
||||
if (strpos($InfoFieldList[4], '$ID$')!==false && !empty($objectid)) {
|
||||
$InfoFieldList[4]=str_replace('$ID$', $objectid, $InfoFieldList[4]);
|
||||
} elseif (preg_match("#^.*list.php$#", $_SERVER["DOCUMENT_URI"])) {
|
||||
// Pattern for word=$ID$
|
||||
$word = '\b[a-zA-Z0-9-\.-_]+\b=\$ID\$';
|
||||
// can use SELECT request
|
||||
if (strpos($InfoFieldList[4], '$SEL$') !== false) {
|
||||
$InfoFieldList[4] = str_replace('$SEL$', 'SELECT', $InfoFieldList[4]);
|
||||
}
|
||||
|
||||
// Removing space arount =, ( and )
|
||||
$InfoFieldList[4]=preg_replace('# *(=|\(|\)) *#', '$1', $InfoFieldList[4]);
|
||||
// current object id can be use into filter
|
||||
if (strpos($InfoFieldList[4], '$ID$') !== false && !empty($objectid)) {
|
||||
$InfoFieldList[4] = str_replace('$ID$', $objectid, $InfoFieldList[4]);
|
||||
} elseif (preg_match("#^.*list.php$#", $_SERVER["DOCUMENT_URI"])) {
|
||||
// Pattern for word=$ID$
|
||||
$word = '\b[a-zA-Z0-9-\.-_]+\b=\$ID\$';
|
||||
|
||||
$nbPreg = 1;
|
||||
// While we have parenthesis
|
||||
while ($nbPreg!=0) {
|
||||
// Init des compteurs
|
||||
$nbPregRepl = $nbPregSel = 0;
|
||||
// On retire toutes les parenthèses sans = avant
|
||||
$InfoFieldList[4]=preg_replace('#([^=])(\([^)^(]*(' . $word . ')[^)^(]*\))#', '$1 $3 ', $InfoFieldList[4], -1, $nbPregRepl);
|
||||
// On retire les espaces autour des = et parenthèses
|
||||
$InfoFieldList[4]=preg_replace('# *(=|\(|\)) *#', '$1', $InfoFieldList[4]);
|
||||
// On retire toutes les parenthèses avec = avant
|
||||
$InfoFieldList[4]=preg_replace('#\b[a-zA-Z0-9-\.-_]+\b=\([^)^(]*(' . $word . ')[^)^(]*\)#', '$1 ', $InfoFieldList[4], -1, $nbPregSel);
|
||||
// On retire les espaces autour des = et parenthèses
|
||||
$InfoFieldList[4]=preg_replace('# *(=|\(|\)) *#', '$1', $InfoFieldList[4]);
|
||||
// Removing space arount =, ( and )
|
||||
$InfoFieldList[4] = preg_replace('# *(=|\(|\)) *#', '$1', $InfoFieldList[4]);
|
||||
|
||||
// Calcul du compteur général pour la boucle
|
||||
$nbPreg = $nbPregRepl + $nbPregSel;
|
||||
}
|
||||
$nbPreg = 1;
|
||||
// While we have parenthesis
|
||||
while ($nbPreg != 0) {
|
||||
// Init des compteurs
|
||||
$nbPregRepl = $nbPregSel = 0;
|
||||
// On retire toutes les parenthèses sans = avant
|
||||
$InfoFieldList[4] = preg_replace('#([^=])(\([^)^(]*(' . $word . ')[^)^(]*\))#', '$1 $3 ', $InfoFieldList[4], -1, $nbPregRepl);
|
||||
// On retire les espaces autour des = et parenthèses
|
||||
$InfoFieldList[4] = preg_replace('# *(=|\(|\)) *#', '$1', $InfoFieldList[4]);
|
||||
// On retire toutes les parenthèses avec = avant
|
||||
$InfoFieldList[4] = preg_replace('#\b[a-zA-Z0-9-\.-_]+\b=\([^)^(]*(' . $word . ')[^)^(]*\)#', '$1 ', $InfoFieldList[4], -1, $nbPregSel);
|
||||
// On retire les espaces autour des = et parenthèses
|
||||
$InfoFieldList[4] = preg_replace('# *(=|\(|\)) *#', '$1', $InfoFieldList[4]);
|
||||
|
||||
// Si l'on a un AND ou un OR, avant ou après
|
||||
preg_match('#(AND|OR|) *('.$word.') *(AND|OR|)#', $InfoFieldList[4], $matchCondition);
|
||||
while(!empty($matchCondition[0])) {
|
||||
// If the two sides differ but are not empty
|
||||
if (! empty($matchCondition[1]) && ! empty($matchCondition[3]) && $matchCondition[1] != $matchCondition[3] ) {
|
||||
// Nobody sain would do that without parentheses
|
||||
$InfoFieldList[4]=str_replace('$ID$', '0', $InfoFieldList[4]);
|
||||
}
|
||||
else {
|
||||
if (! empty($matchCondition[1])) {
|
||||
$boolCond =(( $matchCondition[1] == "AND" )?' AND 1 ':' OR 0 ');
|
||||
$InfoFieldList[4]=str_replace($matchCondition[0], $boolCond.$matchCondition[3], $InfoFieldList[4]);
|
||||
}
|
||||
elseif (! empty($matchCondition[3])) {
|
||||
$boolCond =(( $matchCondition[3] == "AND" )?' 1 AND ':' 0 OR');
|
||||
$InfoFieldList[4]=str_replace($matchCondition[0], $boolCond, $InfoFieldList[4]);
|
||||
}
|
||||
else {
|
||||
$InfoFieldList[4] = 1;
|
||||
}
|
||||
}
|
||||
// Calcul du compteur général pour la boucle
|
||||
$nbPreg = $nbPregRepl + $nbPregSel;
|
||||
}
|
||||
|
||||
// Si l'on a un AND ou un OR, avant ou après
|
||||
preg_match('#(AND|OR|) *('.$word.') *(AND|OR|)#', $InfoFieldList[4], $matchCondition);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$InfoFieldList[4]=str_replace('$ID$', '0', $InfoFieldList[4]);
|
||||
}
|
||||
// Si l'on a un AND ou un OR, avant ou après
|
||||
preg_match('#(AND|OR|) *(' . $word . ') *(AND|OR|)#', $InfoFieldList[4], $matchCondition);
|
||||
while (!empty($matchCondition[0])) {
|
||||
// If the two sides differ but are not empty
|
||||
if (!empty($matchCondition[1]) && !empty($matchCondition[3]) && $matchCondition[1] != $matchCondition[3]) {
|
||||
// Nobody sain would do that without parentheses
|
||||
$InfoFieldList[4] = str_replace('$ID$', '0', $InfoFieldList[4]);
|
||||
} else {
|
||||
if (!empty($matchCondition[1])) {
|
||||
$boolCond = (($matchCondition[1] == "AND") ? ' AND 1 ' : ' OR 0 ');
|
||||
$InfoFieldList[4] = str_replace($matchCondition[0], $boolCond . $matchCondition[3], $InfoFieldList[4]);
|
||||
} elseif (!empty($matchCondition[3])) {
|
||||
$boolCond = (($matchCondition[3] == "AND") ? ' 1 AND ' : ' 0 OR');
|
||||
$InfoFieldList[4] = str_replace($matchCondition[0], $boolCond, $InfoFieldList[4]);
|
||||
} else {
|
||||
$InfoFieldList[4] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// We have to join on extrafield table
|
||||
if (strpos($InfoFieldList[4], 'extra') !== false) {
|
||||
$sql .= ' as main, ' . MAIN_DB_PREFIX . $InfoFieldList[0] . '_extrafields as extra';
|
||||
$sqlwhere .= ' WHERE extra.fk_object=main.' . $InfoFieldList[2] . ' AND ' . $InfoFieldList[4];
|
||||
} else {
|
||||
$sqlwhere .= ' WHERE ' . $InfoFieldList[4];
|
||||
}
|
||||
} else {
|
||||
$sqlwhere .= ' WHERE 1=1';
|
||||
}
|
||||
// Some tables may have field, some other not. For the moment we disable it.
|
||||
if (in_array($InfoFieldList[0], array ('tablewithentity')))
|
||||
{
|
||||
$sqlwhere .= ' AND entity = ' . $conf->entity;
|
||||
}
|
||||
// $sql.=preg_replace('/^ AND /','',$sqlwhere);
|
||||
// print $sql;
|
||||
// Si l'on a un AND ou un OR, avant ou après
|
||||
preg_match('#(AND|OR|) *(' . $word . ') *(AND|OR|)#', $InfoFieldList[4], $matchCondition);
|
||||
}
|
||||
} else {
|
||||
$InfoFieldList[4] = str_replace('$ID$', '0', $InfoFieldList[4]);
|
||||
}
|
||||
|
||||
$sql .= $sqlwhere;
|
||||
dol_syslog(get_class($this) . '::showInputField type=chkbxlst', LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
// We have to join on extrafield table
|
||||
if (strpos($InfoFieldList[4], 'extra') !== false) {
|
||||
$sql .= ' as main, ' . MAIN_DB_PREFIX . $InfoFieldList[0] . '_extrafields as extra';
|
||||
$sqlwhere .= ' WHERE extra.fk_object=main.' . $InfoFieldList[2] . ' AND ' . $InfoFieldList[4];
|
||||
} else {
|
||||
$sqlwhere .= ' WHERE ' . $InfoFieldList[4];
|
||||
}
|
||||
} else {
|
||||
$sqlwhere .= ' WHERE 1=1';
|
||||
}
|
||||
// Some tables may have field, some other not. For the moment we disable it.
|
||||
if (in_array($InfoFieldList[0], array('tablewithentity'))) {
|
||||
$sqlwhere .= ' AND entity = ' . $conf->entity;
|
||||
}
|
||||
// $sql.=preg_replace('/^ AND /','',$sqlwhere);
|
||||
// print $sql;
|
||||
|
||||
$data=array();
|
||||
$sql .= $sqlwhere;
|
||||
dol_syslog(get_class($this) . '::showInputField type=chkbxlst', LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
while ( $i < $num ) {
|
||||
$labeltoshow = '';
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$data = array();
|
||||
|
||||
$notrans = false;
|
||||
// Several field into label (eq table:code|libelle:rowid)
|
||||
$fields_label = explode('|', $InfoFieldList[1]);
|
||||
if (is_array($fields_label)) {
|
||||
$notrans = true;
|
||||
foreach ($fields_label as $field_toshow) {
|
||||
$labeltoshow .= $obj->$field_toshow . ' ';
|
||||
}
|
||||
} else {
|
||||
$labeltoshow = $obj->{$InfoFieldList[1]};
|
||||
}
|
||||
$labeltoshow = dol_trunc($labeltoshow, 45);
|
||||
while ($i < $num) {
|
||||
$labeltoshow = '';
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
if (is_array($value_arr) && in_array($obj->rowid, $value_arr)) {
|
||||
foreach ($fields_label as $field_toshow) {
|
||||
$translabel = $langs->trans($obj->$field_toshow);
|
||||
if ($translabel != $obj->$field_toshow) {
|
||||
$labeltoshow = dol_trunc($translabel, 18) . ' ';
|
||||
} else {
|
||||
$labeltoshow = dol_trunc($obj->$field_toshow, 18) . ' ';
|
||||
}
|
||||
}
|
||||
$notrans = false;
|
||||
// Several field into label (eq table:code|libelle:rowid)
|
||||
$fields_label = explode('|', $InfoFieldList[1]);
|
||||
if (is_array($fields_label)) {
|
||||
$notrans = true;
|
||||
foreach ($fields_label as $field_toshow) {
|
||||
$labeltoshow .= $obj->$field_toshow . ' ';
|
||||
}
|
||||
} else {
|
||||
$labeltoshow = $obj->{$InfoFieldList[1]};
|
||||
}
|
||||
$labeltoshow = dol_trunc($labeltoshow, 45);
|
||||
|
||||
$data[$obj->rowid]=$labeltoshow;
|
||||
} else {
|
||||
if (! $notrans) {
|
||||
$translabel = $langs->trans($obj->{$InfoFieldList[1]});
|
||||
if ($translabel != $obj->{$InfoFieldList[1]}) {
|
||||
$labeltoshow = dol_trunc($translabel, 18);
|
||||
} else {
|
||||
$labeltoshow = dol_trunc($obj->{$InfoFieldList[1]}, 18);
|
||||
}
|
||||
}
|
||||
if (empty($labeltoshow))
|
||||
$labeltoshow = '(not defined)';
|
||||
if (is_array($value_arr) && in_array($obj->rowid, $value_arr)) {
|
||||
foreach ($fields_label as $field_toshow) {
|
||||
$translabel = $langs->trans($obj->$field_toshow);
|
||||
if ($translabel != $obj->$field_toshow) {
|
||||
$labeltoshow = dol_trunc($translabel, 18) . ' ';
|
||||
} else {
|
||||
$labeltoshow = dol_trunc($obj->$field_toshow, 18) . ' ';
|
||||
}
|
||||
}
|
||||
|
||||
if (is_array($value_arr) && in_array($obj->rowid, $value_arr)) {
|
||||
$data[$obj->rowid]=$labeltoshow;
|
||||
}
|
||||
$data[$obj->rowid] = $labeltoshow;
|
||||
} else {
|
||||
if (!$notrans) {
|
||||
$translabel = $langs->trans($obj->{$InfoFieldList[1]});
|
||||
if ($translabel != $obj->{$InfoFieldList[1]}) {
|
||||
$labeltoshow = dol_trunc($translabel, 18);
|
||||
} else {
|
||||
$labeltoshow = dol_trunc($obj->{$InfoFieldList[1]}, 18);
|
||||
}
|
||||
}
|
||||
if (empty($labeltoshow))
|
||||
$labeltoshow = '(not defined)';
|
||||
|
||||
if (! empty($InfoFieldList[3]) && $parentField) {
|
||||
$parent = $parentName . ':' . $obj->{$parentField};
|
||||
}
|
||||
if (is_array($value_arr) && in_array($obj->rowid, $value_arr)) {
|
||||
$data[$obj->rowid] = $labeltoshow;
|
||||
}
|
||||
|
||||
$data[$obj->rowid]=$labeltoshow;
|
||||
}
|
||||
if (!empty($InfoFieldList[3]) && $parentField) {
|
||||
$parent = $parentName . ':' . $obj->{$parentField};
|
||||
}
|
||||
|
||||
$i ++;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
$data[$obj->rowid] = $labeltoshow;
|
||||
}
|
||||
|
||||
$out=$form->multiselectarray($keyprefix.$key.$keysuffix, $data, $value_arr, '', 0, '', 0, '100%');
|
||||
} else {
|
||||
print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>';
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
$out = $form->multiselectarray($keyprefix . $key . $keysuffix, $data, $value_arr, '', 0, '', 0, '100%');
|
||||
} else {
|
||||
print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>';
|
||||
}
|
||||
} else {
|
||||
$data = $form->select_all_categories(Categorie::$MAP_ID_TO_CODE[$InfoFieldList[5]], '', 'parent', 64, $InfoFieldList[6], 1, 1);
|
||||
$out = $form->multiselectarray($keyprefix . $key . $keysuffix, $data, $value_arr, '', 0, '', 0, '100%');
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif ($type == 'link')
|
||||
|
||||
@ -596,12 +596,13 @@ class Form
|
||||
$ret.='<option value="0"'.($disabled?' disabled="disabled"':'').'>-- '.$langs->trans("SelectAction").' --</option>';
|
||||
foreach($arrayofaction as $code => $label)
|
||||
{
|
||||
$ret.='<option value="'.$code.'"'.($disabled?' disabled="disabled"':'').'>'.$label.'</option>';
|
||||
$ret.='<option value="'.$code.'"'.($disabled?' disabled="disabled"':'').' data-html="'.dol_escape_htmltag($label).'">'.$label.'</option>';
|
||||
}
|
||||
}
|
||||
$ret.=$hookmanager->resPrint;
|
||||
|
||||
$ret.='</select>';
|
||||
$ret.=ajax_combobox('.massactionselect');
|
||||
// Warning: if you set submit button to disabled, post using 'Enter' will no more work if there is no another input submit. So we add a hidden button
|
||||
$ret.='<input type="submit" name="confirmmassactioninvisible" style="display: none" tabindex="-1">'; // Hidden button BEFORE so it is the one used when we submit with ENTER.
|
||||
$ret.='<input type="submit" disabled name="confirmmassaction" class="button'.(empty($conf->use_javascript_ajax)?'':' hideobject').' massaction massactionconfirmed" value="'.dol_escape_htmltag($langs->trans("Confirm")).'">';
|
||||
@ -3801,16 +3802,21 @@ class Form
|
||||
/**
|
||||
* Return list of categories having choosed type
|
||||
*
|
||||
* @param string|int $type Type of category ('customer', 'supplier', 'contact', 'product', 'member'). Old mode (0, 1, 2, ...) is deprecated.
|
||||
* @param string $selected Id of category preselected or 'auto' (autoselect category if there is only one element)
|
||||
* @param string $htmlname HTML field name
|
||||
* @param int $maxlength Maximum length for labels
|
||||
* @param int $excludeafterid Exclude all categories after this leaf in category tree.
|
||||
* @param int $outputmode 0=HTML select string, 1=Array
|
||||
* @param string|int $type Type of category ('customer', 'supplier', 'contact', 'product', 'member'). Old mode (0, 1, 2, ...) is deprecated.
|
||||
* @param string $selected Id of category preselected or 'auto' (autoselect category if there is only one element)
|
||||
* @param string $htmlname HTML field name
|
||||
* @param int $maxlength Maximum length for labels
|
||||
* @param int|string|array $markafterid Keep only or removed all categories including the leaf $markafterid in category tree (exclude) or Keep only of category is inside the leaf starting with this id.
|
||||
* $markafterid can be an :
|
||||
* - int (id of category)
|
||||
* - string (categories ids seprated by comma)
|
||||
* - array (list of categories ids)
|
||||
* @param int $outputmode 0=HTML select string, 1=Array
|
||||
* @param int $include [=0] Removed or 1=Keep only
|
||||
* @return string
|
||||
* @see select_categories()
|
||||
*/
|
||||
public function select_all_categories($type, $selected = '', $htmlname = "parent", $maxlength = 64, $excludeafterid = 0, $outputmode = 0)
|
||||
public function select_all_categories($type, $selected = '', $htmlname = "parent", $maxlength = 64, $markafterid = 0, $outputmode = 0, $include = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf, $langs;
|
||||
@ -3850,7 +3856,7 @@ class Form
|
||||
else
|
||||
{
|
||||
$cat = new Categorie($this->db);
|
||||
$cate_arbo = $cat->get_full_arbo($type, $excludeafterid);
|
||||
$cate_arbo = $cat->get_full_arbo($type, $markafterid, $include);
|
||||
}
|
||||
|
||||
$output = '<select class="flat" name="'.$htmlname.'" id="'.$htmlname.'">';
|
||||
@ -5828,7 +5834,7 @@ class Form
|
||||
* Note: Do not apply langs->trans function on returned content, content may be entity encoded twice.
|
||||
*
|
||||
* @param string $htmlname Name of html select area. Must start with "multi" if this is a multiselect
|
||||
* @param array $array Array (key => value)
|
||||
* @param array $array Array like array(key => value) or array(key=>array('label'=>..., 'data-...'=>...))
|
||||
* @param string|string[] $id Preselected key or preselected keys for multiselect
|
||||
* @param int|string $show_empty 0 no empty value allowed, 1 or string to add an empty value into list (key is -1 and value is '' or ' ' if 1, key is -1 and value is text if string), <0 to add an empty value with key that is this value.
|
||||
* @param int $key_in_label 1 to show key into label with format "[key] value"
|
||||
@ -5889,7 +5895,8 @@ class Form
|
||||
{
|
||||
foreach($array as $key => $value)
|
||||
{
|
||||
$array[$key]=$langs->trans($value);
|
||||
if (! is_array($value)) $array[$key]=$langs->trans($value);
|
||||
else $array[$key]['label']=$langs->trans($value['label']);
|
||||
}
|
||||
}
|
||||
|
||||
@ -5897,8 +5904,11 @@ class Form
|
||||
if ($sort == 'ASC') asort($array);
|
||||
elseif ($sort == 'DESC') arsort($array);
|
||||
|
||||
foreach($array as $key => $value)
|
||||
foreach($array as $key => $tmpvalue)
|
||||
{
|
||||
if (is_array($tmpvalue)) $value=$tmpvalue['label'];
|
||||
else $value = $tmpvalue;
|
||||
|
||||
$disabled=''; $style='';
|
||||
if (! empty($disablebademail))
|
||||
{
|
||||
@ -5926,6 +5936,13 @@ class Form
|
||||
$out.=$style.$disabled;
|
||||
if ($id != '' && $id == $key && ! $disabled) $out.=' selected'; // To preselect a value
|
||||
if ($nohtmlescape) $out.=' data-html="'.dol_escape_htmltag($selectOptionValue).'"';
|
||||
if (is_array($tmpvalue))
|
||||
{
|
||||
foreach($tmpvalue as $keyforvalue => $valueforvalue)
|
||||
{
|
||||
if (preg_match('/^data-/', $keyforvalue)) $out.=' '.$keyforvalue.'="'.$valueforvalue.'"';
|
||||
}
|
||||
}
|
||||
$out.='>';
|
||||
//var_dump($selectOptionValue);
|
||||
$out.=$selectOptionValue;
|
||||
@ -7288,8 +7305,10 @@ class Form
|
||||
global $conf, $langs;
|
||||
|
||||
$out='<div class="nowrap">';
|
||||
$out.='<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"), 'search.png', '', '', 1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
$out.='<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
//$out.='<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"), 'search.png', '', '', 1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
//$out.='<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
$out.='<button type="submit" class="liste_titre button_search" name="button_search_x" value="x"><span class="fa fa-search"></span></button>';
|
||||
$out.='<button type="submit" class="liste_titre button_removefilter" name="button_removefilter_x" value="x"><span class="fa fa-remove"></span></button>';
|
||||
$out.='</div>';
|
||||
|
||||
return $out;
|
||||
|
||||
@ -1561,10 +1561,9 @@ function dol_add_file_process($upload_dir, $allowoverwrite = 0, $donotupdatesess
|
||||
|
||||
// dol_sanitizeFileName the file name and lowercase extension
|
||||
$info = pathinfo($destfull);
|
||||
$destfull = $info['dirname'].'/'.dol_sanitizeFileName($info['filename'].'.'.strtolower($info['extension']));
|
||||
$destfull = $info['dirname'].'/'.dol_sanitizeFileName($info['filename'].($info['extension']!='' ? ('.'.strtolower($info['extension'])) : ''));
|
||||
$info = pathinfo($destfile);
|
||||
$destfile = dol_sanitizeFileName($info['filename'].'.'.strtolower($info['extension']));
|
||||
|
||||
$destfile = dol_sanitizeFileName($info['filename'].($info['extension']!='' ? ('.'.strtolower($info['extension'])) : ''));
|
||||
$resupload = dol_move_uploaded_file($TFile['tmp_name'][$i], $destfull, $allowoverwrite, 0, $TFile['error'][$i], 0, $varfiles);
|
||||
|
||||
if (is_numeric($resupload) && $resupload > 0) // $resupload can be 'ErrorFileAlreadyExists'
|
||||
|
||||
@ -226,7 +226,7 @@ function GETPOSTISSET($paramname)
|
||||
* 'san_alpha'=Use filter_var with FILTER_SANITIZE_STRING (do not use this for free text string)
|
||||
* 'nohtml', 'alphanohtml'=check there is no html content
|
||||
* 'custom'= custom filter specify $filter and $options)
|
||||
* @param int $method Type of method (0 = get then post, 1 = only get, 2 = only post, 3 = post then get, 4 = post then get then cookie)
|
||||
* @param int $method Type of method (0 = get then post, 1 = only get, 2 = only post, 3 = post then get)
|
||||
* @param int $filter Filter to apply when $check is set to 'custom'. (See http://php.net/manual/en/filter.filters.php for détails)
|
||||
* @param mixed $options Options to pass to filter_var when $check is set to 'custom'
|
||||
* @param string $noreplace Force disable of replacement of __xxx__ strings.
|
||||
@ -248,7 +248,6 @@ function GETPOST($paramname, $check = 'none', $method = 0, $filter = null, $opti
|
||||
elseif ($method==1) $out = isset($_GET[$paramname])?$_GET[$paramname]:'';
|
||||
elseif ($method==2) $out = isset($_POST[$paramname])?$_POST[$paramname]:'';
|
||||
elseif ($method==3) $out = isset($_POST[$paramname])?$_POST[$paramname]:(isset($_GET[$paramname])?$_GET[$paramname]:'');
|
||||
elseif ($method==4) $out = isset($_POST[$paramname])?$_POST[$paramname]:(isset($_GET[$paramname])?$_GET[$paramname]:(isset($_COOKIE[$paramname])?$_COOKIE[$paramname]:''));
|
||||
else return 'BadThirdParameterForGETPOST';
|
||||
|
||||
if (empty($method) || $method == 3 || $method == 4)
|
||||
@ -574,34 +573,41 @@ if (! function_exists('dol_getprefix'))
|
||||
{
|
||||
/**
|
||||
* Return a prefix to use for this Dolibarr instance, for session/cookie names or email id.
|
||||
* The prefix for session is unique in a web context only and is unique for instance and avoid conflict
|
||||
* between multi-instances, even when having two instances with same root dir or two instances in same virtual servers.
|
||||
* The prefix for email is unique if MAIL_PREFIX_FOR_EMAIL_ID is set to a value, otherwise value may be same than other instance.
|
||||
* The prefix is unique for instance and avoid conflict between multi-instances, even when having two instances with same root dir
|
||||
* or two instances in same virtual servers.
|
||||
*
|
||||
* @param string $mode '' (prefix for session name) or 'email' (prefix for email id)
|
||||
* @return string A calculated prefix
|
||||
*/
|
||||
function dol_getprefix($mode = '')
|
||||
{
|
||||
global $conf;
|
||||
global $conf;
|
||||
|
||||
// If prefix is for email
|
||||
if ($mode == 'email')
|
||||
{
|
||||
if (! empty($conf->global->MAIL_PREFIX_FOR_EMAIL_ID)) // If MAIL_PREFIX_FOR_EMAIL_ID is set (a value initialized with a random value is recommended)
|
||||
if (! empty($conf->global->MAIL_PREFIX_FOR_EMAIL_ID)) // If MAIL_PREFIX_FOR_EMAIL_ID is set (a value initialized with a random value is recommended)
|
||||
{
|
||||
if ($conf->global->MAIL_PREFIX_FOR_EMAIL_ID != 'SERVER_NAME') return $conf->global->MAIL_PREFIX_FOR_EMAIL_ID;
|
||||
elseif (isset($_SERVER["SERVER_NAME"])) return $_SERVER["SERVER_NAME"];
|
||||
}
|
||||
|
||||
// The recommended value (may be not defined for old versions)
|
||||
if (! empty($conf->file->instance_unique_id)) return $conf->file->instance_unique_id;
|
||||
|
||||
// For backward compatibility
|
||||
return dol_hash(DOL_DOCUMENT_ROOT.DOL_URL_ROOT, '3');
|
||||
}
|
||||
|
||||
// The recommended value (may be not defined for old versions)
|
||||
if (! empty($conf->file->instance_unique_id)) return $conf->file->instance_unique_id;
|
||||
|
||||
// For backward compatibility
|
||||
if (isset($_SERVER["SERVER_NAME"]) && isset($_SERVER["DOCUMENT_ROOT"]))
|
||||
{
|
||||
return dol_hash($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].DOL_DOCUMENT_ROOT.DOL_URL_ROOT, '3');
|
||||
// Use this for a "readable" key
|
||||
//return dol_sanitizeFileName($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].DOL_DOCUMENT_ROOT.DOL_URL_ROOT);
|
||||
}
|
||||
|
||||
return dol_hash(DOL_DOCUMENT_ROOT.DOL_URL_ROOT, '3');
|
||||
}
|
||||
}
|
||||
@ -1633,7 +1639,7 @@ function dol_format_address($object, $withcountry = 0, $sep = "\n", $outputlangs
|
||||
{
|
||||
$ret .= ($ret ? $sep : '' ).$object->zip;
|
||||
$ret .= ($object->town?(($object->zip?' ':'').$object->town):'');
|
||||
$ret .= ($object->departement_id?(' ('.($object->departement_id).')'):'');
|
||||
$ret .= ($object->state_id?(' ('.($object->state_id).')'):'');
|
||||
}
|
||||
else // Other: title firstname name \n address lines \n zip town \n country
|
||||
{
|
||||
|
||||
@ -2115,6 +2115,10 @@ function getElementProperties($element_type)
|
||||
$subelement='facturefournisseur';
|
||||
$classfile='fournisseur.facture';
|
||||
}
|
||||
if ($element_type == "service") {
|
||||
$classpath = 'product/class';
|
||||
$subelement='product';
|
||||
}
|
||||
|
||||
if (!isset($classfile)) $classfile = strtolower($subelement);
|
||||
if (!isset($classname)) $classname = ucfirst($subelement);
|
||||
@ -2457,10 +2461,10 @@ if (! function_exists('dolEscapeXML'))
|
||||
/**
|
||||
* Return automatic or manual in current language
|
||||
*
|
||||
* @param string $automaticmanual Value to test (1, 'automatic', 'true' or 0, 'manual', 'false')
|
||||
* @param integer $case 1=Yes/No, 0=yes/no, 2=Disabled checkbox, 3=Disabled checkbox + Automatic/Manual
|
||||
* @param int $color 0=texte only, 1=Text is formated with a color font style ('ok' or 'error'), 2=Text is formated with 'ok' color.
|
||||
* @return string HTML string
|
||||
* @param string $automaticmanual Value to test (1, 'automatic', 'true' or 0, 'manual', 'false')
|
||||
* @param integer $case 1=Yes/No, 0=yes/no, 2=Disabled checkbox, 3=Disabled checkbox + Automatic/Manual
|
||||
* @param int $color 0=texte only, 1=Text is formated with a color font style ('ok' or 'error'), 2=Text is formated with 'ok' color.
|
||||
* @return string HTML string
|
||||
*/
|
||||
function autoOrManual($automaticmanual, $case = 1, $color = 0)
|
||||
{
|
||||
@ -2475,7 +2479,7 @@ function autoOrManual($automaticmanual, $case = 1, $color = 0)
|
||||
|
||||
$classname='ok';
|
||||
}
|
||||
elseif ($yesno == 0 || strtolower($automaticmanual) == 'manual' || strtolower($automaticmanual) == 'false')
|
||||
elseif ($automaticmanual == 0 || strtolower($automaticmanual) == 'manual' || strtolower($automaticmanual) == 'false')
|
||||
{
|
||||
$result=$langs->trans("manual");
|
||||
if ($case == 1 || $case == 3) $result=$langs->trans("Manual");
|
||||
|
||||
@ -68,7 +68,7 @@ function commande_prepare_head(Commande $object)
|
||||
if ($conf->expedition_bon->enabled && $conf->livraison_bon->enabled) $text.='/';
|
||||
if ($conf->livraison_bon->enabled) $text.=$langs->trans("Receivings");
|
||||
if ($nbShipments > 0 || $nbReceiption > 0) $text.= ' <span class="badge">'.($nbShipments?$nbShipments:0);
|
||||
if ($conf->expedition_bon->enabled && $conf->livraison_bon->enabled) $text.='/';
|
||||
if ($conf->expedition_bon->enabled && $conf->livraison_bon->enabled && ($nbShipments > 0 || $nbReceiption > 0)) $text.='/';
|
||||
if ($conf->expedition_bon->enabled && $conf->livraison_bon->enabled && ($nbShipments > 0 || $nbReceiption > 0)) $text.= ($nbReceiption?$nbReceiption:0);
|
||||
if ($nbShipments > 0 || $nbReceiption > 0) $text.= '</span>';
|
||||
$head[$h][1] = $text;
|
||||
|
||||
@ -341,14 +341,14 @@ function pdfBuildThirdpartyName($thirdparty, Translate $outputlangs, $includeali
|
||||
/**
|
||||
* Return a string with full address formated for output on documents
|
||||
*
|
||||
* @param Translate $outputlangs Output langs object
|
||||
* @param Societe $sourcecompany Source company object
|
||||
* @param Societe $targetcompany Target company object
|
||||
* @param Contact $targetcontact Target contact object
|
||||
* @param int $usecontact Use contact instead of company
|
||||
* @param int $mode Address type ('source', 'target', 'targetwithdetails', 'targetwithdetails_xxx': target but include also phone/fax/email/url)
|
||||
* @param Object $object Object we want to build document for
|
||||
* @return string String with full address
|
||||
* @param Translate $outputlangs Output langs object
|
||||
* @param Societe $sourcecompany Source company object
|
||||
* @param Societe|string $targetcompany Target company object
|
||||
* @param Contact|string $targetcontact Target contact object
|
||||
* @param int $usecontact Use contact instead of company
|
||||
* @param string $mode Address type ('source', 'target', 'targetwithdetails', 'targetwithdetails_xxx': target but include also phone/fax/email/url)
|
||||
* @param Object $object Object we want to build document for
|
||||
* @return string String with full address
|
||||
*/
|
||||
function pdf_build_address($outputlangs, $sourcecompany, $targetcompany = '', $targetcontact = '', $usecontact = 0, $mode = 'source', $object = null)
|
||||
{
|
||||
@ -357,12 +357,8 @@ function pdf_build_address($outputlangs, $sourcecompany, $targetcompany = '', $t
|
||||
if ($mode == 'source' && ! is_object($sourcecompany)) return -1;
|
||||
if ($mode == 'target' && ! is_object($targetcompany)) return -1;
|
||||
|
||||
if (! empty($sourcecompany->state_id) && empty($sourcecompany->departement)) $sourcecompany->departement=getState($sourcecompany->state_id); //TODO deprecated
|
||||
if (! empty($sourcecompany->state_id) && empty($sourcecompany->state)) $sourcecompany->state=getState($sourcecompany->state_id);
|
||||
if (! empty($sourcecompany->state_id) && !isset($sourcecompany->departement_id)) $sourcecompany->departement_id=getState($sourcecompany->state_id, '2');
|
||||
if (! empty($targetcompany->state_id) && empty($targetcompany->departement)) $targetcompany->departement=getState($targetcompany->state_id); //TODO deprecated
|
||||
if (! empty($targetcompany->state_id) && empty($targetcompany->state)) $targetcompany->state=getState($targetcompany->state_id);
|
||||
if (! empty($targetcompany->state_id) && !isset($targetcompany->departement_id)) $targetcompany->departement_id=getState($targetcompany->state_id, '2');
|
||||
if (! empty($sourcecompany->state_id) && empty($sourcecompany->state)) $sourcecompany->state=getState($sourcecompany->state_id);
|
||||
if (! empty($targetcompany->state_id) && empty($targetcompany->state)) $targetcompany->state=getState($targetcompany->state_id);
|
||||
|
||||
$reshook=0;
|
||||
$stringaddress = '';
|
||||
|
||||
@ -127,6 +127,25 @@ function product_prepare_head($object)
|
||||
$h++;
|
||||
}
|
||||
}
|
||||
|
||||
// Tab to link resources
|
||||
if (!empty($conf->resource->enabled))
|
||||
{
|
||||
if ($object->isProduct() && ! empty($conf->global->RESOURCE_ON_PRODUCTS))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT . '/resource/element_resource.php?element=product&ref=' . $object->ref;
|
||||
$head[$h][1] = $langs->trans("Resources");
|
||||
$head[$h][2] = 'resources';
|
||||
$h++;
|
||||
}
|
||||
if ($object->isService() && ! empty($conf->global->RESOURCE_ON_SERVICES))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT . '/resource/element_resource.php?element=service&ref=' . $object->ref;
|
||||
$head[$h][1] = $langs->trans("Resources");
|
||||
$head[$h][2] = 'resources';
|
||||
$h++;
|
||||
}
|
||||
}
|
||||
|
||||
// Show more tabs from modules
|
||||
// Entries must be declared in modules descriptor with line
|
||||
|
||||
@ -600,8 +600,7 @@ function dolSaveMasterFile($filemaster)
|
||||
$mastercontent = '<?php'."\n";
|
||||
$mastercontent.= '// File generated to link to the master file - DO NOT MODIFY - It is just an include'."\n";
|
||||
$mastercontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) require_once '".DOL_DOCUMENT_ROOT."/master.inc.php';\n";
|
||||
$mastercontent.= "\n";
|
||||
|
||||
$mastercontent.= '?>'."\n";
|
||||
$result = file_put_contents($filemaster, $mastercontent);
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@chmod($filemaster, octdec($conf->global->MAIN_UMASK));
|
||||
@ -629,8 +628,7 @@ function dolSavePageAlias($filealias, $object, $objectpage)
|
||||
$aliascontent.= 'global $dolibarr_main_data_root;'."\n";
|
||||
$aliascontent.= 'if (empty($dolibarr_main_data_root)) require \'./page'.$objectpage->id.'.tpl.php\'; ';
|
||||
$aliascontent.= 'else require $dolibarr_main_data_root.\'/website/\'.$website->ref.\'/page'.$objectpage->id.'.tpl.php\';'."\n";
|
||||
$aliascontent.= "\n";
|
||||
|
||||
$aliascontent.= '?>'."\n";
|
||||
$result = file_put_contents($filealias, $aliascontent);
|
||||
if (! empty($conf->global->MAIN_UMASK)) {
|
||||
@chmod($filealias, octdec($conf->global->MAIN_UMASK));
|
||||
@ -701,7 +699,7 @@ function dolSavePageContent($filetpl, $object, $objectpage)
|
||||
|
||||
$tplcontent.= '<?php // BEGIN PHP'."\n";
|
||||
$tplcontent.= '$tmp = ob_get_contents(); ob_end_clean(); dolWebsiteOutput($tmp);'."\n";
|
||||
$tplcontent.= "// END PHP"."\n";
|
||||
$tplcontent.= "// END PHP ?>"."\n";
|
||||
|
||||
//var_dump($filetpl);exit;
|
||||
$result = file_put_contents($filetpl, $tplcontent);
|
||||
@ -741,8 +739,7 @@ function dolSaveIndexPage($pathofwebsite, $fileindex, $filetpl, $filewrapper)
|
||||
$indexcontent.= ' redirectToContainer($_GET[\'pageref\'], $_GET[\'pagealiasalt\'], $_GET[\'pageid\']);'."\n";
|
||||
$indexcontent.= "}\n";
|
||||
$indexcontent.= "include_once './".basename($filetpl)."'\n";
|
||||
$indexcontent.= '// END PHP'."\n";
|
||||
|
||||
$indexcontent.= '// END PHP ?>'."\n";
|
||||
$result1 = file_put_contents($fileindex, $indexcontent);
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@chmod($fileindex, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
75
htdocs/core/login/functions_googleoauth.php
Normal file
75
htdocs/core/login/functions_googleoauth.php
Normal file
@ -0,0 +1,75 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2007-2009 Regis Houssin <regis.houssin@inodbox.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/login/functions_googleoauth.php
|
||||
* \ingroup core
|
||||
* \brief Authentication functions for Google OAuth mode using "Server flow"
|
||||
* Another method could be to use the "Implicit flow" using Google-Signin library.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//include_once DOL_DOCUMENT_ROOT.'/core/class/openid.class.php';
|
||||
|
||||
|
||||
/**
|
||||
* Check validity of user/password/entity
|
||||
* If test is ko, reason must be filled into $_SESSION["dol_loginmesg"]
|
||||
*
|
||||
* @param string $usertotest Login
|
||||
* @param string $passwordtotest Password
|
||||
* @param int $entitytotest Number of instance (always 1 if module multicompany not enabled)
|
||||
* @return string Login if OK, '' if KO
|
||||
*/
|
||||
function check_user_password_googleoauth($usertotest, $passwordtotest, $entitytotest)
|
||||
{
|
||||
global $_POST,$db,$conf,$langs;
|
||||
|
||||
dol_syslog("functions_googleoauth::check_user_password_googleoauth usertotest=".$usertotest);
|
||||
|
||||
$login='';
|
||||
|
||||
// Get identity from user and redirect browser to Google OAuth Server
|
||||
if (isset($_POST['username']))
|
||||
{
|
||||
/*$openid = new SimpleOpenID();
|
||||
$openid->SetIdentity($_POST['username']);
|
||||
$protocol = ($conf->file->main_force_https ? 'https://' : 'http://');
|
||||
$openid->SetTrustRoot($protocol . $_SERVER["HTTP_HOST"]);
|
||||
$openid->SetRequiredFields(array('email','fullname'));
|
||||
$_SESSION['dol_entity'] = $_POST["entity"];
|
||||
//$openid->SetOptionalFields(array('dob','gender','postcode','country','language','timezone'));
|
||||
if ($openid->sendDiscoveryRequestToGetXRDS())
|
||||
{
|
||||
$openid->SetApprovedURL($protocol . $_SERVER["HTTP_HOST"] . $_SERVER["SCRIPT_NAME"]); // Send Response from OpenID server to this script
|
||||
$openid->Redirect(); // This will redirect user to OpenID Server
|
||||
}
|
||||
else
|
||||
{
|
||||
$error = $openid->GetError();
|
||||
return false;
|
||||
}
|
||||
return false;*/
|
||||
}
|
||||
|
||||
|
||||
return $login;
|
||||
}
|
||||
@ -116,7 +116,7 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
|
||||
/**
|
||||
* Issuer
|
||||
* @var Company object that emits
|
||||
* @var Societe object that emits
|
||||
*/
|
||||
public $emetteur;
|
||||
|
||||
|
||||
@ -83,32 +83,32 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
* @var int page_largeur
|
||||
*/
|
||||
public $page_largeur;
|
||||
|
||||
|
||||
/**
|
||||
* @var int page_hauteur
|
||||
*/
|
||||
public $page_hauteur;
|
||||
|
||||
|
||||
/**
|
||||
* @var array format
|
||||
*/
|
||||
public $format;
|
||||
|
||||
|
||||
/**
|
||||
* @var int marge_gauche
|
||||
*/
|
||||
public $marge_gauche;
|
||||
|
||||
|
||||
/**
|
||||
* @var int marge_droite
|
||||
*/
|
||||
public $marge_droite;
|
||||
|
||||
|
||||
/**
|
||||
* @var int marge_haute
|
||||
*/
|
||||
public $marge_haute;
|
||||
|
||||
|
||||
/**
|
||||
* @var int marge_basse
|
||||
*/
|
||||
@ -170,6 +170,8 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
$this->posxdesc=$this->marge_gauche+1;
|
||||
|
||||
|
||||
$this->tabTitleHeight = 5; // default height
|
||||
|
||||
$this->tva=array();
|
||||
$this->localtax1=array();
|
||||
$this->localtax2=array();
|
||||
@ -203,6 +205,73 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
|
||||
$nblignes = count($object->lines);
|
||||
|
||||
$hidetop=0;
|
||||
if(!empty($conf->global->MAIN_PDF_DISABLE_COL_HEAD_TITLE)){
|
||||
$hidetop=$conf->global->MAIN_PDF_DISABLE_COL_HEAD_TITLE;
|
||||
}
|
||||
|
||||
// Loop on each lines to detect if there is at least one image to show
|
||||
$realpatharray=array();
|
||||
$this->atleastonephoto = false;
|
||||
if (! empty($conf->global->MAIN_GENERATE_ORDERS_WITH_PICTURE))
|
||||
{
|
||||
$objphoto = new Product($this->db);
|
||||
|
||||
for ($i = 0 ; $i < $nblignes ; $i++)
|
||||
{
|
||||
if (empty($object->lines[$i]->fk_product)) continue;
|
||||
|
||||
$objphoto->fetch($object->lines[$i]->fk_product);
|
||||
//var_dump($objphoto->ref);exit;
|
||||
if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO))
|
||||
{
|
||||
$pdir[0] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product') . $objphoto->id ."/photos/";
|
||||
$pdir[1] = get_exdir(0, 0, 0, 0, $objphoto, 'product') . dol_sanitizeFileName($objphoto->ref).'/';
|
||||
}
|
||||
else
|
||||
{
|
||||
$pdir[0] = get_exdir(0, 0, 0, 0, $objphoto, 'product') . dol_sanitizeFileName($objphoto->ref).'/'; // default
|
||||
$pdir[1] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product') . $objphoto->id ."/photos/"; // alternative
|
||||
}
|
||||
|
||||
$arephoto = false;
|
||||
foreach ($pdir as $midir)
|
||||
{
|
||||
if (! $arephoto)
|
||||
{
|
||||
$dir = $conf->product->dir_output.'/'.$midir;
|
||||
|
||||
foreach ($objphoto->liste_photos($dir, 1) as $key => $obj)
|
||||
{
|
||||
if (empty($conf->global->CAT_HIGH_QUALITY_IMAGES)) // If CAT_HIGH_QUALITY_IMAGES not defined, we use thumb if defined and then original photo
|
||||
{
|
||||
if ($obj['photo_vignette'])
|
||||
{
|
||||
$filename= $obj['photo_vignette'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$filename=$obj['photo'];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$filename=$obj['photo'];
|
||||
}
|
||||
|
||||
$realpath = $dir.$filename;
|
||||
$arephoto = true;
|
||||
$this->atleastonephoto = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($realpath && $arephoto) $realpatharray[$i]=$realpath;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($conf->commande->dir_output)
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
@ -464,13 +533,19 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
$height_note=0;
|
||||
}
|
||||
|
||||
$iniY = $tab_top + 7;
|
||||
$curY = $tab_top + 7;
|
||||
$nexY = $tab_top + 7;
|
||||
|
||||
// Use new auto collum system
|
||||
$this->prepareArrayColumnField($object, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
|
||||
// tab simulation to know line height
|
||||
$pdf->startTransaction();
|
||||
$this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
|
||||
$pdf->rollbackTransaction(true);
|
||||
|
||||
$iniY = $tab_top + $this->tabTitleHeight + 2;
|
||||
$curY = $tab_top + $this->tabTitleHeight + 2;
|
||||
$nexY = $tab_top + $this->tabTitleHeight + 2;
|
||||
|
||||
// Loop on each lines
|
||||
$pageposbeforeprintlines=$pdf->getPage();
|
||||
$pagenb = $pageposbeforeprintlines;
|
||||
@ -480,6 +555,10 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
$pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage
|
||||
$pdf->SetTextColor(0, 0, 0);
|
||||
|
||||
// Define size of image if we need it
|
||||
$imglinesize=array();
|
||||
if (! empty($realpatharray[$i])) $imglinesize=pdf_getSizeForImage($realpatharray[$i]);
|
||||
|
||||
$pdf->setTopMargin($tab_top_newpage);
|
||||
$pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it.
|
||||
$pageposbefore=$pdf->getPage();
|
||||
@ -488,6 +567,29 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
$curX = $this->posxdesc-1;
|
||||
|
||||
$showpricebeforepagebreak=1;
|
||||
$posYAfterImage=0;
|
||||
$posYAfterDescription=0;
|
||||
|
||||
if($this->getColumnStatus('photo'))
|
||||
{
|
||||
// We start with Photo of product line
|
||||
if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur-($heightforfooter+$heightforfreetext+$heightforinfotot))) // If photo too high, we moved completely on new page
|
||||
{
|
||||
$pdf->AddPage('', '', true);
|
||||
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
|
||||
$pdf->setPage($pageposbefore+1);
|
||||
|
||||
$curY = $tab_top_newpage;
|
||||
$showpricebeforepagebreak=0;
|
||||
}
|
||||
|
||||
if (!empty($this->cols['photo']) && isset($imglinesize['width']) && isset($imglinesize['height']))
|
||||
{
|
||||
$pdf->Image($realpatharray[$i], $this->getColumnContentXStart('photo'), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi
|
||||
// $pdf->Image does not increase value return by getY, so we save it manually
|
||||
$posYAfterImage=$curY+$imglinesize['height'];
|
||||
}
|
||||
}
|
||||
|
||||
if($this->getColumnStatus('desc'))
|
||||
{
|
||||
@ -526,7 +628,11 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
$posYAfterDescription=$pdf->GetY();
|
||||
}
|
||||
|
||||
$nexY = $pdf->GetY();
|
||||
|
||||
|
||||
$nexY = max($pdf->GetY(), $posYAfterImage);
|
||||
|
||||
|
||||
$pageposafter=$pdf->getPage();
|
||||
|
||||
$pdf->setPage($pageposbefore);
|
||||
@ -657,7 +763,7 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
$pdf->setPage($pagenb);
|
||||
if ($pagenb == $pageposbeforeprintlines)
|
||||
{
|
||||
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code);
|
||||
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -673,7 +779,7 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
{
|
||||
if ($pagenb == $pageposafter)
|
||||
{
|
||||
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code);
|
||||
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -690,7 +796,7 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
|
||||
// Show square
|
||||
if ($pagenb == $pageposbeforeprintlines)
|
||||
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0, $object->multicurrency_code);
|
||||
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, $hidetop, 0, $object->multicurrency_code);
|
||||
else
|
||||
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code);
|
||||
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
|
||||
@ -973,15 +1079,12 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
$col2x-=20;
|
||||
}
|
||||
$largcol2 = ($this->page_largeur - $this->marge_droite - $col2x);
|
||||
|
||||
$useborder=0;
|
||||
$index = 0;
|
||||
|
||||
// Total HT
|
||||
$pdf->SetFillColor(255, 255, 255);
|
||||
$pdf->SetXY($col1x, $tab2_top + 0);
|
||||
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
|
||||
|
||||
$total_ht = ($conf->multicurrency->enabled && $object->mylticurrency_tx != 1 ? $object->multicurrency_total_ht : $object->total_ht);
|
||||
$pdf->SetXY($col2x, $tab2_top + 0);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price($total_ht + (! empty($object->remise)?$object->remise:0), 0, $outputlangs), 0, 'R', 1);
|
||||
@ -1250,29 +1353,10 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
$this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param
|
||||
|
||||
|
||||
foreach ($this->cols as $colKey => $colDef)
|
||||
{
|
||||
if(!$this->getColumnStatus($colKey)) continue;
|
||||
|
||||
// get title label
|
||||
$colDef['title']['label'] = !empty($colDef['title']['label'])?$colDef['title']['label']:$outputlangs->transnoentities($colDef['title']['textkey']);
|
||||
|
||||
// Add column separator
|
||||
if(!empty($colDef['border-left'])){
|
||||
$pdf->line($colDef['xStartPos'], $tab_top, $colDef['xStartPos'], $tab_top + $tab_height);
|
||||
}
|
||||
|
||||
if (empty($hidetop))
|
||||
{
|
||||
$pdf->SetXY($colDef['xStartPos'] + $colDef['title']['padding'][3], $tab_top + $colDef['title']['padding'][0]);
|
||||
|
||||
$textWidth = $colDef['width'] - $colDef['title']['padding'][3] -$colDef['title']['padding'][1];
|
||||
$pdf->MultiCell($textWidth, 2, $colDef['title']['label'], '', $colDef['title']['align']);
|
||||
}
|
||||
}
|
||||
$this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
|
||||
|
||||
if (empty($hidetop)){
|
||||
$pdf->line($this->marge_gauche, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5); // line prend une position y en 2eme param et 4eme param
|
||||
$pdf->line($this->marge_gauche, $tab_top+$this->tabTitleHeight, $this->page_largeur-$this->marge_droite, $tab_top+$this->tabTitleHeight); // line prend une position y en 2eme param et 4eme param
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -43,7 +43,7 @@ class mod_contract_magre extends ModelNumRefContracts
|
||||
/**
|
||||
* @var string nom
|
||||
* @deprecated
|
||||
* @see name
|
||||
* @see $name
|
||||
*/
|
||||
public $nom='Magre';
|
||||
|
||||
|
||||
@ -35,7 +35,7 @@ class mod_contract_olive extends ModelNumRefContracts
|
||||
/**
|
||||
* @var string Nom du modele
|
||||
* @deprecated
|
||||
* @see name
|
||||
* @see $name
|
||||
*/
|
||||
public $nom='Olive';
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@ class mod_contract_serpis extends ModelNumRefContracts
|
||||
/**
|
||||
* @var string Nom du modele
|
||||
* @deprecated
|
||||
* @see name
|
||||
* @see $name
|
||||
*/
|
||||
public $nom='Serpis';
|
||||
|
||||
|
||||
1229
htdocs/core/modules/expedition/doc/pdf_espadon.modules.php
Normal file
1229
htdocs/core/modules/expedition/doc/pdf_espadon.modules.php
Normal file
File diff suppressed because it is too large
Load Diff
@ -105,7 +105,7 @@ class pdf_rouget extends ModelePdfExpedition
|
||||
|
||||
/**
|
||||
* Issuer
|
||||
* @var Company object that emits
|
||||
* @var Societe object that emits
|
||||
*/
|
||||
public $emetteur;
|
||||
|
||||
|
||||
@ -43,7 +43,7 @@ class mod_expedition_ribera extends ModelNumRefExpedition
|
||||
/**
|
||||
* @var string Nom du modele
|
||||
* @deprecated
|
||||
* @see name
|
||||
* @see $name
|
||||
*/
|
||||
public $nom='Ribera';
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@ class mod_expedition_safor extends ModelNumRefExpedition
|
||||
/**
|
||||
* @var string Nom du modele
|
||||
* @deprecated
|
||||
* @see name
|
||||
* @see $name
|
||||
*/
|
||||
public $nom='Safor';
|
||||
|
||||
|
||||
@ -4,6 +4,8 @@
|
||||
* Copyright (C) 2016-2018 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2018 Francis Appels <francis.appels@z-application.com>
|
||||
* Copyright (C) 2019 Markus Welters <markus@welters.de>
|
||||
* Copyright (C) 2019 Rafael Ingenleuf <ingenleuf@welters.de>
|
||||
*
|
||||
* 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
|
||||
@ -32,8 +34,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/user/class/userbankaccount.class.php';
|
||||
|
||||
/**
|
||||
* Class to generate expense report based on standard model
|
||||
@ -121,7 +124,7 @@ class pdf_standard extends ModeleExpenseReport
|
||||
*/
|
||||
public function __construct($db)
|
||||
{
|
||||
global $conf, $langs, $mysoc;
|
||||
global $conf, $langs, $mysoc, $user;
|
||||
|
||||
// Translations
|
||||
$langs->loadLangs(array("main", "trips", "projects"));
|
||||
@ -156,6 +159,7 @@ class pdf_standard extends ModeleExpenseReport
|
||||
|
||||
// Get source company
|
||||
$this->emetteur=$mysoc;
|
||||
|
||||
if (empty($this->emetteur->country_code)) $this->emetteur->country_code=substr($langs->defaultlang, -2); // By default, if was not defined
|
||||
|
||||
// Define position of columns
|
||||
@ -626,7 +630,8 @@ class pdf_standard extends ModeleExpenseReport
|
||||
*/
|
||||
private function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
|
||||
{
|
||||
global $conf, $langs, $hookmanager;
|
||||
// global $conf, $langs, $hookmanager;
|
||||
global $user, $langs, $conf, $mysoc, $db, $hookmanager;
|
||||
|
||||
// Load traductions files requiredby by page
|
||||
$outputlangs->loadLangs(array("main", "trips", "companies"));
|
||||
@ -711,15 +716,23 @@ class pdf_standard extends ModeleExpenseReport
|
||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->convToOutputCharset($this->emetteur->address);
|
||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->convToOutputCharset($this->emetteur->zip).' '.$outputlangs->convToOutputCharset($this->emetteur->town);
|
||||
$carac_emetteur .= "\n";
|
||||
// Phone
|
||||
if ($this->emetteur->phone) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Phone")." : ".$outputlangs->convToOutputCharset($this->emetteur->phone);
|
||||
// Fax
|
||||
if ($this->emetteur->fax) $carac_emetteur .= ($carac_emetteur ? ($this->emetteur->tel ? " - " : "\n") : '' ).$outputlangs->transnoentities("Fax")." : ".$outputlangs->convToOutputCharset($this->emetteur->fax);
|
||||
// EMail
|
||||
if ($this->emetteur->email) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Email")." : ".$outputlangs->convToOutputCharset($this->emetteur->email);
|
||||
// Web
|
||||
if ($this->emetteur->url) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Web")." : ".$outputlangs->convToOutputCharset($this->emetteur->url);
|
||||
|
||||
// Receiver Properties
|
||||
$receiver=new User($this->db);
|
||||
$receiver->fetch($object->fk_user_author);
|
||||
$receiver_account=new UserBankAccount($this->db);
|
||||
$receiver_account->fetch(0, '', $object->fk_user_author);
|
||||
$expense_receiver = '';
|
||||
$expense_receiver .= ($expense_receiver ? "\n" : '' ).$outputlangs->convToOutputCharset($receiver->address);
|
||||
$expense_receiver .= ($expense_receiver ? "\n" : '' ).$outputlangs->convToOutputCharset($receiver->zip).' '.$outputlangs->convToOutputCharset($receiver->town);
|
||||
$expense_receiver .= "\n";
|
||||
if ($receiver->email) $expense_receiver .= ($expense_receiver ? "\n" : '' ).$outputlangs->transnoentities("Email")." : ".$outputlangs->convToOutputCharset($receiver->email);
|
||||
if ($receiver_account->iban) $expense_receiver .= ($expense_receiver ? "\n" : '' ).$outputlangs->transnoentities("IBAN")." : ".$outputlangs->convToOutputCharset($receiver_account->iban);
|
||||
|
||||
// Show sender
|
||||
$posy=50;
|
||||
$posx=$this->marge_gauche;
|
||||
@ -736,19 +749,28 @@ class pdf_standard extends ModeleExpenseReport
|
||||
$pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1);
|
||||
$pdf->SetTextColor(0, 0, 60);
|
||||
|
||||
// Show sender name
|
||||
$pdf->SetXY($posx+2, $posy+3);
|
||||
$pdf->SetFont('', 'B', $default_font_size);
|
||||
$pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L');
|
||||
|
||||
// Show sender information
|
||||
$pdf->SetXY($posx+2, $posy+8);
|
||||
$pdf->SetFont('', '', $default_font_size - 1);
|
||||
$pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L');
|
||||
if (empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
|
||||
$pdf->SetXY($posx+2, $posy+3);
|
||||
$pdf->SetFont('', 'B', $default_font_size);
|
||||
$pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L');
|
||||
$pdf->SetXY($posx+2, $posy+8);
|
||||
$pdf->SetFont('', '', $default_font_size - 1);
|
||||
$pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L');
|
||||
} else {
|
||||
$pdf->SetXY($posx+2, $posy+3);
|
||||
$pdf->SetFont('', 'B', $default_font_size);
|
||||
$pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset(dolGetFirstLastname($receiver->firstname, $receiver->lastname)), 0, 'L');
|
||||
$pdf->SetXY($posx+2, $posy+8);
|
||||
$pdf->SetFont('', '', $default_font_size - 1);
|
||||
$pdf->MultiCell(80, 4, $expense_receiver, 0, 'L');
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche;
|
||||
|
||||
// Show recipient
|
||||
$posy=50;
|
||||
$posx=100;
|
||||
$posx=10;
|
||||
|
||||
// Show recipient frame
|
||||
$pdf->SetTextColor(0, 0, 0);
|
||||
@ -760,7 +782,8 @@ class pdf_standard extends ModeleExpenseReport
|
||||
// Informations for trip (dates and users workflow)
|
||||
if ($object->fk_user_author > 0) {
|
||||
$userfee=new User($this->db);
|
||||
$userfee->fetch($object->fk_user_author); $posy+=3;
|
||||
$userfee->fetch($object->fk_user_author);
|
||||
$posy+=3;
|
||||
$pdf->SetXY($posx+2, $posy);
|
||||
$pdf->SetFont('', '', 10);
|
||||
$pdf->MultiCell(96, 4, $outputlangs->transnoentities("AUTHOR")." : ".dolGetFirstLastname($userfee->firstname, $userfee->lastname), 0, 'L');
|
||||
|
||||
@ -44,7 +44,7 @@ class mod_expensereport_sand extends ModeleNumRefExpenseReport
|
||||
/**
|
||||
* @var string Nom du modele
|
||||
* @deprecated
|
||||
* @see name
|
||||
* @see $name
|
||||
*/
|
||||
public $nom='Sand';
|
||||
|
||||
|
||||
@ -856,7 +856,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
$invoice->fetch($obj->fk_facture_source);
|
||||
|
||||
$pdf->SetXY($tab3_posx, $tab3_top+$y);
|
||||
$pdf->MultiCell(20, 3, dol_print_date($db->jdate($obj->datef), 'day', false, $outputlangs, true), 0, 'L', 0);
|
||||
$pdf->MultiCell(20, 3, dol_print_date($this->db->jdate($obj->datef), 'day', false, $outputlangs, true), 0, 'L', 0);
|
||||
$pdf->SetXY($tab3_posx+21, $tab3_top+$y);
|
||||
$pdf->MultiCell(20, 3, price(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? $obj->multicurrency_amount_ttc : $obj->amount_ttc, 0, $outputlangs), 0, 'L', 0);
|
||||
$pdf->SetXY($tab3_posx+40, $tab3_top+$y);
|
||||
|
||||
@ -84,32 +84,32 @@ class pdf_sponge extends ModelePDFFactures
|
||||
* @var int page_largeur
|
||||
*/
|
||||
public $page_largeur;
|
||||
|
||||
|
||||
/**
|
||||
* @var int page_hauteur
|
||||
*/
|
||||
public $page_hauteur;
|
||||
|
||||
|
||||
/**
|
||||
* @var array format
|
||||
*/
|
||||
public $format;
|
||||
|
||||
|
||||
/**
|
||||
* @var int marge_gauche
|
||||
*/
|
||||
public $marge_gauche;
|
||||
|
||||
|
||||
/**
|
||||
* @var int marge_droite
|
||||
*/
|
||||
public $marge_droite;
|
||||
|
||||
|
||||
/**
|
||||
* @var int marge_haute
|
||||
*/
|
||||
public $marge_haute;
|
||||
|
||||
|
||||
/**
|
||||
* @var int marge_basse
|
||||
*/
|
||||
@ -180,6 +180,9 @@ class pdf_sponge extends ModelePDFFactures
|
||||
// Define position of columns
|
||||
$this->posxdesc=$this->marge_gauche+1; // used for notes ans other stuff
|
||||
|
||||
|
||||
$this->tabTitleHeight = 5; // default height
|
||||
|
||||
// Use new system for position of columns, view $this->defineColumnField()
|
||||
|
||||
$this->tva=array();
|
||||
@ -217,6 +220,11 @@ class pdf_sponge extends ModelePDFFactures
|
||||
|
||||
$nblignes = count($object->lines);
|
||||
|
||||
$hidetop=0;
|
||||
if(!empty($conf->global->MAIN_PDF_DISABLE_COL_HEAD_TITLE)){
|
||||
$hidetop=$conf->global->MAIN_PDF_DISABLE_COL_HEAD_TITLE;
|
||||
}
|
||||
|
||||
// Loop on each lines to detect if there is at least one image to show
|
||||
$realpatharray=array();
|
||||
$this->atleastonephoto = false;
|
||||
@ -549,13 +557,18 @@ class pdf_sponge extends ModelePDFFactures
|
||||
$height_note=0;
|
||||
}
|
||||
|
||||
$iniY = $tab_top + 7;
|
||||
$curY = $tab_top + 7;
|
||||
$nexY = $tab_top + 7;
|
||||
|
||||
// Use new auto collum system
|
||||
$this->prepareArrayColumnField($object, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
|
||||
// Simulation de tableau pour connaitre la hauteur de la ligne de titre
|
||||
$pdf->startTransaction();
|
||||
$this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
|
||||
$pdf->rollbackTransaction(true);
|
||||
|
||||
$iniY = $tab_top + $this->tabTitleHeight + 2;
|
||||
$curY = $tab_top + $this->tabTitleHeight + 2;
|
||||
$nexY = $tab_top + $this->tabTitleHeight + 2;
|
||||
|
||||
// Loop on each lines
|
||||
$pageposbeforeprintlines=$pdf->getPage();
|
||||
$pagenb = $pageposbeforeprintlines;
|
||||
@ -786,7 +799,7 @@ class pdf_sponge extends ModelePDFFactures
|
||||
$pdf->setPage($pagenb);
|
||||
if ($pagenb == $pageposbeforeprintlines)
|
||||
{
|
||||
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code);
|
||||
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -803,7 +816,7 @@ class pdf_sponge extends ModelePDFFactures
|
||||
{
|
||||
if ($pagenb == $pageposafter)
|
||||
{
|
||||
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code);
|
||||
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -821,7 +834,7 @@ class pdf_sponge extends ModelePDFFactures
|
||||
// Show square
|
||||
if ($pagenb == $pageposbeforeprintlines)
|
||||
{
|
||||
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0, $object->multicurrency_code);
|
||||
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, $hidetop, 0, $object->multicurrency_code);
|
||||
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
|
||||
}
|
||||
else
|
||||
@ -959,7 +972,7 @@ class pdf_sponge extends ModelePDFFactures
|
||||
$invoice->fetch($obj->fk_facture_source);
|
||||
|
||||
$pdf->SetXY($tab3_posx, $tab3_top+$y);
|
||||
$pdf->MultiCell(20, 3, dol_print_date($db->jdate($obj->datef), 'day', false, $outputlangs, true), 0, 'L', 0);
|
||||
$pdf->MultiCell(20, 3, dol_print_date($this->db->jdate($obj->datef), 'day', false, $outputlangs, true), 0, 'L', 0);
|
||||
$pdf->SetXY($tab3_posx+21, $tab3_top+$y);
|
||||
$pdf->MultiCell(20, 3, price(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? $obj->multicurrency_amount_ttc : $obj->amount_ttc, 0, $outputlangs), 0, 'L', 0);
|
||||
$pdf->SetXY($tab3_posx+40, $tab3_top+$y);
|
||||
@ -1541,29 +1554,10 @@ class pdf_sponge extends ModelePDFFactures
|
||||
$this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param
|
||||
|
||||
|
||||
foreach ($this->cols as $colKey => $colDef)
|
||||
{
|
||||
if(!$this->getColumnStatus($colKey)) continue;
|
||||
|
||||
// get title label
|
||||
$colDef['title']['label'] = !empty($colDef['title']['label'])?$colDef['title']['label']:$outputlangs->transnoentities($colDef['title']['textkey']);
|
||||
|
||||
// Add column separator
|
||||
if(!empty($colDef['border-left'])){
|
||||
$pdf->line($colDef['xStartPos'], $tab_top, $colDef['xStartPos'], $tab_top + $tab_height);
|
||||
}
|
||||
|
||||
if (empty($hidetop))
|
||||
{
|
||||
$pdf->SetXY($colDef['xStartPos'] + $colDef['title']['padding'][3], $tab_top + $colDef['title']['padding'][0]);
|
||||
|
||||
$textWidth = $colDef['width'] - $colDef['title']['padding'][3] -$colDef['title']['padding'][1];
|
||||
$pdf->MultiCell($textWidth, 2, $colDef['title']['label'], '', $colDef['title']['align']);
|
||||
}
|
||||
}
|
||||
$this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
|
||||
|
||||
if (empty($hidetop)){
|
||||
$pdf->line($this->marge_gauche, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5); // line prend une position y en 2eme param et 4eme param
|
||||
$pdf->line($this->marge_gauche, $tab_top+$this->tabTitleHeight, $this->page_largeur-$this->marge_droite, $tab_top+$this->tabTitleHeight); // line prend une position y en 2eme param et 4eme param
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -48,7 +48,7 @@ class mod_livraison_jade extends ModeleNumRefDeliveryOrder
|
||||
/**
|
||||
* @var string Nom du modele
|
||||
* @deprecated
|
||||
* @see name
|
||||
* @see $name
|
||||
*/
|
||||
public $nom='Jade';
|
||||
|
||||
|
||||
@ -45,7 +45,7 @@ class mod_livraison_saphir extends ModeleNumRefDeliveryOrder
|
||||
/**
|
||||
* @var string Nom du modele
|
||||
* @deprecated
|
||||
* @see name
|
||||
* @see $name
|
||||
*/
|
||||
public $nom='Saphir';
|
||||
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2014 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2016-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2014 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2016-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2017 Open-DSI <support@open-dsi.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -22,8 +22,8 @@
|
||||
|
||||
/**
|
||||
* \file htdocs/core/modules/modAccounting.class.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Module to activate Accounting Expert module
|
||||
* \ingroup Double entry accounting
|
||||
* \brief Module to activate the double entry accounting module
|
||||
*/
|
||||
include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
|
||||
|
||||
@ -48,7 +48,7 @@ class modAccounting extends DolibarrModules
|
||||
$this->module_position = '61';
|
||||
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
|
||||
$this->name = preg_replace('/^mod/i', '', get_class($this));
|
||||
$this->description = "Advanced accounting management";
|
||||
$this->description = "Double entry accounting management";
|
||||
|
||||
// Possible values for version are: 'development', 'experimental', 'dolibarr' or 'dolibarr_deprecated' or version
|
||||
$this->version = 'dolibarr';
|
||||
|
||||
@ -169,6 +169,7 @@ class pdf_cyan extends ModelePDFPropales
|
||||
$this->posxdesc=$this->marge_gauche+1;
|
||||
|
||||
|
||||
$this->tabTitleHeight = 5; // default height
|
||||
|
||||
$this->tva=array();
|
||||
$this->localtax1=array();
|
||||
@ -207,6 +208,11 @@ class pdf_cyan extends ModelePDFPropales
|
||||
|
||||
$nblignes = count($object->lines);
|
||||
|
||||
$hidetop=0;
|
||||
if(!empty($conf->global->MAIN_PDF_DISABLE_COL_HEAD_TITLE)){
|
||||
$hidetop=$conf->global->MAIN_PDF_DISABLE_COL_HEAD_TITLE;
|
||||
}
|
||||
|
||||
// Loop on each lines to detect if there is at least one image to show
|
||||
$realpatharray=array();
|
||||
$this->atleastonephoto = false;
|
||||
@ -536,13 +542,18 @@ class pdf_cyan extends ModelePDFPropales
|
||||
$height_note=0;
|
||||
}
|
||||
|
||||
$iniY = $tab_top + 7;
|
||||
$curY = $tab_top + 7;
|
||||
$nexY = $tab_top + 7;
|
||||
|
||||
// Use new auto collum system
|
||||
$this->prepareArrayColumnField($object, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
|
||||
// Simulation de tableau pour connaitre la hauteur de la ligne de titre
|
||||
$pdf->startTransaction();
|
||||
$this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
|
||||
$pdf->rollbackTransaction(true);
|
||||
|
||||
$iniY = $tab_top + $this->tabTitleHeight + 2;
|
||||
$curY = $tab_top + $this->tabTitleHeight + 2;
|
||||
$nexY = $tab_top + $this->tabTitleHeight + 2;
|
||||
|
||||
// Loop on each lines
|
||||
$pageposbeforeprintlines=$pdf->getPage();
|
||||
$pagenb = $pageposbeforeprintlines;
|
||||
@ -761,7 +772,7 @@ class pdf_cyan extends ModelePDFPropales
|
||||
$pdf->setPage($pagenb);
|
||||
if ($pagenb == $pageposbeforeprintlines)
|
||||
{
|
||||
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code);
|
||||
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -777,7 +788,7 @@ class pdf_cyan extends ModelePDFPropales
|
||||
{
|
||||
if ($pagenb == $pageposafter)
|
||||
{
|
||||
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code);
|
||||
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -795,7 +806,7 @@ class pdf_cyan extends ModelePDFPropales
|
||||
// Show square
|
||||
if ($pagenb == $pageposbeforeprintlines)
|
||||
{
|
||||
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforsignature - $heightforfooter, 0, $outputlangs, 0, 0, $object->multicurrency_code);
|
||||
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforsignature - $heightforfooter, 0, $outputlangs, $hidetop, 0, $object->multicurrency_code);
|
||||
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforsignature - $heightforfooter + 1;
|
||||
}
|
||||
else
|
||||
@ -1448,29 +1459,10 @@ class pdf_cyan extends ModelePDFPropales
|
||||
$this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param
|
||||
|
||||
|
||||
foreach ($this->cols as $colKey => $colDef)
|
||||
{
|
||||
if(!$this->getColumnStatus($colKey)) continue;
|
||||
|
||||
// get title label
|
||||
$colDef['title']['label'] = !empty($colDef['title']['label'])?$colDef['title']['label']:$outputlangs->transnoentities($colDef['title']['textkey']);
|
||||
|
||||
// Add column separator
|
||||
if(!empty($colDef['border-left'])){
|
||||
$pdf->line($colDef['xStartPos'], $tab_top, $colDef['xStartPos'], $tab_top + $tab_height);
|
||||
}
|
||||
|
||||
if (empty($hidetop))
|
||||
{
|
||||
$pdf->SetXY($colDef['xStartPos'] + $colDef['title']['padding'][3], $tab_top + $colDef['title']['padding'][0]);
|
||||
|
||||
$textWidth = $colDef['width'] - $colDef['title']['padding'][3] -$colDef['title']['padding'][1];
|
||||
$pdf->MultiCell($textWidth, 2, $colDef['title']['label'], '', $colDef['title']['align']);
|
||||
}
|
||||
}
|
||||
|
||||
$this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
|
||||
|
||||
if (empty($hidetop)){
|
||||
$pdf->line($this->marge_gauche, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5); // line prend une position y en 2eme param et 4eme param
|
||||
$pdf->line($this->marge_gauche, $tab_top+$this->tabTitleHeight, $this->page_largeur-$this->marge_droite, $tab_top+$this->tabTitleHeight); // line prend une position y en 2eme param et 4eme param
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -106,7 +106,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
|
||||
|
||||
/**
|
||||
* Issuer
|
||||
* @var Company object that emits
|
||||
* @var Societe object that emits
|
||||
*/
|
||||
public $emetteur;
|
||||
|
||||
|
||||
1857
htdocs/core/modules/supplier_order/pdf/pdf_cornas.modules.php
Normal file
1857
htdocs/core/modules/supplier_order/pdf/pdf_cornas.modules.php
Normal file
File diff suppressed because it is too large
Load Diff
@ -49,10 +49,8 @@ foreach($object->fields as $key => $val)
|
||||
if ($val['type'] == 'text' || $val['type'] == 'html') print ' tdtop';
|
||||
print '"';
|
||||
print '>';
|
||||
print $langs->trans($val['label']);
|
||||
if(!empty($val['help'])){
|
||||
print $form->textwithpicto('', $langs->trans($val['help']));
|
||||
}
|
||||
if (! empty($val['help'])) print $form->textwithpicto($langs->trans($val['label']), $langs->trans($val['help']));
|
||||
else print $langs->trans($val['label']);
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if (in_array($val['type'], array('int', 'integer'))) $value = GETPOST($key, 'int');
|
||||
|
||||
@ -47,7 +47,7 @@ foreach($object->fields as $key => $val)
|
||||
if ($val['notnull'] > 0) print ' fieldrequired';
|
||||
if ($val['type'] == 'text' || $val['type'] == 'html') print ' tdtop';
|
||||
print '">';
|
||||
if (! empty($val['help'])) print $form->textwithpicto($langs->trans($val['label']), $val['help']);
|
||||
if (! empty($val['help'])) print $form->textwithpicto($langs->trans($val['label']), $langs->trans($val['help']));
|
||||
else print $langs->trans($val['label']);
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
|
||||
@ -52,7 +52,7 @@ foreach($object->fields as $key => $val)
|
||||
if ($val['notnull'] > 0) print ' fieldrequired';
|
||||
if ($val['type'] == 'text' || $val['type'] == 'html') print ' tdtop';
|
||||
print '">';
|
||||
if (! empty($val['help'])) print $form->textwithpicto($langs->trans($val['label']), $val['help']);
|
||||
if (! empty($val['help'])) print $form->textwithpicto($langs->trans($val['label']), $langs->trans($val['help']));
|
||||
else print $langs->trans($val['label']);
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
|
||||
@ -23,10 +23,10 @@ if (! empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_
|
||||
$align=$extrafields->getAlignFlag($key);
|
||||
$typeofextrafield=$extrafields->attributes[$extrafieldsobjectkey]['type'][$key];
|
||||
print '<td class="liste_titre'.($align?' '.$align:'').'">';
|
||||
$tmpkey=preg_replace('/'.$search_options_pattern.'/', '', $key);
|
||||
if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select')) && empty($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key]))
|
||||
{
|
||||
$crit=$val;
|
||||
$tmpkey=preg_replace('/'.$search_options_pattern.'/', '', $key);
|
||||
$searchclass='';
|
||||
if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring';
|
||||
if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum';
|
||||
@ -37,7 +37,7 @@ if (! empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_
|
||||
// for the type as 'checkbox', 'chkbxlst', 'sellist' we should use code instead of id (example: I declare a 'chkbxlst' to have a link with dictionnairy, I have to extend it with the 'code' instead 'rowid')
|
||||
$morecss='';
|
||||
if ($typeofextrafield == 'sellist') $morecss='maxwidth200';
|
||||
echo $extrafields->showInputField($key, $search_array_options[$search_options_pattern.$key], '', '', 'search_', $morecss);
|
||||
echo $extrafields->showInputField($key, $search_array_options[$search_options_pattern.$tmpkey], '', '', $search_options_pattern, $morecss);
|
||||
}
|
||||
elseif (in_array($typeofextrafield, array('datetime','timestamp')))
|
||||
{
|
||||
|
||||
@ -21,6 +21,7 @@ $out .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$out .= '<input type="hidden" name="action" value="add_element_resource">';
|
||||
$out .= '<input type="hidden" name="element" value="'.$element.'">';
|
||||
$out .= '<input type="hidden" name="element_id" value="'.$element_id.'">';
|
||||
$out .= '<input type="hidden" name="ref" value="'.$element_ref.'">';
|
||||
$out .= '<input type="hidden" name="resource_type" value="'.(empty($resource_type) ? 'dolresource' : $resource_type).'">';
|
||||
|
||||
|
||||
|
||||
@ -325,7 +325,7 @@ $arrayofmassactions = array(
|
||||
'enable'=>$langs->trans("CronStatusActiveBtn"),
|
||||
'disable'=>$langs->trans("CronStatusInactiveBtn"),
|
||||
);
|
||||
if ($user->rights->mymodule->delete) $arrayofmassactions['predelete']=$langs->trans("Delete");
|
||||
if ($user->rights->mymodule->delete) $arrayofmassactions['predelete']='<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
||||
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
|
||||
@ -79,7 +79,7 @@ class PaymentDonation extends CommonObject
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see amount, amounts
|
||||
* @see $amount, $amounts
|
||||
*/
|
||||
public $total;
|
||||
|
||||
|
||||
@ -27,6 +27,7 @@ require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/ticket/class/ticket.class.php';
|
||||
|
||||
|
||||
/**
|
||||
@ -97,14 +98,15 @@ class EmailCollector extends CommonObject
|
||||
'description' => array('type'=>'text', 'label'=>'Description', 'visible'=>-1, 'enabled'=>1, 'position'=>60, 'notnull'=>-1),
|
||||
'host' => array('type'=>'varchar(255)', 'label'=>'EMailHost', 'visible'=>1, 'enabled'=>1, 'position'=>100, 'notnull'=>1, 'searchall'=>1, 'comment'=>"IMAP server", 'help'=>'Example: imap.gmail.com'),
|
||||
'login' => array('type'=>'varchar(128)', 'label'=>'Login', 'visible'=>1, 'enabled'=>1, 'position'=>101, 'notnull'=>-1, 'index'=>1, 'comment'=>"IMAP login", 'help'=>'Example: myaccount@gmail.com'),
|
||||
'password' => array('type'=>'password', 'label'=>'Password', 'visible'=>-1, 'enabled'=>1, 'position'=>102, 'notnull'=>-1, 'comment'=>"IMAP password"),
|
||||
'password' => array('type'=>'password', 'label'=>'Password', 'visible'=>-1, 'enabled'=>1, 'position'=>102, 'notnull'=>-1, 'comment'=>"IMAP password", 'help'=>'WithGMailYouCanCreateADedicatedPassword'),
|
||||
'source_directory' => array('type'=>'varchar(255)', 'label'=>'MailboxSourceDirectory', 'visible'=>-1, 'enabled'=>1, 'position'=>103, 'notnull'=>1, 'default' => 'Inbox', 'help'=>'Example: INBOX'),
|
||||
//'filter' => array('type'=>'text', 'label'=>'Filter', 'visible'=>1, 'enabled'=>1, 'position'=>105),
|
||||
//'actiontodo' => array('type'=>'varchar(255)', 'label'=>'ActionToDo', 'visible'=>1, 'enabled'=>1, 'position'=>106),
|
||||
'target_directory' => array('type'=>'varchar(255)', 'label'=>'MailboxTargetDirectory', 'visible'=>1, 'enabled'=>1, 'position'=>110, 'notnull'=>0, 'comment'=>"Where to store messages once processed"),
|
||||
'datelastresult' => array('type'=>'datetime', 'label'=>'DateLastResult', 'visible'=>1, 'enabled'=>'$action != "create" && $action != "edit"', 'position'=>121, 'notnull'=>-1,),
|
||||
'datelastresult' => array('type'=>'datetime', 'label'=>'DateLastCollectResult', 'visible'=>1, 'enabled'=>'$action != "create" && $action != "edit"', 'position'=>121, 'notnull'=>-1,),
|
||||
'codelastresult' => array('type'=>'varchar(16)', 'label'=>'CodeLastResult', 'visible'=>1, 'enabled'=>'$action != "create" && $action != "edit"', 'position'=>122, 'notnull'=>-1,),
|
||||
'lastresult' => array('type'=>'varchar(255)', 'label'=>'LastResult', 'visible'=>1, 'enabled'=>'$action != "create" && $action != "edit"', 'position'=>123, 'notnull'=>-1,),
|
||||
'datelastok' => array('type'=>'datetime', 'label'=>'DateLastcollectResultOk', 'visible'=>1, 'enabled'=>'$action != "create"', 'position'=>125, 'notnull'=>-1,),
|
||||
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'visible'=>0, 'enabled'=>1, 'position'=>61, 'notnull'=>-1,),
|
||||
'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'visible'=>0, 'enabled'=>1, 'position'=>62, 'notnull'=>-1,),
|
||||
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'visible'=>-2, 'enabled'=>1, 'position'=>500, 'notnull'=>1,),
|
||||
@ -172,6 +174,8 @@ class EmailCollector extends CommonObject
|
||||
public $filters;
|
||||
public $actions;
|
||||
|
||||
public $debuginfo;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@ -737,7 +741,7 @@ class EmailCollector extends CommonObject
|
||||
$errorforthisaction = 0;
|
||||
|
||||
// Overwrite values with values extracted from source email
|
||||
// $this->actionparam = 'opportunity_status=123;abc=REGEX:BODY:....'
|
||||
// $this->actionparam = 'opportunity_status=123;abc=EXTRACT:BODY:....'
|
||||
$arrayvaluetouse = dolExplodeIntoArray($actionparam, ';', '=');
|
||||
foreach($arrayvaluetouse as $propertytooverwrite => $valueforproperty)
|
||||
{
|
||||
@ -754,20 +758,20 @@ class EmailCollector extends CommonObject
|
||||
}
|
||||
if ($tmpclass && ($tmpclass != $object->element)) continue; // Property is for another type of object
|
||||
|
||||
if (property_exists($object, $tmpproperty))
|
||||
if (property_exists($object, $tmpproperty) || preg_match('/^options_/', $tmpproperty))
|
||||
{
|
||||
$sourcestring='';
|
||||
$sourcefield='';
|
||||
$regexstring='';
|
||||
//$transformationstring='';
|
||||
$regforregex=array();
|
||||
if (preg_match('/^REGEX:([a-zA-Z0-9]+):(.*):([^:])$/', $valueforproperty, $regforregex))
|
||||
if (preg_match('/^EXTRACT:([a-zA-Z0-9]+):(.*):([^:])$/', $valueforproperty, $regforregex))
|
||||
{
|
||||
$sourcefield=$regforregex[1];
|
||||
$regexstring=$regforregex[2];
|
||||
//$transofrmationstring=$regforregex[3];
|
||||
}
|
||||
elseif (preg_match('/^REGEX:([a-zA-Z0-9]+):(.*)$/', $valueforproperty, $regforregex))
|
||||
elseif (preg_match('/^EXTRACT:([a-zA-Z0-9]+):(.*)$/', $valueforproperty, $regforregex))
|
||||
{
|
||||
$sourcefield=$regforregex[1];
|
||||
$regexstring=$regforregex[2];
|
||||
@ -789,9 +793,10 @@ class EmailCollector extends CommonObject
|
||||
// Nothing can be done for this param
|
||||
}
|
||||
}
|
||||
elseif (preg_match('/^VALUE:(.*)$/', $valueforproperty, $reg))
|
||||
elseif (preg_match('/^SET:(.*)$/', $valueforproperty, $reg))
|
||||
{
|
||||
$object->$tmpproperty = $reg[1];
|
||||
if (preg_match('/^options_/', $tmpproperty)) $object->array_options[preg_replace('/^options_/', '', $tmpproperty)] = $reg[1];
|
||||
else $object->$tmpproperty = $reg[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -820,7 +825,7 @@ class EmailCollector extends CommonObject
|
||||
|
||||
dol_syslog("EmailCollector::doCollectOneCollector start", LOG_DEBUG);
|
||||
|
||||
$langs->loadLangs(array("project", "companies", "mails", "errors"));
|
||||
$langs->loadLangs(array("project", "companies", "mails", "errors", "ticket"));
|
||||
|
||||
$error = 0;
|
||||
$this->output = '';
|
||||
@ -865,9 +870,16 @@ class EmailCollector extends CommonObject
|
||||
$this->error = 'Failed to open IMAP connection '.$connectstringsource;
|
||||
return -3;
|
||||
}
|
||||
imap_errors(); // Clear stack of errors.
|
||||
|
||||
// $conf->global->MAIL_PREFIX_FOR_EMAIL_ID must be defined
|
||||
$host=dol_getprefix('email');
|
||||
|
||||
// Define the IMAP search string
|
||||
// See https://tools.ietf.org/html/rfc3501#section-6.4.4
|
||||
//$search='ALL';
|
||||
$search='UNDELETED';
|
||||
$search='UNDELETED'; // Seems not supported by some servers
|
||||
$searchhead='';
|
||||
$searchfilterdoltrackid=0;
|
||||
$searchfilternodoltrackid=0;
|
||||
foreach($this->filters as $rule)
|
||||
@ -880,17 +892,23 @@ class EmailCollector extends CommonObject
|
||||
if ($rule['type'] == 'from') $search.=($search?' ':'').'FROM "'.str_replace('"', '', $rule['rulevalue']).'"';
|
||||
if ($rule['type'] == 'subject') $search.=($search?' ':'').'SUBJECT "'.str_replace('"', '', $rule['rulevalue']).'"';
|
||||
if ($rule['type'] == 'body') $search.=($search?' ':'').'BODY "'.str_replace('"', '', $rule['rulevalue']).'"';
|
||||
if ($rule['type'] == 'header') $search.=($search?' ':'').'HEADER '.$rule['rulevalue'];
|
||||
|
||||
if ($rule['type'] == 'seen') $search.=($search?' ':'').'SEEN';
|
||||
if ($rule['type'] == 'unseen') $search.=($search?' ':'').'UNSEEN';
|
||||
if ($rule['type'] == 'withtrackingid') $searchfilterdoltrackid++;
|
||||
if ($rule['type'] == 'withouttrackingid') $searchfilternodoltrackid++;
|
||||
if ($rule['type'] == 'smaller') $search.=($search?' ':'').'SMALLER "'.str_replace('"', '', $rule['rulevalue']).'"';
|
||||
if ($rule['type'] == 'larger') $search.=($search?' ':'').'LARGER "'.str_replace('"', '', $rule['rulevalue']).'"';
|
||||
|
||||
if ($rule['type'] == 'withtrackingid') { $searchfilterdoltrackid++; $searchhead.='/References.*@'.preg_quote($host, '/').'/'; }
|
||||
if ($rule['type'] == 'withouttrackingid') { $searchfilternodoltrackid++; $searchhead.='! /References.*@'.preg_quote($host, '/').'/';}
|
||||
}
|
||||
|
||||
if (empty($targetdir)) // Use last date as filter if there is no targetdir defined.
|
||||
{
|
||||
$fromdate=0;
|
||||
if ($this->datelastresult && $this->codelastresult == 'OK') $fromdate = $this->datelastresult;
|
||||
if ($fromdate > 0) $search.=($search?' ':'').'SINCE '.dol_print_date($fromdate - 1, 'dayhourrfc');
|
||||
if ($this->datelastok) $fromdate = $this->datelastok;
|
||||
if ($fromdate > 0) $search.=($search?' ':'').'SINCE '.date('j-M-Y', $fromdate - 1); // SENTSINCE not supported. Date must be X-Abc-9999 (X on 1 digit if < 10)
|
||||
//$search.=($search?' ':'').'SINCE 8-Apr-2018';
|
||||
}
|
||||
dol_syslog("IMAP search string = ".$search);
|
||||
//var_dump($search);
|
||||
@ -900,11 +918,21 @@ class EmailCollector extends CommonObject
|
||||
$nbactiondone=0;
|
||||
|
||||
// Scan IMAP inbox
|
||||
$arrayofemail= imap_search($connection, $search);
|
||||
//var_dump($arrayofemail);exit;
|
||||
$arrayofemail= imap_search($connection, $search, null, "UTF-8");
|
||||
if ($arrayofemail === false)
|
||||
{
|
||||
// Nothing found or search string not understood
|
||||
$mapoferrrors = imap_errors();
|
||||
if ($mapoferrrors !== false)
|
||||
{
|
||||
$error++;
|
||||
$this->error = "Search string not understood - ".join(',', $mapoferrrors);
|
||||
$this->errors[] = $this->error;
|
||||
}
|
||||
}
|
||||
|
||||
// Loop on each email found
|
||||
if (! empty($arrayofemail) && count($arrayofemail) > 0)
|
||||
if (! $error && ! empty($arrayofemail) && count($arrayofemail) > 0)
|
||||
{
|
||||
foreach($arrayofemail as $imapemail)
|
||||
{
|
||||
@ -916,11 +944,7 @@ class EmailCollector extends CommonObject
|
||||
$headers = array_combine($matches[1], $matches[2]);
|
||||
//var_dump($headers);
|
||||
|
||||
// $conf->global->MAIL_PREFIX_FOR_EMAIL_ID must be defined
|
||||
$host=dol_getprefix('email');
|
||||
|
||||
// If there is a filter on trackid
|
||||
//var_dump($host);exit;
|
||||
if ($searchfilterdoltrackid > 0)
|
||||
{
|
||||
//if (empty($headers['X-Dolibarr-TRACKID'])) continue;
|
||||
@ -1066,16 +1090,18 @@ class EmailCollector extends CommonObject
|
||||
$partplain=1;
|
||||
}*/
|
||||
|
||||
//var_dump($structure);
|
||||
//var_dump($parthtml);var_dump($partplain);
|
||||
/*var_dump($structure);
|
||||
var_dump($parthtml);
|
||||
var_dump($partplain);*/
|
||||
|
||||
$messagetext = imap_fetchbody($connection, $imapemail, ($parthtml != '-1' ? $parthtml : ($partplain != '-1' ? $partplain : 0)), FT_PEEK);
|
||||
$messagetext = imap_fetchbody($connection, $imapemail, ($parthtml != '-1' ? $parthtml : ($partplain != '-1' ? $partplain : 1)), FT_PEEK);
|
||||
|
||||
//var_dump($overview);
|
||||
//var_dump($header);
|
||||
//var_dump($message);
|
||||
//var_dump($messagetext);
|
||||
//var_dump($structure->parts[0]->parts);
|
||||
//var_dump($messagetext);exit;
|
||||
//print $header;
|
||||
//print $messagetext;
|
||||
//exit;
|
||||
|
||||
$fromstring=$overview[0]->from;
|
||||
$sender=$overview[0]->sender;
|
||||
$to=$overview[0]->to;
|
||||
@ -1101,8 +1127,10 @@ class EmailCollector extends CommonObject
|
||||
|
||||
$contactid = 0; $thirdpartyid = 0; $projectid = 0;
|
||||
|
||||
// Analyze TrackId in field References
|
||||
// For example: References: <1542377954.SMTPs-dolibarr-thi649@8f6014fde11ec6cdec9a822234fc557e>
|
||||
// Analyze TrackId in field References. For example:
|
||||
// References: <1542377954.SMTPs-dolibarr-thi649@8f6014fde11ec6cdec9a822234fc557e>
|
||||
// References: <1542377954.SMTPs-dolibarr-tic649@8f6014fde11ec6cdec9a822234fc557e>
|
||||
// References: <1542377954.SMTPs-dolibarr-abc649@8f6014fde11ec6cdec9a822234fc557e>
|
||||
$trackid = '';
|
||||
$reg=array();
|
||||
if (! empty($headers['References']) && preg_match('/dolibarr-([a-z]+)([0-9]+)@'.preg_quote($host, '/').'/', $headers['References'], $reg))
|
||||
@ -1136,6 +1164,11 @@ class EmailCollector extends CommonObject
|
||||
$objectid = $reg[1];
|
||||
$objectemail = new User($this->db);
|
||||
}
|
||||
if ($reg[0] == 'tic')
|
||||
{
|
||||
$objectid = $reg[1];
|
||||
$objectemail = new Ticket($this->db);
|
||||
}
|
||||
|
||||
if (is_object($objectemail))
|
||||
{
|
||||
@ -1227,13 +1260,32 @@ class EmailCollector extends CommonObject
|
||||
// Make Operation
|
||||
dol_syslog("Execute action ".$operation['type']." actionparam=".$operation['actionparam'].' thirdpartystatic->id='.$thirdpartystatic->id.' contactstatic->id='.$contactstatic->id.' projectstatic->id='.$projectstatic->id);
|
||||
|
||||
$description = $descriptionfull = '';
|
||||
if (in_array($operation['type'], array('recordevent', 'project', 'ticket')))
|
||||
{
|
||||
$description = $langs->trans("ProjectCreatedByEmailCollector", $msgid);
|
||||
$description = dol_concatdesc($description, "-----");
|
||||
$description = dol_concatdesc($description, $langs->trans("Topic").' : '.$subject);
|
||||
$description = dol_concatdesc($description, $langs->trans("From").' : '.$fromstring);
|
||||
if ($sender) $description = dol_concatdesc($description, $langs->trans("Sender").' : '.$sender);
|
||||
$description = dol_concatdesc($description, $langs->trans("To").' : '.$to);
|
||||
//if ($cc) $description = dol_concatdesc($description, $langs->trans("Cc").' : '.$cc);
|
||||
//if ($bcc) $description = dol_concatdesc($description, $langs->trans("Bcc").' : '.$bcc);
|
||||
$description = dol_concatdesc($description, "-----");
|
||||
$description = dol_concatdesc($description, $messagetext);
|
||||
|
||||
$descriptionfull = $description;
|
||||
$descriptionfull = dol_concatdesc($descriptionfull, "----- Header");
|
||||
$descriptionfull = dol_concatdesc($descriptionfull, $header);
|
||||
}
|
||||
|
||||
// Search and create thirdparty
|
||||
if ($operation['type'] == 'loadthirdparty' || $operation['type'] == 'loadandcreatethirdparty')
|
||||
{
|
||||
if (empty($operation['actionparam']))
|
||||
{
|
||||
$errorforactions++;
|
||||
$this->error = "Action loadthirdparty or loadandcreatethirdparty has empty parameter. Must be 'VALUE:xxx' or 'REGEX:(body|subject):regex' to define how to extract data";
|
||||
$this->error = "Action loadthirdparty or loadandcreatethirdparty has empty parameter. Must be 'SET:xxx' or 'EXTRACT:(body|subject):regex' to define how to extract data";
|
||||
$this->errors[] = $this->error;
|
||||
}
|
||||
else
|
||||
@ -1241,7 +1293,7 @@ class EmailCollector extends CommonObject
|
||||
$actionparam = $operation['actionparam'];
|
||||
$nametouseforthirdparty='';
|
||||
|
||||
// $this->actionparam = 'VALUE:aaa' or 'REGEX:BODY:....'
|
||||
// $this->actionparam = 'SET:aaa' or 'EXTRACT:BODY:....'
|
||||
$arrayvaluetouse = dolExplodeIntoArray($actionparam, ';', '=');
|
||||
foreach($arrayvaluetouse as $propertytooverwrite => $valueforproperty)
|
||||
{
|
||||
@ -1250,7 +1302,7 @@ class EmailCollector extends CommonObject
|
||||
$regexstring='';
|
||||
$regforregex=array();
|
||||
|
||||
if (preg_match('/^REGEX:([a-zA-Z0-9]+):(.*)$/', $valueforproperty, $regforregex))
|
||||
if (preg_match('/^EXTRACT:([a-zA-Z0-9]+):(.*)$/', $valueforproperty, $regforregex))
|
||||
{
|
||||
$sourcefield=$regforregex[1];
|
||||
$regexstring=$regforregex[2];
|
||||
@ -1273,7 +1325,7 @@ class EmailCollector extends CommonObject
|
||||
}
|
||||
//var_dump($sourcestring); var_dump($regexstring);var_dump($nametouseforthirdparty);exit;
|
||||
}
|
||||
elseif (preg_match('/^VALUE:(.*)$/', $valueforproperty, $reg))
|
||||
elseif (preg_match('/^SET:(.*)$/', $valueforproperty, $reg))
|
||||
{
|
||||
$nametouseforthirdparty = $reg[1];
|
||||
}
|
||||
@ -1337,14 +1389,31 @@ class EmailCollector extends CommonObject
|
||||
elseif ($operation['type'] == 'recordevent')
|
||||
{
|
||||
$actioncode = 'EMAIL_IN';
|
||||
// If we scan the Sent box, we use the code for out email
|
||||
if ($this->source_directory == 'Sent') {
|
||||
$actioncode = 'EMAIL_OUT';
|
||||
}
|
||||
|
||||
if ($projectstatic->id > 0)
|
||||
{
|
||||
if ($projectfoundby) $messagetext .= ' - Project found from '.$projectfoundby;
|
||||
}
|
||||
if ($thirdpartystatic->id > 0)
|
||||
{
|
||||
if ($thirdpartyfoundby) $messagetext .= ' - Third party found from '.$thirdpartyfoundby;
|
||||
}
|
||||
if ($contactstatic->id > 0)
|
||||
{
|
||||
if ($contactfoundby) $messagetext .= ' - Contact/address found from '.$contactfoundby;
|
||||
}
|
||||
|
||||
// Insert record of emails sent
|
||||
$actioncomm = new ActionComm($this->db);
|
||||
|
||||
$actioncomm->type_code = 'AC_OTH_AUTO'; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...)
|
||||
$actioncomm->code = 'AC_'.$actioncode;
|
||||
$actioncomm->label = $langs->trans("ActionAC_EMAIL_IN").' - '.$langs->trans("MailFrom").' '.$from;
|
||||
$actioncomm->note = $messagetext;
|
||||
$actioncomm->label = $langs->trans("ActionAC_".$actioncode).' - '.$langs->trans("MailFrom").' '.$from;
|
||||
$actioncomm->note = $descriptionfull;
|
||||
$actioncomm->fk_project = $projectstatic->id;
|
||||
$actioncomm->datep = $date;
|
||||
$actioncomm->datef = $date;
|
||||
@ -1391,17 +1460,16 @@ class EmailCollector extends CommonObject
|
||||
// Create event
|
||||
elseif ($operation['type'] == 'project')
|
||||
{
|
||||
$note_private = $langs->trans("ProjectCreatedByEmailCollector", $msgid);
|
||||
$projecttocreate = new Project($this->db);
|
||||
if ($thirdpartystatic->id > 0)
|
||||
{
|
||||
$projecttocreate->socid = $thirdpartystatic->id;
|
||||
if ($thirdpartyfoundby) $note_private .= ' - Third party found from '.$thirdpartyfoundby;
|
||||
if ($thirdpartyfoundby) $messagetext .= dol_concatdesc($messagetext, 'Third party found from '.$thirdpartyfoundby);
|
||||
}
|
||||
if ($contactstatic->id > 0)
|
||||
{
|
||||
$projecttocreate->contact_id = $contactstatic->id;
|
||||
if ($contactfoundby) $note_private .= ' - Contact/address found from '.$contactfoundby;
|
||||
if ($contactfoundby) $messagetext .= dol_concatdesc($messagetext, 'Contact/address found from '.$contactfoundby);
|
||||
}
|
||||
|
||||
$id_opp_status = dol_getIdFromCode($this->db, 'PROSP', 'c_lead_status', 'code', 'rowid');
|
||||
@ -1412,8 +1480,8 @@ class EmailCollector extends CommonObject
|
||||
$projecttocreate->date_end = '';
|
||||
$projecttocreate->opp_status = $id_opp_status;
|
||||
$projecttocreate->opp_percent = $percent_opp_status;
|
||||
$projecttocreate->description = dol_concatdesc(dol_concatdesc($note_private, dolGetFirstLineOfText(dol_string_nohtmltag($messagetext, 2), 3)), '...'.$langs->transnoentities("SeePrivateNote").'...');
|
||||
$projecttocreate->note_private = dol_concatdesc($note_private, dol_string_nohtmltag($messagetext, 2));
|
||||
$projecttocreate->description = dol_concatdesc(dolGetFirstLineOfText(dol_string_nohtmltag($description, 2), 8), '...'.$langs->transnoentities("SeePrivateNote").'...');
|
||||
$projecttocreate->note_private = dol_concatdesc($descriptionfull, dol_string_nohtmltag($descriptionfull, 2));
|
||||
$projecttocreate->entity = $conf->entity;
|
||||
|
||||
// Get next project Ref
|
||||
@ -1471,6 +1539,90 @@ class EmailCollector extends CommonObject
|
||||
}
|
||||
}
|
||||
}
|
||||
// Create event
|
||||
elseif ($operation['type'] == 'ticket')
|
||||
{
|
||||
$note_private = $langs->trans("TicketCreatedByEmailCollector", $msgid);
|
||||
$tickettocreate = new Ticket($this->db);
|
||||
if ($thirdpartystatic->id > 0)
|
||||
{
|
||||
$tickettocreate->socid = $thirdpartystatic->id;
|
||||
if ($thirdpartyfoundby) $note_private .= ' - Third party found from '.$thirdpartyfoundby;
|
||||
}
|
||||
if ($contactstatic->id > 0)
|
||||
{
|
||||
$tickettocreate->contact_id = $contactstatic->id;
|
||||
if ($contactfoundby) $note_private .= ' - Contact/address found from '.$contactfoundby;
|
||||
}
|
||||
|
||||
$tickettocreate->title = $subject;
|
||||
$tickettocreate->type_code = 0;
|
||||
$tickettocreate->category_code = 0;
|
||||
$tickettocreate->severity_code = 0;
|
||||
$tickettocreate->origin_email = $fromstring;
|
||||
$tickettocreate->fk_user_create = $user->id;
|
||||
$tickettocreate->entity = $conf->entity;
|
||||
$tickettocreate->datec = $date;
|
||||
$tickettocreate->fk_project = $projectstatic->id;
|
||||
$tickettocreate->fk_soc = $thirdpartystatic->id;
|
||||
$tickettocreate->notify_tiers_at_create = 0;
|
||||
//$tickettocreate->fk_contact = $contactstatic->id;
|
||||
|
||||
// Get next project Ref
|
||||
$defaultref='';
|
||||
$modele = empty($conf->global->TICKET_ADDON)?'mod_ticket_simple':$conf->global->TICKET_ADDON;
|
||||
|
||||
// Search template files
|
||||
$file=''; $classname=''; $filefound=0; $reldir='';
|
||||
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
foreach($dirmodels as $reldir)
|
||||
{
|
||||
$file=dol_buildpath($reldir."core/modules/ticket/".$modele.'.php', 0);
|
||||
if (file_exists($file))
|
||||
{
|
||||
$filefound=1;
|
||||
$classname = $modele;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($filefound)
|
||||
{
|
||||
$result=dol_include_once($reldir."core/modules/ticket/".$modele.'.php');
|
||||
$modTicket = new $classname;
|
||||
|
||||
$defaultref = $modTicket->getNextValue(($thirdpartystatic->id > 0 ? $thirdpartystatic : null), $tickettocreate);
|
||||
}
|
||||
|
||||
$tickettocreate->ref = $defaultref;
|
||||
|
||||
// Overwrite values with values extracted from source email
|
||||
$errorforthisaction = $this->overwritePropertiesOfObject($tickettocreate, $operation['actionparam'], $messagetext, $subject);
|
||||
|
||||
if ($errorforthisaction)
|
||||
{
|
||||
$errorforactions++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (is_numeric($tickettocreate->ref) && $tickettocreate->ref <= 0)
|
||||
{
|
||||
$errorforactions++;
|
||||
$this->error = 'Failed to create ticket: Can\'t get a valid value for ticket Ref';
|
||||
}
|
||||
else
|
||||
{
|
||||
// Create project
|
||||
$result = $tickettocreate->create($user);
|
||||
if ($result <= 0)
|
||||
{
|
||||
$errorforactions++;
|
||||
$this->error = 'Failed to create ticket: '.$langs->trans($tickettocreate->error);
|
||||
$this->errors = $tickettocreate->errors;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! $errorforactions)
|
||||
{
|
||||
@ -1537,6 +1689,10 @@ class EmailCollector extends CommonObject
|
||||
|
||||
$this->datelastresult = $now;
|
||||
$this->lastresult = $output;
|
||||
$this->debuginfo = 'IMAP search string used : '.$search;
|
||||
if ($searchhead) $this->debuginfo .= '<br>Then search string into email header : '.$searchhead;
|
||||
|
||||
if (! $error) $this->datelastok = $now;
|
||||
|
||||
if (! empty($this->errors)) $this->lastresult.= " - ".join(" - ", $this->errors);
|
||||
$this->codelastresult = ($error ? 'KO' : 'OK');
|
||||
|
||||
@ -162,7 +162,7 @@ class EmailCollectorFilter extends CommonObject
|
||||
if (! in_array($this->type, array('seen','unseen','withtrackingid','withouttrackingid')) && empty($this->rulevalue))
|
||||
{
|
||||
$langs->load("errors");
|
||||
$this->errors[]=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("StringToFilter"));
|
||||
$this->errors[]=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("SearchString"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@ -607,7 +607,7 @@ class Expedition extends CommonObject
|
||||
$this->getUrlTrackingStatus($obj->tracking_number);
|
||||
|
||||
/*
|
||||
* Thirparty
|
||||
* Thirdparty
|
||||
*/
|
||||
$result=$this->fetch_thirdparty();
|
||||
|
||||
@ -2417,7 +2417,7 @@ class ExpeditionLigne extends CommonObjectLine
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see product_ref
|
||||
* @see $product_ref
|
||||
*/
|
||||
public $ref;
|
||||
|
||||
|
||||
@ -894,7 +894,7 @@ if ($id > 0 || ! empty($ref))
|
||||
print $langs->trans("WarehouseSource");
|
||||
//print '</td>';
|
||||
//print '<td>';
|
||||
print $formproduct->selectWarehouses(! empty($object->warehouse_id)?$object->warehouse_id:-1, 'entrepot_id', '', 1, 0, 0, '', 0, 0, array(), 'minwidth200');
|
||||
print $formproduct->selectWarehouses(! empty($object->warehouse_id)?$object->warehouse_id:'ifone', 'entrepot_id', '', 1, 0, 0, '', 0, 0, array(), 'minwidth200');
|
||||
if (count($formproduct->cache_warehouses) <= 0)
|
||||
{
|
||||
print ' '.$langs->trans("WarehouseSourceNotDefined").' <a href="'.DOL_URL_ROOT.'/product/stock/card.php?action=create">'.$langs->trans("AddOne").'</a>';
|
||||
|
||||
@ -2391,7 +2391,8 @@ else
|
||||
$arrayoffiles=dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png|'.preg_quote(dol_sanitizeFileName($object->ref.'.pdf'), '/').')$');
|
||||
$nbFiles = count($arrayoffiles);
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
if ($nbFiles >= 0)
|
||||
|
||||
if ($nbFiles > 0)
|
||||
{
|
||||
print '<tr class="oddeven nohover trattachnewfilenow"'.(! GETPOSTISSET('sendit') && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)?' style="display: none"':'').'>';
|
||||
print '<td colspan="'.$colspan.'">';
|
||||
@ -2484,6 +2485,13 @@ else
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr class="oddeven nohover trattachnewfilenow"'.(! GETPOSTISSET('sendit') && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)?' style="display: none"':'').'>';
|
||||
print '<td colspan="'.$colspan.'">';
|
||||
print '<span class="opacitymedium">'.$langs->trans("NoFilesUploadedYet").'</span>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
@ -344,7 +344,7 @@ if ($resql)
|
||||
'presend'=>$langs->trans("SendByMail"),
|
||||
'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
if ($user->rights->expensereport->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete");
|
||||
if ($user->rights->expensereport->supprimer) $arrayofmassactions['predelete']='<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
||||
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
|
||||
@ -234,7 +234,7 @@ print '</td></tr>';
|
||||
// Status
|
||||
print '<tr><td class="left">'.$langs->trans("Status").'</td><td class="left">';
|
||||
$liststatus=$tmpexpensereport->statuts;
|
||||
print $form->selectarray('object_status', $liststatus, GETPOST('object_status'), -4, 0, 0, '', 1);
|
||||
print $form->selectarray('object_status', $liststatus, GETPOST('object_status', 'int'), -4, 0, 0, '', 1);
|
||||
print '</td></tr>';
|
||||
// Year
|
||||
print '<tr><td>'.$langs->trans("Year").'</td><td>';
|
||||
|
||||
@ -309,7 +309,7 @@ if ($resql)
|
||||
//'presend'=>$langs->trans("SendByMail"),
|
||||
'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
if ($user->rights->ficheinter->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete");
|
||||
if ($user->rights->ficheinter->supprimer) $arrayofmassactions['predelete']='<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
||||
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
|
||||
@ -625,7 +625,7 @@ if ($resql)
|
||||
'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
//if($user->rights->fournisseur->facture->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer");
|
||||
if ($user->rights->fournisseur->commande->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete");
|
||||
if ($user->rights->fournisseur->commande->supprimer) $arrayofmassactions['predelete']='<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
||||
if (in_array($massaction, array('presend','predelete','createbills'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
|
||||
@ -459,7 +459,7 @@ if ($resql)
|
||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
//if($user->rights->fournisseur->facture->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer");
|
||||
if ($user->rights->fournisseur->facture->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete");
|
||||
if ($user->rights->fournisseur->facture->supprimer) $arrayofmassactions['predelete']='<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
||||
if (in_array($massaction, array('presend','predelete','createbills'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
|
||||
@ -121,7 +121,7 @@ $arrayofmassactions = array(
|
||||
'presend'=>$langs->trans("SendByMail"),
|
||||
'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
if ($user->rights->mymodule->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete");
|
||||
if ($user->rights->mymodule->supprimer) $arrayofmassactions['predelete']='<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
||||
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
|
||||
@ -284,7 +284,7 @@ $arrayofmassactions = array(
|
||||
//'presend'=>$langs->trans("SendByMail"),
|
||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
if ($user->rights->holiday->delete) $arrayofmassactions['predelete']=$langs->trans("Delete");
|
||||
if ($user->rights->holiday->delete) $arrayofmassactions['predelete']='<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
||||
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
|
||||
@ -76,8 +76,8 @@ if (! empty($useragent))
|
||||
|
||||
|
||||
// Check PHP version
|
||||
$arrayphpminversionerror = array(5,4,0);
|
||||
$arrayphpminversionwarning = array(5,4,0);
|
||||
$arrayphpminversionerror = array(5,5,0);
|
||||
$arrayphpminversionwarning = array(5,5,0);
|
||||
if (versioncompare(versionphparray(), $arrayphpminversionerror) < 0) // Minimum to use (error if lower)
|
||||
{
|
||||
print '<img src="../theme/eldy/img/error.png" alt="Error"> '.$langs->trans("ErrorPHPVersionTooLow", versiontostring($arrayphpminversionerror));
|
||||
|
||||
@ -286,4 +286,5 @@ DELETE from llx_accounting_account where rowid in (select minid from tmp_llx_acc
|
||||
ALTER TABLE llx_accounting_account DROP INDEX uk_accounting_account;
|
||||
ALTER TABLE llx_accounting_account ADD UNIQUE INDEX uk_accounting_account (account_number, entity, fk_pcg_version);
|
||||
|
||||
UPDATE llx_projet SET fk_opp_status = NULL WHERE fk_opp_status = -1;
|
||||
|
||||
|
||||
@ -275,3 +275,5 @@ ALTER TABLE llx_product ADD COLUMN fk_project integer DEFAULT NULL;
|
||||
ALTER TABLE llx_product ADD INDEX idx_product_fk_project (fk_project);
|
||||
|
||||
ALTER TABLE llx_actioncomm ADD COLUMN calling_duration integer;
|
||||
|
||||
ALTER TABLE llx_emailcollector_emailcollector ADD COLUMN datelastok datetime;
|
||||
|
||||
@ -29,6 +29,7 @@ CREATE TABLE llx_emailcollector_emailcollector(
|
||||
datelastresult datetime,
|
||||
codelastresult varchar(16),
|
||||
lastresult varchar(255),
|
||||
datelastok datetime,
|
||||
note_public text,
|
||||
note_private text,
|
||||
date_creation datetime NOT NULL,
|
||||
|
||||
@ -956,7 +956,7 @@ function write_conf_file($conffile)
|
||||
fputs($fp, '$dolibarr_nocsrfcheck=\'0\';');
|
||||
fputs($fp, "\n");
|
||||
|
||||
fputs($fp, '$dolibarr_main_cookie_cryptkey=\''.$key.'\';');
|
||||
fputs($fp, '$dolibarr_main_instance_unique_id=\''.$key.'\';');
|
||||
fputs($fp, "\n");
|
||||
|
||||
fputs($fp, '$dolibarr_mailing_limit_sendbyweb=\'0\';');
|
||||
|
||||
@ -233,7 +233,7 @@ Limit=Limit
|
||||
Limits=Limits
|
||||
Logout=Abmelden
|
||||
NoLogoutProcessWithAuthMode=Keine Anwendung Trennungsfunktion mit Authentifizierungsmodus <b>% s </ b>
|
||||
Connection=Benutzername
|
||||
Connection=Anmelden
|
||||
Setup=Einstellungen
|
||||
Alert=Warnung
|
||||
MenuWarnings=Benachrichtigungen
|
||||
|
||||
@ -494,7 +494,7 @@ Module1Name=Third Parties
|
||||
Module1Desc=Companies and contacts management (customers, prospects...)
|
||||
Module2Name=Commercial
|
||||
Module2Desc=Commercial management
|
||||
Module10Name=Accounting
|
||||
Module10Name=Accounting (simplified)
|
||||
Module10Desc=Simple accounting reports (journals, turnover) based on database content. Does not use any ledger table.
|
||||
Module20Name=Proposals
|
||||
Module20Desc=Commercial proposal management
|
||||
@ -541,7 +541,7 @@ Module80Desc=Shipments and delivery note management
|
||||
Module85Name=Banks & Cash
|
||||
Module85Desc=Management of bank or cash accounts
|
||||
Module100Name=External Site
|
||||
Module100Desc=Add a link to an external website as a main menu icon. Website is shown in a frame in the Dolibarr page.
|
||||
Module100Desc=Add a link to an external website as a main menu icon. Website is shown in a frame under the top menu.
|
||||
Module105Name=Mailman and SPIP
|
||||
Module105Desc=Mailman or SPIP interface for member module
|
||||
Module200Name=LDAP
|
||||
@ -632,7 +632,7 @@ Module50200Name=Paypal
|
||||
Module50200Desc=Offer customers a PayPal online payment page (PayPal account or credit/debit cards). This can be used to allow your customers to make ad-hoc payments or payments related to a specific Dolibarr object (invoice, order etc...)
|
||||
Module50300Name=Stripe
|
||||
Module50300Desc=Offer customers a Stripe online payment page (credit/debit cards). This can be used to allow your customers to make ad-hoc payments or payments related to a specific Dolibarr object (invoice, order etc...)
|
||||
Module50400Name=Accounting (advanced)
|
||||
Module50400Name=Accounting (double entry)
|
||||
Module50400Desc=Accounting management (double entries, support general and auxiliary ledgers). Export the ledger in several other accounting software formats.
|
||||
Module54000Name=PrintIPP
|
||||
Module54000Desc=Direct print (without opening the documents) using Cups IPP interface (Printer must be visible from server, and CUPS must be installed on server).
|
||||
@ -1829,16 +1829,18 @@ MailboxSourceDirectory=Mailbox source directory
|
||||
MailboxTargetDirectory=Mailbox target directory
|
||||
EmailcollectorOperations=Operations to do by collector
|
||||
CollectNow=Collect now
|
||||
DateLastResult=Date last collect
|
||||
LastResult=Last result
|
||||
DateLastCollectResult=Date latest collect tried
|
||||
DateLastcollectResultOk=Date latest collect successfull
|
||||
LastResult=Latest result
|
||||
EmailCollectorConfirmCollectTitle=Email collect confirmation
|
||||
EmailCollectorConfirmCollect=Do you want to run the collection for this collector now ?
|
||||
NoNewEmailToProcess=No new email (matching filters) to process
|
||||
NothingProcessed=Nothing done
|
||||
XEmailsDoneYActionsDone=%s emails qualified, %s emails successfully processed (for %s record/actions done) by collector
|
||||
XEmailsDoneYActionsDone=%s emails qualified, %s emails successfully processed (for %s record/actions done)
|
||||
RecordEvent=Record email event
|
||||
CreateLeadAndThirdParty=Create lead (and third party if necessary)
|
||||
CodeLastResult=Result code of last collect
|
||||
CreateTicketAndThirdParty=Create ticket (and third party if necessary)
|
||||
CodeLastResult=Latest result code
|
||||
NbOfEmailsInInbox=Number of emails in source directory
|
||||
LoadThirdPartyFromName=Load third party from name (load only)
|
||||
LoadThirdPartyFromNameOrCreate=Load third party from name (create if not found)
|
||||
@ -1847,7 +1849,7 @@ WithoutDolTrackingID=Dolibarr Tracking ID not found
|
||||
FormatZip=Zip
|
||||
MainMenuCode=Menu entry code (mainmenu)
|
||||
ECMAutoTree=Show automatic ECM tree
|
||||
OperationParamDesc=Define values to use for action, or how to extract values. For example:<br>VALUE:abc<br>REGEX:SUBJECT:([^\s]*)<br>REGEX:BODY:My company name is\s([^\s]*)
|
||||
OperationParamDesc=Define values to use for action, or how to extract values. For example:<br>objproperty1=SET:abc<br>objproperty2=EXTRACT:HEADER:X-Myheaderkey.*[^\s]+(.*)<br>objproperty3=EXTRACT:SUBJECT:([^\s]*)<br>object.objproperty4=EXTRACT:BODY:My company name is\s([^\s]*)<br><br>Use a ; char as separator to extract or set several properties.
|
||||
OpeningHours=Opening hours
|
||||
OpeningHoursDesc=Enter here the regular opening hours of your company.
|
||||
ResourceSetup=Configuration of Resource module
|
||||
@ -1875,3 +1877,8 @@ WarningValueHigherSlowsDramaticalyOutput=Warning, higher values slows dramatical
|
||||
DebugBarModuleActivated=Module debugbar is activated and slows dramaticaly the interface
|
||||
EXPORTS_SHARE_MODELS=Export models are share with everybody
|
||||
ExportSetup=Setup of module Export
|
||||
InstanceUniqueID=Unique ID of the instance
|
||||
SmallerThan=Smaller than
|
||||
LargerThan=Larger than
|
||||
IfTrackingIDFoundEventWillBeLinked=Note that If a tracking ID is found into incoming email, the event will be automatically linked to the related objects.
|
||||
WithGMailYouCanCreateADedicatedPassword=With a GMail account, if you enabled the 2 steps validation, it is recommanded to create a dedicated second password for the application instead of using your own account passsword from https://myaccount.google.com/.
|
||||
|
||||
@ -35,7 +35,7 @@ BoxTitleOldestUnpaidCustomerBills=Customer Invoices: oldest %s unpaid
|
||||
BoxTitleOldestUnpaidSupplierBills=Vendor Invoices: oldest %s unpaid
|
||||
BoxTitleCurrentAccounts=Open Accounts: balances
|
||||
BoxTitleLastModifiedContacts=Contacts/Addresses: last %s modified
|
||||
BoxMyLastBookmarks=Bookmarks: last %s
|
||||
BoxMyLastBookmarks=Bookmarks: latest %s
|
||||
BoxOldestExpiredServices=Oldest active expired services
|
||||
BoxLastExpiredServices=Latest %s oldest contacts with active expired services
|
||||
BoxTitleLastActionsToDo=Latest %s actions to do
|
||||
|
||||
@ -966,4 +966,6 @@ YouAreCurrentlyInSandboxMode=You are currently in the %s "sandbox" mode
|
||||
Inventory=Inventory
|
||||
AnalyticCode=Analytic code
|
||||
TMenuMRP=MRP
|
||||
ShowMoreInfos=Show More Infos
|
||||
ShowMoreInfos=Show More Infos
|
||||
NoFilesUploadedYet=Please upload a document first
|
||||
SeePrivateNote=See private note
|
||||
|
||||
@ -994,7 +994,7 @@ class Livraison extends CommonObject
|
||||
* Set the planned delivery date
|
||||
*
|
||||
* @param User $user Objet utilisateur qui modifie
|
||||
* @param timestamp $date_livraison Date de livraison
|
||||
* @param integer $date_livraison Date de livraison
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function set_date_livraison($user, $date_livraison)
|
||||
@ -1107,7 +1107,7 @@ class LivraisonLigne extends CommonObjectLine
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see product_ref
|
||||
* @see $product_ref
|
||||
*/
|
||||
public $ref;
|
||||
/**
|
||||
|
||||
@ -398,7 +398,7 @@ if ((! defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && ! empty($conf->
|
||||
}
|
||||
|
||||
// Disable modules (this must be after session_start and after conf has been loaded)
|
||||
if (GETPOST('disablemodules', 'alpha')) $_SESSION["disablemodules"]=GETPOST('disablemodules', 'alpha');
|
||||
if (GETPOSTISSET('disablemodules')) $_SESSION["disablemodules"]=GETPOST('disablemodules', 'alpha');
|
||||
if (! empty($_SESSION["disablemodules"]))
|
||||
{
|
||||
$disabled_modules=explode(',', $_SESSION["disablemodules"]);
|
||||
@ -426,7 +426,7 @@ if(is_array($modulepart) && count($modulepart)>0)
|
||||
if(in_array($module, $modulepart))
|
||||
{
|
||||
$conf->modulepart = $module;
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -437,7 +437,7 @@ if(is_array($modulepart) && count($modulepart)>0)
|
||||
$login='';
|
||||
if (! defined('NOLOGIN'))
|
||||
{
|
||||
// $authmode lists the different means of identification to be tested in order of preference.
|
||||
// $authmode lists the different method of identification to be tested in order of preference.
|
||||
// Example: 'http', 'dolibarr', 'ldap', 'http,forceuser', '...'
|
||||
|
||||
if (defined('MAIN_AUTHENTICATION_MODE'))
|
||||
|
||||
@ -65,7 +65,7 @@ $conf->file->mailing_limit_sendbycli = $dolibarr_mailing_limit_sendbycli;
|
||||
$conf->file->main_authentication = empty($dolibarr_main_authentication)?'':$dolibarr_main_authentication; // Identification mode
|
||||
$conf->file->main_force_https = empty($dolibarr_main_force_https)?'':$dolibarr_main_force_https; // Force https
|
||||
$conf->file->strict_mode = empty($dolibarr_strict_mode)?'':$dolibarr_strict_mode; // Force php strict mode (for debug)
|
||||
$conf->file->cookie_cryptkey = empty($dolibarr_main_cookie_cryptkey)?'':$dolibarr_main_cookie_cryptkey; // Cookie cryptkey
|
||||
$conf->file->instance_unique_id = empty($dolibarr_main_instance_unique_id)?(empty($dolibarr_main_cookie_cryptkey)?'':$dolibarr_main_cookie_cryptkey):$dolibarr_main_instance_unique_id; // Unique id of instance
|
||||
$conf->file->dol_document_root = array('main' => (string) DOL_DOCUMENT_ROOT); // Define array of document root directories ('/home/htdocs')
|
||||
$conf->file->dol_url_root = array('main' => (string) DOL_URL_ROOT); // Define array of url root path ('' or '/dolibarr')
|
||||
if (! empty($dolibarr_main_document_root_alt))
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user