This commit is contained in:
Christophe Battarel 2019-04-09 16:35:52 +02:00
commit 7cc9a5aa08
143 changed files with 4938 additions and 1137 deletions

View File

@ -31,7 +31,6 @@ addons:
- pgloader - pgloader
php: php:
- '5.4'
- '5.5' - '5.5'
- '5.6' - '5.6'
- '7.0' - '7.0'
@ -62,8 +61,6 @@ matrix:
- php: nightly - php: nightly
# We exclude some combinations not usefull to save Travis CPU # We exclude some combinations not usefull to save Travis CPU
exclude: exclude:
- php: '5.5'
env: DB=mariadb
- php: '5.6' - php: '5.6'
env: DB=mariadb env: DB=mariadb
- php: '7.0' - php: '7.0'
@ -72,8 +69,6 @@ matrix:
env: DB=mariadb env: DB=mariadb
- php: '7.2' - php: '7.2'
env: DB=mariadb env: DB=mariadb
- php: '5.5'
env: DB=postgresql
- php: '5.6' - php: '5.6'
env: DB=postgresql env: DB=postgresql
- php: '7.0' - php: '7.0'

View File

@ -2,20 +2,25 @@
English Dolibarr ChangeLog English Dolibarr ChangeLog
-------------------------------------------------------------- --------------------------------------------------------------
***** ChangeLog for 10.0.0 compared to 9.0.0 ***** ***** ChangeLog for 10.0.0 compared to 9.0.0 *****
For Users: For Users:
NEW: Module Ticket is available as a stable module. NEW: Module "Ticket" is available as a stable module.
NEW: module "Email Collector" is available as a stable module.
NEW: module "TakePOS" is available as a stable module.
NEW: Experimental module "Vendor receptions". NEW: Experimental module "Vendor receptions".
NEW: Experimental module "BOM". NEW: Experimental module "BOM".
FIX: Disallow line start date to be after end date FIX: Disallow line start date if after end date.
For Developers: For Developers:
NEW: Module DebugBar is available as a stable module. NEW: Module "DebugBar" is available as a stable module.
WARNING: WARNING:
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better: Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
* PHP 5.4 is no more supported. Minimum PHP is now 5.5+.
* The PHP extension php-intl is not mandatory but should be installed to have new features working correctly. * The PHP extension php-intl is not mandatory but should be installed to have new features working correctly.
* Method GetUrlTrackingStatus were renamed into getUrlTrackingStatus for consistency with naming rules. * Method GetUrlTrackingStatus were renamed into getUrlTrackingStatus for consistency with naming rules.
* API getListOfCivility has been renamed into getListOfCivilities for consistency with naming rules. * API getListOfCivility has been renamed into getListOfCivilities for consistency with naming rules.
@ -28,8 +33,59 @@ Following changes may create regressions for some external modules, but were nec
* Hidden option CHANGE_ORDER_CONCAT_DESCRIPTION were renamed into MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION. * Hidden option CHANGE_ORDER_CONCAT_DESCRIPTION were renamed into MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION.
* Method dolEscapeXML was moved from functions.lib.php into function2.lib.php (not used enough to be loaded by default). * Method dolEscapeXML was moved from functions.lib.php into function2.lib.php (not used enough to be loaded by default).
* Removed deprecated use of string in dol_print_date(). Only date allowed. * Removed deprecated use of string in dol_print_date(). Only date allowed.
* Deprecated property ->fk_departement is now ->state_id everywhere.
* Removed the method 4 of GETPOST (to get $_COOKIE). It was not used and not recommanded to use in Dolibarr.
***** ChangeLog for 9.0.2 compared to 9.0.1 *****
FIX: #10822
FIX: Accountancy - Format EBP import
FIX: A page of a site replaced with another when switching in edit mode
FIX: Autodetect buy price for invoices autogenerated with templates.
FIX: Avoid error 500 when extension php-intl not loaded
FIX: bad check on type of expense report (mandatory status not working)
FIX: Bad label of status for members (must be short version in list)
FIX: Can not create contract with numbering module without autogen rule
FIX: Can't set default value of extrafield of type varchar
FIX: check only if invoice module is enabled (bank is check after)
FIX: counter of permissions in badge was wrong
FIX: default value of language of thirdparty
FIX: Don't show accountingjournal:getNomUrl without data
FIX: Duplicate executeHook function
FIX: Edit of personalized groups
FIX: Error with various & salary payment on project
FIX: extrafields always visible on view mode
FIX: function not found
FIX: If we build one invoice for several orders, we must put the ref of
orders on lines.
FIX: expensereport must be in $check array
FIX: missing entity filter and wrong var name
FIX: Missing field "In sale" in list
FIX: missing hook completeTabsHead in margins module
FIX: missing hook in agenda export
FIX: missing vat_src_code when inserting an expense report line
FIX: More complete auto setup of barcode module
FIX: need to round with 2 decimals to avoid movements not correctly balanced
FIX: no need to test anything to display documents tabs on expense report
FIX: old export models was not visible
FIX: Param keepn must be 1 when dol_escape_htmltag used for textarea
FIX: possibility to set up payment mode when invoice module is disabled
FIX: problem with sign of various payment in project preview
FIX: Remane of project
FIX: setup of module export
FIX: several hooks in shipping/delivery cards
FIX: supplier discount was not retrieved when choosing a product
FIX: The minimum amount filter does not work in the VAT report per customer
FIX: Tooltip on click was ko on smartphone
FIX: translation
FIX: useless join
FIX: Vat src code lost after editing expense report line
FIX: we need to keep originline special_code
FIX: Can't insert if there is extrafields mandatory on another entity.
FIX: error in create object when 2 extra fields are mandatory in 2 different entities
FIX: when we create deposit with multi tva, we mustn't add line if amount = 0 (example when we have a 100% reduc on one of origin invoice line)
FIX: wrong redirect link on holiday refuse
NEW: Add more complete error messages in log on stripe payments
***** ChangeLog for 9.0.1 compared to 9.0.0 ***** ***** ChangeLog for 9.0.1 compared to 9.0.0 *****
FIX: #10381 FIX: #10381
@ -511,7 +567,7 @@ NEW: Filter export model is now by user
NEW: Finish implementation of option PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES NEW: Finish implementation of option PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES
NEW: generalize use of button to create new element from list NEW: generalize use of button to create new element from list
NEW: hidden conf AGENDA_NB_WEEKS_IN_VIEW_PER_USER to set nb weeks to show into per user view NEW: hidden conf AGENDA_NB_WEEKS_IN_VIEW_PER_USER to set nb weeks to show into per user view
NEW: hidden conf to assign category to thirparty that are neither customer nor prospect or supplier NEW: hidden conf to assign category to thirdparty that are neither customer nor prospect or supplier
NEW: hidden conf to set nb weeks to show into user view NEW: hidden conf to set nb weeks to show into user view
NEW: hidden option MAIN_DISABLE_FREE_LINES NEW: hidden option MAIN_DISABLE_FREE_LINES
NEW: improve way of adding users/sales representative to thirdparty NEW: improve way of adding users/sales representative to thirdparty

View File

@ -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.doc_date BETWEEN '" . $db->idate($date_start) . "' AND '" . $db->idate($date_end) . "' )";
} }
$sql.= ' AND bk.entity IN ('.getEntity('accountingbookkeeping').')';
$sql .= $db->order($sortfield, $sortorder); $sql .= $db->order($sortfield, $sortorder);
$debit = 0; $debit = 0;

View File

@ -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 .= " 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 .= " 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 . "' )"; $sql .= " WHERE (bk.subledger_account = '" . $object->code_compta_fournisseur . "' AND bk.numero_compte = '" . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . "' )";
if (dol_strlen($search_year)) { if (dol_strlen($search_year)) {
$date_start = dol_mktime(0, 0, 0, 1, 1, $search_year); $date_start = dol_mktime(0, 0, 0, 1, 1, $search_year);
$date_end = dol_mktime(23, 59, 59, 12, 31, $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.doc_date BETWEEN '".$db->idate($date_start)."' AND '".$db->idate($date_end)."' )";
} }
$sql.= ' AND bk.entity IN ('.getEntity('accountingbookkeeping').')';
$sql.= $db->order($sortfield, $sortorder); $sql.= $db->order($sortfield, $sortorder);
$debit = 0; $debit = 0;

View File

@ -341,7 +341,7 @@ if ($result) {
//'presend'=>$langs->trans("SendByMail"), //'presend'=>$langs->trans("SendByMail"),
//'builddoc'=>$langs->trans("PDFMerge"), //'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(); //if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('ventil', $arrayofmassactions, 1); $massactionbutton=$form->selectMassAction('ventil', $arrayofmassactions, 1);

View File

@ -273,7 +273,7 @@ if ($result) {
//'presend'=>$langs->trans("SendByMail"), //'presend'=>$langs->trans("SendByMail"),
//'builddoc'=>$langs->trans("PDFMerge"), //'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(); //if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('ventil', $arrayofmassactions, 1); $massactionbutton=$form->selectMassAction('ventil', $arrayofmassactions, 1);

View File

@ -340,7 +340,7 @@ if ($result) {
//'presend'=>$langs->trans("SendByMail"), //'presend'=>$langs->trans("SendByMail"),
//'builddoc'=>$langs->trans("PDFMerge"), //'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(); //if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('ventil', $arrayofmassactions, 1); $massactionbutton=$form->selectMassAction('ventil', $arrayofmassactions, 1);

View File

@ -358,7 +358,7 @@ $arrayofmassactions = array(
//'presend'=>$langs->trans("SendByMail"), //'presend'=>$langs->trans("SendByMail"),
//'builddoc'=>$langs->trans("PDFMerge"), //'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(); if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions); $massactionbutton=$form->selectMassAction('', $arrayofmassactions);

View File

@ -240,7 +240,7 @@ $arrayofmassactions = array(
//'presend'=>$langs->trans("SendByMail"), //'presend'=>$langs->trans("SendByMail"),
//'builddoc'=>$langs->trans("PDFMerge"), //'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(); if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions); $massactionbutton=$form->selectMassAction('', $arrayofmassactions);

View File

@ -75,6 +75,8 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be inclu
//$isdraft = (($object->statut == MyObject::STATUS_DRAFT) ? 1 : 0); //$isdraft = (($object->statut == MyObject::STATUS_DRAFT) ? 1 : 0);
//$result = restrictedArea($user, 'mymodule', $object->id, '', '', 'fk_soc', 'rowid', $isdraft); //$result = restrictedArea($user, 'mymodule', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
$debuginfo='';
/* /*
* Actions * Actions
@ -180,10 +182,12 @@ if ($action == 'confirm_collect')
$res = $object->doCollectOneCollector(); $res = $object->doCollectOneCollector();
if ($res > 0) if ($res > 0)
{ {
$debuginfo = $object->debuginfo;
setEventMessages($object->lastresult, null, 'mesgs'); setEventMessages($object->lastresult, null, 'mesgs');
} }
else else
{ {
$debuginfo = $object->debuginfo;
setEventMessages($object->error, null, 'errors'); setEventMessages($object->error, null, 'errors');
} }
@ -443,22 +447,45 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'; print '<td>';
$arrayoftypes=array( $arrayoftypes=array(
'from'=>'MailFrom', 'from'=>array('label'=>'MailFrom', 'data-placeholder'=>'SearchString'),
'to'=>'MailTo', 'to'=>array('label'=>'MailTo', 'data-placeholder'=>'SearchString'),
'cc'=>'Cc', 'cc'=>array('label'=>'Cc', 'data-placeholder'=>'SearchString'),
'bcc'=>'Bcc', 'bcc'=>array('label'=>'Bcc', 'data-placeholder'=>'SearchString'),
'subject'=>'Subject', 'subject'=>array('label'=>'Subject', 'data-placeholder'=>'SearchString'),
'body'=>'Body', 'body'=>array('label'=>'Body', 'data-placeholder'=>'SearchString'),
'header'=>array('label'=>'Header', 'data-placeholder'=>'HeaderKey SearchString'), // HEADER key value
'X1'=>'---', 'X1'=>'---',
'seen'=>'AlreadyRead', 'seen'=>array('label'=>'AlreadyRead', 'data-noparam'=>1),
'unseen'=>'NotRead', 'unseen'=>array('label'=>'NotRead', 'data-noparam'=>1),
'smaller'=>array('label'=>'SmallerThan', 'data-placeholder'=>'NumberOfBytes'),
'larger'=>array('label'=>'LargerThan', 'data-placeholder'=>'NumberOfBytes'),
'X2'=>'---', 'X2'=>'---',
'withtrackingid'=>'WithDolTrackingID', 'withtrackingid'=>array('label'=>'WithDolTrackingID', 'data-noparam'=>1),
'withouttrackingid'=>'WithoutDolTrackingID' 'withouttrackingid'=>array('label'=>'WithoutDolTrackingID', 'data-noparam'=>1)
); );
print $form->selectarray('filtertype', $arrayoftypes, '', 1, 0, 0, '', 1, 0, 0, '', '', 0, '', 2); 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 '</td><td>';
print '<input type="text" name="rulevalue">'; print '<input type="text" name="rulevalue" id="rulevalue">';
print '</td>'; print '</td>';
print '<td class="right"><input type="submit" name="addfilter" id="addfilter" class="flat button" value="'.$langs->trans("Add").'"></td>'; print '<td class="right"><input type="submit" name="addfilter" id="addfilter" class="flat button" value="'.$langs->trans("Add").'"></td>';
print '</tr>'; print '</tr>';
@ -470,7 +497,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'; print '<td>';
print $langs->trans($arrayoftypes[$rulefilter['type']]); print $langs->trans($arrayoftypes[$rulefilter['type']]['label']);
print '</td>'; print '</td>';
print '<td>'.$rulefilter['rulevalue'].'</td>'; print '<td>'.$rulefilter['rulevalue'].'</td>';
print '<td class="right">'; print '<td class="right">';
@ -492,8 +519,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Add operation // Add operation
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'; 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->projet->enabled) $arrayoftypes['project']='CreateLeadAndThirdParty';
if ($conf->ticket->enabled) $arrayoftypes['ticket']='CreateTicketAndThirdParty';
print $form->selectarray('operationtype', $arrayoftypes, '', 1, 0, 0, '', 1); print $form->selectarray('operationtype', $arrayoftypes, '', 1, 0, 0, '', 1);
print '</td><td>'; print '</td><td>';
print '<input type="text" name="operationparam">'; print '<input type="text" name="operationparam">';
@ -517,12 +548,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<tr class="drag drop oddeven" id="row-'.$ruleaction['id'].'">'; print '<tr class="drag drop oddeven" id="row-'.$ruleaction['id'].'">';
print '<td>'; print '<td>';
print $langs->trans($arrayoftypes[$ruleaction['type']]); print $langs->trans($arrayoftypes[$ruleaction['type']]);
if (in_array($ruleaction['type'], array('recordevent')))
{
print $form->textwithpicto('', $langs->transnoentitiesnoconv('IfTrackingIDFoundEventWillBeLinked'));
}
print '</td>'; print '</td>';
print '<td>'.$ruleaction['actionparam'].'</td>'; print '<td>'.$ruleaction['actionparam'].'</td>';
print '<td class="right">'; // Move up/down
//print $ruleactionobj->getLibStatut(3);
print ' <a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=deleteoperation&operationid='.$ruleaction['id'].'">'.img_delete().'</a>';
print '</td>';
print '<td class="center linecolmove tdlineupdown">'; print '<td class="center linecolmove tdlineupdown">';
if ($i > 0) if ($i > 0)
{ {
@ -532,6 +564,10 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<a class="lineupdown" href="'.$_SERVER['PHP_SELF'].'?action=down&amp;rowid='.$ruleaction['id'].'">'.img_down('default', 0, 'imgdownforline').'</a>'; print '<a class="lineupdown" href="'.$_SERVER['PHP_SELF'].'?action=down&amp;rowid='.$ruleaction['id'].'">'.img_down('default', 0, 'imgdownforline').'</a>';
} }
print '</td>'; print '</td>';
// Delete
print '<td class="right">';
print ' <a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=deleteoperation&operationid='.$ruleaction['id'].'">'.img_delete().'</a>';
print '</td>';
print '</tr>'; print '</tr>';
$i++; $i++;
} }
@ -540,6 +576,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '</table>'; print '</table>';
if (! empty($conf->use_javascript_ajax)) { if (! empty($conf->use_javascript_ajax)) {
$urltorefreshaftermove = DOL_URL_ROOT.'/admin/emailcollector_card.php?id='.$id;
include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php'; include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php';
} }
@ -571,6 +608,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '</div>' . "\n"; print '</div>' . "\n";
} }
if (! empty($debuginfo))
{
print info_admin($debuginfo);
}
// Select mail models is same action as presend // Select mail models is same action as presend
if (GETPOST('modelselected')) { if (GETPOST('modelselected')) {
$action = 'presend'; $action = 'presend';

View File

@ -304,7 +304,7 @@ $arrayofmassactions = array(
//'presend'=>$langs->trans("SendByMail"), //'presend'=>$langs->trans("SendByMail"),
//'builddoc'=>$langs->trans("PDFMerge"), //'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(); if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions); $massactionbutton=$form->selectMassAction('', $arrayofmassactions);

View File

@ -131,11 +131,13 @@ if ($action == 'update')
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_TEXTLINK', $conf->entity); if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_TEXTLINK', $conf->entity);
else dolibarr_set_const($db, 'THEME_ELDY_TEXTLINK', $val, 'chaine', 0, '', $conf->entity); else dolibarr_set_const($db, 'THEME_ELDY_TEXTLINK', $val, 'chaine', 0, '', $conf->entity);
if (GETPOST('THEME_ELDY_USE_HOVER') == '') dolibarr_set_const($db, "THEME_ELDY_USE_HOVER", '0', 'chaine', 0, '', $conf->entity); // If empty, we set to '0' ('000000' is for black) $val=(implode(',', (colorStringToArray(GETPOST('THEME_ELDY_USE_HOVER'), array()))));
else dolibarr_set_const($db, "THEME_ELDY_USE_HOVER", $_POST["THEME_ELDY_USE_HOVER"], 'chaine', 0, '', $conf->entity); if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_USE_HOVER', $conf->entity);
else dolibarr_set_const($db, "THEME_ELDY_USE_HOVER", $val, 'chaine', 0, '', $conf->entity);
if (GETPOST('THEME_ELDY_USE_CHECKED') == '') dolibarr_set_const($db, "THEME_ELDY_USE_CHECKED", '0', 'chaine', 0, '', $conf->entity); $val=(implode(',', (colorStringToArray(GETPOST('THEME_ELDY_USE_CHECKED'), array()))));
else dolibarr_set_const($db, "THEME_ELDY_USE_CHECKED", $_POST["THEME_ELDY_USE_CHECKED"], 'chaine', 0, '', $conf->entity); if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_USE_CHECKED', $conf->entity);
else dolibarr_set_const($db, "THEME_ELDY_USE_CHECKED", $val, 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_SIZE_LISTE_LIMIT", $_POST["main_size_liste_limit"], 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_SIZE_LISTE_LIMIT", $_POST["main_size_liste_limit"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_SIZE_SHORTLIST_LIMIT", $_POST["main_size_shortliste_limit"], 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_SIZE_SHORTLIST_LIMIT", $_POST["main_size_shortliste_limit"], 'chaine', 0, '', $conf->entity);
@ -239,14 +241,14 @@ if ($action == 'edit') // Edit
print '</tr>'; print '</tr>';
// Default language // Default language
print '<tr><td class="titlefield">'.$langs->trans("DefaultLanguage").'</td><td>'; print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("DefaultLanguage").'</td><td>';
print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT, 'MAIN_LANG_DEFAULT', 1, 0, 0, 0, 0, 'minwidth300', 2); print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT, 'MAIN_LANG_DEFAULT', 1, 0, 0, 0, 0, 'minwidth300', 2);
print '</td>'; print '</td>';
print '<td width="20">&nbsp;</td>'; print '<td width="20">&nbsp;</td>';
print '</tr>'; print '</tr>';
// Multilingual GUI // Multilingual GUI
print '<tr><td class="titlefield">'.$langs->trans("EnableMultilangInterface").'</td><td>'; print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("EnableMultilangInterface").'</td><td>';
print $form->selectyesno('MAIN_MULTILANGS', $conf->global->MAIN_MULTILANGS, 1); print $form->selectyesno('MAIN_MULTILANGS', $conf->global->MAIN_MULTILANGS, 1);
print '</td>'; print '</td>';
print '<td width="20">&nbsp;</td>'; print '<td width="20">&nbsp;</td>';
@ -265,19 +267,19 @@ if ($action == 'edit') // Edit
print '</tr>'; print '</tr>';
// Disable javascript and ajax // Disable javascript and ajax
print '<tr><td>'.$langs->trans("DisableJavascript").'</td><td>'; print '<tr class="oddeven"><td>'.$langs->trans("DisableJavascript").'</td><td>';
print $form->selectyesno('MAIN_DISABLE_JAVASCRIPT', isset($conf->global->MAIN_DISABLE_JAVASCRIPT)?$conf->global->MAIN_DISABLE_JAVASCRIPT:0, 1); print $form->selectyesno('MAIN_DISABLE_JAVASCRIPT', isset($conf->global->MAIN_DISABLE_JAVASCRIPT)?$conf->global->MAIN_DISABLE_JAVASCRIPT:0, 1);
print '</td>'; print '</td>';
print '<td width="20">&nbsp;</td>'; print '<td width="20">&nbsp;</td>';
print '</tr>'; print '</tr>';
// Max size of lists // Max size of lists
print '<tr><td>'.$langs->trans("DefaultMaxSizeList").'</td><td><input class="flat" name="main_size_liste_limit" size="4" value="' . $conf->global->MAIN_SIZE_LISTE_LIMIT . '"></td>'; print '<tr class="oddeven"><td>'.$langs->trans("DefaultMaxSizeList").'</td><td><input class="flat" name="main_size_liste_limit" size="4" value="' . $conf->global->MAIN_SIZE_LISTE_LIMIT . '"></td>';
print '<td width="20">&nbsp;</td>'; print '<td width="20">&nbsp;</td>';
print '</tr>'; print '</tr>';
// Max size of short lists on customer card // Max size of short lists on customer card
print '<tr><td>'.$langs->trans("DefaultMaxSizeShortList").'</td><td><input class="flat" name="main_size_shortliste_limit" size="4" value="' . $conf->global->MAIN_SIZE_SHORTLIST_LIMIT . '"></td>'; print '<tr class="oddeven"><td>'.$langs->trans("DefaultMaxSizeShortList").'</td><td><input class="flat" name="main_size_shortliste_limit" size="4" value="' . $conf->global->MAIN_SIZE_SHORTLIST_LIMIT . '"></td>';
print '<td width="20">&nbsp;</td>'; print '<td width="20">&nbsp;</td>';
print '</tr>'; print '</tr>';
@ -291,28 +293,28 @@ if ($action == 'edit') // Edit
*/ */
// First day for weeks // First day for weeks
print '<tr><td class="titlefield">'.$langs->trans("WeekStartOnDay").'</td><td>'; print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("WeekStartOnDay").'</td><td>';
print $formother->select_dayofweek((isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:'1'), 'MAIN_START_WEEK', 0); print $formother->select_dayofweek((isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:'1'), 'MAIN_START_WEEK', 0);
print '</td>'; print '</td>';
print '<td width="20">&nbsp;</td>'; print '<td width="20">&nbsp;</td>';
print '</tr>'; print '</tr>';
// DefaultWorkingDays // DefaultWorkingDays
print '<tr><td class="titlefield">'.$langs->trans("DefaultWorkingDays").'</td><td>'; print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("DefaultWorkingDays").'</td><td>';
print '<input type="text" name="MAIN_DEFAULT_WORKING_DAYS" size="5" value="'.(isset($conf->global->MAIN_DEFAULT_WORKING_DAYS)?$conf->global->MAIN_DEFAULT_WORKING_DAYS:'1-5').'">'; print '<input type="text" name="MAIN_DEFAULT_WORKING_DAYS" size="5" value="'.(isset($conf->global->MAIN_DEFAULT_WORKING_DAYS)?$conf->global->MAIN_DEFAULT_WORKING_DAYS:'1-5').'">';
print '</td>'; print '</td>';
print '<td width="20">&nbsp;</td>'; print '<td width="20">&nbsp;</td>';
print '</tr>'; print '</tr>';
// DefaultWorkingHours // DefaultWorkingHours
print '<tr><td class="titlefield">'.$langs->trans("DefaultWorkingHours").'</td><td>'; print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("DefaultWorkingHours").'</td><td>';
print '<input type="text" name="MAIN_DEFAULT_WORKING_HOURS" size="5" value="'.(isset($conf->global->MAIN_DEFAULT_WORKING_HOURS)?$conf->global->MAIN_DEFAULT_WORKING_HOURS:'9-18').'">'; print '<input type="text" name="MAIN_DEFAULT_WORKING_HOURS" size="5" value="'.(isset($conf->global->MAIN_DEFAULT_WORKING_HOURS)?$conf->global->MAIN_DEFAULT_WORKING_HOURS:'9-18').'">';
print '</td>'; print '</td>';
print '<td width="20">&nbsp;</td>'; print '<td width="20">&nbsp;</td>';
print '</tr>'; print '</tr>';
// Firstname/Name // Firstname/Name
print '<tr><td class="titlefield">'.$langs->trans("FirstnameNamePosition").'</td><td>'; print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("FirstnameNamePosition").'</td><td>';
$array=array(0=>$langs->trans("Firstname").' '.$langs->trans("Lastname"), 1=>$langs->trans("Lastname").' '.$langs->trans("Firstname")); $array=array(0=>$langs->trans("Firstname").' '.$langs->trans("Lastname"), 1=>$langs->trans("Lastname").' '.$langs->trans("Firstname"));
print $form->selectarray('MAIN_FIRSTNAME_NAME_POSITION', $array, (isset($conf->global->MAIN_FIRSTNAME_NAME_POSITION)?$conf->global->MAIN_FIRSTNAME_NAME_POSITION:0)); print $form->selectarray('MAIN_FIRSTNAME_NAME_POSITION', $array, (isset($conf->global->MAIN_FIRSTNAME_NAME_POSITION)?$conf->global->MAIN_FIRSTNAME_NAME_POSITION:0));
print '</td>'; print '</td>';
@ -320,14 +322,14 @@ if ($action == 'edit') // Edit
print '</tr>'; print '</tr>';
// Hide unauthorized button // Hide unauthorized button
print '<tr><td class="titlefield">'.$langs->trans("ButtonHideUnauthorized").'</td><td>'; print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("ButtonHideUnauthorized").'</td><td>';
print $form->selectyesno('MAIN_BUTTON_HIDE_UNAUTHORIZED', isset($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED)?$conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED:0, 1); print $form->selectyesno('MAIN_BUTTON_HIDE_UNAUTHORIZED', isset($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED)?$conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED:0, 1);
print '</td>'; print '</td>';
print '<td width="20">&nbsp;</td>'; print '<td width="20">&nbsp;</td>';
print '</tr>'; print '</tr>';
// Show logo // Show logo
print '<tr><td class="titlefield">'.$langs->trans("EnableShowLogo").'</td><td>'; print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("EnableShowLogo").'</td><td>';
print $form->selectyesno('MAIN_SHOW_LOGO', $conf->global->MAIN_SHOW_LOGO, 1); print $form->selectyesno('MAIN_SHOW_LOGO', $conf->global->MAIN_SHOW_LOGO, 1);
print '</td>'; print '</td>';
print '<td width="20">&nbsp;</td>'; print '<td width="20">&nbsp;</td>';
@ -344,7 +346,7 @@ if ($action == 'edit') // Edit
*/ */
// Show bugtrack link // Show bugtrack link
print '<tr><td class="titlefield">'.$langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")).'</td><td>'; print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")).'</td><td>';
print $form->selectyesno('MAIN_BUGTRACK_ENABLELINK', $conf->global->MAIN_BUGTRACK_ENABLELINK, 1); print $form->selectyesno('MAIN_BUGTRACK_ENABLELINK', $conf->global->MAIN_BUGTRACK_ENABLELINK, 1);
print '</td>'; print '</td>';
print '<td width="20">&nbsp;</td>'; print '<td width="20">&nbsp;</td>';
@ -352,7 +354,7 @@ if ($action == 'edit') // Edit
// Hide wiki link on login page // Hide wiki link on login page
$pictohelp='<span class="fa fa-question-circle"></span>'; $pictohelp='<span class="fa fa-question-circle"></span>';
print '<tr><td class="titlefield">'.$langs->trans("DisableLinkToHelp", $pictohelp).'</td><td>'; print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("DisableLinkToHelp", $pictohelp).'</td><td>';
print $form->selectyesno('MAIN_HELP_DISABLELINK', isset($conf->global->MAIN_HELP_DISABLELINK)?$conf->global->MAIN_HELP_DISABLELINK:0, 1); print $form->selectyesno('MAIN_HELP_DISABLELINK', isset($conf->global->MAIN_HELP_DISABLELINK)?$conf->global->MAIN_HELP_DISABLELINK:0, 1);
print '</td>'; print '</td>';
print '<td width="20">&nbsp;</td>'; print '<td width="20">&nbsp;</td>';
@ -362,7 +364,7 @@ if ($action == 'edit') // Edit
$substitutionarray=getCommonSubstitutionArray($langs, 0, array('object','objectamount')); $substitutionarray=getCommonSubstitutionArray($langs, 0, array('object','objectamount'));
complete_substitutions_array($substitutionarray, $langs); complete_substitutions_array($substitutionarray, $langs);
print '<tr><td class="titlefield">'; print '<tr class="oddeven"><td class="titlefield">';
$texthelp=$langs->trans("FollowingConstantsWillBeSubstituted").'<br>'; $texthelp=$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
foreach($substitutionarray as $key => $val) foreach($substitutionarray as $key => $val)
{ {
@ -390,7 +392,7 @@ if ($action == 'edit') // Edit
// Message on login page // Message on login page
$substitutionarray=getCommonSubstitutionArray($langs, 0, array('object','objectamount','user')); $substitutionarray=getCommonSubstitutionArray($langs, 0, array('object','objectamount','user'));
complete_substitutions_array($substitutionarray, $langs); complete_substitutions_array($substitutionarray, $langs);
print '<tr><td>'; print '<tr class="oddeven"><td>';
$texthelp=$langs->trans("FollowingConstantsWillBeSubstituted").'<br>'; $texthelp=$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
foreach($substitutionarray as $key => $val) foreach($substitutionarray as $key => $val)
{ {
@ -403,14 +405,14 @@ if ($action == 'edit') // Edit
print '</td></tr>'."\n"; print '</td></tr>'."\n";
// Hide helpcenter link on login page // Hide helpcenter link on login page
print '<tr><td class="titlefield">'.$langs->trans("DisableLinkToHelpCenter").'</td><td>'; print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("DisableLinkToHelpCenter").'</td><td>';
print $form->selectyesno('MAIN_HELPCENTER_DISABLELINK', isset($conf->global->MAIN_HELPCENTER_DISABLELINK)?$conf->global->MAIN_HELPCENTER_DISABLELINK:0, 1); print $form->selectyesno('MAIN_HELPCENTER_DISABLELINK', isset($conf->global->MAIN_HELPCENTER_DISABLELINK)?$conf->global->MAIN_HELPCENTER_DISABLELINK:0, 1);
print '</td>'; print '</td>';
print '<td width="20">&nbsp;</td>'; print '<td width="20">&nbsp;</td>';
print '</tr>'; print '</tr>';
// Background // Background
print '<tr><td><label for="imagebackground">'.$langs->trans("BackgroundImageLogin").' (png,jpg)</label></td><td colspan="2">'; print '<tr class="oddeven"><td><label for="imagebackground">'.$langs->trans("BackgroundImageLogin").' (png,jpg)</label></td><td colspan="2">';
print '<div class="centpercent inline-block">'; print '<div class="centpercent inline-block">';
print '<input type="file" class="flat class=minwidth200" name="imagebackground" id="imagebackground">'; print '<input type="file" class="flat class=minwidth200" name="imagebackground" id="imagebackground">';
if (! empty($conf->global->MAIN_LOGIN_BACKGROUND)) { if (! empty($conf->global->MAIN_LOGIN_BACKGROUND)) {

View File

@ -291,7 +291,7 @@ $arrayofmassactions = array(
//'presend'=>$langs->trans("SendByMail"), //'presend'=>$langs->trans("SendByMail"),
//'builddoc'=>$langs->trans("PDFMerge"), //'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(); if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions); $massactionbutton=$form->selectMassAction('', $arrayofmassactions);

View File

@ -286,6 +286,7 @@ $configfileparameters=array(
'dolibarr_main_document_root'=> $langs->trans("DocumentRootServer"), 'dolibarr_main_document_root'=> $langs->trans("DocumentRootServer"),
'?dolibarr_main_document_root_alt' => $langs->trans("DocumentRootServer").' (alt)', '?dolibarr_main_document_root_alt' => $langs->trans("DocumentRootServer").' (alt)',
'dolibarr_main_data_root' => $langs->trans("DataRootServer"), 'dolibarr_main_data_root' => $langs->trans("DataRootServer"),
'dolibarr_main_instance_unique_id' => $langs->trans("InstanceUniqueID"),
'separator1' => '', 'separator1' => '',
'dolibarr_main_db_host' => $langs->trans("DatabaseServer"), 'dolibarr_main_db_host' => $langs->trans("DatabaseServer"),
'dolibarr_main_db_port' => $langs->trans("DatabasePort"), 'dolibarr_main_db_port' => $langs->trans("DatabasePort"),
@ -391,7 +392,20 @@ foreach($configfileparameters as $key => $value)
++$i; ++$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.')'; if ($newkey == 'dolibarr_main_url_root' && ${$newkey} != DOL_MAIN_URL_ROOT) print ' (currently overwritten by autodetected value: '.DOL_MAIN_URL_ROOT.')';
print "</td>"; print "</td>";
} }

View File

@ -66,7 +66,7 @@ if ($action == 'updateMask') {
// TODO Verifier si module numerotation choisi peut etre active // TODO Verifier si module numerotation choisi peut etre active
// par appel methode canBeActivated // 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') { } elseif ($action == 'setvar') {
include_once DOL_DOCUMENT_ROOT . "/core/lib/files.lib.php"; include_once DOL_DOCUMENT_ROOT . "/core/lib/files.lib.php";
@ -256,7 +256,7 @@ foreach ($dirmodels as $reldir) {
print '</td>' . "\n"; print '</td>' . "\n";
print '<td align="center">'; 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'); print img_picto($langs->trans("Activated"), 'switch_on');
} else { } else {
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=setmod&amp;value=mod_' . $classname . '" alt="' . $langs->trans("Default") . '">' . img_picto($langs->trans("Disabled"), 'switch_off') . '</a>'; print '<a href="' . $_SERVER["PHP_SELF"] . '?action=setmod&amp;value=mod_' . $classname . '" alt="' . $langs->trans("Default") . '">' . img_picto($langs->trans("Disabled"), 'switch_off') . '</a>';

View File

@ -291,7 +291,7 @@ $arrayofmassactions = array(
//'presend'=>$langs->trans("SendByMail"), //'presend'=>$langs->trans("SendByMail"),
//'builddoc'=>$langs->trans("PDFMerge"), //'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(); if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions); $massactionbutton=$form->selectMassAction('', $arrayofmassactions);

View File

@ -299,7 +299,7 @@ $arrayofmassactions = array(
//'presend'=>$langs->trans("SendByMail"), //'presend'=>$langs->trans("SendByMail"),
//'builddoc'=>$langs->trans("PDFMerge"), //'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(); if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions); $massactionbutton=$form->selectMassAction('', $arrayofmassactions);

View File

@ -142,7 +142,11 @@ class Facturation
$this->montantRemise($montant_remise_ht); $this->montantRemise($montant_remise_ht);
$newcartarray=$_SESSION['poscart']; $newcartarray=$_SESSION['poscart'];
$i = 0;
if (!is_null($newcartarray) && !empty($newcartarray)) {
$i=count($newcartarray); $i=count($newcartarray);
}
$newcartarray[$i]['id']=$i; $newcartarray[$i]['id']=$i;
$newcartarray[$i]['ref']=$product->ref; $newcartarray[$i]['ref']=$product->ref;

View File

@ -984,17 +984,41 @@ class Categorie extends CommonObject
* fullpath = chemin complet compose des id * fullpath = chemin complet compose des id
* *
* @param string $type Type of categories ('customer', 'supplier', 'contact', 'product', 'member') or (0, 1, 2, ...). * @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|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.
* @param int $keeponlyifinleafid 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 * @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 // phpcs:enable
global $conf, $langs; global $conf, $langs;
if (! is_numeric($type)) $type = $this->MAP_ID[$type]; if (! is_numeric($type)) $type = $this->MAP_ID[$type];
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(); $this->cats = array();
// Init this->motherof that is array(id_son=>id_parent, ...) // Init this->motherof that is array(id_son=>id_parent, ...)
@ -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) $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 // Include or exclude leaf including $markafterid from tree
if ($markafterid) if (count($markafterid) > 0)
{ {
$keyfiltercatid = implode('|', $markafterid);
//print "Look to discard category ".$markafterid."\n"; //print "Look to discard category ".$markafterid."\n";
$keyfilter1='^'.$markafterid.'$'; $keyfilter1 = '^' . $keyfiltercatid . '$';
$keyfilter2='_'.$markafterid.'$'; $keyfilter2 = '_' . $keyfiltercatid . '$';
$keyfilter3='^'.$markafterid.'_'; $keyfilter3 = '^' . $keyfiltercatid . '_';
$keyfilter4='_'.$markafterid.'_'; $keyfilter4 = '_' . $keyfiltercatid . '_';
foreach($this->cats as $key => $val) foreach($this->cats as $key => $val)
{ {
if (preg_match('/'.$keyfilter1.'/', $val['fullpath']) || preg_match('/'.$keyfilter2.'/', $val['fullpath']) $test = (preg_match('/' . $keyfilter1 . '/', $val['fullpath']) || preg_match('/' . $keyfilter2 . '/', $val['fullpath'])
|| preg_match('/'.$keyfilter3.'/', $val['fullpath']) || preg_match('/'.$keyfilter4.'/', $val['fullpath'])) || preg_match('/' . $keyfilter3 . '/', $val['fullpath']) || preg_match('/' . $keyfilter4 . '/', $val['fullpath']));
{
unset($this->cats[$key]); if (($test && !$include) || (!$test && $include))
}
}
}
// 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
{ {
unset($this->cats[$key]); unset($this->cats[$key]);
} }

View File

@ -668,7 +668,7 @@ class Mailing extends CommonObject
* *
* @param int $statut Id statut * @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 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 * @return string Label
*/ */
public static function libStatutDest($statut, $mode = 0, $desc = '') public static function libStatutDest($statut, $mode = 0, $desc = '')

View File

@ -623,7 +623,7 @@ if (empty($reshook))
{ {
$db->begin(); $db->begin();
$result=$object->cloture($user, 4, ''); $result=$object->cloture($user, Propal::STATUS_BILLED, '');
if ($result < 0) if ($result < 0)
{ {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');

View File

@ -430,7 +430,7 @@ if ($resql)
'presend'=>$langs->trans("SendByMail"), 'presend'=>$langs->trans("SendByMail"),
'builddoc'=>$langs->trans("PDFMerge"), '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 ($user->rights->propal->cloturer) $arrayofmassactions['closed']=$langs->trans("Close");
if (in_array($massaction, array('presend','predelete','closed'))) $arrayofmassactions=array(); if (in_array($massaction, array('presend','predelete','closed'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions); $massactionbutton=$form->selectMassAction('', $arrayofmassactions);

View File

@ -161,7 +161,7 @@ class Commande extends CommonOrder
/** /**
* @deprecated * @deprecated
* @see date * @see $date
*/ */
public $date_commande; public $date_commande;
@ -1331,7 +1331,7 @@ class Commande extends CommonOrder
* @param double $pu_ht_devise Unit price in currency * @param double $pu_ht_devise Unit price in currency
* @return int >0 if OK, <0 if KO * @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 * 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 * 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 * Id of parent order
* @var int * @var int
* @deprecated Use fk_commande * @deprecated Use fk_commande
* @see fk_commande * @see $fk_commande
*/ */
public $commande_id; public $commande_id;
@ -3932,7 +3932,7 @@ class OrderLine extends CommonOrderLine
/** /**
* @deprecated * @deprecated
* @see remise_percent, fk_remise_except * @see $remise_percent, $fk_remise_except
*/ */
public $remise; public $remise;

View File

@ -434,7 +434,7 @@ if ($resql)
); );
if($user->rights->facture->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer"); 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(); if (in_array($massaction, array('presend','predelete','createbills'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions); $massactionbutton=$form->selectMassAction('', $arrayofmassactions);

View File

@ -282,7 +282,7 @@ if ($mode == 'customer')
Commande::STATUS_CLOSED=>$langs->trans("StatusOrderDelivered"), Commande::STATUS_CLOSED=>$langs->trans("StatusOrderDelivered"),
Commande::STATUS_CANCELED=>$langs->trans("StatusOrderCanceled") 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') if ($mode == 'supplier')
{ {

View File

@ -564,7 +564,7 @@ if ($resql)
//'presend'=>$langs->trans("SendByMail"), //'presend'=>$langs->trans("SendByMail"),
//'builddoc'=>$langs->trans("PDFMerge"), //'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(); if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions); $massactionbutton=$form->selectMassAction('', $arrayofmassactions);

View File

@ -220,7 +220,7 @@ $arrayofmassactions = array(
// 'presend'=>$langs->trans("SendByMail"), // 'presend'=>$langs->trans("SendByMail"),
// 'builddoc'=>$langs->trans("PDFMerge"), // '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(); if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions); $massactionbutton=$form->selectMassAction('', $arrayofmassactions);

View File

@ -320,7 +320,7 @@ $arrayofmassactions = array(
//'presend'=>$langs->trans("SendByMail"), //'presend'=>$langs->trans("SendByMail"),
//'builddoc'=>$langs->trans("PDFMerge"), //'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(); if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions); $massactionbutton=$form->selectMassAction('', $arrayofmassactions);

View File

@ -949,50 +949,111 @@ class Invoices extends DolibarrApi
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
} }
$result = $this->invoice->fetch_thirdparty(); if ($this->invoice->paye) {
if( ! $result ) { throw new RestException(500, 'Alreay payed');
throw new RestException(404, 'Thirdparty not found');
} }
if (! $this->invoice->paye) // protection against multiple submit $this->invoice->fetch($id);
$this->invoice->fetch_thirdparty();
// 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);
$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(); $this->db->begin();
$this->invoice->fetch_lines();
$amount_ht = $amount_tva = $amount_ttc = array(); $amount_ht = $amount_tva = $amount_ttc = array();
$multicurrency_amount_ht = $multicurrency_amount_tva = $multicurrency_amount_ttc = array();
// Loop on each vat rate // Loop on each vat rate
$i = 0; $i = 0;
$amount_ht = array();
$amount_tva = array();
$amount_ttc = array();
foreach ($this->invoice->lines as $line) 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_ht[$line->tva_tx] += $line->total_ht;
$amount_tva[$line->tva_tx] += $line->total_tva; $amount_tva[$line->tva_tx] += $line->total_tva;
$amount_ttc[$line->tva_tx] += $line->total_ttc; $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++; $i++;
} }
}
// Insert one discount by VAT rate category // Insert one discount by VAT rate category
$discount = new DiscountAbsolute($this->db); $discount = new DiscountAbsolute($this->db);
if ($this->invoice->type == 2) $discount->description='(CREDIT_NOTE)'; if ($this->invoice->type == Facture::TYPE_CREDIT_NOTE) {
elseif ($this->invoice->type == 3) $discount->description='(DEPOSIT)'; $discount->description = '(CREDIT_NOTE)';
else {
$this->error="CantConvertToReducAnInvoiceOfThisType";
return -1;
} }
$discount->tva_tx=abs($this->invoice->total_ttc); 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');
}
$discount->fk_soc = $this->invoice->socid; $discount->fk_soc = $this->invoice->socid;
$discount->fk_facture_source = $this->invoice->id; $discount->fk_facture_source = $this->invoice->id;
$error = 0; $error = 0;
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
// 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) foreach ($amount_ht as $tva_tx => $xxx)
{ {
$discount->amount_ht = abs($amount_ht[$tva_tx]); $discount->amount_ht = abs($amount_ht[$tva_tx]);
$discount->amount_tva = abs($amount_tva[$tva_tx]); $discount->amount_tva = abs($amount_tva[$tva_tx]);
$discount->amount_ttc = abs($amount_ttc[$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); $discount->tva_tx = abs($tva_tx);
$result = $discount->create(DolibarrApiAccess::$user); $result = $discount->create(DolibarrApiAccess::$user);
@ -1002,14 +1063,15 @@ class Invoices extends DolibarrApi
break; break;
} }
} }
}
if (! $error) if (empty($error))
{ {
if($this->invoice->type != Facture::TYPE_DEPOSIT) {
// Classe facture // Classe facture
$result = $this->invoice->set_paid(DolibarrApiAccess::$user); $result = $this->invoice->set_paid(DolibarrApiAccess::$user);
if ($result > 0) if ($result >= 0)
{ {
//$mesg='OK'.$discount->id;
$this->db->commit(); $this->db->commit();
} }
else else
@ -1017,6 +1079,9 @@ class Invoices extends DolibarrApi
$this->db->rollback(); $this->db->rollback();
throw new RestException(500, 'Could not set paid'); throw new RestException(500, 'Could not set paid');
} }
} else {
$this->db->commit();
}
} }
else else
{ {
@ -1025,15 +1090,6 @@ class Invoices extends DolibarrApi
} }
} }
$result = $this->invoice->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Invoice not found');
}
if( ! DolibarrApi::_checkAccessToResource('facture', $this->invoice->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
return $this->_cleanObjectDatas($this->invoice); return $this->_cleanObjectDatas($this->invoice);
} }

View File

@ -773,7 +773,7 @@ class RemiseCheque extends CommonObject
* Reopen linked invoices and create a new negative payment. * Reopen linked invoices and create a new negative payment.
* *
* @param int $bank_id Id of bank transaction line concerned * @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 * @return int Id of negative payment line created
*/ */
public function rejectCheck($bank_id, $rejection_date) public function rejectCheck($bank_id, $rejection_date)

View File

@ -58,13 +58,13 @@ class Paiement extends CommonObject
/** /**
* @deprecated * @deprecated
* @see amount, amounts * @see $amount, $amounts
*/ */
public $total; public $total;
/** /**
* @deprecated * @deprecated
* @see amount, amounts * @see $amount, $amounts
*/ */
public $montant; public $montant;

View File

@ -121,7 +121,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes')
$result=$object->delete($user); $result=$object->delete($user);
if ($result > 0) if ($result > 0)
{ {
header("Location: index.php"); header("Location: list.php");
exit; exit;
} }
else else

View File

@ -154,7 +154,7 @@ abstract class ActionsContactCardCommon
if ($user->admin) $this->tpl['info_admin'] = info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); if ($user->admin) $this->tpl['info_admin'] = info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
// State // 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; else $this->tpl['select_state'] = $countrynotdefined;
// Public or private // Public or private
@ -289,7 +289,6 @@ abstract class ActionsContactCardCommon
$this->object->address = $_POST["address"]; $this->object->address = $_POST["address"];
$this->object->zip = $_POST["zipcode"]; $this->object->zip = $_POST["zipcode"];
$this->object->town = $_POST["town"]; $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->country_id = $_POST["country_id"]?$_POST["country_id"]:$mysoc->country_id;
$this->object->state_id = $_POST["state_id"]; $this->object->state_id = $_POST["state_id"];
$this->object->phone_pro = $_POST["phone_pro"]; $this->object->phone_pro = $_POST["phone_pro"];

View File

@ -356,7 +356,6 @@ if (empty($reshook))
$object->zip = GETPOST("zipcode", 'alpha'); $object->zip = GETPOST("zipcode", 'alpha');
$object->town = GETPOST("town", 'alpha'); $object->town = GETPOST("town", 'alpha');
$object->state_id = GETPOST("state_id", 'int'); $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->country_id = GETPOST("country_id", 'int');
$object->email = GETPOST("email", 'alpha'); $object->email = GETPOST("email", 'alpha');

View File

@ -337,7 +337,6 @@ class Contact extends CommonObject
$this->zip=(empty($this->zip)?'':$this->zip); $this->zip=(empty($this->zip)?'':$this->zip);
$this->town=(empty($this->town)?'':$this->town); $this->town=(empty($this->town)?'':$this->town);
$this->country_id=($this->country_id > 0?$this->country_id:$this->country_id); $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; if (empty($this->statut)) $this->statut = 0;
$this->db->begin(); $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 = "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.address, c.statut, c.zip, c.town,";
$sql.= " c.fk_pays as country_id,"; $sql.= " c.fk_pays as country_id,";
$sql.= " c.fk_departement,"; $sql.= " c.fk_departement as state_id,";
$sql.= " c.birthday,"; $sql.= " c.birthday,";
$sql.= " c.poste, c.phone, c.phone_perso, c.phone_mobile, c.fax, c.email, c.jabberid, c.skype, c.twitter, c.facebook, c.linkedin,"; $sql.= " c.poste, c.phone, c.phone_perso, c.phone_mobile, c.fax, c.email, c.jabberid, c.skype, c.twitter, c.facebook, c.linkedin,";
$sql.= " c.photo,"; $sql.= " c.photo,";
@ -759,11 +758,8 @@ class Contact extends CommonObject
$this->date_creation = $this->db->jdate($obj->date_creation); $this->date_creation = $this->db->jdate($obj->date_creation);
$this->date_modification = $this->db->jdate($obj->date_modification); $this->date_modification = $this->db->jdate($obj->date_modification);
$this->fk_departement = $obj->fk_departement; // deprecated $this->state_id = $obj->state_id;
$this->state_id = $obj->fk_departement;
$this->departement_code = $obj->state_code; // deprecated
$this->state_code = $obj->state_code; $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_id = $obj->country_id;

View File

@ -446,7 +446,7 @@ $arrayofmassactions = array(
// 'builddoc'=>$langs->trans("PDFMerge"), // 'builddoc'=>$langs->trans("PDFMerge"),
); );
//if($user->rights->societe->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer"); //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(); if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions); $massactionbutton=$form->selectMassAction('', $arrayofmassactions);

View File

@ -165,7 +165,7 @@ class Contrat extends CommonObject
/** /**
* @deprecated Use fk_project instead * @deprecated Use fk_project instead
* @see fk_project * @see $fk_project
*/ */
public $fk_projet; public $fk_projet;
@ -305,7 +305,7 @@ class Contrat extends CommonObject
* @param int $notrigger 1=Does not execute triggers, 0=Execute triggers * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers
* @param string $comment Comment * @param string $comment Comment
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
* @see closeAll * @see ()
*/ */
public function activateAll($user, $date_start = '', $notrigger = 0, $comment = '') 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 int $notrigger 1=Does not execute triggers, 0=Execute triggers
* @param string $comment Comment * @param string $comment Comment
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
* @see activateAll * @see activateAll()
*/ */
public function closeAll(User $user, $notrigger = 0, $comment = '') public function closeAll(User $user, $notrigger = 0, $comment = '')
{ {

View File

@ -369,7 +369,7 @@ $arrayofmassactions = array(
'presend'=>$langs->trans("SendByMail"), 'presend'=>$langs->trans("SendByMail"),
'builddoc'=>$langs->trans("PDFMerge"), '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(); if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions); $massactionbutton=$form->selectMassAction('', $arrayofmassactions);

View File

@ -313,7 +313,7 @@ $arrayofmassactions = array(
//'presend'=>$langs->trans("SendByMail"), //'presend'=>$langs->trans("SendByMail"),
//'builddoc'=>$langs->trans("PDFMerge"), //'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(); //if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions); $massactionbutton=$form->selectMassAction('', $arrayofmassactions);

View File

@ -1069,4 +1069,54 @@ abstract class CommonDocGenerator
} }
else return false; 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;
}
} }

View File

@ -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->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($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 // Security
if (empty($this->global->USER_PASSWORD_GENERATED)) $this->global->USER_PASSWORD_GENERATED='standard'; // Default password generator if (empty($this->global->USER_PASSWORD_GENERATED)) $this->global->USER_PASSWORD_GENERATED='standard'; // Default password generator

View File

@ -1180,6 +1180,8 @@ class ExtraFields
// 2 : key fields name (if differ of rowid) // 2 : key fields name (if differ of rowid)
// 3 : key field parent (for dependent lists) // 3 : key field parent (for dependent lists)
// 4 : where clause filter on column or table extrafield, syntax field='value' or extra.field=value // 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'); $keyList=(empty($InfoFieldList[2])?'rowid':$InfoFieldList[2].' as rowid');
@ -1198,9 +1200,16 @@ class ExtraFields
$keyList.= ', '.$parentField; $keyList.= ', '.$parentField;
} }
$filter_categorie = false;
if (count($InfoFieldList) > 5) {
if ($InfoFieldList[0] == 'categorie') {
$filter_categorie = true;
}
}
if ($filter_categorie === false) {
$fields_label = explode('|', $InfoFieldList[1]); $fields_label = explode('|', $InfoFieldList[1]);
if (is_array($fields_label)) if (is_array($fields_label)) {
{
$keyList .= ', '; $keyList .= ', ';
$keyList .= implode(', ', $fields_label); $keyList .= implode(', ', $fields_label);
} }
@ -1208,8 +1217,7 @@ class ExtraFields
$sqlwhere = ''; $sqlwhere = '';
$sql = 'SELECT ' . $keyList; $sql = 'SELECT ' . $keyList;
$sql .= ' FROM ' . MAIN_DB_PREFIX . $InfoFieldList[0]; $sql .= ' FROM ' . MAIN_DB_PREFIX . $InfoFieldList[0];
if (!empty($InfoFieldList[4])) if (!empty($InfoFieldList[4])) {
{
// can use curent entity filter // can use curent entity filter
if (strpos($InfoFieldList[4], '$ENTITY$') !== false) { if (strpos($InfoFieldList[4], '$ENTITY$') !== false) {
$InfoFieldList[4] = str_replace('$ENTITY$', $conf->entity, $InfoFieldList[4]); $InfoFieldList[4] = str_replace('$ENTITY$', $conf->entity, $InfoFieldList[4]);
@ -1226,23 +1234,17 @@ class ExtraFields
$InfoFieldList[4] = str_replace('$ID$', '0', $InfoFieldList[4]); $InfoFieldList[4] = str_replace('$ID$', '0', $InfoFieldList[4]);
} }
//We have to join on extrafield table //We have to join on extrafield table
if (strpos($InfoFieldList[4], 'extra')!==false) if (strpos($InfoFieldList[4], 'extra') !== false) {
{
$sql .= ' as main, ' . MAIN_DB_PREFIX . $InfoFieldList[0] . '_extrafields as extra'; $sql .= ' as main, ' . MAIN_DB_PREFIX . $InfoFieldList[0] . '_extrafields as extra';
$sqlwhere .= ' WHERE extra.fk_object=main.' . $InfoFieldList[2] . ' AND ' . $InfoFieldList[4]; $sqlwhere .= ' WHERE extra.fk_object=main.' . $InfoFieldList[2] . ' AND ' . $InfoFieldList[4];
} } else {
else
{
$sqlwhere .= ' WHERE ' . $InfoFieldList[4]; $sqlwhere .= ' WHERE ' . $InfoFieldList[4];
} }
} } else {
else
{
$sqlwhere .= ' WHERE 1=1'; $sqlwhere .= ' WHERE 1=1';
} }
// Some tables may have field, some other not. For the moment we disable it. // Some tables may have field, some other not. For the moment we disable it.
if (in_array($InfoFieldList[0], array('tablewithentity'))) if (in_array($InfoFieldList[0], array('tablewithentity'))) {
{
$sqlwhere .= ' AND entity = ' . $conf->entity; $sqlwhere .= ' AND entity = ' . $conf->entity;
} }
$sql .= $sqlwhere; $sql .= $sqlwhere;
@ -1252,37 +1254,29 @@ class ExtraFields
dol_syslog(get_class($this) . '::showInputField type=sellist', LOG_DEBUG); dol_syslog(get_class($this) . '::showInputField type=sellist', LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql) {
{
$out .= '<option value="0">&nbsp;</option>'; $out .= '<option value="0">&nbsp;</option>';
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
$i = 0; $i = 0;
while ($i < $num) while ($i < $num) {
{
$labeltoshow = ''; $labeltoshow = '';
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
// Several field into label (eq table:code|libelle:rowid) // Several field into label (eq table:code|libelle:rowid)
$notrans = false; $notrans = false;
$fields_label = explode('|', $InfoFieldList[1]); $fields_label = explode('|', $InfoFieldList[1]);
if (is_array($fields_label)) if (is_array($fields_label)) {
{
$notrans = true; $notrans = true;
foreach ($fields_label as $field_toshow) foreach ($fields_label as $field_toshow) {
{
$labeltoshow .= $obj->$field_toshow . ' '; $labeltoshow .= $obj->$field_toshow . ' ';
} }
} } else {
else
{
$labeltoshow = $obj->{$InfoFieldList[1]}; $labeltoshow = $obj->{$InfoFieldList[1]};
} }
$labeltoshow = dol_trunc($labeltoshow, 45); $labeltoshow = dol_trunc($labeltoshow, 45);
if ($value == $obj->rowid) if ($value == $obj->rowid) {
{ foreach ($fields_label as $field_toshow) {
foreach ($fields_label as $field_toshow)
{
$translabel = $langs->trans($obj->$field_toshow); $translabel = $langs->trans($obj->$field_toshow);
if ($translabel != $obj->$field_toshow) { if ($translabel != $obj->$field_toshow) {
$labeltoshow = dol_trunc($translabel, 18) . ' '; $labeltoshow = dol_trunc($translabel, 18) . ' ';
@ -1291,27 +1285,21 @@ class ExtraFields
} }
} }
$out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>'; $out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>';
} } else {
else if (!$notrans) {
{
if (! $notrans)
{
$translabel = $langs->trans($obj->{$InfoFieldList[1]}); $translabel = $langs->trans($obj->{$InfoFieldList[1]});
if ($translabel != $obj->{$InfoFieldList[1]}) { if ($translabel != $obj->{$InfoFieldList[1]}) {
$labeltoshow = dol_trunc($translabel, 18); $labeltoshow = dol_trunc($translabel, 18);
} } else {
else {
$labeltoshow = dol_trunc($obj->{$InfoFieldList[1]}, 18); $labeltoshow = dol_trunc($obj->{$InfoFieldList[1]}, 18);
} }
} }
if (empty($labeltoshow)) $labeltoshow = '(not defined)'; if (empty($labeltoshow)) $labeltoshow = '(not defined)';
if ($value==$obj->rowid) if ($value == $obj->rowid) {
{
$out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>'; $out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>';
} }
if (!empty($InfoFieldList[3]) && $parentField) if (!empty($InfoFieldList[3]) && $parentField) {
{
$parent = $parentName . ':' . $obj->{$parentField}; $parent = $parentName . ':' . $obj->{$parentField};
} }
@ -1324,9 +1312,17 @@ class ExtraFields
$i++; $i++;
} }
$this->db->free($resql); $this->db->free($resql);
} } else {
else {
print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>'; 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">&nbsp;</option>';
foreach ($data as $data_key => $data_value) {
$out .= '<option value="' . $data_key . '"';
$out .= ($value == $data_key ? ' selected' : '');
$out .= '>' . $data_value . '</option>';
}
} }
} }
$out.='</select>'; $out.='</select>';
@ -1367,6 +1363,8 @@ class ExtraFields
// 2 : key fields name (if differ of rowid) // 2 : key fields name (if differ of rowid)
// 3 : key field parent (for dependent lists) // 3 : key field parent (for dependent lists)
// 4 : where clause filter on column or table extrafield, syntax field='value' or extra.field=value // 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'); $keyList = (empty($InfoFieldList[2]) ? 'rowid' : $InfoFieldList[2] . ' as rowid');
if (count($InfoFieldList) > 3 && ! empty($InfoFieldList[3])) { if (count($InfoFieldList) > 3 && ! empty($InfoFieldList[3])) {
@ -1381,6 +1379,14 @@ class ExtraFields
} }
} }
$filter_categorie = false;
if (count($InfoFieldList) > 5) {
if ($InfoFieldList[0] == 'categorie') {
$filter_categorie = true;
}
}
if ($filter_categorie === false) {
$fields_label = explode('|', $InfoFieldList[1]); $fields_label = explode('|', $InfoFieldList[1]);
if (is_array($fields_label)) { if (is_array($fields_label)) {
$keyList .= ', '; $keyList .= ', ';
@ -1432,17 +1438,14 @@ class ExtraFields
if (!empty($matchCondition[1]) && !empty($matchCondition[3]) && $matchCondition[1] != $matchCondition[3]) { if (!empty($matchCondition[1]) && !empty($matchCondition[3]) && $matchCondition[1] != $matchCondition[3]) {
// Nobody sain would do that without parentheses // Nobody sain would do that without parentheses
$InfoFieldList[4] = str_replace('$ID$', '0', $InfoFieldList[4]); $InfoFieldList[4] = str_replace('$ID$', '0', $InfoFieldList[4]);
} } else {
else {
if (!empty($matchCondition[1])) { if (!empty($matchCondition[1])) {
$boolCond = (($matchCondition[1] == "AND") ? ' AND 1 ' : ' OR 0 '); $boolCond = (($matchCondition[1] == "AND") ? ' AND 1 ' : ' OR 0 ');
$InfoFieldList[4] = str_replace($matchCondition[0], $boolCond . $matchCondition[3], $InfoFieldList[4]); $InfoFieldList[4] = str_replace($matchCondition[0], $boolCond . $matchCondition[3], $InfoFieldList[4]);
} } elseif (!empty($matchCondition[3])) {
elseif (! empty($matchCondition[3])) {
$boolCond = (($matchCondition[3] == "AND") ? ' 1 AND ' : ' 0 OR'); $boolCond = (($matchCondition[3] == "AND") ? ' 1 AND ' : ' 0 OR');
$InfoFieldList[4] = str_replace($matchCondition[0], $boolCond, $InfoFieldList[4]); $InfoFieldList[4] = str_replace($matchCondition[0], $boolCond, $InfoFieldList[4]);
} } else {
else {
$InfoFieldList[4] = 1; $InfoFieldList[4] = 1;
} }
} }
@ -1450,8 +1453,7 @@ class ExtraFields
// Si l'on a un AND ou un OR, avant ou après // Si l'on a un AND ou un OR, avant ou après
preg_match('#(AND|OR|) *(' . $word . ') *(AND|OR|)#', $InfoFieldList[4], $matchCondition); preg_match('#(AND|OR|) *(' . $word . ') *(AND|OR|)#', $InfoFieldList[4], $matchCondition);
} }
} } else {
else {
$InfoFieldList[4] = str_replace('$ID$', '0', $InfoFieldList[4]); $InfoFieldList[4] = str_replace('$ID$', '0', $InfoFieldList[4]);
} }
@ -1466,8 +1468,7 @@ class ExtraFields
$sqlwhere .= ' WHERE 1=1'; $sqlwhere .= ' WHERE 1=1';
} }
// Some tables may have field, some other not. For the moment we disable it. // Some tables may have field, some other not. For the moment we disable it.
if (in_array($InfoFieldList[0], array ('tablewithentity'))) if (in_array($InfoFieldList[0], array('tablewithentity'))) {
{
$sqlwhere .= ' AND entity = ' . $conf->entity; $sqlwhere .= ' AND entity = ' . $conf->entity;
} }
// $sql.=preg_replace('/^ AND /','',$sqlwhere); // $sql.=preg_replace('/^ AND /','',$sqlwhere);
@ -1540,6 +1541,10 @@ class ExtraFields
$out = $form->multiselectarray($keyprefix . $key . $keysuffix, $data, $value_arr, '', 0, '', 0, '100%'); $out = $form->multiselectarray($keyprefix . $key . $keysuffix, $data, $value_arr, '', 0, '', 0, '100%');
} else { } else {
print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>'; 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%');
} }
} }
} }

View File

@ -596,12 +596,13 @@ class Form
$ret.='<option value="0"'.($disabled?' disabled="disabled"':'').'>-- '.$langs->trans("SelectAction").' --</option>'; $ret.='<option value="0"'.($disabled?' disabled="disabled"':'').'>-- '.$langs->trans("SelectAction").' --</option>';
foreach($arrayofaction as $code => $label) 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.=$hookmanager->resPrint;
$ret.='</select>'; $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 // 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" 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")).'">'; $ret.='<input type="submit" disabled name="confirmmassaction" class="button'.(empty($conf->use_javascript_ajax)?'':' hideobject').' massaction massactionconfirmed" value="'.dol_escape_htmltag($langs->trans("Confirm")).'">';
@ -3805,12 +3806,17 @@ class Form
* @param string $selected Id of category preselected or 'auto' (autoselect category if there is only one element) * @param string $selected Id of category preselected or 'auto' (autoselect category if there is only one element)
* @param string $htmlname HTML field name * @param string $htmlname HTML field name
* @param int $maxlength Maximum length for labels * @param int $maxlength Maximum length for labels
* @param int $excludeafterid Exclude all categories after this leaf in category tree. * @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 $outputmode 0=HTML select string, 1=Array
* @param int $include [=0] Removed or 1=Keep only
* @return string * @return string
* @see select_categories() * @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 // phpcs:enable
global $conf, $langs; global $conf, $langs;
@ -3850,7 +3856,7 @@ class Form
else else
{ {
$cat = new Categorie($this->db); $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.'">'; $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. * 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 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 string|string[] $id Preselected key or preselected keys for multiselect
* @param int|string $show_empty 0 no empty value allowed, 1 or string to add an empty value into list (key is -1 and value is '' or '&nbsp;' if 1, key is -1 and value is text if string), <0 to add an empty value with key that is this value. * @param int|string $show_empty 0 no empty value allowed, 1 or string to add an empty value into list (key is -1 and value is '' or '&nbsp;' 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" * @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) 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); if ($sort == 'ASC') asort($array);
elseif ($sort == 'DESC') arsort($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=''; $disabled=''; $style='';
if (! empty($disablebademail)) if (! empty($disablebademail))
{ {
@ -5926,6 +5936,13 @@ class Form
$out.=$style.$disabled; $out.=$style.$disabled;
if ($id != '' && $id == $key && ! $disabled) $out.=' selected'; // To preselect a value if ($id != '' && $id == $key && ! $disabled) $out.=' selected'; // To preselect a value
if ($nohtmlescape) $out.=' data-html="'.dol_escape_htmltag($selectOptionValue).'"'; 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.='>'; $out.='>';
//var_dump($selectOptionValue); //var_dump($selectOptionValue);
$out.=$selectOptionValue; $out.=$selectOptionValue;
@ -7288,8 +7305,10 @@ class Form
global $conf, $langs; global $conf, $langs;
$out='<div class="nowrap">'; $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_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_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>'; $out.='</div>';
return $out; return $out;

View File

@ -662,7 +662,7 @@ class FormTicket
$ticketstat->loadCacheSeveritiesTickets(); $ticketstat->loadCacheSeveritiesTickets();
print '<select id="select' . $htmlname . '" class="flat minwidth150'.($morecss?' '.$morecss:'').'" name="' . $htmlname . '">'; print '<select id="select' . $htmlname . '" class="flat minwidth100'.($morecss?' '.$morecss:'').'" name="' . $htmlname . '">';
if ($empty) { if ($empty) {
print '<option value="">&nbsp;</option>'; print '<option value="">&nbsp;</option>';
} }

View File

@ -1561,10 +1561,9 @@ function dol_add_file_process($upload_dir, $allowoverwrite = 0, $donotupdatesess
// dol_sanitizeFileName the file name and lowercase extension // dol_sanitizeFileName the file name and lowercase extension
$info = pathinfo($destfull); $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); $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); $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' if (is_numeric($resupload) && $resupload > 0) // $resupload can be 'ErrorFileAlreadyExists'

View File

@ -226,7 +226,7 @@ function GETPOSTISSET($paramname)
* 'san_alpha'=Use filter_var with FILTER_SANITIZE_STRING (do not use this for free text string) * '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 * 'nohtml', 'alphanohtml'=check there is no html content
* 'custom'= custom filter specify $filter and $options) * '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 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 mixed $options Options to pass to filter_var when $check is set to 'custom'
* @param string $noreplace Force disable of replacement of __xxx__ strings. * @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==1) $out = isset($_GET[$paramname])?$_GET[$paramname]:'';
elseif ($method==2) $out = isset($_POST[$paramname])?$_POST[$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==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'; else return 'BadThirdParameterForGETPOST';
if (empty($method) || $method == 3 || $method == 4) if (empty($method) || $method == 3 || $method == 4)
@ -574,9 +573,8 @@ if (! function_exists('dol_getprefix'))
{ {
/** /**
* Return a prefix to use for this Dolibarr instance, for session/cookie names or email id. * 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 * The prefix is unique for instance and avoid conflict between multi-instances, even when having two instances with same root dir
* between multi-instances, even when having two instances with same root dir or two instances in same virtual servers. * 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.
* *
* @param string $mode '' (prefix for session name) or 'email' (prefix for email id) * @param string $mode '' (prefix for session name) or 'email' (prefix for email id)
* @return string A calculated prefix * @return string A calculated prefix
@ -593,15 +591,23 @@ if (! function_exists('dol_getprefix'))
if ($conf->global->MAIL_PREFIX_FOR_EMAIL_ID != 'SERVER_NAME') return $conf->global->MAIL_PREFIX_FOR_EMAIL_ID; 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"]; 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'); 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"])) 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'); 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'); 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 .= ($ret ? $sep : '' ).$object->zip;
$ret .= ($object->town?(($object->zip?' ':'').$object->town):''); $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 else // Other: title firstname name \n address lines \n zip town \n country
{ {

View File

@ -2115,6 +2115,10 @@ function getElementProperties($element_type)
$subelement='facturefournisseur'; $subelement='facturefournisseur';
$classfile='fournisseur.facture'; $classfile='fournisseur.facture';
} }
if ($element_type == "service") {
$classpath = 'product/class';
$subelement='product';
}
if (!isset($classfile)) $classfile = strtolower($subelement); if (!isset($classfile)) $classfile = strtolower($subelement);
if (!isset($classname)) $classname = ucfirst($subelement); if (!isset($classname)) $classname = ucfirst($subelement);
@ -2475,7 +2479,7 @@ function autoOrManual($automaticmanual, $case = 1, $color = 0)
$classname='ok'; $classname='ok';
} }
elseif ($yesno == 0 || strtolower($automaticmanual) == 'manual' || strtolower($automaticmanual) == 'false') elseif ($automaticmanual == 0 || strtolower($automaticmanual) == 'manual' || strtolower($automaticmanual) == 'false')
{ {
$result=$langs->trans("manual"); $result=$langs->trans("manual");
if ($case == 1 || $case == 3) $result=$langs->trans("Manual"); if ($case == 1 || $case == 3) $result=$langs->trans("Manual");

View File

@ -68,7 +68,7 @@ function commande_prepare_head(Commande $object)
if ($conf->expedition_bon->enabled && $conf->livraison_bon->enabled) $text.='/'; if ($conf->expedition_bon->enabled && $conf->livraison_bon->enabled) $text.='/';
if ($conf->livraison_bon->enabled) $text.=$langs->trans("Receivings"); if ($conf->livraison_bon->enabled) $text.=$langs->trans("Receivings");
if ($nbShipments > 0 || $nbReceiption > 0) $text.= ' <span class="badge">'.($nbShipments?$nbShipments:0); 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 ($conf->expedition_bon->enabled && $conf->livraison_bon->enabled && ($nbShipments > 0 || $nbReceiption > 0)) $text.= ($nbReceiption?$nbReceiption:0);
if ($nbShipments > 0 || $nbReceiption > 0) $text.= '</span>'; if ($nbShipments > 0 || $nbReceiption > 0) $text.= '</span>';
$head[$h][1] = $text; $head[$h][1] = $text;

View File

@ -343,10 +343,10 @@ function pdfBuildThirdpartyName($thirdparty, Translate $outputlangs, $includeali
* *
* @param Translate $outputlangs Output langs object * @param Translate $outputlangs Output langs object
* @param Societe $sourcecompany Source company object * @param Societe $sourcecompany Source company object
* @param Societe $targetcompany Target company object * @param Societe|string $targetcompany Target company object
* @param Contact $targetcontact Target contact object * @param Contact|string $targetcontact Target contact object
* @param int $usecontact Use contact instead of company * @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 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 * @param Object $object Object we want to build document for
* @return string String with full address * @return string String with full address
*/ */
@ -357,12 +357,8 @@ function pdf_build_address($outputlangs, $sourcecompany, $targetcompany = '', $t
if ($mode == 'source' && ! is_object($sourcecompany)) return -1; if ($mode == 'source' && ! is_object($sourcecompany)) return -1;
if ($mode == 'target' && ! is_object($targetcompany)) 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) && 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) && 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');
$reshook=0; $reshook=0;
$stringaddress = ''; $stringaddress = '';

View File

@ -128,6 +128,25 @@ function product_prepare_head($object)
} }
} }
// 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 // Show more tabs from modules
// Entries must be declared in modules descriptor with line // Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab

View File

@ -842,7 +842,7 @@ function show_theme($fuser, $edit = 0, $foruserprofile = false)
if ($color != 'e6edf0') print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">'; if ($color != 'e6edf0') print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
else print $langs->trans("Default"); else print $langs->trans("Default");
} }
else print $langs->trans("None"); else print $langs->trans("Default");
} }
print ' &nbsp; <span class="nowraponall">('.$langs->trans("Default").': <strong>e6edf0</strong>) '; print ' &nbsp; <span class="nowraponall">('.$langs->trans("Default").': <strong>e6edf0</strong>) ';
print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
@ -886,7 +886,7 @@ function show_theme($fuser, $edit = 0, $foruserprofile = false)
if ($color != 'e6edf0') print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">'; if ($color != 'e6edf0') print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
else print $langs->trans("Default"); else print $langs->trans("Default");
} }
else print $langs->trans("None"); else print $langs->trans("Default");
} }
print ' &nbsp; <span class="nowraponall">('.$langs->trans("Default").': <strong>e6edf0</strong>) '; print ' &nbsp; <span class="nowraponall">('.$langs->trans("Default").': <strong>e6edf0</strong>) ';
print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));

View 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;
}

View File

@ -116,7 +116,7 @@ class pdf_einstein extends ModelePDFCommandes
/** /**
* Issuer * Issuer
* @var Company object that emits * @var Societe object that emits
*/ */
public $emetteur; public $emetteur;

View File

@ -170,6 +170,8 @@ class pdf_eratosthene extends ModelePDFCommandes
$this->posxdesc=$this->marge_gauche+1; $this->posxdesc=$this->marge_gauche+1;
$this->tabTitleHeight = 5; // default height
$this->tva=array(); $this->tva=array();
$this->localtax1=array(); $this->localtax1=array();
$this->localtax2=array(); $this->localtax2=array();
@ -203,6 +205,73 @@ class pdf_eratosthene extends ModelePDFCommandes
$nblignes = count($object->lines); $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) if ($conf->commande->dir_output)
{ {
$object->fetch_thirdparty(); $object->fetch_thirdparty();
@ -464,13 +533,19 @@ class pdf_eratosthene extends ModelePDFCommandes
$height_note=0; $height_note=0;
} }
$iniY = $tab_top + 7;
$curY = $tab_top + 7;
$nexY = $tab_top + 7;
// Use new auto collum system // Use new auto collum system
$this->prepareArrayColumnField($object, $outputlangs, $hidedetails, $hidedesc, $hideref); $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 // Loop on each lines
$pageposbeforeprintlines=$pdf->getPage(); $pageposbeforeprintlines=$pdf->getPage();
$pagenb = $pageposbeforeprintlines; $pagenb = $pageposbeforeprintlines;
@ -480,6 +555,10 @@ class pdf_eratosthene extends ModelePDFCommandes
$pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage $pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage
$pdf->SetTextColor(0, 0, 0); $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->setTopMargin($tab_top_newpage);
$pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. $pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it.
$pageposbefore=$pdf->getPage(); $pageposbefore=$pdf->getPage();
@ -488,6 +567,29 @@ class pdf_eratosthene extends ModelePDFCommandes
$curX = $this->posxdesc-1; $curX = $this->posxdesc-1;
$showpricebeforepagebreak=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')) if($this->getColumnStatus('desc'))
{ {
@ -526,7 +628,11 @@ class pdf_eratosthene extends ModelePDFCommandes
$posYAfterDescription=$pdf->GetY(); $posYAfterDescription=$pdf->GetY();
} }
$nexY = $pdf->GetY();
$nexY = max($pdf->GetY(), $posYAfterImage);
$pageposafter=$pdf->getPage(); $pageposafter=$pdf->getPage();
$pdf->setPage($pageposbefore); $pdf->setPage($pageposbefore);
@ -657,7 +763,7 @@ class pdf_eratosthene extends ModelePDFCommandes
$pdf->setPage($pagenb); $pdf->setPage($pagenb);
if ($pagenb == $pageposbeforeprintlines) 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 else
{ {
@ -673,7 +779,7 @@ class pdf_eratosthene extends ModelePDFCommandes
{ {
if ($pagenb == $pageposafter) 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 else
{ {
@ -690,7 +796,7 @@ class pdf_eratosthene extends ModelePDFCommandes
// Show square // Show square
if ($pagenb == $pageposbeforeprintlines) 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 else
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code); $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; $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
@ -973,15 +1079,12 @@ class pdf_eratosthene extends ModelePDFCommandes
$col2x-=20; $col2x-=20;
} }
$largcol2 = ($this->page_largeur - $this->marge_droite - $col2x); $largcol2 = ($this->page_largeur - $this->marge_droite - $col2x);
$useborder=0; $useborder=0;
$index = 0; $index = 0;
// Total HT // Total HT
$pdf->SetFillColor(255, 255, 255); $pdf->SetFillColor(255, 255, 255);
$pdf->SetXY($col1x, $tab2_top + 0); $pdf->SetXY($col1x, $tab2_top + 0);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
$total_ht = ($conf->multicurrency->enabled && $object->mylticurrency_tx != 1 ? $object->multicurrency_total_ht : $object->total_ht); $total_ht = ($conf->multicurrency->enabled && $object->mylticurrency_tx != 1 ? $object->multicurrency_total_ht : $object->total_ht);
$pdf->SetXY($col2x, $tab2_top + 0); $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); $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 $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) $this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
{
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']);
}
}
if (empty($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
} }
} }

View File

@ -43,7 +43,7 @@ class mod_contract_magre extends ModelNumRefContracts
/** /**
* @var string nom * @var string nom
* @deprecated * @deprecated
* @see name * @see $name
*/ */
public $nom='Magre'; public $nom='Magre';

View File

@ -35,7 +35,7 @@ class mod_contract_olive extends ModelNumRefContracts
/** /**
* @var string Nom du modele * @var string Nom du modele
* @deprecated * @deprecated
* @see name * @see $name
*/ */
public $nom='Olive'; public $nom='Olive';

View File

@ -44,7 +44,7 @@ class mod_contract_serpis extends ModelNumRefContracts
/** /**
* @var string Nom du modele * @var string Nom du modele
* @deprecated * @deprecated
* @see name * @see $name
*/ */
public $nom='Serpis'; public $nom='Serpis';

File diff suppressed because it is too large Load Diff

View File

@ -105,7 +105,7 @@ class pdf_rouget extends ModelePdfExpedition
/** /**
* Issuer * Issuer
* @var Company object that emits * @var Societe object that emits
*/ */
public $emetteur; public $emetteur;

View File

@ -43,7 +43,7 @@ class mod_expedition_ribera extends ModelNumRefExpedition
/** /**
* @var string Nom du modele * @var string Nom du modele
* @deprecated * @deprecated
* @see name * @see $name
*/ */
public $nom='Ribera'; public $nom='Ribera';

View File

@ -44,7 +44,7 @@ class mod_expedition_safor extends ModelNumRefExpedition
/** /**
* @var string Nom du modele * @var string Nom du modele
* @deprecated * @deprecated
* @see name * @see $name
*/ */
public $nom='Safor'; public $nom='Safor';

View File

@ -4,6 +4,8 @@
* Copyright (C) 2016-2018 Philippe Grand <philippe.grand@atoo-net.com> * 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 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018 Francis Appels <francis.appels@z-application.com> * 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 * 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 * 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/pdf.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.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/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 * Class to generate expense report based on standard model
@ -121,7 +124,7 @@ class pdf_standard extends ModeleExpenseReport
*/ */
public function __construct($db) public function __construct($db)
{ {
global $conf, $langs, $mysoc; global $conf, $langs, $mysoc, $user;
// Translations // Translations
$langs->loadLangs(array("main", "trips", "projects")); $langs->loadLangs(array("main", "trips", "projects"));
@ -156,6 +159,7 @@ class pdf_standard extends ModeleExpenseReport
// Get source company // Get source company
$this->emetteur=$mysoc; $this->emetteur=$mysoc;
if (empty($this->emetteur->country_code)) $this->emetteur->country_code=substr($langs->defaultlang, -2); // By default, if was not defined if (empty($this->emetteur->country_code)) $this->emetteur->country_code=substr($langs->defaultlang, -2); // By default, if was not defined
// Define position of columns // Define position of columns
@ -626,7 +630,8 @@ class pdf_standard extends ModeleExpenseReport
*/ */
private function _pagehead(&$pdf, $object, $showaddress, $outputlangs) 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 // Load traductions files requiredby by page
$outputlangs->loadLangs(array("main", "trips", "companies")); $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->address);
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->convToOutputCharset($this->emetteur->zip).' '.$outputlangs->convToOutputCharset($this->emetteur->town); $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->convToOutputCharset($this->emetteur->zip).' '.$outputlangs->convToOutputCharset($this->emetteur->town);
$carac_emetteur .= "\n"; $carac_emetteur .= "\n";
// Phone
if ($this->emetteur->phone) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Phone")." : ".$outputlangs->convToOutputCharset($this->emetteur->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); 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); 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); 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 // Show sender
$posy=50; $posy=50;
$posx=$this->marge_gauche; $posx=$this->marge_gauche;
@ -736,19 +749,28 @@ class pdf_standard extends ModeleExpenseReport
$pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1); $pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1);
$pdf->SetTextColor(0, 0, 60); $pdf->SetTextColor(0, 0, 60);
// Show sender name // Show sender information
if (empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
$pdf->SetXY($posx+2, $posy+3); $pdf->SetXY($posx+2, $posy+3);
$pdf->SetFont('', 'B', $default_font_size); $pdf->SetFont('', 'B', $default_font_size);
$pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L'); $pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L');
// Show sender information
$pdf->SetXY($posx+2, $posy+8); $pdf->SetXY($posx+2, $posy+8);
$pdf->SetFont('', '', $default_font_size - 1); $pdf->SetFont('', '', $default_font_size - 1);
$pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L'); $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 // Show recipient
$posy=50; $posy=50;
$posx=100; $posx=10;
// Show recipient frame // Show recipient frame
$pdf->SetTextColor(0, 0, 0); $pdf->SetTextColor(0, 0, 0);
@ -760,7 +782,8 @@ class pdf_standard extends ModeleExpenseReport
// Informations for trip (dates and users workflow) // Informations for trip (dates and users workflow)
if ($object->fk_user_author > 0) { if ($object->fk_user_author > 0) {
$userfee=new User($this->db); $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->SetXY($posx+2, $posy);
$pdf->SetFont('', '', 10); $pdf->SetFont('', '', 10);
$pdf->MultiCell(96, 4, $outputlangs->transnoentities("AUTHOR")." : ".dolGetFirstLastname($userfee->firstname, $userfee->lastname), 0, 'L'); $pdf->MultiCell(96, 4, $outputlangs->transnoentities("AUTHOR")." : ".dolGetFirstLastname($userfee->firstname, $userfee->lastname), 0, 'L');

View File

@ -44,7 +44,7 @@ class mod_expensereport_sand extends ModeleNumRefExpenseReport
/** /**
* @var string Nom du modele * @var string Nom du modele
* @deprecated * @deprecated
* @see name * @see $name
*/ */
public $nom='Sand'; public $nom='Sand';

View File

@ -856,7 +856,7 @@ class pdf_crabe extends ModelePDFFactures
$invoice->fetch($obj->fk_facture_source); $invoice->fetch($obj->fk_facture_source);
$pdf->SetXY($tab3_posx, $tab3_top+$y); $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->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->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); $pdf->SetXY($tab3_posx+40, $tab3_top+$y);

View File

@ -180,6 +180,9 @@ class pdf_sponge extends ModelePDFFactures
// Define position of columns // Define position of columns
$this->posxdesc=$this->marge_gauche+1; // used for notes ans other stuff $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() // Use new system for position of columns, view $this->defineColumnField()
$this->tva=array(); $this->tva=array();
@ -217,6 +220,11 @@ class pdf_sponge extends ModelePDFFactures
$nblignes = count($object->lines); $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 // Loop on each lines to detect if there is at least one image to show
$realpatharray=array(); $realpatharray=array();
$this->atleastonephoto = false; $this->atleastonephoto = false;
@ -549,13 +557,18 @@ class pdf_sponge extends ModelePDFFactures
$height_note=0; $height_note=0;
} }
$iniY = $tab_top + 7;
$curY = $tab_top + 7;
$nexY = $tab_top + 7;
// Use new auto collum system // Use new auto collum system
$this->prepareArrayColumnField($object, $outputlangs, $hidedetails, $hidedesc, $hideref); $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 // Loop on each lines
$pageposbeforeprintlines=$pdf->getPage(); $pageposbeforeprintlines=$pdf->getPage();
$pagenb = $pageposbeforeprintlines; $pagenb = $pageposbeforeprintlines;
@ -786,7 +799,7 @@ class pdf_sponge extends ModelePDFFactures
$pdf->setPage($pagenb); $pdf->setPage($pagenb);
if ($pagenb == $pageposbeforeprintlines) 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 else
{ {
@ -803,7 +816,7 @@ class pdf_sponge extends ModelePDFFactures
{ {
if ($pagenb == $pageposafter) 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 else
{ {
@ -821,7 +834,7 @@ class pdf_sponge extends ModelePDFFactures
// Show square // Show square
if ($pagenb == $pageposbeforeprintlines) 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; $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
} }
else else
@ -959,7 +972,7 @@ class pdf_sponge extends ModelePDFFactures
$invoice->fetch($obj->fk_facture_source); $invoice->fetch($obj->fk_facture_source);
$pdf->SetXY($tab3_posx, $tab3_top+$y); $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->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->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); $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 $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) $this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
{
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']);
}
}
if (empty($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
} }
} }

View File

@ -48,7 +48,7 @@ class mod_livraison_jade extends ModeleNumRefDeliveryOrder
/** /**
* @var string Nom du modele * @var string Nom du modele
* @deprecated * @deprecated
* @see name * @see $name
*/ */
public $nom='Jade'; public $nom='Jade';

View File

@ -45,7 +45,7 @@ class mod_livraison_saphir extends ModeleNumRefDeliveryOrder
/** /**
* @var string Nom du modele * @var string Nom du modele
* @deprecated * @deprecated
* @see name * @see $name
*/ */
public $nom='Saphir'; public $nom='Saphir';

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com> /* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2018 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2013-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2014 Ari Elbaz (elarifr) <github@accedinfo.com> * Copyright (C) 2014 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2016-2017 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2016-2017 Laurent Destailleur <eldy@users.sourceforge.net>
@ -22,8 +22,8 @@
/** /**
* \file htdocs/core/modules/modAccounting.class.php * \file htdocs/core/modules/modAccounting.class.php
* \ingroup Advanced accountancy * \ingroup Double entry accounting
* \brief Module to activate Accounting Expert module * \brief Module to activate the double entry accounting module
*/ */
include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
@ -48,7 +48,7 @@ class modAccounting extends DolibarrModules
$this->module_position = '61'; $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) // 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->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 // Possible values for version are: 'development', 'experimental', 'dolibarr' or 'dolibarr_deprecated' or version
$this->version = 'dolibarr'; $this->version = 'dolibarr';

View File

@ -169,6 +169,7 @@ class pdf_cyan extends ModelePDFPropales
$this->posxdesc=$this->marge_gauche+1; $this->posxdesc=$this->marge_gauche+1;
$this->tabTitleHeight = 5; // default height
$this->tva=array(); $this->tva=array();
$this->localtax1=array(); $this->localtax1=array();
@ -207,6 +208,11 @@ class pdf_cyan extends ModelePDFPropales
$nblignes = count($object->lines); $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 // Loop on each lines to detect if there is at least one image to show
$realpatharray=array(); $realpatharray=array();
$this->atleastonephoto = false; $this->atleastonephoto = false;
@ -536,13 +542,18 @@ class pdf_cyan extends ModelePDFPropales
$height_note=0; $height_note=0;
} }
$iniY = $tab_top + 7;
$curY = $tab_top + 7;
$nexY = $tab_top + 7;
// Use new auto collum system // Use new auto collum system
$this->prepareArrayColumnField($object, $outputlangs, $hidedetails, $hidedesc, $hideref); $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 // Loop on each lines
$pageposbeforeprintlines=$pdf->getPage(); $pageposbeforeprintlines=$pdf->getPage();
$pagenb = $pageposbeforeprintlines; $pagenb = $pageposbeforeprintlines;
@ -761,7 +772,7 @@ class pdf_cyan extends ModelePDFPropales
$pdf->setPage($pagenb); $pdf->setPage($pagenb);
if ($pagenb == $pageposbeforeprintlines) 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 else
{ {
@ -777,7 +788,7 @@ class pdf_cyan extends ModelePDFPropales
{ {
if ($pagenb == $pageposafter) 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 else
{ {
@ -795,7 +806,7 @@ class pdf_cyan extends ModelePDFPropales
// Show square // Show square
if ($pagenb == $pageposbeforeprintlines) 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; $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforsignature - $heightforfooter + 1;
} }
else 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 $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) $this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
{
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']);
}
}
if (empty($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
} }
} }

View File

@ -106,7 +106,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
/** /**
* Issuer * Issuer
* @var Company object that emits * @var Societe object that emits
*/ */
public $emetteur; public $emetteur;

File diff suppressed because it is too large Load Diff

View File

@ -77,8 +77,8 @@ $(document).ready(function(){
function() { function() {
console.log("tableDND end of ajax call"); console.log("tableDND end of ajax call");
if (reloadpage == 1) { if (reloadpage == 1) {
//console.log('<?php echo dol_escape_js($_SERVER['QUERY_STRING']); ?>'); //console.log('<?php echo $urltorefreshaftermove.' - '.$_SERVER['PHP_SELF'].' - '.dol_escape_js($_SERVER['QUERY_STRING']); ?>');
location.href = '<?php echo dol_escape_js($_SERVER['PHP_SELF']).'?'.dol_escape_js($_SERVER['QUERY_STRING']); ?>'; location.href = '<?php echo dol_escape_js(empty($urltorefreshaftermove) ? ($_SERVER['PHP_SELF'].'?'.dol_escape_js($_SERVER['QUERY_STRING'])) : $urltorefreshaftermove); ?>';
} else { } else {
$("#<?php echo $tagidfortablednd; ?> .drag").each( $("#<?php echo $tagidfortablednd; ?> .drag").each(
function( intIndex ) { function( intIndex ) {

View File

@ -49,10 +49,8 @@ foreach($object->fields as $key => $val)
if ($val['type'] == 'text' || $val['type'] == 'html') print ' tdtop'; if ($val['type'] == 'text' || $val['type'] == 'html') print ' tdtop';
print '"'; print '"';
print '>'; print '>';
print $langs->trans($val['label']); if (! empty($val['help'])) print $form->textwithpicto($langs->trans($val['label']), $langs->trans($val['help']));
if(!empty($val['help'])){ else print $langs->trans($val['label']);
print $form->textwithpicto('', $langs->trans($val['help']));
}
print '</td>'; print '</td>';
print '<td>'; print '<td>';
if (in_array($val['type'], array('int', 'integer'))) $value = GETPOST($key, 'int'); if (in_array($val['type'], array('int', 'integer'))) $value = GETPOST($key, 'int');

View File

@ -47,7 +47,7 @@ foreach($object->fields as $key => $val)
if ($val['notnull'] > 0) print ' fieldrequired'; if ($val['notnull'] > 0) print ' fieldrequired';
if ($val['type'] == 'text' || $val['type'] == 'html') print ' tdtop'; if ($val['type'] == 'text' || $val['type'] == 'html') print ' tdtop';
print '">'; 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']); else print $langs->trans($val['label']);
print '</td>'; print '</td>';
print '<td>'; print '<td>';

View File

@ -52,7 +52,7 @@ foreach($object->fields as $key => $val)
if ($val['notnull'] > 0) print ' fieldrequired'; if ($val['notnull'] > 0) print ' fieldrequired';
if ($val['type'] == 'text' || $val['type'] == 'html') print ' tdtop'; if ($val['type'] == 'text' || $val['type'] == 'html') print ' tdtop';
print '">'; 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']); else print $langs->trans($val['label']);
print '</td>'; print '</td>';
print '<td>'; print '<td>';

View File

@ -23,10 +23,10 @@ if (! empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_
$align=$extrafields->getAlignFlag($key); $align=$extrafields->getAlignFlag($key);
$typeofextrafield=$extrafields->attributes[$extrafieldsobjectkey]['type'][$key]; $typeofextrafield=$extrafields->attributes[$extrafieldsobjectkey]['type'][$key];
print '<td class="liste_titre'.($align?' '.$align:'').'">'; 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])) if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select')) && empty($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key]))
{ {
$crit=$val; $crit=$val;
$tmpkey=preg_replace('/'.$search_options_pattern.'/', '', $key);
$searchclass=''; $searchclass='';
if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring'; if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring';
if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum'; 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') // 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=''; $morecss='';
if ($typeofextrafield == 'sellist') $morecss='maxwidth200'; 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'))) elseif (in_array($typeofextrafield, array('datetime','timestamp')))
{ {

View File

@ -62,7 +62,7 @@ if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf-
<?php <?php
$coldisplay=-1; // We remove first td $coldisplay=-1; // We remove first td
?> ?>
<tr <?php echo $bc[$var]; ?>> <tr class="oddeven tredited">
<?php if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { ?> <?php if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { ?>
<td class="linecolnum center"><?php $coldisplay++; ?><?php echo ($i+1); ?></td> <td class="linecolnum center"><?php $coldisplay++; ?><?php echo ($i+1); ?></td>
<?php } ?> <?php } ?>

View File

@ -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="action" value="add_element_resource">';
$out .= '<input type="hidden" name="element" value="'.$element.'">'; $out .= '<input type="hidden" name="element" value="'.$element.'">';
$out .= '<input type="hidden" name="element_id" value="'.$element_id.'">'; $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).'">'; $out .= '<input type="hidden" name="resource_type" value="'.(empty($resource_type) ? 'dolresource' : $resource_type).'">';

View File

@ -325,7 +325,7 @@ $arrayofmassactions = array(
'enable'=>$langs->trans("CronStatusActiveBtn"), 'enable'=>$langs->trans("CronStatusActiveBtn"),
'disable'=>$langs->trans("CronStatusInactiveBtn"), '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(); if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions); $massactionbutton=$form->selectMassAction('', $arrayofmassactions);

View File

@ -79,7 +79,7 @@ class PaymentDonation extends CommonObject
/** /**
* @deprecated * @deprecated
* @see amount, amounts * @see $amount, $amounts
*/ */
public $total; public $total;

View File

@ -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 . '/societe/class/societe.class.php';
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.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 . '/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), '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'), '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'), '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'), '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), //'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), //'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"), '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,), '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,), '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_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,), '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,), '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 $filters;
public $actions; public $actions;
public $debuginfo;
/** /**
* Constructor * Constructor
@ -730,14 +734,15 @@ class EmailCollector extends CommonObject
* @param string $actionparam Action parameters * @param string $actionparam Action parameters
* @param string $messagetext Body * @param string $messagetext Body
* @param string $subject Subject * @param string $subject Subject
* @param string $header Header
* @return int 0=OK, Nb of error if error * @return int 0=OK, Nb of error if error
*/ */
private function overwritePropertiesOfObject(&$object, $actionparam, $messagetext, $subject) private function overwritePropertiesOfObject(&$object, $actionparam, $messagetext, $subject, $header)
{ {
$errorforthisaction = 0; $errorforthisaction = 0;
// Overwrite values with values extracted from source email // 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, ';', '='); $arrayvaluetouse = dolExplodeIntoArray($actionparam, ';', '=');
foreach($arrayvaluetouse as $propertytooverwrite => $valueforproperty) foreach($arrayvaluetouse as $propertytooverwrite => $valueforproperty)
{ {
@ -754,44 +759,59 @@ class EmailCollector extends CommonObject
} }
if ($tmpclass && ($tmpclass != $object->element)) continue; // Property is for another type of object 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=''; $sourcestring='';
$sourcefield=''; $sourcefield='';
$regexstring=''; $regexstring='';
//$transformationstring=''; //$transformationstring='';
$regforregex=array(); $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]; $sourcefield=$regforregex[1];
$regexstring=$regforregex[2]; $regexstring=$regforregex[2];
//$transofrmationstring=$regforregex[3]; //$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]; $sourcefield=$regforregex[1];
$regexstring=$regforregex[2]; $regexstring=$regforregex[2];
} }
if (! empty($sourcefield) && ! empty($regexstring)) if (! empty($sourcefield) && ! empty($regexstring))
{ {
if (strtolower($sourcefield) == 'body') $sourcestring=$messagetext; if (strtolower($sourcefield) == 'body') $sourcestring=$messagetext;
elseif (strtolower($sourcefield) == 'subject') $sourcestring=$subject; elseif (strtolower($sourcefield) == 'subject') $sourcestring=$subject;
elseif (strtolower($sourcefield) == 'header') $sourcestring=$header;
$regforval=array(); if ($sourcestring)
if (preg_match('/'.preg_quote($regexstring, '/').'/', $sourcestring, $regforval))
{ {
$regforval=array();
//var_dump($regexstring);var_dump($sourcestring);
if (preg_match('/'.$regexstring.'/ms', $sourcestring, $regforval))
{
//var_dump($regforval[1]);exit;
// Overwrite param $tmpproperty // Overwrite param $tmpproperty
$object->$tmpproperty = $regforval[1]; $object->$tmpproperty = isset($regforval[1])?trim($regforval[1]):null;
}
else
{
// Regex not found
$object->$tmpproperty = null;
}
//var_dump($object->$tmpproperty);exit;
} }
else else
{ {
// Nothing can be done for this param // Nothing can be done for this param
$errorforthisaction++;
$this->errors = 'The extract rule to use has on an unknown source (must be HEADER, SUBJECT or BODY)';
$this->errors[] = $this->error;
} }
} }
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 else
{ {
@ -820,7 +840,7 @@ class EmailCollector extends CommonObject
dol_syslog("EmailCollector::doCollectOneCollector start", LOG_DEBUG); dol_syslog("EmailCollector::doCollectOneCollector start", LOG_DEBUG);
$langs->loadLangs(array("project", "companies", "mails", "errors")); $langs->loadLangs(array("project", "companies", "mails", "errors", "ticket"));
$error = 0; $error = 0;
$this->output = ''; $this->output = '';
@ -865,9 +885,16 @@ class EmailCollector extends CommonObject
$this->error = 'Failed to open IMAP connection '.$connectstringsource; $this->error = 'Failed to open IMAP connection '.$connectstringsource;
return -3; 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='ALL';
$search='UNDELETED'; $search='UNDELETED'; // Seems not supported by some servers
$searchhead='';
$searchfilterdoltrackid=0; $searchfilterdoltrackid=0;
$searchfilternodoltrackid=0; $searchfilternodoltrackid=0;
foreach($this->filters as $rule) foreach($this->filters as $rule)
@ -880,17 +907,23 @@ class EmailCollector extends CommonObject
if ($rule['type'] == 'from') $search.=($search?' ':'').'FROM "'.str_replace('"', '', $rule['rulevalue']).'"'; 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'] == 'subject') $search.=($search?' ':'').'SUBJECT "'.str_replace('"', '', $rule['rulevalue']).'"';
if ($rule['type'] == 'body') $search.=($search?' ':'').'BODY "'.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'] == 'seen') $search.=($search?' ':'').'SEEN';
if ($rule['type'] == 'unseen') $search.=($search?' ':'').'UNSEEN'; if ($rule['type'] == 'unseen') $search.=($search?' ':'').'UNSEEN';
if ($rule['type'] == 'withtrackingid') $searchfilterdoltrackid++; if ($rule['type'] == 'smaller') $search.=($search?' ':'').'SMALLER "'.str_replace('"', '', $rule['rulevalue']).'"';
if ($rule['type'] == 'withouttrackingid') $searchfilternodoltrackid++; 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. if (empty($targetdir)) // Use last date as filter if there is no targetdir defined.
{ {
$fromdate=0; $fromdate=0;
if ($this->datelastresult && $this->codelastresult == 'OK') $fromdate = $this->datelastresult; if ($this->datelastok) $fromdate = $this->datelastok;
if ($fromdate > 0) $search.=($search?' ':'').'SINCE '.dol_print_date($fromdate - 1, 'dayhourrfc'); 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); dol_syslog("IMAP search string = ".$search);
//var_dump($search); //var_dump($search);
@ -900,11 +933,21 @@ class EmailCollector extends CommonObject
$nbactiondone=0; $nbactiondone=0;
// Scan IMAP inbox // Scan IMAP inbox
$arrayofemail= imap_search($connection, $search); $arrayofemail= imap_search($connection, $search, null, "UTF-8");
//var_dump($arrayofemail);exit; 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 // Loop on each email found
if (! empty($arrayofemail) && count($arrayofemail) > 0) if (! $error && ! empty($arrayofemail) && count($arrayofemail) > 0)
{ {
foreach($arrayofemail as $imapemail) foreach($arrayofemail as $imapemail)
{ {
@ -916,11 +959,7 @@ class EmailCollector extends CommonObject
$headers = array_combine($matches[1], $matches[2]); $headers = array_combine($matches[1], $matches[2]);
//var_dump($headers); //var_dump($headers);
// $conf->global->MAIL_PREFIX_FOR_EMAIL_ID must be defined
$host=dol_getprefix('email');
// If there is a filter on trackid // If there is a filter on trackid
//var_dump($host);exit;
if ($searchfilterdoltrackid > 0) if ($searchfilterdoltrackid > 0)
{ {
//if (empty($headers['X-Dolibarr-TRACKID'])) continue; //if (empty($headers['X-Dolibarr-TRACKID'])) continue;
@ -1066,16 +1105,18 @@ class EmailCollector extends CommonObject
$partplain=1; $partplain=1;
}*/ }*/
//var_dump($structure); /*var_dump($structure);
//var_dump($parthtml);var_dump($partplain); 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($messagetext);
//var_dump($header);
//var_dump($message);
//var_dump($structure->parts[0]->parts); //var_dump($structure->parts[0]->parts);
//var_dump($messagetext);exit; //print $header;
//print $messagetext;
//exit;
$fromstring=$overview[0]->from; $fromstring=$overview[0]->from;
$sender=$overview[0]->sender; $sender=$overview[0]->sender;
$to=$overview[0]->to; $to=$overview[0]->to;
@ -1101,8 +1142,10 @@ class EmailCollector extends CommonObject
$contactid = 0; $thirdpartyid = 0; $projectid = 0; $contactid = 0; $thirdpartyid = 0; $projectid = 0;
// Analyze TrackId in field References // Analyze TrackId in field References. For example:
// For example: References: <1542377954.SMTPs-dolibarr-thi649@8f6014fde11ec6cdec9a822234fc557e> // References: <1542377954.SMTPs-dolibarr-thi649@8f6014fde11ec6cdec9a822234fc557e>
// References: <1542377954.SMTPs-dolibarr-tic649@8f6014fde11ec6cdec9a822234fc557e>
// References: <1542377954.SMTPs-dolibarr-abc649@8f6014fde11ec6cdec9a822234fc557e>
$trackid = ''; $trackid = '';
$reg=array(); $reg=array();
if (! empty($headers['References']) && preg_match('/dolibarr-([a-z]+)([0-9]+)@'.preg_quote($host, '/').'/', $headers['References'], $reg)) if (! empty($headers['References']) && preg_match('/dolibarr-([a-z]+)([0-9]+)@'.preg_quote($host, '/').'/', $headers['References'], $reg))
@ -1136,6 +1179,11 @@ class EmailCollector extends CommonObject
$objectid = $reg[1]; $objectid = $reg[1];
$objectemail = new User($this->db); $objectemail = new User($this->db);
} }
if ($reg[0] == 'tic')
{
$objectid = $reg[1];
$objectemail = new Ticket($this->db);
}
if (is_object($objectemail)) if (is_object($objectemail))
{ {
@ -1227,13 +1275,32 @@ class EmailCollector extends CommonObject
// Make Operation // Make Operation
dol_syslog("Execute action ".$operation['type']." actionparam=".$operation['actionparam'].' thirdpartystatic->id='.$thirdpartystatic->id.' contactstatic->id='.$contactstatic->id.' projectstatic->id='.$projectstatic->id); 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 // Search and create thirdparty
if ($operation['type'] == 'loadthirdparty' || $operation['type'] == 'loadandcreatethirdparty') if ($operation['type'] == 'loadthirdparty' || $operation['type'] == 'loadandcreatethirdparty')
{ {
if (empty($operation['actionparam'])) if (empty($operation['actionparam']))
{ {
$errorforactions++; $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; $this->errors[] = $this->error;
} }
else else
@ -1241,7 +1308,7 @@ class EmailCollector extends CommonObject
$actionparam = $operation['actionparam']; $actionparam = $operation['actionparam'];
$nametouseforthirdparty=''; $nametouseforthirdparty='';
// $this->actionparam = 'VALUE:aaa' or 'REGEX:BODY:....' // $this->actionparam = 'SET:aaa' or 'EXTRACT:BODY:....'
$arrayvaluetouse = dolExplodeIntoArray($actionparam, ';', '='); $arrayvaluetouse = dolExplodeIntoArray($actionparam, ';', '=');
foreach($arrayvaluetouse as $propertytooverwrite => $valueforproperty) foreach($arrayvaluetouse as $propertytooverwrite => $valueforproperty)
{ {
@ -1250,7 +1317,7 @@ class EmailCollector extends CommonObject
$regexstring=''; $regexstring='';
$regforregex=array(); $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]; $sourcefield=$regforregex[1];
$regexstring=$regforregex[2]; $regexstring=$regforregex[2];
@ -1273,7 +1340,7 @@ class EmailCollector extends CommonObject
} }
//var_dump($sourcestring); var_dump($regexstring);var_dump($nametouseforthirdparty);exit; //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]; $nametouseforthirdparty = $reg[1];
} }
@ -1308,7 +1375,7 @@ class EmailCollector extends CommonObject
$thirdpartystatic->email = $from; $thirdpartystatic->email = $from;
// Overwrite values with values extracted from source email // Overwrite values with values extracted from source email
$errorforthisaction = $this->overwritePropertiesOfObject($thirdpartystatic, $operation['actionparam'], $messagetext, $subject); $errorforthisaction = $this->overwritePropertiesOfObject($thirdpartystatic, $operation['actionparam'], $messagetext, $subject, $header);
if ($errorforthisaction) if ($errorforthisaction)
{ {
@ -1337,14 +1404,31 @@ class EmailCollector extends CommonObject
elseif ($operation['type'] == 'recordevent') elseif ($operation['type'] == 'recordevent')
{ {
$actioncode = 'EMAIL_IN'; $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 // Insert record of emails sent
$actioncomm = new ActionComm($this->db); $actioncomm = new ActionComm($this->db);
$actioncomm->type_code = 'AC_OTH_AUTO'; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...) $actioncomm->type_code = 'AC_OTH_AUTO'; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...)
$actioncomm->code = 'AC_'.$actioncode; $actioncomm->code = 'AC_'.$actioncode;
$actioncomm->label = $langs->trans("ActionAC_EMAIL_IN").' - '.$langs->trans("MailFrom").' '.$from; $actioncomm->label = $langs->trans("ActionAC_".$actioncode).' - '.$langs->trans("MailFrom").' '.$from;
$actioncomm->note = $messagetext; $actioncomm->note = $descriptionfull;
$actioncomm->fk_project = $projectstatic->id; $actioncomm->fk_project = $projectstatic->id;
$actioncomm->datep = $date; $actioncomm->datep = $date;
$actioncomm->datef = $date; $actioncomm->datef = $date;
@ -1372,7 +1456,7 @@ class EmailCollector extends CommonObject
//$actioncomm->extraparams = $extraparams; //$actioncomm->extraparams = $extraparams;
// Overwrite values with values extracted from source email // Overwrite values with values extracted from source email
$errorforthisaction = $this->overwritePropertiesOfObject($actioncommn, $operation['actionparam'], $messagetext, $subject); $errorforthisaction = $this->overwritePropertiesOfObject($actioncommn, $operation['actionparam'], $messagetext, $subject, $header);
if ($errorforthisaction) if ($errorforthisaction)
{ {
@ -1391,17 +1475,16 @@ class EmailCollector extends CommonObject
// Create event // Create event
elseif ($operation['type'] == 'project') elseif ($operation['type'] == 'project')
{ {
$note_private = $langs->trans("ProjectCreatedByEmailCollector", $msgid);
$projecttocreate = new Project($this->db); $projecttocreate = new Project($this->db);
if ($thirdpartystatic->id > 0) if ($thirdpartystatic->id > 0)
{ {
$projecttocreate->socid = $thirdpartystatic->id; $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) if ($contactstatic->id > 0)
{ {
$projecttocreate->contact_id = $contactstatic->id; $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'); $id_opp_status = dol_getIdFromCode($this->db, 'PROSP', 'c_lead_status', 'code', 'rowid');
@ -1412,8 +1495,8 @@ class EmailCollector extends CommonObject
$projecttocreate->date_end = ''; $projecttocreate->date_end = '';
$projecttocreate->opp_status = $id_opp_status; $projecttocreate->opp_status = $id_opp_status;
$projecttocreate->opp_percent = $percent_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->description = dol_concatdesc(dolGetFirstLineOfText(dol_string_nohtmltag($description, 2), 8), '...'.$langs->transnoentities("SeePrivateNote").'...');
$projecttocreate->note_private = dol_concatdesc($note_private, dol_string_nohtmltag($messagetext, 2)); $projecttocreate->note_private = dol_concatdesc($descriptionfull, dol_string_nohtmltag($descriptionfull, 2));
$projecttocreate->entity = $conf->entity; $projecttocreate->entity = $conf->entity;
// Get next project Ref // Get next project Ref
@ -1445,7 +1528,7 @@ class EmailCollector extends CommonObject
$projecttocreate->ref = $defaultref; $projecttocreate->ref = $defaultref;
// Overwrite values with values extracted from source email // Overwrite values with values extracted from source email
$errorforthisaction = $this->overwritePropertiesOfObject($projecttocreate, $operation['actionparam'], $messagetext, $subject); $errorforthisaction = $this->overwritePropertiesOfObject($projecttocreate, $operation['actionparam'], $messagetext, $subject, $header);
if ($errorforthisaction) if ($errorforthisaction)
{ {
@ -1471,6 +1554,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, $header);
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) if (! $errorforactions)
{ {
@ -1537,6 +1704,10 @@ class EmailCollector extends CommonObject
$this->datelastresult = $now; $this->datelastresult = $now;
$this->lastresult = $output; $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); if (! empty($this->errors)) $this->lastresult.= " - ".join(" - ", $this->errors);
$this->codelastresult = ($error ? 'KO' : 'OK'); $this->codelastresult = ($error ? 'KO' : 'OK');

View File

@ -162,7 +162,7 @@ class EmailCollectorFilter extends CommonObject
if (! in_array($this->type, array('seen','unseen','withtrackingid','withouttrackingid')) && empty($this->rulevalue)) if (! in_array($this->type, array('seen','unseen','withtrackingid','withouttrackingid')) && empty($this->rulevalue))
{ {
$langs->load("errors"); $langs->load("errors");
$this->errors[]=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("StringToFilter")); $this->errors[]=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("SearchString"));
return -1; return -1;
} }

View File

@ -607,7 +607,7 @@ class Expedition extends CommonObject
$this->getUrlTrackingStatus($obj->tracking_number); $this->getUrlTrackingStatus($obj->tracking_number);
/* /*
* Thirparty * Thirdparty
*/ */
$result=$this->fetch_thirdparty(); $result=$this->fetch_thirdparty();
@ -2417,7 +2417,7 @@ class ExpeditionLigne extends CommonObjectLine
/** /**
* @deprecated * @deprecated
* @see product_ref * @see $product_ref
*/ */
public $ref; public $ref;

View File

@ -894,7 +894,7 @@ if ($id > 0 || ! empty($ref))
print $langs->trans("WarehouseSource"); print $langs->trans("WarehouseSource");
//print '</td>'; //print '</td>';
//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) if (count($formproduct->cache_warehouses) <= 0)
{ {
print ' &nbsp; '.$langs->trans("WarehouseSourceNotDefined").' <a href="'.DOL_URL_ROOT.'/product/stock/card.php?action=create">'.$langs->trans("AddOne").'</a>'; print ' &nbsp; '.$langs->trans("WarehouseSourceNotDefined").' <a href="'.DOL_URL_ROOT.'/product/stock/card.php?action=create">'.$langs->trans("AddOne").'</a>';

View File

@ -2209,7 +2209,51 @@ else
if ($action == 'editline' && $line->rowid == GETPOST('rowid', 'int')) if ($action == 'editline' && $line->rowid == GETPOST('rowid', 'int'))
{ {
print '<tr class="oddeven">';
// Add line with link to add new file or attach to an existing file
$colspan = 12;
if (! empty($conf->projet->enabled)) $colspan++;
if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) $colspan++;
print '<tr class="tredited">';
print '<td colspan="'.$colspan.'" class="liste_titre">';
print '<a href="" class="commonlink auploadnewfilenow reposition">'.$langs->trans("UploadANewFileNow");
print img_picto($langs->trans("UploadANewFileNow"), 'chevron-down', '', false, 0, 0, '', 'marginleftonly');
print '</a>';
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
{
print ' &nbsp; - &nbsp; '.'<a href="" class="commonlink aattachtodoc reposition">'.$langs->trans("AttachTheNewLineToTheDocument");
print img_picto($langs->trans("AttachTheNewLineToTheDocument"), 'chevron-down', '', false, 0, 0, '', 'marginleftonly');
print '</a>';
}
print '<script language="javascript">'."\n";
print '$(document).ready(function() {
$( ".auploadnewfilenow" ).click(function() {
jQuery(".truploadnewfilenow").toggle();
jQuery(".trattachnewfilenow").hide();
return false;
});
$( ".aattachtodoc" ).click(function() {
jQuery(".trattachnewfilenow").toggle();
jQuery(".truploadnewfilenow").hide();
return false;
});';
if (is_array(GETPOST('attachfile', 'array')) && count(GETPOST('attachfile', 'array')))
{
print 'jQuery(".trattachnewfilenow").toggle();'."\n";
}
print '
});
';
print '</script>'."\n";
print '</td></tr>';
$tredited='tredited';
include DOL_DOCUMENT_ROOT.'/expensereport/tpl/expensereport_addfile.tpl.php';
include DOL_DOCUMENT_ROOT.'/expensereport/tpl/expensereport_linktofile.tpl.php';
print '<tr class="oddeven tredited">';
print '<td></td>'; print '<td></td>';
@ -2264,11 +2308,8 @@ else
print '<input type="number" min="0" class="right maxwidth50" name="qty" value="'.dol_escape_htmltag($line->qty).'" />'; print '<input type="number" min="0" class="right maxwidth50" name="qty" value="'.dol_escape_htmltag($line->qty).'" />';
print '</td>'; print '</td>';
if ($action != 'editline') //print '<td class="right">'.$langs->trans('AmountHT').'</td>';
{ //print '<td class="right">'.$langs->trans('AmountTTC').'</td>';
print '<td class="right">'.$langs->trans('AmountHT').'</td>';
print '<td class="right">'.$langs->trans('AmountTTC').'</td>';
}
// Picture // Picture
print '<td class="center">'; print '<td class="center">';
@ -2280,6 +2321,8 @@ else
print '<input type="submit" class="button" name="save" value="'.$langs->trans('Save').'">'; print '<input type="submit" class="button" name="save" value="'.$langs->trans('Save').'">';
print '<br><input type="submit" class="button" name="cancel" value="'.$langs->trans('Cancel').'">'; print '<br><input type="submit" class="button" name="cancel" value="'.$langs->trans('Cancel').'">';
print '</td>'; print '</td>';
print '</tr>';
} }
$i++; $i++;
@ -2342,149 +2385,8 @@ else
print '</script>'."\n"; print '</script>'."\n";
print '</td></tr>'; print '</td></tr>';
// Add line to upload new file include DOL_DOCUMENT_ROOT.'/expensereport/tpl/expensereport_addfile.tpl.php';
print '<tr class="oddeven nohover truploadnewfilenow"'.(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)?' style="display: none"':'').'>'; include DOL_DOCUMENT_ROOT.'/expensereport/tpl/expensereport_linktofile.tpl.php';
print '<td colspan="'.$colspan.'">';
$modulepart = 'expensereport';
$permission = $user->rights->expensereport->creer;
// We define var to enable the feature to add prefix of uploaded files
$savingdocmask='';
if (empty($conf->global->MAIN_DISABLE_SUGGEST_REF_AS_PREFIX))
{
//var_dump($modulepart);
if (in_array($modulepart, array('facture_fournisseur','commande_fournisseur','facture','commande','propal','supplier_proposal','ficheinter','contract','expedition','project','project_task','expensereport','tax', 'produit', 'product_batch')))
{
$savingdocmask=dol_sanitizeFileName($object->ref).'-__file__';
}
}
// Show upload form (document and links)
$formfile->form_attach_new_file(
$_SERVER["PHP_SELF"].'?id='.$object->id,
'none',
0,
0,
$permission,
$conf->browser->layout == 'phone' ? 40 : 60,
$object,
'',
1,
$savingdocmask,
0,
'formuserfile',
'accept',
'',
1
);
print '</td></tr>';
// Add line to select existing file
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
$upload_dir = $conf->expensereport->dir_output . "/" . dol_sanitizeFileName($object->ref);
$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)
{
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("AttachTheNewLineToTheDocument").'</span><br>';
$modulepart='expensereport';$maxheightmini=48;
$relativepath=(! empty($object->ref)?dol_sanitizeFileName($object->ref):'').'/';
foreach($arrayoffiles as $file)
{
print '<div class="inline-block margintoponly marginleftonly marginrightonly center">';
$fileinfo = pathinfo($file['name']);
if (image_format_supported($file['name']) > 0)
{
$minifile=getImageFileNameForSize($file['name'], '_mini'); // For new thumbs using same ext (in lower case however) than original
//print $file['path'].'/'.$minifile.'<br>';
$urlforhref=getAdvancedPreviewUrl($modulepart, $fileinfo['relativename'].'.'.strtolower($fileinfo['extension']), 1, '&entity='.(!empty($object->entity)?$object->entity:$conf->entity));
if (empty($urlforhref)) {
$urlforhref=DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.(!empty($object->entity)?$object->entity:$conf->entity).'&file='.urlencode($fileinfo['relativename'].'.'.strtolower($fileinfo['extension']));
print '<a href="'.$urlforhref.'" class="aphoto" target="_blank">';
} else {
print '<a href="'.$urlforhref['url'].'" class="'.$urlforhref['css'].'" target="'.$urlforhref['target'].'" mime="'.$urlforhref['mime'].'">';
}
print '<div class="photoref">';
print '<img class="photoexpensereport photorefcenter" height="'.$maxheightmini.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.(!empty($object->entity)?$object->entity:$conf->entity).'&file='.urlencode($relativepath.$minifile).'" title="">';
print '</div>';
print '</a>';
}
else
{
$modulepart='expensereport';
print '<a href=""><div class="photoref">';
$thumbshown=0;
if (preg_match('/\.pdf$/i', $file['name']))
{
$filepdf = $conf->expensereport->dir_output.'/'.$relativepath.$file['name'];
$fileimage = $conf->expensereport->dir_output.'/'.$relativepath.$file['name'].'_preview.png';
$relativepathimage = $relativepath.$file['name'].'_preview.png';
$pdfexists = file_exists($filepdf);
if ($pdfexists)
{
// Conversion du PDF en image png si fichier png non existant
if (! file_exists($fileimage) || (filemtime($fileimage) < filemtime($filepdf)))
{
if (empty($conf->global->MAIN_DISABLE_PDF_THUMBS)) // If you experience trouble with pdf thumb generation and imagick, you can disable here.
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$ret = dol_convert_file($filepdf, 'png', $fileimage, '0'); // Convert first page of PDF into a file _preview.png
if ($ret < 0) $error++;
}
}
}
if ($pdfexists && ! $error)
{
$heightforphotref=70;
if (! empty($conf->dol_optimize_smallscreen)) $heightforphotref=60;
// If the preview file is found
if (file_exists($fileimage))
{
$thumbshown=1;
print '<img height="'.$heightforphotref.'" class="photo photowithmargin photowithborder" src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercu'.$modulepart.'&amp;file='.urlencode($relativepathimage).'">';
}
}
}
if (! $thumbshown)
{
print img_mime($minifile);
}
print '</div></a>';
}
print '<br>';
$checked='';
//var_dump(GETPOST($file['relativename'])); var_dump($file['relativename']); var_dump($_FILES['userfile']['name']);
foreach($_FILES['userfile']['name'] as $tmpfile)
{
if ($file['relativename'] == (GETPOST('savingdocmask', 'alpha') ? dol_sanitizeFileName($object->ref.'-') : '').$tmpfile)
{
$checked=' checked';
break;
}
elseif ($file['relativename'] && in_array($file['relativename'], GETPOST('attachfile', 'array'))) {
$checked=' checked';
break;
}
}
print '<div class="margintoponly"><input type="radio"'.$checked.' name="attachfile[]" value="'.$file['relativename'].'"> '.$file['relativename'].'</div>';
print '</div>';
}
print '</td></tr>';
}
}
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td></td>'; print '<td></td>';
@ -2503,7 +2405,7 @@ else
print '<td></td>'; print '<td></td>';
print '</tr>'; print '</tr>';
print '<tr class="oddeven">'; print '<tr class="oddeven nohover">';
// Line number // Line number
print '<td></td>'; print '<td></td>';

View File

@ -344,7 +344,7 @@ if ($resql)
'presend'=>$langs->trans("SendByMail"), 'presend'=>$langs->trans("SendByMail"),
'builddoc'=>$langs->trans("PDFMerge"), '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(); if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions); $massactionbutton=$form->selectMassAction('', $arrayofmassactions);

View File

@ -234,7 +234,7 @@ print '</td></tr>';
// Status // Status
print '<tr><td class="left">'.$langs->trans("Status").'</td><td class="left">'; print '<tr><td class="left">'.$langs->trans("Status").'</td><td class="left">';
$liststatus=$tmpexpensereport->statuts; $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>'; print '</td></tr>';
// Year // Year
print '<tr><td>'.$langs->trans("Year").'</td><td>'; print '<tr><td>'.$langs->trans("Year").'</td><td>';

View File

@ -0,0 +1,40 @@
<?php
// Add line to upload new file
print '<!-- expensereport_addfile.tpl.php -->'."\n";
print '<tr class="truploadnewfilenow'.(empty($tredited)?' oddeven nohover':' '.$tredited).'"'.(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)?' style="display: none"':'').'>';
print '<td colspan="'.$colspan.'">';
$modulepart = 'expensereport';
$permission = $user->rights->expensereport->creer;
// We define var to enable the feature to add prefix of uploaded files
$savingdocmask='';
if (empty($conf->global->MAIN_DISABLE_SUGGEST_REF_AS_PREFIX))
{
//var_dump($modulepart);
if (in_array($modulepart, array('facture_fournisseur','commande_fournisseur','facture','commande','propal','supplier_proposal','ficheinter','contract','expedition','project','project_task','expensereport','tax', 'produit', 'product_batch')))
{
$savingdocmask=dol_sanitizeFileName($object->ref).'-__file__';
}
}
// Show upload form (document and links)
$formfile->form_attach_new_file(
$_SERVER["PHP_SELF"].'?id='.$object->id,
'none',
0,
0,
$permission,
$conf->browser->layout == 'phone' ? 40 : 60,
$object,
'',
1,
$savingdocmask,
0,
'formuserfile',
'accept',
'',
1
);
print '</td></tr>';

View File

@ -0,0 +1,115 @@
<?php
// Add line to select existing file
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
{
print '<!-- expensereport_linktofile.tpl.php -->'."\n";
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
$upload_dir = $conf->expensereport->dir_output . "/" . dol_sanitizeFileName($object->ref);
$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)
{
print '<tr class="trattachnewfilenow'.(empty($tredited)?' oddeven nohover':' '.$tredited).'"'.(! GETPOSTISSET('sendit') && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)?' style="display: none"':'').'>';
print '<td colspan="'.$colspan.'">';
//print '<span class="opacitymedium">'.$langs->trans("AttachTheNewLineToTheDocument").'</span><br>';
$modulepart='expensereport';$maxheightmini=48;
$relativepath=(! empty($object->ref)?dol_sanitizeFileName($object->ref):'').'/';
foreach($arrayoffiles as $file)
{
print '<div class="inline-block margintoponly marginleftonly marginrightonly center">';
$fileinfo = pathinfo($file['name']);
if (image_format_supported($file['name']) > 0)
{
$minifile=getImageFileNameForSize($file['name'], '_mini'); // For new thumbs using same ext (in lower case however) than original
//print $file['path'].'/'.$minifile.'<br>';
$urlforhref=getAdvancedPreviewUrl($modulepart, $fileinfo['relativename'].'.'.strtolower($fileinfo['extension']), 1, '&entity='.(!empty($object->entity)?$object->entity:$conf->entity));
if (empty($urlforhref)) {
$urlforhref=DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.(!empty($object->entity)?$object->entity:$conf->entity).'&file='.urlencode($fileinfo['relativename'].'.'.strtolower($fileinfo['extension']));
print '<a href="'.$urlforhref.'" class="aphoto" target="_blank">';
} else {
print '<a href="'.$urlforhref['url'].'" class="'.$urlforhref['css'].'" target="'.$urlforhref['target'].'" mime="'.$urlforhref['mime'].'">';
}
print '<div class="photoref">';
print '<img class="photoexpensereport photorefcenter" height="'.$maxheightmini.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.(!empty($object->entity)?$object->entity:$conf->entity).'&file='.urlencode($relativepath.$minifile).'" title="">';
print '</div>';
print '</a>';
}
else
{
$modulepart='expensereport';
print '<a href=""><div class="photoref">';
$thumbshown=0;
if (preg_match('/\.pdf$/i', $file['name']))
{
$filepdf = $conf->expensereport->dir_output.'/'.$relativepath.$file['name'];
$fileimage = $conf->expensereport->dir_output.'/'.$relativepath.$file['name'].'_preview.png';
$relativepathimage = $relativepath.$file['name'].'_preview.png';
$pdfexists = file_exists($filepdf);
if ($pdfexists)
{
// Conversion du PDF en image png si fichier png non existant
if (! file_exists($fileimage) || (filemtime($fileimage) < filemtime($filepdf)))
{
if (empty($conf->global->MAIN_DISABLE_PDF_THUMBS)) // If you experience trouble with pdf thumb generation and imagick, you can disable here.
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$ret = dol_convert_file($filepdf, 'png', $fileimage, '0'); // Convert first page of PDF into a file _preview.png
if ($ret < 0) $error++;
}
}
}
if ($pdfexists && ! $error)
{
$heightforphotref=70;
if (! empty($conf->dol_optimize_smallscreen)) $heightforphotref=60;
// If the preview file is found
if (file_exists($fileimage))
{
$thumbshown=1;
print '<img height="'.$heightforphotref.'" class="photo photowithmargin photowithborder" src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercu'.$modulepart.'&amp;file='.urlencode($relativepathimage).'">';
}
}
}
if (! $thumbshown)
{
print img_mime($minifile);
}
print '</div></a>';
}
print '<br>';
$checked='';
//var_dump(GETPOST($file['relativename'])); var_dump($file['relativename']); var_dump($_FILES['userfile']['name']);
foreach($_FILES['userfile']['name'] as $tmpfile)
{
if ($file['relativename'] == (GETPOST('savingdocmask', 'alpha') ? dol_sanitizeFileName($object->ref.'-') : '').$tmpfile)
{
$checked=' checked';
break;
}
elseif ($file['relativename'] && in_array($file['relativename'], GETPOST('attachfile', 'array'))) {
$checked=' checked';
break;
}
}
print '<div class="margintoponly"><input type="radio"'.$checked.' name="attachfile[]" value="'.$file['relativename'].'"> '.$file['relativename'].'</div>';
print '</div>';
}
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>';
}
}

View File

@ -309,7 +309,7 @@ if ($resql)
//'presend'=>$langs->trans("SendByMail"), //'presend'=>$langs->trans("SendByMail"),
'builddoc'=>$langs->trans("PDFMerge"), '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(); if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions); $massactionbutton=$form->selectMassAction('', $arrayofmassactions);

View File

@ -625,7 +625,7 @@ if ($resql)
'builddoc'=>$langs->trans("PDFMerge"), 'builddoc'=>$langs->trans("PDFMerge"),
); );
//if($user->rights->fournisseur->facture->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer"); //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(); if (in_array($massaction, array('presend','predelete','createbills'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions); $massactionbutton=$form->selectMassAction('', $arrayofmassactions);

View File

@ -459,7 +459,7 @@ if ($resql)
//'builddoc'=>$langs->trans("PDFMerge"), //'builddoc'=>$langs->trans("PDFMerge"),
); );
//if($user->rights->fournisseur->facture->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer"); //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(); if (in_array($massaction, array('presend','predelete','createbills'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions); $massactionbutton=$form->selectMassAction('', $arrayofmassactions);

View File

@ -121,7 +121,7 @@ $arrayofmassactions = array(
'presend'=>$langs->trans("SendByMail"), 'presend'=>$langs->trans("SendByMail"),
'builddoc'=>$langs->trans("PDFMerge"), '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(); if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions); $massactionbutton=$form->selectMassAction('', $arrayofmassactions);

View File

@ -284,7 +284,7 @@ $arrayofmassactions = array(
//'presend'=>$langs->trans("SendByMail"), //'presend'=>$langs->trans("SendByMail"),
//'builddoc'=>$langs->trans("PDFMerge"), //'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(); if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions); $massactionbutton=$form->selectMassAction('', $arrayofmassactions);

View File

@ -76,8 +76,8 @@ if (! empty($useragent))
// Check PHP version // Check PHP version
$arrayphpminversionerror = array(5,4,0); $arrayphpminversionerror = array(5,5,0);
$arrayphpminversionwarning = array(5,4,0); $arrayphpminversionwarning = array(5,5,0);
if (versioncompare(versionphparray(), $arrayphpminversionerror) < 0) // Minimum to use (error if lower) 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)); print '<img src="../theme/eldy/img/error.png" alt="Error"> '.$langs->trans("ErrorPHPVersionTooLow", versiontostring($arrayphpminversionerror));

View File

@ -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 DROP INDEX uk_accounting_account;
ALTER TABLE llx_accounting_account ADD UNIQUE INDEX uk_accounting_account (account_number, entity, fk_pcg_version); 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;

View File

@ -275,3 +275,8 @@ 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_product ADD INDEX idx_product_fk_project (fk_project);
ALTER TABLE llx_actioncomm ADD COLUMN calling_duration integer; ALTER TABLE llx_actioncomm ADD COLUMN calling_duration integer;
ALTER TABLE llx_emailcollector_emailcollector ADD COLUMN datelastok datetime;
DELETE FROM llx_const WHERE name = 'THEME_ELDY_USE_HOVER' AND value = '0';
DELETE FROM llx_const WHERE name = 'THEME_ELDY_USE_CHECKED' AND value = '0';

View File

@ -29,6 +29,7 @@ CREATE TABLE llx_emailcollector_emailcollector(
datelastresult datetime, datelastresult datetime,
codelastresult varchar(16), codelastresult varchar(16),
lastresult varchar(255), lastresult varchar(255),
datelastok datetime,
note_public text, note_public text,
note_private text, note_private text,
date_creation datetime NOT NULL, date_creation datetime NOT NULL,

View File

@ -956,7 +956,7 @@ function write_conf_file($conffile)
fputs($fp, '$dolibarr_nocsrfcheck=\'0\';'); fputs($fp, '$dolibarr_nocsrfcheck=\'0\';');
fputs($fp, "\n"); fputs($fp, "\n");
fputs($fp, '$dolibarr_main_cookie_cryptkey=\''.$key.'\';'); fputs($fp, '$dolibarr_main_instance_unique_id=\''.$key.'\';');
fputs($fp, "\n"); fputs($fp, "\n");
fputs($fp, '$dolibarr_mailing_limit_sendbyweb=\'0\';'); fputs($fp, '$dolibarr_mailing_limit_sendbyweb=\'0\';');

View File

@ -233,7 +233,7 @@ Limit=Limit
Limits=Limits Limits=Limits
Logout=Abmelden Logout=Abmelden
NoLogoutProcessWithAuthMode=Keine Anwendung Trennungsfunktion mit Authentifizierungsmodus <b>% s </ b> NoLogoutProcessWithAuthMode=Keine Anwendung Trennungsfunktion mit Authentifizierungsmodus <b>% s </ b>
Connection=Benutzername Connection=Anmelden
Setup=Einstellungen Setup=Einstellungen
Alert=Warnung Alert=Warnung
MenuWarnings=Benachrichtigungen MenuWarnings=Benachrichtigungen

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