Merge branch 'develop' of github.com:Dolibarr/dolibarr into dev_add_OrderNotificationTriggers
This commit is contained in:
commit
c101acb3ce
17
ChangeLog
17
ChangeLog
@ -12,7 +12,7 @@ NEW: Minimal PHP version is now PHP 7.0 instead of PHP 5.6
|
||||
NEW: #21780 Add pid field to Cronjob class and store PID on job execution
|
||||
NEW: #19680 Add option PRODUCT_ALLOW_EXTERNAL_DOWNLOAD to automatically have uploaded files shared publicly by a link
|
||||
NEW: #20650 can move the checkbox column on left (experimental option)
|
||||
NEW: #21000 Added columns 'alias_name' on poject, supplier invoice, supplier order, supplier proposals and taks list
|
||||
NEW: #21000 Added columns 'alias_name' on project, supplier invoice, supplier order, supplier proposals and task list
|
||||
NEW: #21395 Added option for dark theme mode in display - color and theme
|
||||
NEW: #21397 added option to auto define barcode numbers for third-parties in barcode module setup
|
||||
NEW: #21399
|
||||
@ -22,11 +22,11 @@ NEW: #22048 Added notes to productlot module
|
||||
NEW: #22298 Bank - Add salaries & vat in the tab of planned entries of a bank account
|
||||
NEW: #22328
|
||||
NEW: #22424
|
||||
NEW: #22500 member module set up made easier
|
||||
NEW: #22500 member module set up made easier
|
||||
NEW: #22527 projects and thirdparties can be viewed as conversation ("Message" view), like events/agenda.
|
||||
NEW: #22546 can now set user supervisors using mass action in htdocs/user
|
||||
NEW: #22594 can chose if VAT ID is unique or not for third parties
|
||||
NEW: #22622 all partneships displayed on tab partnership of a thirdparty and member
|
||||
NEW: #22622 all partnerships displayed on tab partnership of a thirdparty and member
|
||||
NEW: #22676 massaction for updating product prices
|
||||
NEW: #22735 Massaction to affect users on projects
|
||||
NEW: #25594 can chose if VAT ID is unique or not for third parties
|
||||
@ -66,7 +66,7 @@ NEW: Add option FICHINTER_ALLOW_EXTERNAL_DOWNLOAD
|
||||
NEW: Add option --force on CLI cron_run_jobs.php
|
||||
NEW: Add option "Show price on the generated documents for receptions"
|
||||
NEW: Add performance index (name for company and contact) and llx_bank_url(url_id)
|
||||
NEW: Add picto property on sub-module for paswword generation
|
||||
NEW: Add picto property on sub-module for password generation
|
||||
NEW: Add price to product box in TakePOS
|
||||
NEW: add redirect on action confirm addconsumedline and addproduceline
|
||||
NEW: Add a new advanced permission "read price"
|
||||
@ -85,7 +85,7 @@ NEW: Can enter the unit price including the vat
|
||||
NEW: Can invoice task time per different services
|
||||
NEW: Can join several files by default on email form
|
||||
NEW: Can send an email on scheduled job error
|
||||
NEW: Can set a commercial discount by entereing amount including VAT
|
||||
NEW: Can set a commercial discount by entering amount including VAT
|
||||
NEW: Can set a monthly frequency (or multiple) in cron tasks.
|
||||
NEW: Can set start and end dates and comment on button "Activate all services"
|
||||
NEW: can sort and preselected best supplier price
|
||||
@ -133,7 +133,7 @@ NEW: Option PRODUIT_DESC_IN_FORM accept (desktop only or +smartphone)
|
||||
NEW: Page for mass stock transfer can be used with no source stock
|
||||
NEW: parent company column and filter in invoice and order list
|
||||
NEW: Add show "Sales rep" option for PDF
|
||||
NEW: Picto for shared link is clicable
|
||||
NEW: Picto for shared link is clickable
|
||||
NEW: possibility to select scopes with checkbox for Oauth tokens
|
||||
NEW: private and public note on user, thirdparty and contact list
|
||||
NEW: product categories filter on inventory list
|
||||
@ -147,7 +147,7 @@ NEW: Saved token of OAUTH module are now encrypted into llx_oauth_token
|
||||
NEW: Save one click to select on delivery ack, on emails.
|
||||
NEW: scheduled job to send unpaid invoice reminder can now use the cc and bcc from email template
|
||||
NEW: set thirdparty type with company modify trigger
|
||||
NEW: Show also shceduled task never finished in scheduled task widget
|
||||
NEW: Show also scheduled task never finished in scheduled task widget
|
||||
NEW: show badge with number of extrafields in setup
|
||||
NEW: show category tree in sellist and chkbxlst for common object
|
||||
NEW: Show picto and color into combo for selection of tags
|
||||
@ -165,7 +165,10 @@ NEW: Update ActionComm type_code on email message ticket
|
||||
NEW: VAT - Admin - Add information on deadline day for submission of VAT declaration
|
||||
NEW: expand/collapse permissions on user permission page
|
||||
NEW: Show delivery mode on PDF for proposals
|
||||
NEW: Add the target to select attendees of event for emailings
|
||||
|
||||
Modules
|
||||
NEW: Experimental module Asset
|
||||
|
||||
For developers or integrators:
|
||||
------------------------------
|
||||
|
||||
@ -1,2 +0,0 @@
|
||||
htdocs/install/doctemplates/websites/website_template-corporate.zip
|
||||
htdocs/install/doctemplates/websites/website_template-stellar.zip
|
||||
3
build/debian/source/options
Normal file
3
build/debian/source/options
Normal file
@ -0,0 +1,3 @@
|
||||
# Use bzip2 instead of gzip
|
||||
compression = "bzip2"
|
||||
compression-level = 9
|
||||
@ -55,14 +55,24 @@ if (empty($argv[1])) {
|
||||
|
||||
|
||||
$i=0;
|
||||
$result=array();
|
||||
while ($i < $argc) {
|
||||
if (!empty($argv[$i])) {
|
||||
parse_str($argv[$i]); // set all params $release, $includecustom, $includeconstant, $buildzip ...
|
||||
parse_str($argv[$i], $result); // set all params $release, $includecustom, $includeconstant, $buildzip ...
|
||||
}
|
||||
if (preg_match('/includeconstant=/', $argv[$i])) {
|
||||
$tmp=explode(':', $includeconstant, 3); // $includeconstant has been set with previous parse_str()
|
||||
if (!empty($result["release"])) {
|
||||
$release = $result["release"];
|
||||
}
|
||||
if (!empty($result["includecustom"])) {
|
||||
$includecustom = $result["includecustom"];
|
||||
}
|
||||
if (!empty($result["includeconstant"])) {
|
||||
$includeconstants[$i] = $result["includeconstant"];
|
||||
}
|
||||
if (preg_match('/includeconstant=/', strval($argv[$i]))) {
|
||||
$tmp=explode(':', $result['includeconstant'], 3); // $includeconstant has been set with previous parse_str()
|
||||
if (count($tmp) != 3) {
|
||||
print "Error: Bad parameter includeconstant=".$includeconstant."\n";
|
||||
print "Error: Bad parameter includeconstant=".$result['includeconstant'] ."\n";
|
||||
exit -1;
|
||||
}
|
||||
$includeconstants[$tmp[0]][$tmp[1]] = $tmp[2];
|
||||
@ -71,7 +81,7 @@ while ($i < $argc) {
|
||||
}
|
||||
|
||||
if (empty($release)) {
|
||||
print "Error: Missing release paramater\n";
|
||||
print "Error: Missing release parameter\n";
|
||||
print "Usage: ".$script_file." release=autostable|auto[-mybuild]|x.y.z[-mybuild] [includecustom=1] [includeconstant=CC:MY_CONF_NAME:value]\n";
|
||||
exit -1;
|
||||
}
|
||||
|
||||
@ -283,6 +283,9 @@ RESTLER:
|
||||
|
||||
elseif (count($value) && isset($value[0]) && is_numeric($value[0]))
|
||||
|
||||
* Add CommentParser.php line 406 & 407 to remove a warning on api request in php 8.1
|
||||
empty($value[0]) ? null :
|
||||
empty($value[1]) ? null :
|
||||
|
||||
+With swagger 2 provided into /explorer:
|
||||
----------------------------------------
|
||||
|
||||
@ -239,10 +239,17 @@ if ($action != 'export_csv') {
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('addMoreActionsButtonsList', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
|
||||
$button = empty($hookmanager->resPrint) ? '' : $hookmanager->resPrint;
|
||||
|
||||
if (empty($reshook)) {
|
||||
$button = '<input type="button" id="exportcsvbutton" name="exportcsvbutton" class="butAction" value="'.$langs->trans("Export").' ('.$conf->global->ACCOUNTING_EXPORT_FORMAT.')" />';
|
||||
$button .= '<input type="button" id="exportcsvbutton" name="exportcsvbutton" class="butAction" value="'.$langs->trans("Export").' ('.$conf->global->ACCOUNTING_EXPORT_FORMAT.')" />';
|
||||
|
||||
print '<script type="text/javascript">
|
||||
jQuery(document).ready(function() {
|
||||
@ -497,6 +504,10 @@ if ($action != 'export_csv') {
|
||||
print "<td></td>\n";
|
||||
print '</tr>';
|
||||
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print "</table>";
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
@ -944,12 +944,18 @@ if (count($filter)) {
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('addMoreActionsButtonsList', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
|
||||
$newcardbutton = empty($hookmanager->resPrint) ? '' : $hookmanager->resPrint;
|
||||
|
||||
if (empty($reshook)) {
|
||||
// Button re-export
|
||||
if (!empty($conf->global->ACCOUNTING_REEXPORT)) {
|
||||
$newcardbutton = '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=setreexport&token='.newToken().'&value=0'.($param ? '&'.$param : '').'">'.img_picto($langs->trans("Activated"), 'switch_on').'</a> ';
|
||||
$newcardbutton .= '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=setreexport&token='.newToken().'&value=0'.($param ? '&'.$param : '').'">'.img_picto($langs->trans("Activated"), 'switch_on').'</a> ';
|
||||
} else {
|
||||
$newcardbutton = '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=setreexport&token='.newToken().'&value=1'.($param ? '&'.$param : '').'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a> ';
|
||||
$newcardbutton .= '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=setreexport&token='.newToken().'&value=1'.($param ? '&'.$param : '').'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a> ';
|
||||
}
|
||||
$newcardbutton .= '<span class="valignmiddle marginrightonly">'.$langs->trans("IncludeDocsAlreadyExported").'</span>';
|
||||
|
||||
@ -1506,6 +1512,10 @@ while ($i < min($num, $limit)) {
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
|
||||
|
||||
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
@ -1520,4 +1530,5 @@ print '</form>';
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
|
||||
@ -644,6 +644,12 @@ print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('addMoreActionsButtonsList', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
|
||||
$newcardbutton = empty($hookmanager->resPrint) ? '' : $hookmanager->resPrint;
|
||||
|
||||
if (empty($reshook)) {
|
||||
$newcardbutton = dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param);
|
||||
if ($type == 'sub') {
|
||||
@ -1227,6 +1233,10 @@ if ($num > 0 && $colspan > 0) {
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
|
||||
|
||||
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
|
||||
@ -207,31 +207,31 @@ if ($action == 'validatehistory') {
|
||||
while ($i < min($num_lines, 10000)) { // No more than 10000 at once
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$thirdpartystatic->id = $objp->socid;
|
||||
$thirdpartystatic->name = $objp->name;
|
||||
$thirdpartystatic->client = $objp->client;
|
||||
$thirdpartystatic->fournisseur = $objp->fournisseur;
|
||||
$thirdpartystatic->code_client = $objp->code_client;
|
||||
$thirdpartystatic->code_compta_client = $objp->code_compta_client;
|
||||
$thirdpartystatic->code_fournisseur = $objp->code_fournisseur;
|
||||
$thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur;
|
||||
$thirdpartystatic->email = $objp->email;
|
||||
$thirdpartystatic->country_code = $objp->country_code;
|
||||
$thirdpartystatic->tva_intra = $objp->tva_intra;
|
||||
$thirdpartystatic->code_compta_product = $objp->company_code_sell; // The accounting account for product stored on thirdparty object (for level3 suggestion)
|
||||
$thirdpartystatic->id = !empty($objp->socid) ? $objp->socid : 0;
|
||||
$thirdpartystatic->name = !empty($objp->name) ? $objp->name : "";
|
||||
$thirdpartystatic->client = !empty($objp->client) ? $objp->client : "";
|
||||
$thirdpartystatic->fournisseur = !empty($objp->fournisseur) ? $objp->fournisseur : "";
|
||||
$thirdpartystatic->code_client = !empty($objp->code_client) ? $objp->code_client : "";
|
||||
$thirdpartystatic->code_compta_client = !empty($objp->code_compta_client) ? $objp->code_compta_client : "";
|
||||
$thirdpartystatic->code_fournisseur = !empty($objp->code_fournisseur) ? $objp->code_fournisseur : "";
|
||||
$thirdpartystatic->code_compta_fournisseur = !empty($objp->code_compta_fournisseur) ? $objp->code_compta_fournisseur : "";
|
||||
$thirdpartystatic->email = !empty($objp->email) ? $objp->email : "";
|
||||
$thirdpartystatic->country_code = !empty($objp->country_code) ? $objp->country_code : "";
|
||||
$thirdpartystatic->tva_intra = !empty($objp->tva_intra) ? $objp->tva_intra : "";
|
||||
$thirdpartystatic->code_compta_product = !empty($objp->company_code_sell) ? $objp->company_code_sell : ""; // The accounting account for product stored on thirdparty object (for level3 suggestion)
|
||||
|
||||
$product_static->ref = $objp->product_ref;
|
||||
$product_static->id = $objp->product_id;
|
||||
$product_static->type = $objp->type;
|
||||
$product_static->label = $objp->product_label;
|
||||
$product_static->status = $objp->status;
|
||||
$product_static->status_buy = $objp->status_buy;
|
||||
$product_static->status = !empty($objp->status) ? $objp->status : 0;
|
||||
$product_static->status_buy = !empty($objp->status_buy) ? $objp->status_buy : 0;
|
||||
$product_static->accountancy_code_sell = $objp->code_sell;
|
||||
$product_static->accountancy_code_sell_intra = $objp->code_sell_intra;
|
||||
$product_static->accountancy_code_sell_export = $objp->code_sell_export;
|
||||
$product_static->accountancy_code_buy = $objp->code_buy;
|
||||
$product_static->accountancy_code_buy_intra = $objp->code_buy_intra;
|
||||
$product_static->accountancy_code_buy_export = $objp->code_buy_export;
|
||||
$product_static->accountancy_code_buy = !empty($objp->code_buy) ? $objp->code_buy : "";
|
||||
$product_static->accountancy_code_buy_intra = !empty($objp->code_buy_intra) ? $objp->code_buy_intra : "";
|
||||
$product_static->accountancy_code_buy_export = !empty($objp->code_buy_export) ? $objp->code_buy_export : "";
|
||||
$product_static->tva_tx = $objp->tva_tx_prod;
|
||||
|
||||
$facture_static->ref = $objp->ref;
|
||||
|
||||
@ -605,7 +605,7 @@ class Adherent extends CommonObject
|
||||
|
||||
// Insert member
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."adherent";
|
||||
$sql .= " (ref, datec,login,fk_user_author,fk_user_mod,fk_user_valid,morphy,fk_adherent_type,entity,import_key)";
|
||||
$sql .= " (ref, datec,login,fk_user_author,fk_user_mod,fk_user_valid,morphy,fk_adherent_type,entity,import_key, ip)";
|
||||
$sql .= " VALUES (";
|
||||
$sql .= " '(PROV)'";
|
||||
$sql .= ", '".$this->db->idate($this->datec)."'";
|
||||
@ -615,6 +615,7 @@ class Adherent extends CommonObject
|
||||
$sql .= ", ".((int) $this->typeid);
|
||||
$sql .= ", ".$conf->entity;
|
||||
$sql .= ", ".(!empty($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null");
|
||||
$sql .= ", ".(!empty($this->ip) ? "'".$this->db->escape($this->ip)."'" : "null");
|
||||
$sql .= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
@ -740,7 +741,7 @@ class Adherent extends CommonObject
|
||||
$sql .= ", state_id = ".($this->state_id > 0 ? $this->db->escape($this->state_id) : "null");
|
||||
$sql .= ", email = '".$this->db->escape($this->email)."'";
|
||||
$sql .= ", url = ".(!empty($this->url) ? "'".$this->db->escape($this->url)."'" : "null");
|
||||
$sql .= ", socialnetworks = '".$this->db->escape(json_encode($this->socialnetworks))."'";
|
||||
$sql .= ", socialnetworks = ".($this->socialnetworks ? "'".$this->db->escape(json_encode($this->socialnetworks))."'" : "null");
|
||||
$sql .= ", phone = ".($this->phone ? "'".$this->db->escape($this->phone)."'" : "null");
|
||||
$sql .= ", phone_perso = ".($this->phone_perso ? "'".$this->db->escape($this->phone_perso)."'" : "null");
|
||||
$sql .= ", phone_mobile = ".($this->phone_mobile ? "'".$this->db->escape($this->phone_mobile)."'" : "null");
|
||||
@ -2374,7 +2375,7 @@ class Adherent extends CommonObject
|
||||
$labelStatus = $langs->trans("MemberStatusDraft");
|
||||
$labelStatusShort = $langs->trans("MemberStatusDraftShort");
|
||||
} elseif ($status >= self::STATUS_VALIDATED) {
|
||||
if ($need_subscription == 0) {
|
||||
if ($need_subscription === 0) {
|
||||
$statusType = 'status4';
|
||||
$labelStatus = $langs->trans("MemberStatusNoSubscription");
|
||||
$labelStatusShort = $langs->trans("MemberStatusNoSubscriptionShort");
|
||||
@ -2957,17 +2958,18 @@ class Adherent extends CommonObject
|
||||
dol_syslog(__METHOD__.' - Process delta = '.$daysbeforeend, LOG_DEBUG);
|
||||
|
||||
if (!is_numeric($daysbeforeend)) {
|
||||
$blockingerrormsg = "Value for delta is not a positive or negative numeric";
|
||||
$blockingerrormsg = "Value for delta is not a numeric value";
|
||||
$nbko++;
|
||||
break;
|
||||
}
|
||||
|
||||
$tmp = dol_getdate($now);
|
||||
$datetosearchfor = dol_time_plus_duree(dol_mktime(0, 0, 0, $tmp['mon'], $tmp['mday'], $tmp['year']), $daysbeforeend, 'd');
|
||||
$datetosearchfor = dol_time_plus_duree(dol_mktime(0, 0, 0, $tmp['mon'], $tmp['mday'], $tmp['year'], 'tzserver'), $daysbeforeend, 'd');
|
||||
|
||||
$sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'adherent';
|
||||
$sql .= " WHERE entity = ".$conf->entity; // Do not use getEntity('adherent').")" here, we want the batch to be on its entity only;
|
||||
$sql .= " WHERE entity = ".((int) $conf->entity); // Do not use getEntity('adherent').")" here, we want the batch to be on its entity only;
|
||||
$sql .= " AND datefin = '".$this->db->idate($datetosearchfor)."'";
|
||||
//$sql .= " LIMIT 10000";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
@ -3000,7 +3002,7 @@ class Adherent extends CommonObject
|
||||
dol_syslog("sendReminderForExpiredSubscription Language for member id ".$adherent->id." set to ".$outputlangs->defaultlang." mysoc->default_lang=".$mysoc->default_lang);
|
||||
|
||||
$arraydefaultmessage = null;
|
||||
$labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_REMIND_EXPIRATION;
|
||||
$labeltouse = getDolGlobalString('ADHERENT_EMAIL_TEMPLATE_REMIND_EXPIRATION');
|
||||
|
||||
if (!empty($labeltouse)) {
|
||||
$arraydefaultmessage = $formmail->getEMailTemplate($this->db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
|
||||
@ -3024,7 +3026,7 @@ class Adherent extends CommonObject
|
||||
$result = $cmail->sendfile();
|
||||
if (!$result) {
|
||||
$error++;
|
||||
$this->error = $cmail->error;
|
||||
$this->error .= $cmail->error.' ';
|
||||
if (!is_null($cmail->errors)) {
|
||||
$this->errors += $cmail->errors;
|
||||
}
|
||||
@ -3042,8 +3044,7 @@ class Adherent extends CommonObject
|
||||
$extraparams = '';
|
||||
|
||||
$actionmsg = '';
|
||||
$actionmsg2 = $langs->transnoentities('MailSentBy').' '.CMailFile::getValidAddress($from, 4, 0, 1).' '.$langs->transnoentities('To').' '.
|
||||
CMailFile::getValidAddress($sendto, 4, 0, 1);
|
||||
$actionmsg2 = $langs->transnoentities('MailSentBy').' '.CMailFile::getValidAddress($from, 4, 0, 1).' '.$langs->transnoentities('To').' '.CMailFile::getValidAddress($sendto, 4, 0, 1);
|
||||
if ($message) {
|
||||
$actionmsg = $langs->transnoentities('MailFrom').': '.dol_escape_htmltag($from);
|
||||
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTo').': '.dol_escape_htmltag($sendto));
|
||||
@ -3090,7 +3091,10 @@ class Adherent extends CommonObject
|
||||
$actioncomm->create($user);
|
||||
}
|
||||
} else {
|
||||
$blockingerrormsg = "Can't find email template, defined into member module setup, to use for reminding";
|
||||
//$blockingerrormsg = "Can't find email template with label=".$labeltouse.", to use for the reminding email";
|
||||
|
||||
$error++;
|
||||
$this->error .= "Can't find email template with label=".$labeltouse.", to use for the reminding email ";
|
||||
|
||||
$nbko++;
|
||||
$listofmembersko[$adherent->id] = $adherent->id;
|
||||
@ -3132,7 +3136,8 @@ class Adherent extends CommonObject
|
||||
if ($listofids) {
|
||||
$listofids .= ']';
|
||||
}
|
||||
$this->output .= $listofids;
|
||||
|
||||
$this->output .= ($listofids ? ' ids='.$listofids : '');
|
||||
}
|
||||
if ($nbko) {
|
||||
$this->output .= ' - Canceled for '.$nbko.' member (no email or email sending error)';
|
||||
@ -3155,11 +3160,11 @@ class Adherent extends CommonObject
|
||||
if ($listofids) {
|
||||
$listofids .= ']';
|
||||
}
|
||||
$this->output .= $listofids;
|
||||
$this->output .= ($listofids ? ' ids='.$listofids : '');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return $nbko;
|
||||
}
|
||||
}
|
||||
|
||||
@ -383,14 +383,18 @@ class Members extends DolibarrApi
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
if (!$member->delete($member->id, DolibarrApiAccess::$user)) {
|
||||
throw new RestException(401, 'error when deleting member');
|
||||
|
||||
$res = $member->delete($member->id, DolibarrApiAccess::$user);
|
||||
if ($res < 0) {
|
||||
throw new RestException(500, "Can't delete, error occurs");
|
||||
} elseif ($res == 0) {
|
||||
throw new RestException(409, "Can't delete, that product is probably used");
|
||||
}
|
||||
|
||||
return array(
|
||||
'success' => array(
|
||||
'code' => 200,
|
||||
'message' => 'member deleted'
|
||||
'message' => 'Member deleted'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@ -229,14 +229,17 @@ class MembersTypes extends DolibarrApi
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
if (!$membertype->delete()) {
|
||||
throw new RestException(401, 'error when deleting member type');
|
||||
$res = $membertype->delete();
|
||||
if ($res < 0) {
|
||||
throw new RestException(500, "Can't delete, error occurs");
|
||||
} elseif ($res == 0) {
|
||||
throw new RestException(409, "Can't delete, that product is probably used");
|
||||
}
|
||||
|
||||
return array(
|
||||
'success' => array(
|
||||
'code' => 200,
|
||||
'message' => 'member type deleted'
|
||||
'message' => 'Member type deleted'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@ -215,14 +215,17 @@ class Subscriptions extends DolibarrApi
|
||||
throw new RestException(404, 'Subscription not found');
|
||||
}
|
||||
|
||||
if (!$subscription->delete(DolibarrApiAccess::$user)) {
|
||||
throw new RestException(401, 'error when deleting subscription');
|
||||
$res = $subscription->delete(DolibarrApiAccess::$user);
|
||||
if ($res < 0) {
|
||||
throw new RestException(500, "Can't delete, error occurs");
|
||||
} elseif ($res == 0) {
|
||||
throw new RestException(409, "Can't delete, that product is probably used");
|
||||
}
|
||||
|
||||
return array(
|
||||
'success' => array(
|
||||
'code' => 200,
|
||||
'message' => 'subscription deleted'
|
||||
'message' => 'Subscription deleted'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@ -346,6 +346,9 @@ $parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
|
||||
$sql = preg_replace('/,\s*$/', '', $sql);
|
||||
|
||||
$sqlfields = $sql; // $sql fields to remove for count total
|
||||
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d";
|
||||
if (!empty($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (d.rowid = ef.fk_object)";
|
||||
@ -480,9 +483,13 @@ $sql .= $hookmanager->resPrint;
|
||||
// Count total nb of records with no order and no limits
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
$resql = $db->query($sql);
|
||||
/* The fast and low memory method to get and count full list converts the sql into a sql count */
|
||||
$sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
|
||||
$sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
|
||||
$resql = $db->query($sqlforcount);
|
||||
if ($resql) {
|
||||
$nbtotalofrecords = $db->num_rows($resql);
|
||||
$objforcount = $db->fetch_object($resql);
|
||||
$nbtotalofrecords = $objforcount->nbtotalofrecords;
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
||||
* Copyright (C) 2012-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com>
|
||||
* Copyright (C) 2022 Anthony Berton <anthony.berton@bb2a.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -754,7 +755,7 @@ print '<input type="hidden" name="action" value="setforcedate" />';
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("ForceInvoiceDate");
|
||||
print '</td><td width="60" class="center">';
|
||||
print $form->selectyesno("forcedate", $conf->global->FAC_FORCE_DATE_VALIDATION, 1);
|
||||
print $form->selectyesno("forcedate", getDolGlobalInt('FAC_FORCE_DATE_VALIDATION', 0), 1);
|
||||
print '</td><td class="right">';
|
||||
print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'" />';
|
||||
print "</td></tr>\n";
|
||||
|
||||
@ -100,7 +100,7 @@ foreach ($modules as $const => $desc) {
|
||||
exit;
|
||||
}
|
||||
if ($action == 'disable_'.strtolower($const)) {
|
||||
dolibarr_del_const($db, "FCKEDITOR_ENABLE_".$const, $conf->entity);
|
||||
dolibarr_set_const($db, "FCKEDITOR_ENABLE_".$const, "0", 'chaine', 0, '', $conf->entity);
|
||||
header("Location: ".$_SERVER["PHP_SELF"]);
|
||||
exit;
|
||||
}
|
||||
@ -172,7 +172,7 @@ if (empty($conf->use_javascript_ajax)) {
|
||||
print '<br><span class="warning">'.$langs->trans("FCKeditorForProductDetails2").'</span>';
|
||||
}
|
||||
print '</td>';
|
||||
print '<td class="center" width="100">';
|
||||
print '<td class="center centpercent">';
|
||||
$value = (isset($conf->global->$constante) ? $conf->global->$constante : 0);
|
||||
if ($value == 0) {
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=enable_'.strtolower($const).'&token='.newToken().'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
|
||||
|
||||
@ -123,32 +123,35 @@ print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Parameter").'</td>';
|
||||
print '<td>'.$langs->trans("Value").'</td>';
|
||||
print '<td>'.$langs->trans("Example").'</td>';
|
||||
print '<td class="hideonsmartphone">'.$langs->trans("Example").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
$help = img_help(1, $langs->trans("EMailHelpMsgSPFDKIM"));
|
||||
print $langs->trans("MailingEMailFrom").' '.$help.'</td><td>';
|
||||
print '<input size="32" type="text" name="MAILING_EMAIL_FROM" value="'.$conf->global->MAILING_EMAIL_FROM.'">';
|
||||
print '<input class="minwidth100" type="text" name="MAILING_EMAIL_FROM" value="'.$conf->global->MAILING_EMAIL_FROM.'">';
|
||||
if (!empty($conf->global->MAILING_EMAIL_FROM) && !isValidEmail($conf->global->MAILING_EMAIL_FROM)) {
|
||||
print ' '.img_warning($langs->trans("BadEMail"));
|
||||
}
|
||||
print '</td><td><span class="opacitymedium">'.dol_escape_htmltag(($mysoc->name ? $mysoc->name : 'MyName').' <noreply@example.com>').'</span></td>';
|
||||
print '</td>';
|
||||
print '<td class="hideonsmartphone"><span class="opacitymedium">'.dol_escape_htmltag(($mysoc->name ? $mysoc->name : 'MyName').' <noreply@example.com>').'</span></td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("MailingEMailError").'</td><td>';
|
||||
print '<input size="32" type="text" name="MAILING_EMAIL_ERRORSTO" value="'.$conf->global->MAILING_EMAIL_ERRORSTO.'">';
|
||||
print '<input class="minwidth100" type="text" name="MAILING_EMAIL_ERRORSTO" value="'.$conf->global->MAILING_EMAIL_ERRORSTO.'">';
|
||||
if (!empty($conf->global->MAILING_EMAIL_ERRORSTO) && !isValidEmail($conf->global->MAILING_EMAIL_ERRORSTO)) {
|
||||
print ' '.img_warning($langs->trans("BadEMail"));
|
||||
}
|
||||
print '</td><td><span class="opacitymedium">webmaster@example.com></span></td>';
|
||||
print '</td>';
|
||||
print '<td class="hideonsmartphone"><span class="opacitymedium">webmaster@example.com></span></td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("MailingDelay").'</td><td>';
|
||||
print '<input class="width75" type="text" name="MAILING_DELAY" value="'.$conf->global->MAILING_DELAY.'">';
|
||||
print '</td><td></td>';
|
||||
print '</td>';
|
||||
print '<td class="hideonsmartphone"></td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
@ -157,11 +160,12 @@ print '</tr>';
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("ActivateCheckReadKey").'</td><td>';
|
||||
print '<input size="32" type="text" name="MAILING_EMAIL_UNSUBSCRIBE_KEY" id="MAILING_EMAIL_UNSUBSCRIBE_KEY" value="'.$conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY.'">';
|
||||
print '<input class="minwidth100 maxwdith250 widthcentpercentminusx" type="text" name="MAILING_EMAIL_UNSUBSCRIBE_KEY" id="MAILING_EMAIL_UNSUBSCRIBE_KEY" value="'.$conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY.'">';
|
||||
if (!empty($conf->use_javascript_ajax)) {
|
||||
print ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token" class="linkobject"');
|
||||
}
|
||||
print '</td><td></td>';
|
||||
print '</td>';
|
||||
print '<td class="hideonsmartphone"></td>';
|
||||
print '</tr>';
|
||||
|
||||
// default blacklist from mailing
|
||||
@ -171,7 +175,7 @@ print '<td>';
|
||||
$blacklist_setting=array(0=>$langs->trans('No'), 1=>$langs->trans('Yes'), 2=>$langs->trans('DefaultStatusEmptyMandatory'));
|
||||
print $form->selectarray("MAILING_CONTACT_DEFAULT_BULK_STATUS", $blacklist_setting, $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS);
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
print '<td class="hideonsmartphone"></td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
@ -179,7 +183,8 @@ if (!empty($conf->use_javascript_ajax) && $conf->global->MAIN_FEATURES_LEVEL >=
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("MailAdvTargetRecipients").'</td><td>';
|
||||
print ajax_constantonoff('EMAILING_USE_ADVANCED_SELECTOR');
|
||||
print '</td><td></td>';
|
||||
print '</td>';
|
||||
print '<td class="hideonsmartphone"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
|
||||
@ -174,7 +174,6 @@ if ($action == 'update') {
|
||||
if (GETPOSTISSET('PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME')) {
|
||||
dolibarr_set_const($db, "PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME", GETPOST('PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
|
||||
if (GETPOSTISSET('PDF_USE_A')) {
|
||||
dolibarr_set_const($db, "PDF_USE_A", GETPOST('PDF_USE_A', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
@ -400,6 +399,13 @@ if ($conf->use_javascript_ajax) {
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Show alias in thirdparty name
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME").'</td><td>';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("THIRDPARTY_ALIAS"), '2' => $langs->trans("ALIAS_THIRDPARTY"));
|
||||
print $form->selectarray("PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME", $arrval, getDolGlobalInt('PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME'));
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
@ -584,16 +590,6 @@ if ($conf->use_javascript_ajax) {
|
||||
print $form->selectarray("DOC_SHOW_FIRST_SALES_REP", $arrval, $conf->global->DOC_SHOW_FIRST_SALES_REP);
|
||||
}
|
||||
|
||||
// Show alias in thirdparty name
|
||||
|
||||
/* Disabled because not yet completely implemented (does not work when we force a contact on object)
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME").'</td><td>';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("THIRDPARTY_ALIAS"), '2' => $langs->trans("ALIAS_THIRDPARTY"));
|
||||
print $form->selectarray("PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME", $arrval, getDolGlobalInt('PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME'));
|
||||
}
|
||||
*/
|
||||
|
||||
// Show online payment link on invoices
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("PDF_SHOW_LINK_TO_ONLINE_PAYMENT").'</td><td>';
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2012-2107 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2019 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2021 Anthony Berton <bertonanthony@gmail.com>
|
||||
* Copyright (C) 2021-2022 Anthony Berton <bertonanthony@gmail.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
|
||||
@ -69,6 +69,10 @@ if ($action == 'update') {
|
||||
dolibarr_set_const($db, "INVOICE_ADD_SWISS_QR_CODE", GETPOST("INVOICE_ADD_SWISS_QR_CODE", 'int'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_del_const($db, "INVOICE_ADD_ZATCA_QR_CODE", $conf->entity);
|
||||
}
|
||||
if (GETPOSTISSET('INVOICE_SHOW_SHIPPING_ADDRESS')) {
|
||||
dolibarr_set_const($db, "INVOICE_SHOW_SHIPPING_ADDRESS", GETPOST("INVOICE_SHOW_SHIPPING_ADDRESS", 'int'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_del_const($db, "INVOICE_SHOW_SHIPPING_ADDRESS", $conf->entity);
|
||||
}
|
||||
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
|
||||
@ -155,16 +159,16 @@ if (isModEnabled('facture')) {
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
/*
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING").'</td><td>';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING');
|
||||
} else {
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $form->textwithpicto($langs->trans("INVOICE_SHOW_SHIPPING_ADDRESS"), $langs->trans("INVOICE_SHOW_SHIPPING_ADDRESSMore"));
|
||||
print '</td><td>';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('INVOICE_SHOW_SHIPPING_ADDRESS');
|
||||
} else {
|
||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||
print $form->selectarray("MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING", $arrval, $conf->global->MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING);
|
||||
}
|
||||
print '</td></tr>';
|
||||
*/
|
||||
print $form->selectarray("INVOICE_SHOW_SHIPPING_ADDRESS", $arrval, $conf->global->INVOICE_SHOW_SHIPPING_ADDRESS);
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
@ -62,7 +62,7 @@ if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) {
|
||||
dol_print_error($db);
|
||||
}
|
||||
} elseif ($action == 'updateform') {
|
||||
$res1 = 1; $res2 = 1; $res3 = 1; $res4 = 1;
|
||||
$res1 = 1; $res2 = 1; $res3 = 1; $res4 = 1; $res5 = 1;
|
||||
if (GETPOSTISSET('MAIN_APPLICATION_TITLE')) {
|
||||
$res1 = dolibarr_set_const($db, "MAIN_APPLICATION_TITLE", GETPOST("MAIN_APPLICATION_TITLE", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
@ -75,7 +75,10 @@ if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) {
|
||||
if (GETPOSTISSET('MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS')) {
|
||||
$res4 = dolibarr_set_const($db, "MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS", GETPOST("MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS", 'alphanohtml'), 'int', 0, '', $conf->entity);
|
||||
}
|
||||
if ($res1 && $res2 && $res3 && $res4) {
|
||||
if (GETPOSTISSET('MAIN_SECURITY_MAX_ATTACHMENT_ON_FORMS')) {
|
||||
$res5 = dolibarr_set_const($db, "MAIN_SECURITY_MAX_ATTACHMENT_ON_FORMS", GETPOST("MAIN_SECURITY_MAX_ATTACHMENT_ON_FORMS", 'alphanohtml'), 'int', 0, '', $conf->entity);
|
||||
}
|
||||
if ($res1 && $res2 && $res3 && $res4 && $res5) {
|
||||
setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
|
||||
}
|
||||
}
|
||||
@ -177,7 +180,7 @@ if (ini_get("session.gc_probability") == 0) {
|
||||
}
|
||||
print '</td>';
|
||||
print '<td class="nowrap">';
|
||||
print '<input class="flat right width50" name="MAIN_SESSION_TIMEOUT" type="text" value="'.dol_escape_htmltag($conf->global->MAIN_SESSION_TIMEOUT).'"> '.strtolower($langs->trans("Seconds"));
|
||||
print '<input class="flat right width50" name="MAIN_SESSION_TIMEOUT" type="text" value="'.getDolGlobalInt('MAIN_SESSION_TIMEOUT').'"> '.strtolower($langs->trans("Seconds"));
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -185,7 +188,7 @@ print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("MaxNumberOfImagesInGetPost").'</td><td class="right">';
|
||||
print '</td>';
|
||||
print '<td class="nowrap">';
|
||||
print '<input class="flat right width50" name="MAIN_SECURITY_MAX_IMG_IN_HTML_CONTENT" type="text" value="'.dol_escape_htmltag($conf->global->MAIN_SECURITY_MAX_IMG_IN_HTML_CONTENT).'"> '.strtolower($langs->trans("Images"));
|
||||
print '<input class="flat right width50" name="MAIN_SECURITY_MAX_IMG_IN_HTML_CONTENT" type="text" value="'.getDolGlobalInt('MAIN_SECURITY_MAX_IMG_IN_HTML_CONTENT').'"> '.strtolower($langs->trans("Images"));
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -193,7 +196,15 @@ print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("MaxNumberOfPostOnPublicPagesByIP").'</td><td class="right">';
|
||||
print '</td>';
|
||||
print '<td class="nowrap">';
|
||||
print '<input class="flat right width50" name="MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS" type="text" value="'.getDolGlobalInt("MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS", 1000).'">';
|
||||
print '<input class="flat right width50" name="MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS" type="text" value="'.getDolGlobalInt("MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS", 200).'"> '.strtolower($langs->trans("Posts"));
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("MaxNumberOfAttachementOnForms").'</td><td class="right">';
|
||||
print '</td>';
|
||||
print '<td class="nowrap">';
|
||||
print '<input class="flat right width50" name="MAIN_SECURITY_MAX_ATTACHMENT_ON_FORMS" type="text" value="'.getDolGlobalInt("MAIN_SECURITY_MAX_ATTACHMENT_ON_FORMS", 10).'"> '.strtolower($langs->trans("Files"));
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
@ -312,6 +312,32 @@ print yn(empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA) ? 0 : 1);
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
|
||||
$sessiontimeout = ini_get("session.gc_maxlifetime");
|
||||
if (empty($conf->global->MAIN_SESSION_TIMEOUT)) {
|
||||
$conf->global->MAIN_SESSION_TIMEOUT = $sessiontimeout;
|
||||
}
|
||||
print '<strong>'.$langs->trans("SessionTimeOut").'</strong>';
|
||||
if (ini_get("session.gc_probability") == 0) {
|
||||
print $form->textwithpicto('', $langs->trans("SessionsPurgedByExternalSystem", ini_get("session.gc_maxlifetime")));
|
||||
} else {
|
||||
print $form->textwithpicto('', $langs->trans("SessionExplanation", ini_get("session.gc_probability"), ini_get("session.gc_divisor"), ini_get("session.gc_maxlifetime")));
|
||||
}
|
||||
print ': '.getDolGlobalInt('MAIN_SESSION_TIMEOUT').' '.strtolower($langs->trans("Seconds"));
|
||||
print '<br><br>';
|
||||
|
||||
print '<strong>'.$langs->trans("MaxNumberOfImagesInGetPost").'</strong>: ';
|
||||
print getDolGlobalInt('MAIN_SECURITY_MAX_IMG_IN_HTML_CONTENT').' '.strtolower($langs->trans("Images"));
|
||||
print '<br><br>';
|
||||
|
||||
print '<strong>'.$langs->trans("MaxNumberOfPostOnPublicPagesByIP").'</strong>: ';
|
||||
print getDolGlobalInt('MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS', 200).' '.strtolower($langs->trans("Posts"));
|
||||
print '<br><br>';
|
||||
|
||||
print '<strong>'.$langs->trans("MaxNumberOfAttachementOnForms").'</strong>: ';
|
||||
print getDolGlobalInt("MAIN_SECURITY_MAX_ATTACHMENT_ON_FORMS", 10).' '.strtolower($langs->trans("Files"));
|
||||
print '<br><br>';
|
||||
|
||||
print '<strong>'.$langs->trans("DoNotStoreClearPassword").'</strong>: ';
|
||||
print empty($conf->global->DATABASE_PWD_ENCRYPTED) ? '' : img_picto('', 'tick').' ';
|
||||
print yn(empty($conf->global->DATABASE_PWD_ENCRYPTED) ? 0 : 1);
|
||||
|
||||
@ -148,7 +148,7 @@ print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("RESTRICT_ON_IP");
|
||||
print ' '.$langs->trans("Example").': '.$langs->trans("IPListExample");
|
||||
print '</td>';
|
||||
print '<td><input type="text" name="API_RESTRICT_ON_IP" value="'.dol_escape_htmltag($conf->global->API_RESTRICT_ON_IP).'"></td>';
|
||||
print '<td><input type="text" name="API_RESTRICT_ON_IP" value="'.dol_escape_htmltag(getDolGlobalString('API_RESTRICT_ON_IP')).'"></td>';
|
||||
print '<td>';
|
||||
print '<input type="submit" class="button button-save" name="save" value="'.dol_escape_htmltag($langs->trans("Save")).'"></td>';
|
||||
print '</td>';
|
||||
|
||||
@ -506,6 +506,9 @@ class Documents extends DolibarrApi
|
||||
throw new RestException(500, 'Modulepart '.$modulepart.' not implemented yet.');
|
||||
}
|
||||
|
||||
$objectType = $modulepart;
|
||||
if (! empty($object->id) && ! empty($object->table_element)) $objectType = $object->table_element;
|
||||
|
||||
$filearray = dol_dir_list($upload_dir, $type, $recursive, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
|
||||
if (empty($filearray)) {
|
||||
throw new RestException(404, 'Search for modulepart '.$modulepart.' with Id '.$object->id.(!empty($object->ref) ? ' or Ref '.$object->ref : '').' does not return any document.');
|
||||
@ -513,11 +516,14 @@ class Documents extends DolibarrApi
|
||||
if (($object->id) > 0 && !empty($modulepart)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php';
|
||||
$ecmfile = new EcmFiles($this->db);
|
||||
$result = $ecmfile->fetchAll('', '', 0, 0, array('t.src_object_type' => $modulepart, 't.src_object_id' => $object->id));
|
||||
$result = $ecmfile->fetchAll('', '', 0, 0, array('t.src_object_type' => $objectType, 't.src_object_id' => $object->id));
|
||||
if ($result < 0) {
|
||||
throw new RestException(503, 'Error when retrieve ecm list : '.$this->db->lasterror());
|
||||
} elseif (is_array($ecmfile->lines) && count($ecmfile->lines) > 0) {
|
||||
$filearray['ecmfiles_infos'] = $ecmfile->lines;
|
||||
$count = count($filearray);
|
||||
for ($i = 0 ; $i < $count ; $i++) {
|
||||
if ($filearray[$i]['name'] == $ecmfile->lines[$i]->filename) $filearray[$i] = array_merge($filearray[$i], (array) $ecmfile->lines[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -407,6 +407,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
|
||||
print '</div><div class="fichehalfright">';
|
||||
|
||||
$morehtmlcenter = '';
|
||||
$MAXEVENT = 10;
|
||||
|
||||
$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/asset/agenda.php?id='.$object->id);
|
||||
@ -414,7 +415,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
// List of actions on element
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
|
||||
$formactions = new FormActions($db);
|
||||
$somethingshown = $formactions->showactions($object, $object->element, 0, 1, '', $MAXEVENT, '', $morehtmlright);
|
||||
$somethingshown = $formactions->showactions($object, $object->element, 0, 1, '', $MAXEVENT, '', $morehtmlcenter);
|
||||
|
||||
print '</div></div>';
|
||||
}
|
||||
|
||||
@ -652,6 +652,8 @@ class Asset extends CommonObject
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Old request with 'WITH'
|
||||
/*
|
||||
$sql = "WITH in_accounting_bookkeeping(fk_docdet) AS (";
|
||||
$sql .= " SELECT DISTINCT fk_docdet";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping";
|
||||
@ -663,6 +665,14 @@ class Asset extends CommonObject
|
||||
$sql .= " LEFT JOIN in_accounting_bookkeeping as iab ON iab.fk_docdet = ad.rowid";
|
||||
$sql .= " WHERE ad.fk_asset = " . (int) $this->id;
|
||||
$sql .= " ORDER BY ad.depreciation_date ASC";
|
||||
*/
|
||||
|
||||
$sql = "SELECT ad.rowid, ad.depreciation_mode, ad.ref, ad.depreciation_date, ad.depreciation_ht, ad.cumulative_depreciation_ht";
|
||||
$sql .= ", " . $this->db->ifsql('iab.fk_docdet IS NOT NULL', 1, 0) . " AS bookkeeping";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "asset_depreciation AS ad";
|
||||
$sql .= " LEFT JOIN (SELECT DISTINCT fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE doc_type = 'asset') AS iab ON iab.fk_docdet = ad.rowid";
|
||||
$sql .= " WHERE ad.fk_asset = " . (int) $this->id;
|
||||
$sql .= " ORDER BY ad.depreciation_date ASC";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
@ -708,6 +718,8 @@ class Asset extends CommonObject
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Old request with 'WITH'
|
||||
/*
|
||||
$sql = "WITH in_accounting_bookkeeping(fk_docdet) AS (";
|
||||
$sql .= " SELECT DISTINCT fk_docdet";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping";
|
||||
@ -718,6 +730,13 @@ class Asset extends CommonObject
|
||||
$sql .= " LEFT JOIN in_accounting_bookkeeping as iab ON iab.fk_docdet = ad.rowid";
|
||||
$sql .= " WHERE ad.fk_asset = " . (int) $this->id;
|
||||
$sql .= " AND iab.fk_docdet IS NOT NULL";
|
||||
*/
|
||||
|
||||
$sql = "SELECT COUNT(*) AS has_bookkeeping";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "asset_depreciation AS ad";
|
||||
$sql .= " LEFT JOIN (SELECT DISTINCT fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE doc_type = 'asset') AS iab ON iab.fk_docdet = ad.rowid";
|
||||
$sql .= " WHERE ad.fk_asset = " . (int) $this->id;
|
||||
$sql .= " AND iab.fk_docdet IS NOT NULL";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
@ -866,6 +885,9 @@ class Asset extends CommonObject
|
||||
foreach ($options->deprecation_options as $mode_key => $fields) {
|
||||
// Get last depreciation lines save in bookkeeping
|
||||
//-----------------------------------------------------
|
||||
|
||||
// Old request with 'WITH'
|
||||
/*
|
||||
$sql = "WITH in_accounting_bookkeeping(fk_docdet) AS (";
|
||||
$sql .= " SELECT fk_docdet";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping";
|
||||
@ -879,6 +901,17 @@ class Asset extends CommonObject
|
||||
$sql .= " AND iab.fk_docdet IS NOT NULL";
|
||||
$sql .= " ORDER BY ad.depreciation_date DESC";
|
||||
$sql .= " LIMIT 1";
|
||||
*/
|
||||
|
||||
$sql = "SELECT ad.depreciation_date, ad.cumulative_depreciation_ht";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "asset_depreciation AS ad";
|
||||
$sql .= " LEFT JOIN (SELECT DISTINCT fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE doc_type = 'asset') AS iab ON iab.fk_docdet = ad.rowid";
|
||||
$sql .= " WHERE ad.fk_asset = " . (int) $this->id;
|
||||
$sql .= " AND ad.depreciation_mode = '" . $this->db->escape($mode_key) . "'";
|
||||
$sql .= " AND iab.fk_docdet IS NOT NULL";
|
||||
$sql .= " ORDER BY ad.depreciation_date DESC";
|
||||
$sql .= " LIMIT 1";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$this->errors[] = $langs->trans('AssetErrorFetchMaxDepreciationDateForMode', $mode_key) . ': ' . $this->db->lasterror();
|
||||
|
||||
@ -216,6 +216,9 @@ $parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
|
||||
$sql = preg_replace('/,\s*$/', '', $sql);
|
||||
|
||||
$sqlfields = $sql; // $sql fields to remove for count total
|
||||
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
|
||||
if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
|
||||
@ -297,21 +300,18 @@ $sql .= !empty($hookmanager->resPrint) ? (" HAVING 1=1 " . $hookmanager->resPrin
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
/* This old and fast method to get and count full list returns all record so use a high amount of memory.
|
||||
$resql = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($resql);
|
||||
*/
|
||||
/* The slow method does not consume memory on mysql (not tested on pgsql) */
|
||||
/*$resql = $db->query($sql, 0, 'auto', 1);
|
||||
while ($db->fetch_object($resql)) {
|
||||
$nbtotalofrecords++;
|
||||
}*/
|
||||
/* The fast and low memory method to get and count full list converts the sql into a sql count */
|
||||
$sqlforcount = preg_replace('/^SELECT[a-z0-9\._\s\(\),]+FROM/Ui', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql);
|
||||
$sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
|
||||
$sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
|
||||
$resql = $db->query($sqlforcount);
|
||||
$objforcount = $db->fetch_object($resql);
|
||||
$nbtotalofrecords = $objforcount->nbtotalofrecords;
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0
|
||||
if ($resql) {
|
||||
$objforcount = $db->fetch_object($resql);
|
||||
$nbtotalofrecords = $objforcount->nbtotalofrecords;
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
$page = 0;
|
||||
$offset = 0;
|
||||
}
|
||||
|
||||
@ -305,6 +305,9 @@ $parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
|
||||
$sql = preg_replace('/,\s*$/', '', $sql);
|
||||
|
||||
$sqlfields = $sql; // $sql fields to remove for count total
|
||||
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
|
||||
if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
|
||||
@ -378,35 +381,41 @@ $sql.=$hookmanager->resPrint;
|
||||
$sql=preg_replace('/,\s*$/','', $sql);
|
||||
*/
|
||||
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
$resql = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($resql);
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0
|
||||
/* The fast and low memory method to get and count full list converts the sql into a sql count */
|
||||
$sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
|
||||
$sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
|
||||
$resql = $db->query($sqlforcount);
|
||||
if ($resql) {
|
||||
$objforcount = $db->fetch_object($resql);
|
||||
$nbtotalofrecords = $objforcount->nbtotalofrecords;
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
$page = 0;
|
||||
$offset = 0;
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set.
|
||||
if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) {
|
||||
$num = $nbtotalofrecords;
|
||||
} else {
|
||||
if ($limit) {
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
}
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if (!$resql) {
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
// Complete request and execute it with limit
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
if ($limit) {
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
}
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if (!$resql) {
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
// Direct jump if only one record found
|
||||
if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
@ -105,6 +105,9 @@ llxHeader('', $title);
|
||||
|
||||
$sql = "SELECT b.rowid, b.dateb, b.fk_user, b.url, b.target, b.title, b.favicon, b.position,";
|
||||
$sql .= " u.login, u.lastname, u.firstname";
|
||||
|
||||
$sqlfields = $sql; // $sql fields to remove for count total
|
||||
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."bookmark as b LEFT JOIN ".MAIN_DB_PREFIX."user as u ON b.fk_user=u.rowid";
|
||||
$sql .= " WHERE 1=1";
|
||||
$sql .= " AND b.entity IN (".getEntity('bookmark').")";
|
||||
@ -116,7 +119,8 @@ if (!$user->admin) {
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
/* The fast and low memory method to get and count full list converts the sql into a sql count */
|
||||
$sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/Ui', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql);
|
||||
$sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
|
||||
$sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
|
||||
$resql = $db->query($sqlforcount);
|
||||
if ($resql) {
|
||||
$objforcount = $db->fetch_object($resql);
|
||||
@ -125,7 +129,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
$page = 0;
|
||||
$offset = 0;
|
||||
}
|
||||
|
||||
@ -716,15 +716,28 @@ if (empty($reshook) && $action == 'update') {
|
||||
$datef = dol_mktime($fulldayevent ? '23' : GETPOST("p2hour", 'int'), $fulldayevent ? '59' : GETPOST("p2min", 'int'), $fulldayevent ? '59' : GETPOST("apsec", 'int'), GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), 'tzuser');
|
||||
}
|
||||
|
||||
if ($object->elementtype == 'ticket') {
|
||||
if ($object->elementtype == 'ticket') { // code should be TICKET_MSG, TICKET_MSG_PRIVATE, TICKET_MSG_SENTBYMAIL, TICKET_MSG_PRIVATE_SENTBYMAIL
|
||||
if ($private) {
|
||||
$object->type_code = 'TICKET_MSG_PRIVATE';
|
||||
if ($object->code == 'TICKET_MSG') {
|
||||
$object->code = 'TICKET_MSG_PRIVATE';
|
||||
}
|
||||
if ($object->code == 'TICKET_MSG_SENTBYMAIL') {
|
||||
$object->code = 'TICKET_MSG_PRIVATE_SENTBYMAIL';
|
||||
}
|
||||
} else {
|
||||
$object->type_id = dol_getIdFromCode($db, 'AC_EMAIL', 'c_actioncomm');
|
||||
if ($object->code == 'TICKET_MSG_PRIVATE') {
|
||||
$object->code = 'TICKET_MSG';
|
||||
}
|
||||
if ($object->code == 'TICKET_MSG_PRIVATE_SENTBYMAIL') {
|
||||
$object->code = 'TICKET_MSG_SENTBYMAIL';
|
||||
}
|
||||
}
|
||||
// type_id and type_code is not modified
|
||||
} else {
|
||||
$object->type_id = dol_getIdFromCode($db, GETPOST("actioncode", 'aZ09'), 'c_actioncomm');
|
||||
$object->type_code = GETPOST("actioncode", 'aZ09');
|
||||
}
|
||||
|
||||
$object->label = GETPOST("label", "alphanohtml");
|
||||
$object->datep = $datep;
|
||||
$object->datef = $datef;
|
||||
@ -1253,7 +1266,7 @@ if ($action == 'create') {
|
||||
print $langs->trans("DayOfWeek").': <input type="input" size="4" name="BYDAY" value="'.$selectedrecurrulebyday.'">';
|
||||
print '</div>';
|
||||
// limit date
|
||||
$repeateventlimitdate = $repeateventlimitdate ? $repeateventlimitdate : '';
|
||||
$repeateventlimitdate = !empty($repeateventlimitdate) ? $repeateventlimitdate : '';
|
||||
print '<div class="hidden marginrightonly inline-block repeateventlimitdate">';
|
||||
print $langs->trans("Until")." ";
|
||||
print $form->selectDate($repeateventlimitdate, 'limit', 0, 0, 0, "action", 1, 0, 0, '', '', '', '', 1, '', '', 'tzuserrel');
|
||||
@ -1315,11 +1328,6 @@ if ($action == 'create') {
|
||||
|
||||
// Date start
|
||||
print '<tr><td class="nowrap">';
|
||||
/*
|
||||
print '<span class="fieldrequired">'.$langs->trans("DateActionStart").'</span>';
|
||||
print ' - ';
|
||||
print '<span id="dateend"'.(GETPOST("actioncode", 'aZ09') == 'AC_RDV' ? ' class="fieldrequired"' : '').'>'.$langs->trans("DateActionEnd").'</span>';
|
||||
*/
|
||||
print '</td><td>';
|
||||
if (GETPOST("afaire") == 1) {
|
||||
print $form->selectDate($datep, 'ap', 1, 1, 0, "action", 1, 2, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuserrel'); // Empty value not allowed for start date and hours if "todo"
|
||||
@ -1716,7 +1724,7 @@ if ($id > 0) {
|
||||
if ($backtopage) {
|
||||
print '<input type="hidden" name="backtopage" value="'.($backtopage != '1' ? $backtopage : dol_htmlentities($_SERVER["HTTP_REFERER"])).'">';
|
||||
}
|
||||
if (empty($conf->global->AGENDA_USE_EVENT_TYPE) && $object->code != "TICKET_MSG_PRIVATE") {
|
||||
if (empty($conf->global->AGENDA_USE_EVENT_TYPE) && ! preg_match('/^TICKET_MSG_PRIVATE/', $object->code)) {
|
||||
print '<input type="hidden" name="actioncode" value="'.$object->type_code.'">';
|
||||
}
|
||||
|
||||
@ -1742,7 +1750,11 @@ if ($id > 0) {
|
||||
}
|
||||
|
||||
// Private
|
||||
if ($object->elementtype == 'ticket') print '<tr><td>'.$langs->trans("PrivateEventMessage").'</td><td colspan="3"><input type="checkbox" id="private" name="private" '.(($object->code == 'TICKET_MSG_PRIVATE') ? ' checked' : '').'></td></tr>';
|
||||
if ($object->elementtype == 'ticket') {
|
||||
print '<tr><td>'.$langs->trans("MarkMessageAsPrivate");
|
||||
print ' '.$form->textwithpicto('', $langs->trans("TicketMessagePrivateHelp"), 1, 'help');
|
||||
print '</td><td colspan="3"><input type="checkbox" id="private" name="private" '.(preg_match('/^TICKET_MSG_PRIVATE/', $object->code) ? ' checked' : '').'></td></tr>';
|
||||
}
|
||||
|
||||
// Title
|
||||
print '<tr><td'.(empty($conf->global->AGENDA_USE_EVENT_TYPE) ? ' class="fieldrequired titlefieldcreate"' : '').'>'.$langs->trans("Title").'</td><td colspan="3"><input type="text" name="label" class="soixantepercent" value="'.$object->label.'"></td></tr>';
|
||||
@ -2205,18 +2217,13 @@ if ($id > 0) {
|
||||
print '<table class="border tableforfield" width="100%">';
|
||||
|
||||
// Type
|
||||
if (!empty($conf->global->AGENDA_USE_EVENT_TYPE) && $object->elementtype != 'ticket') {
|
||||
if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Type").'</td><td>';
|
||||
print $object->getTypePicto();
|
||||
print $langs->trans("Action".$object->type_code);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Private
|
||||
if ($object->elementtype == 'ticket') {
|
||||
print '<tr><td class="titlefield">'.$langs->trans("PrivateEventMessage").'</td><td>'.yn(($object->code == 'TICKET_MSG_PRIVATE') ? 1 : 0, 3).'</td></tr>';
|
||||
}
|
||||
|
||||
// Full day event
|
||||
print '<tr><td class="titlefield">'.$langs->trans("EventOnFullDay").'</td><td>'.yn($object->fulldayevent ? 1 : 0, 3).'</td></tr>';
|
||||
|
||||
|
||||
@ -423,7 +423,7 @@ class ActionComm extends CommonObject
|
||||
*/
|
||||
public function create(User $user, $notrigger = 0)
|
||||
{
|
||||
global $langs, $conf, $hookmanager;
|
||||
global $langs, $conf;
|
||||
|
||||
$error = 0;
|
||||
$now = dol_now();
|
||||
@ -555,7 +555,8 @@ class ActionComm extends CommonObject
|
||||
$sql .= "recurdateend,";
|
||||
$sql .= "num_vote,";
|
||||
$sql .= "event_paid,";
|
||||
$sql .= "status";
|
||||
$sql .= "status,";
|
||||
$sql .= "ip";
|
||||
$sql .= ") VALUES (";
|
||||
$sql .= "'(PROV)', ";
|
||||
$sql .= "'".$this->db->idate($now)."', ";
|
||||
@ -596,7 +597,8 @@ class ActionComm extends CommonObject
|
||||
$sql .= (!empty($this->recurdateend) ? "'".$this->db->idate($this->recurdateend)."'" : "null").", ";
|
||||
$sql .= (!empty($this->num_vote) ? (int) $this->num_vote : "null").", ";
|
||||
$sql .= (!empty($this->event_paid) ? (int) $this->event_paid : 0).", ";
|
||||
$sql .= (!empty($this->status) ? (int) $this->status : "0");
|
||||
$sql .= (!empty($this->status) ? (int) $this->status : "0").", ";
|
||||
$sql .= (!empty($this->ip) ? "'".$this->db->escape($this->ip)."'" : "null");
|
||||
$sql .= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::add", LOG_DEBUG);
|
||||
@ -705,10 +707,9 @@ class ActionComm extends CommonObject
|
||||
*/
|
||||
public function createFromClone(User $fuser, $socid)
|
||||
{
|
||||
global $db, $conf, $hookmanager;
|
||||
global $hookmanager;
|
||||
|
||||
$error = 0;
|
||||
$now = dol_now();
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
@ -1160,12 +1161,8 @@ class ActionComm extends CommonObject
|
||||
$userownerid = ($this->userownerid ? $this->userownerid : 0);
|
||||
$userdoneid = ($this->userdoneid ? $this->userdoneid : 0);
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."actioncomm ";
|
||||
$sql .= " SET percent = '".$this->db->escape($this->percentage)."'";
|
||||
// If a type_id is set, we must also have the type_code set
|
||||
if ($this->type_id > 0) {
|
||||
$sql .= ", fk_action = ".(int) $this->type_id;
|
||||
if (empty($this->type_code)) {
|
||||
$cactioncomm = new CActionComm($this->db);
|
||||
$result = $cactioncomm->fetch($this->type_id);
|
||||
@ -1174,7 +1171,18 @@ class ActionComm extends CommonObject
|
||||
}
|
||||
}
|
||||
}
|
||||
$sql .= ", code = " . (isset($this->type_code)? "'".$this->db->escape($this->type_code) . "'":"null");
|
||||
|
||||
$code = $this->code;
|
||||
if (empty($code) || (!empty($this->oldcopy) && $this->oldcopy->type_code != $this->type_code)) { // If code unknown or if we change the type, we reset $code too
|
||||
$code = $this->type_code;
|
||||
}
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."actioncomm";
|
||||
$sql .= " SET percent = '".$this->db->escape($this->percentage)."'";
|
||||
$sql .= ", fk_action = ".(int) $this->type_id;
|
||||
$sql .= ", code = " . ($code ? "'".$this->db->escape($code)."'" : "null");
|
||||
$sql .= ", label = ".($this->label ? "'".$this->db->escape($this->label)."'" : "null");
|
||||
$sql .= ", datep = ".(strval($this->datep) != '' ? "'".$this->db->idate($this->datep)."'" : 'null');
|
||||
$sql .= ", datep2 = ".(strval($this->datef) != '' ? "'".$this->db->idate($this->datef)."'" : 'null');
|
||||
@ -1205,7 +1213,7 @@ class ActionComm extends CommonObject
|
||||
if (!empty($this->status)) {
|
||||
$sql .= ", status=".($this->status ? (int) $this->status : 0);
|
||||
}
|
||||
$sql .= " WHERE id=".$this->id;
|
||||
$sql .= " WHERE id=".((int) $this->id);
|
||||
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
if ($this->db->query($sql)) {
|
||||
@ -1761,11 +1769,11 @@ class ActionComm extends CommonObject
|
||||
$imgpicto = img_picto('', 'object_phoning', $color, false, 0, 0, '', 'paddingright');
|
||||
} elseif ($this->type_code == 'AC_FAX') {
|
||||
$imgpicto = img_picto('', 'object_phoning_fax', $color, false, 0, 0, '', 'paddingright');
|
||||
} elseif ($this->type_code == 'AC_EMAIL' || $this->type_code == 'AC_EMAIL_IN') {
|
||||
} elseif ($this->type_code == 'AC_EMAIL' || $this->type_code == 'AC_EMAIL_IN' || preg_match('/_SENTBYMAIL/', $this->code)) {
|
||||
$imgpicto = img_picto('', 'object_email', $color, false, 0, 0, '', 'paddingright');
|
||||
} elseif ($this->type_code == 'AC_INT') {
|
||||
$imgpicto = img_picto('', 'object_intervention', $color, false, 0, 0, '', 'paddingright');
|
||||
} elseif ($this->type_code == 'AC_OTH' && $this->code == 'TICKET_MSG') {
|
||||
} elseif (preg_match('/^TICKET_MSG/', $this->code)) {
|
||||
$imgpicto = img_picto('', 'object_conversation', $color, false, 0, 0, '', 'paddingright');
|
||||
} elseif ($this->type != 'systemauto') {
|
||||
$imgpicto = img_picto('', 'user-cog', $color, false, 0, 0, '', 'paddingright');
|
||||
|
||||
@ -427,6 +427,8 @@ $parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
|
||||
$sqlfields = $sql; // $sql fields to remove for count total
|
||||
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."actioncomm_extrafields as ef ON (a.id = ef.fk_object)";
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
@ -563,21 +565,18 @@ $sql .= $hookmanager->resPrint;
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
/* This old and fast method to get and count full list returns all record so use a high amount of memory.
|
||||
$resql = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($resql);
|
||||
*/
|
||||
/* The slow method does not consume memory on mysql (not tested on pgsql) */
|
||||
/*$resql = $db->query($sql, 0, 'auto', 1);
|
||||
while ($db->fetch_object($resql)) {
|
||||
$nbtotalofrecords++;
|
||||
}*/
|
||||
/* The fast and low memory method to get and count full list converts the sql into a sql count */
|
||||
$sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/Ui', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql);
|
||||
$sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
|
||||
$sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
|
||||
$resql = $db->query($sqlforcount);
|
||||
$objforcount = $db->fetch_object($resql);
|
||||
$nbtotalofrecords = $objforcount->nbtotalofrecords;
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0
|
||||
if ($resql) {
|
||||
$objforcount = $db->fetch_object($resql);
|
||||
$nbtotalofrecords = $objforcount->nbtotalofrecords;
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
$page = 0;
|
||||
$offset = 0;
|
||||
}
|
||||
@ -974,7 +973,7 @@ while ($i < $imaxinloop) {
|
||||
if (empty($conf->global->AGENDA_USE_EVENT_TYPE) && empty($arraylist[$labeltype])) {
|
||||
$labeltype = 'AC_OTH';
|
||||
}
|
||||
if ($actionstatic->type_code == 'AC_OTH' && $actionstatic->code == 'TICKET_MSG') {
|
||||
if (preg_match('/^TICKET_MSG/', $actionstatic->code)) {
|
||||
$labeltype = $langs->trans("Message");
|
||||
} else {
|
||||
if (!empty($arraylist[$labeltype])) {
|
||||
|
||||
@ -730,7 +730,7 @@ if ($action == 'create') {
|
||||
// Print mail form
|
||||
print load_fiche_titre($langs->trans("NewMailing"), $availablelink, 'object_email');
|
||||
|
||||
print dol_get_fiche_head();
|
||||
print dol_get_fiche_head(array(), '', '', -3);
|
||||
|
||||
print '<table class="border centpercent">';
|
||||
|
||||
@ -768,7 +768,7 @@ if ($action == 'create') {
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
print $form->buttonsSaveCancel("CreateMailing", '');
|
||||
print $form->buttonsSaveCancel("CreateMailing", 'Cancel');
|
||||
|
||||
print '</form>';
|
||||
} else {
|
||||
@ -1093,18 +1093,18 @@ if ($action == 'create') {
|
||||
}
|
||||
|
||||
|
||||
$htmltext = '<i>'.$langs->trans("FollowingConstantsWillBeSubstituted").':<br>';
|
||||
$htmltext = '<i>'.$langs->trans("FollowingConstantsWillBeSubstituted").':<br><br><span class="small">';
|
||||
foreach ($object->substitutionarray as $key => $val) {
|
||||
$htmltext .= $key.' = '.$langs->trans($val).'<br>';
|
||||
}
|
||||
$htmltext .= '</i>';
|
||||
$htmltext .= '</span></i>';
|
||||
|
||||
// Print mail content
|
||||
print load_fiche_titre($langs->trans("EMail"), $form->textwithpicto('<span class="opacitymedium hideonsmartphone">'.$langs->trans("AvailableVariables").'</span>', $htmltext, 1, 'helpclickable', '', 0, 2, 'emailsubstitionhelp'), 'generic');
|
||||
print load_fiche_titre($langs->trans("EMail"), $form->textwithpicto('<span class="opacitymedium hideonsmartphone">'.$langs->trans("AvailableVariables").'</span>', $htmltext, 1, 'helpclickable', '', 0, 3, 'emailsubstitionhelp'), 'generic');
|
||||
|
||||
print dol_get_fiche_head('', '', '', -1);
|
||||
|
||||
print '<table class="bordernooddeven" width="100%">';
|
||||
print '<table class="bordernooddeven tableforfield centpercent">';
|
||||
|
||||
// Subject
|
||||
print '<tr><td class="titlefield">'.$langs->trans("MailTopic").'</td><td colspan="3">'.$object->sujet.'</td></tr>';
|
||||
@ -1314,7 +1314,7 @@ if ($action == 'create') {
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button buttonforacesave button-save" value="'.$langs->trans("Save").'" name="save">';
|
||||
print ' ';
|
||||
print ' ';
|
||||
print '<input type="submit" class="button button-cancel" value="'.$langs->trans("Cancel").'" name="cancel">';
|
||||
print '</div>';
|
||||
|
||||
|
||||
@ -394,7 +394,7 @@ if ($object->fetch($id) >= 0) {
|
||||
if (empty($obj->picto)) {
|
||||
$obj->picto = 'generic';
|
||||
}
|
||||
print img_object($langs->trans("EmailingTargetSelector").': '.get_class($obj), $obj->picto, 'class="valignmiddle pictomodule"');
|
||||
print img_object($langs->trans("EmailingTargetSelector").': '.get_class($obj), $obj->picto, 'class="valignmiddle pictomodule pictofixedwidth"');
|
||||
print ' ';
|
||||
print $obj->getDesc();
|
||||
print '</div>';
|
||||
@ -633,10 +633,12 @@ if ($object->fetch($id) >= 0) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorboothattendee.class.php';
|
||||
$objectstaticmember = new Adherent($db);
|
||||
$objectstaticuser = new User($db);
|
||||
$objectstaticcompany = new Societe($db);
|
||||
$objectstaticcontact = new Contact($db);
|
||||
$objectstaticeventorganization = new ConferenceOrBoothAttendee($db);
|
||||
|
||||
while ($i < min($num, $limit)) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
@ -645,7 +647,7 @@ if ($object->fetch($id) >= 0) {
|
||||
print '<td class="tdoverflowmax150">'.img_picto('$obj->email', 'email', 'class="paddingright"').dol_escape_htmltag($obj->email).'</td>';
|
||||
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->lastname).'">'.dol_escape_htmltag($obj->lastname).'</td>';
|
||||
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->firstname).'">'.dol_escape_htmltag($obj->firstname).'</td>';
|
||||
print '<td>'.dol_escape_htmltag($obj->other).'</td>';
|
||||
print '<td><span class="small">'.dol_escape_htmltag($obj->other).'</small></td>';
|
||||
print '<td class="center tdoverflowmax150">';
|
||||
if (empty($obj->source_id) || empty($obj->source_type)) {
|
||||
print empty($obj->source_url) ? '' : $obj->source_url; // For backward compatibility
|
||||
@ -662,6 +664,9 @@ if ($object->fetch($id) >= 0) {
|
||||
} elseif ($obj->source_type == 'contact') {
|
||||
$objectstaticcontact->fetch($obj->source_id);
|
||||
print $objectstaticcontact->getNomUrl(1);
|
||||
} elseif ($obj->source_type == 'eventorganizationattendee') {
|
||||
$objectstaticeventorganization->fetch($obj->source_id);
|
||||
print $objectstaticeventorganization->getNomUrl(1);
|
||||
} else {
|
||||
print $obj->source_url;
|
||||
}
|
||||
|
||||
@ -105,7 +105,8 @@ $search_date_endyear = GETPOST('search_date_endyear', 'int');
|
||||
$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver
|
||||
$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
|
||||
$search_date_end_startday = GETPOST('search_date_end_startday', 'int');
|
||||
$search_date_end_startmonth = GETPOST('search_date_end_startmonth', 'int');
|
||||
$search_date_end_startmonth = GETPOST('se$sql .= $db->plimit($limit + 1, $offset);
|
||||
arch_date_end_startmonth', 'int');
|
||||
$search_date_end_startyear = GETPOST('search_date_end_startyear', 'int');
|
||||
$search_date_end_endday = GETPOST('search_date_end_endday', 'int');
|
||||
$search_date_end_endmonth = GETPOST('search_date_end_endmonth', 'int');
|
||||
@ -585,6 +586,9 @@ $parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
$sql = preg_replace('/, $/', '', $sql);
|
||||
|
||||
$sqlfields = $sql; // $sql fields to remove for count total
|
||||
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s';
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)";
|
||||
@ -790,22 +794,32 @@ $parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
$sql .= empty($hookmanager->resPrint) ? "" : " HAVING 1=1 ".$hookmanager->resPrint;
|
||||
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
$sql .= ', p.ref DESC';
|
||||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
/* The fast and low memory method to get and count full list converts the sql into a sql count */
|
||||
$sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
|
||||
$sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
|
||||
$resql = $db->query($sqlforcount);
|
||||
if ($resql) {
|
||||
$objforcount = $db->fetch_object($resql);
|
||||
$nbtotalofrecords = $objforcount->nbtotalofrecords;
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
$page = 0;
|
||||
$offset = 0;
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
$sql .= ', p.ref DESC';
|
||||
if ($limit) {
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
}
|
||||
|
||||
$resql = $db->query($sql);
|
||||
|
||||
|
||||
@ -3656,8 +3656,8 @@ class Commande extends CommonOrder
|
||||
}
|
||||
$statusType = 'status4';
|
||||
} elseif ($status == self::STATUS_CLOSED && (!$billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) {
|
||||
$labelStatus = $langs->transnoentitiesnoconv('StatusOrderToBill');
|
||||
$labelStatusShort = $langs->transnoentitiesnoconv('StatusOrderToBillShort');
|
||||
$labelStatus = $langs->transnoentitiesnoconv('StatusOrderToBill'); // translated into Delivered
|
||||
$labelStatusShort = $langs->transnoentitiesnoconv('StatusOrderToBillShort'); // translated into Delivered
|
||||
$statusType = 'status4';
|
||||
} elseif ($status == self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) {
|
||||
$labelStatus = $langs->transnoentitiesnoconv('StatusOrderProcessed').$billedtext;
|
||||
|
||||
@ -825,6 +825,9 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
|
||||
$sqlfields = $sql; // $sql fields to remove for count total
|
||||
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s';
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s2 ON s2.rowid = s.parent";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
|
||||
@ -1043,21 +1046,31 @@ $parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
$sql .= empty($hookmanager->resPrint) ? "" : " HAVING 1=1 ".$hookmanager->resPrint;
|
||||
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
/* The fast and low memory method to get and count full list converts the sql into a sql count */
|
||||
$sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
|
||||
$sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
|
||||
$resql = $db->query($sqlforcount);
|
||||
if ($resql) {
|
||||
$objforcount = $db->fetch_object($resql);
|
||||
$nbtotalofrecords = $objforcount->nbtotalofrecords;
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
$page = 0;
|
||||
$offset = 0;
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
if ($limit) {
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
}
|
||||
//print $sql;
|
||||
|
||||
$resql = $db->query($sql);
|
||||
@ -1933,7 +1946,7 @@ if ($resql) {
|
||||
$companystatic->town = $obj->town;
|
||||
$companystatic->country_code = $obj->country_code;
|
||||
if (!isset($getNomUrl_cache[$obj->socid])) {
|
||||
$getNomUrl_cache[$obj->socid] = $companystatic->getNomUrl(1, 'customer');
|
||||
$getNomUrl_cache[$obj->socid] = $companystatic->getNomUrl(1, 'customer', 100, 0, 1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1);
|
||||
}
|
||||
|
||||
$generic_commande->id = $obj->rowid;
|
||||
|
||||
@ -1561,6 +1561,7 @@ if ($resql) {
|
||||
|
||||
$companylinked_id = 0;
|
||||
$userlinked_id = 0;
|
||||
$type_link = "";
|
||||
|
||||
//payment line type to define user display and user or company linked
|
||||
foreach ($links as $key => $value) {
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
* Copyright (C) 2015-2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2019 JC Prieto <jcprieto@virtual20.com><prietojc@gmail.com>
|
||||
* Copyright (C) 2022 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -852,7 +853,7 @@ class Account extends CommonObject
|
||||
|
||||
$sql .= ",min_allowed = ".($this->min_allowed != '' ? price2num($this->min_allowed) : "null");
|
||||
$sql .= ",min_desired = ".($this->min_desired != '' ? price2num($this->min_desired) : "null");
|
||||
$sql .= ",comment = '".$this->db->escape($this->comment)."'";
|
||||
$sql .= ",comment = '".$this->db->escape($this->comment)."'";
|
||||
|
||||
$sql .= ",state_id = ".($this->state_id > 0 ? ((int) $this->state_id) : "null");
|
||||
$sql .= ",fk_pays = ".($this->country_id > 0 ? ((int) $this->country_id) : "null");
|
||||
@ -1926,18 +1927,18 @@ class AccountLine extends CommonObject
|
||||
$obj = $this->db->fetch_object($result);
|
||||
if ($obj) {
|
||||
$this->id = $obj->rowid;
|
||||
$this->rowid = $obj->rowid;
|
||||
$this->rowid = $obj->rowid;
|
||||
$this->ref = $obj->rowid;
|
||||
|
||||
$this->datec = $obj->datec;
|
||||
$this->datev = $obj->datev;
|
||||
$this->dateo = $obj->dateo;
|
||||
$this->datec = $obj->datec;
|
||||
$this->datev = $obj->datev;
|
||||
$this->dateo = $obj->dateo;
|
||||
$this->amount = $obj->amount;
|
||||
$this->label = $obj->label;
|
||||
$this->note = $obj->note;
|
||||
$this->label = $obj->label;
|
||||
$this->note = $obj->note;
|
||||
|
||||
$this->fk_user_author = $obj->fk_user_author;
|
||||
$this->fk_user_rappro = $obj->fk_user_rappro;
|
||||
$this->fk_user_author = $obj->fk_user_author;
|
||||
$this->fk_user_rappro = $obj->fk_user_rappro;
|
||||
|
||||
$this->fk_type = $obj->fk_type; // Type of transaction
|
||||
$this->rappro = $obj->rappro;
|
||||
@ -1948,9 +1949,13 @@ class AccountLine extends CommonObject
|
||||
$this->fk_bordereau = $obj->fk_bordereau;
|
||||
|
||||
$this->fk_account = $obj->fk_account;
|
||||
$this->bank_account_ref = $obj->bank_account_ref;
|
||||
$this->bank_account_ref = $obj->bank_account_ref;
|
||||
$this->bank_account_label = $obj->bank_account_label;
|
||||
|
||||
// Retrieve all extrafield
|
||||
// fetch optionals attributes and labels
|
||||
$this->fetch_optionals();
|
||||
|
||||
$ret = 1;
|
||||
}
|
||||
$this->db->free($result);
|
||||
@ -1967,6 +1972,10 @@ class AccountLine extends CommonObject
|
||||
*/
|
||||
public function insert()
|
||||
{
|
||||
$error = 0;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bank (";
|
||||
$sql .= "datec";
|
||||
$sql .= ", dateo";
|
||||
@ -2002,15 +2011,26 @@ class AccountLine extends CommonObject
|
||||
|
||||
dol_syslog(get_class($this)."::insert", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
if (!$resql) {
|
||||
if ($resql) {
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'bank');
|
||||
// Actions on extra fields (by external module or standard code)
|
||||
$result = $this->insertExtraFields();
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
$error++;
|
||||
$this->error = $this->db->lasterror();
|
||||
return -1;
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'bank');
|
||||
|
||||
return $this->id;
|
||||
if (!$error) {
|
||||
$this->db->commit();
|
||||
return $this->id;
|
||||
} else {
|
||||
$this->db->rollback();
|
||||
return -1 * $error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2064,6 +2084,12 @@ class AccountLine extends CommonObject
|
||||
$nbko++;
|
||||
}
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_extrafields WHERE fk_object=".(int) $this->rowid;
|
||||
$result = $this->db->query($sql);
|
||||
if (!$result) {
|
||||
$nbko++;
|
||||
}
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank WHERE rowid=".(int) $this->rowid;
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
@ -35,6 +35,7 @@ require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('banks', 'categories', 'compta', 'bills', 'other'));
|
||||
@ -77,7 +78,9 @@ if (empty($user->rights->banque->lire) && empty($user->rights->banque->consolida
|
||||
}
|
||||
|
||||
$hookmanager->initHooks(array('bankline'));
|
||||
|
||||
$object = new AccountLine($db);
|
||||
$extrafields = new ExtraFields($db);
|
||||
$extrafields->fetch_name_optionals_label($object->element);
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -125,18 +128,17 @@ if ($action == 'confirm_delete_categ' && $confirm == "yes" && $user->rights->ban
|
||||
if ($user->rights->banque->modifier && $action == "update") {
|
||||
$error = 0;
|
||||
|
||||
$acline = new AccountLine($db);
|
||||
$result = $acline->fetch($rowid);
|
||||
$result = $object->fetch($rowid);
|
||||
if ($result <= 0) {
|
||||
dol_syslog('Failed to read bank line with id '.$rowid, LOG_WARNING); // This happens due to old bug that has set fk_account to null.
|
||||
$acline->id = $rowid;
|
||||
$object->id = $rowid;
|
||||
}
|
||||
|
||||
$acsource = new Account($db);
|
||||
$acsource->fetch($accountoldid);
|
||||
|
||||
$actarget = new Account($db);
|
||||
if (GETPOST('accountid', 'int') > 0 && !$acline->rappro && !$acline->getVentilExportCompta()) { // We ask to change bank account
|
||||
if (GETPOST('accountid', 'int') > 0 && !$object->rappro && !$object->getVentilExportCompta()) { // We ask to change bank account
|
||||
$actarget->fetch(GETPOST('accountid', 'int'));
|
||||
} else {
|
||||
$actarget->fetch($accountoldid);
|
||||
@ -173,7 +175,7 @@ if ($user->rights->banque->modifier && $action == "update") {
|
||||
$sql .= " emetteur='".$db->escape(GETPOST("emetteur"))."',";
|
||||
}
|
||||
// Blocked when conciliated
|
||||
if (!$acline->rappro) {
|
||||
if (!$object->rappro) {
|
||||
if (GETPOSTISSET('label')) {
|
||||
$sql .= " label = '".$db->escape(GETPOST("label"))."',";
|
||||
}
|
||||
@ -188,7 +190,7 @@ if ($user->rights->banque->modifier && $action == "update") {
|
||||
}
|
||||
}
|
||||
$sql .= " fk_account = ".((int) $actarget->id);
|
||||
$sql .= " WHERE rowid = ".((int) $acline->id);
|
||||
$sql .= " WHERE rowid = ".((int) $object->id);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if (!$result) {
|
||||
@ -214,6 +216,11 @@ if ($user->rights->banque->modifier && $action == "update") {
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET');
|
||||
$object->insertExtraFields();
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
|
||||
$db->commit();
|
||||
@ -601,6 +608,13 @@ if ($result) {
|
||||
print "</td></tr>";
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $bankline, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (empty($reshook)) {
|
||||
print $bankline->showOptionals($extrafields, ($objp->rappro ? 'view' : 'create'), $parameters);
|
||||
}
|
||||
print "</table>";
|
||||
|
||||
// Code to adjust value date with plus and less picto using an Ajax call instead of a full reload of page
|
||||
|
||||
@ -195,6 +195,9 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
|
||||
$sqlfields = $sql; // $sql fields to remove for count total
|
||||
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."bank_account as b";
|
||||
if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (b.rowid = ef.fk_object)";
|
||||
@ -252,16 +255,31 @@ $parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
/* The fast and low memory method to get and count full list converts the sql into a sql count */
|
||||
$sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
|
||||
$sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
|
||||
$resql = $db->query($sqlforcount);
|
||||
if ($resql) {
|
||||
$objforcount = $db->fetch_object($resql);
|
||||
$nbtotalofrecords = $objforcount->nbtotalofrecords;
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
$page = 0;
|
||||
$offset = 0;
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
if ($limit) {
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
}
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
|
||||
@ -213,6 +213,9 @@ if ($arrayfields['account']['checked']) {
|
||||
$sql = "SELECT v.rowid, v.sens, v.amount, v.label, v.datep as datep, v.datev as datev, v.fk_typepayment as type, v.num_payment, v.fk_bank, v.accountancy_code, v.subledger_account, v.fk_projet as fk_project,";
|
||||
$sql .= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number as bank_account_number, ba.fk_accountancy_journal as accountancy_journal, ba.label as blabel,";
|
||||
$sql .= " pst.code as payment_code";
|
||||
|
||||
$sqlfields = $sql; // $sql fields to remove for count total
|
||||
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."payment_various as v";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON v.fk_typepayment = pst.id";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON v.fk_bank = b.rowid";
|
||||
@ -263,14 +266,32 @@ if ($search_all) {
|
||||
$sql .= natural_search(array_keys($fieldstosearchall), $search_all);
|
||||
}
|
||||
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
/* The fast and low memory method to get and count full list converts the sql into a sql count */
|
||||
$sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
|
||||
$sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
|
||||
$resql = $db->query($sqlforcount);
|
||||
if ($resql) {
|
||||
$objforcount = $db->fetch_object($resql);
|
||||
$nbtotalofrecords = $objforcount->nbtotalofrecords;
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
$totalnboflines = 0;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$totalnboflines = $db->num_rows($resql);
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
$page = 0;
|
||||
$offset = 0;
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
|
||||
// Complete request and execute it with limit
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
if ($limit) {
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
}
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
@ -355,7 +376,7 @@ if ($resql) {
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
|
||||
print_barre_liste($langs->trans("MenuVariousPayment"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $totalnboflines, 'object_payment', 0, $newcardbutton, '', $limit, 0, 0, 1);
|
||||
print_barre_liste($langs->trans("MenuVariousPayment"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'object_payment', 0, $newcardbutton, '', $limit, 0, 0, 1);
|
||||
|
||||
if ($search_all) {
|
||||
foreach ($fieldstosearchall as $key => $val) {
|
||||
|
||||
@ -96,7 +96,7 @@ if ($user->socid > 0) { // Protection if external user
|
||||
//$socid = $user->socid;
|
||||
accessforbidden();
|
||||
}
|
||||
if (!$user->rights->cashdesk->run && !$user->rights->takepos->run) {
|
||||
if (!$user->hasRight("cashdesk", "run") && !$user->hasRight("takepos", "run")) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
@ -105,10 +105,10 @@ if (!$user->rights->cashdesk->run && !$user->rights->takepos->run) {
|
||||
* Actions
|
||||
*/
|
||||
|
||||
$permissiontoadd = ($user->rights->cashdesk->run || $user->rights->takepos->run);
|
||||
$permissiontodelete = ($user->rights->cashdesk->run || $user->rights->takepos->run) || ($permissiontoadd && $object->status == 0);
|
||||
$permissiontoadd = ($user->hasRight("cashdesk", "run") || $user->hasRight("takepos", "run"));
|
||||
$permissiontodelete = ($user->hasRight("cashdesk", "run") || $user->hasRight("takepos", "run")) || ($permissiontoadd && $object->status == 0);
|
||||
if (empty($backtopage)) {
|
||||
$backtopage = DOL_URL_ROOT.'/compta/cashcontrol/cashcontrol_card.php?id='.($id > 0 ? $id : '__ID__');
|
||||
$backtopage = DOL_URL_ROOT.'/compta/cashcontrol/cashcontrol_card.php?id='.(!empty($id) && $id > 0 ? $id : '__ID__');
|
||||
}
|
||||
$backurlforlist = DOL_URL_ROOT.'/compta/cashcontrol/cashcontrol_list.php';
|
||||
$triggermodname = 'CACHCONTROL_MODIFY'; // Name of trigger action code to execute when we modify record
|
||||
|
||||
@ -360,21 +360,21 @@ if ($resql) {
|
||||
print '<div style="text-align: right">';
|
||||
print '<h2>';
|
||||
|
||||
print $langs->trans("Cash").($transactionspertype['CASH'] ? ' ('.$transactionspertype['CASH'].')' : '').' : <div class="inline-block amount width100">'.price($cash).'</div>';
|
||||
print $langs->trans("Cash").(!empty($transactionspertype['CASH']) ? ' ('.$transactionspertype['CASH'].')' : '').' : <div class="inline-block amount width100">'.price($cash).'</div>';
|
||||
if ($object->status == $object::STATUS_VALIDATED && $cash != $object->cash) {
|
||||
print ' <> <div class="inline-block amountremaintopay fontsizeunset">'.$langs->trans("Declared").': '.price($object->cash).'</div>';
|
||||
}
|
||||
print "<br>";
|
||||
|
||||
//print '<br>';
|
||||
print $langs->trans("PaymentTypeCHQ").($transactionspertype['CHQ'] ? ' ('.$transactionspertype['CHQ'].')' : '').' : <div class="inline-block amount width100">'.price($cheque).'</div>';
|
||||
print $langs->trans("PaymentTypeCHQ").(!empty($transactionspertype['CHQ']) ? ' ('.$transactionspertype['CHQ'].')' : '').' : <div class="inline-block amount width100">'.price($cheque).'</div>';
|
||||
if ($object->status == $object::STATUS_VALIDATED && $cheque != $object->cheque) {
|
||||
print ' <> <div class="inline-block amountremaintopay fontsizeunset">'.$langs->trans("Declared").' : '.price($object->cheque).'</div>';
|
||||
}
|
||||
print "<br>";
|
||||
|
||||
//print '<br>';
|
||||
print $langs->trans("PaymentTypeCB").($transactionspertype['CB'] ? ' ('.$transactionspertype['CB'].')' : '').' : <div class="inline-block amount width100">'.price($bank).'</div>';
|
||||
print $langs->trans("PaymentTypeCB").(!empty($transactionspertype['CB']) ? ' ('.$transactionspertype['CB'].')' : '').' : <div class="inline-block amount width100">'.price($bank).'</div>';
|
||||
if ($object->status == $object::STATUS_VALIDATED && $bank != $object->card) {
|
||||
print ' <> <div class="inline-block amountremaintopay fontsizeunset">'.$langs->trans("Declared").': '.price($object->card).'</div>';
|
||||
}
|
||||
|
||||
@ -1177,6 +1177,15 @@ if ($action == 'create') {
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteRepeatableInvoice'), $langs->trans('ConfirmDeleteRepeatableInvoice'), 'confirm_deleteinvoice', '', 'no', 1);
|
||||
}
|
||||
|
||||
// Call Hook formConfirm
|
||||
$parameters = array('formConfirm' => $formconfirm);
|
||||
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook)) {
|
||||
$formconfirm .= $hookmanager->resPrint;
|
||||
} elseif ($reshook > 0) {
|
||||
$formconfirm = $hookmanager->resPrint;
|
||||
}
|
||||
|
||||
print $formconfirm;
|
||||
|
||||
$author = new User($db);
|
||||
@ -1653,33 +1662,41 @@ if ($action == 'create') {
|
||||
*/
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if (empty($object->suspended)) {
|
||||
if ($user->rights->facture->creer) {
|
||||
if (!empty($object->frequency) && $object->nb_gen_max > 0 && ($object->nb_gen_done >= $object->nb_gen_max)) {
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("MaxGenerationReached")).'">'.$langs->trans("CreateBill").'</a></div>';
|
||||
} else {
|
||||
if (empty($object->frequency) || $object->date_when <= $nowlasthour) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture/card.php?action=create&socid='.$object->thirdparty->id.'&fac_rec='.$object->id.'">'.$langs->trans("CreateBill").'</a></div>';
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("DateIsNotEnough")).'">'.$langs->trans("CreateBill").'</a></div>';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans("CreateBill").'</a></div>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($user->rights->facture->creer) {
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook)) {
|
||||
$params = array(
|
||||
'attr' => array(
|
||||
'class' => 'classfortooltip',
|
||||
),
|
||||
);
|
||||
if (empty($object->suspended)) {
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=disable&id='.$object->id.'&token='.newToken().'">'.$langs->trans("Disable").'</a></div>';
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=enable&id='.$object->id.'&token='.newToken().'">'.$langs->trans("Enable").'</a></div>';
|
||||
if ($user->rights->facture->creer) {
|
||||
if (!empty($object->frequency) && $object->nb_gen_max > 0 && ($object->nb_gen_done >= $object->nb_gen_max)) {
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="' . dol_escape_htmltag($langs->trans("MaxGenerationReached")) . '">' . $langs->trans("CreateBill") . '</a></div>';
|
||||
} else {
|
||||
if (empty($object->frequency) || $object->date_when <= $nowlasthour) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/compta/facture/card.php?action=create&socid=' . $object->thirdparty->id . '&fac_rec=' . $object->id . '">' . $langs->trans("CreateBill") . '</a></div>';
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="' . dol_escape_htmltag($langs->trans("DateIsNotEnough")) . '">' . $langs->trans("CreateBill") . '</a></div>';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">' . $langs->trans("CreateBill") . '</a></div>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($user->rights->facture->creer) {
|
||||
if (empty($object->suspended)) {
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=disable&id='.$object->id.'&token='.newToken().'">'.$langs->trans("Disable").'</a></div>';
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=enable&id='.$object->id.'&token='.newToken().'">'.$langs->trans("Enable").'</a></div>';
|
||||
}
|
||||
}
|
||||
|
||||
// Delete
|
||||
print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=delete&token=' . newToken(), 'delete', $user->rights->facture->supprimer);
|
||||
}
|
||||
|
||||
// Delete
|
||||
print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $user->rights->facture->supprimer);
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
|
||||
@ -1024,7 +1024,7 @@ class FactureRec extends CommonInvoice
|
||||
if ($this->db->query($sql)) {
|
||||
$lineId = $this->db->last_insert_id(MAIN_DB_PREFIX."facturedet_rec");
|
||||
$this->id = $facid;
|
||||
$this->update_price();
|
||||
$this->update_price(1);
|
||||
return $lineId;
|
||||
} else {
|
||||
$this->error = $this->db->lasterror();
|
||||
@ -1198,7 +1198,7 @@ class FactureRec extends CommonInvoice
|
||||
dol_syslog(get_class($this)."::updateline", LOG_DEBUG);
|
||||
if ($this->db->query($sql)) {
|
||||
$this->id = $facid;
|
||||
$this->update_price();
|
||||
$this->update_price(1);
|
||||
return 1;
|
||||
} else {
|
||||
$this->error = $this->db->lasterror();
|
||||
|
||||
@ -40,7 +40,7 @@
|
||||
* \brief File of class to manage invoices
|
||||
*/
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/commoninvoice.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/commoninvoice.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobjectline.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php';
|
||||
|
||||
@ -597,6 +597,9 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
|
||||
$sqlfields = $sql; // $sql fields to remove for count total
|
||||
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s';
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s2 ON s2.rowid = s.parent";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
|
||||
@ -911,21 +914,12 @@ $parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$sql .= empty($hookmanager->resPrint) ? "" : " HAVING 1=1 ".$hookmanager->resPrint;
|
||||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
/* This old and fast method to get and count full list returns all record so use a high amount of memory.
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
*/
|
||||
/* The fast and low memory method to get and count full list converts the sql into a sql count */
|
||||
if ($sall || $search_user > 0) {
|
||||
$sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/Ui', 'SELECT COUNT(DISTINCT f.rowid) as nbtotalofrecords FROM', $sql);
|
||||
} else {
|
||||
$sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/Ui', 'SELECT COUNT(f.rowid) as nbtotalofrecords FROM', $sql);
|
||||
$sqlforcount = preg_replace('/LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON pf.fk_facture = f.rowid/', '', $sqlforcount);
|
||||
}
|
||||
$sqlforcount = preg_replace('/GROUP BY.*$/', '', $sqlforcount);
|
||||
|
||||
$sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
|
||||
$sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
|
||||
$resql = $db->query($sqlforcount);
|
||||
if ($resql) {
|
||||
$objforcount = $db->fetch_object($resql);
|
||||
@ -934,7 +928,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
$page = 0;
|
||||
$offset = 0;
|
||||
}
|
||||
@ -942,13 +936,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
}
|
||||
|
||||
// Complete request and execute it with limit
|
||||
$sql .= ' ORDER BY ';
|
||||
$listfield = explode(',', $sortfield);
|
||||
$listorder = explode(',', $sortorder);
|
||||
foreach ($listfield as $key => $value) {
|
||||
$sql .= $listfield[$key].' '.($listorder[$key] ? $listorder[$key] : 'DESC').',';
|
||||
}
|
||||
$sql .= ' f.rowid DESC ';
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
if ($limit) {
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
}
|
||||
@ -1825,10 +1813,10 @@ if ($resql) {
|
||||
$facturestatic->close_code = $obj->close_code;
|
||||
$facturestatic->total_ttc = $obj->total_ttc;
|
||||
$facturestatic->paye = $obj->paye;
|
||||
$facturestatic->fk_soc = $obj->fk_soc;
|
||||
$facturestatic->socid = $obj->fk_soc;
|
||||
|
||||
$facturestatic->date = $db->jdate($obj->datef);
|
||||
$facturestatic->date_valid = $db->jdate($obj->date_valid);
|
||||
$facturestatic->date_validation = $db->jdate($obj->date_valid);
|
||||
$facturestatic->date_lim_reglement = $db->jdate($obj->datelimite);
|
||||
|
||||
$facturestatic->note_public = $obj->note_public;
|
||||
|
||||
@ -72,13 +72,9 @@ foreach ($linkedObjectBlock as $key => $objectlink) {
|
||||
print '<td class="linkedcol-date center">'.dol_print_date($objectlink->date, 'day').'</td>';
|
||||
print '<td class="linkedcol-amount right nowraponall">';
|
||||
if (!empty($objectlink) && $objectlink->element == 'facture' && $user->hasRight('facture', 'lire')) {
|
||||
$sign = 1;
|
||||
if ($objectlink->type == Facture::TYPE_CREDIT_NOTE) {
|
||||
$sign = -1;
|
||||
}
|
||||
if ($objectlink->statut != 3) {
|
||||
// If not abandonned
|
||||
$total = $total + $sign * $objectlink->total_ht;
|
||||
$total += $objectlink->total_ht;
|
||||
echo price($objectlink->total_ht);
|
||||
} else {
|
||||
echo '<strike>'.price($objectlink->total_ht).'</strike>';
|
||||
|
||||
@ -67,12 +67,11 @@ if ($socid && $socid != $object->thirdparty->id) {
|
||||
|
||||
$error = 0;
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'setnote' && $user->rights->facture->paiement) {
|
||||
if ($action == 'setnote' && $user->hasRight('facture', 'paiement')) {
|
||||
$db->begin();
|
||||
|
||||
$result = $object->update_note(GETPOST('note', 'restricthtml'));
|
||||
@ -142,13 +141,13 @@ if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->facture
|
||||
$invoice = new Facture($db);
|
||||
|
||||
if ($invoice->fetch($objp->facid) <= 0) {
|
||||
$errors++;
|
||||
$error++;
|
||||
setEventMessages($invoice->error, $invoice->errors, 'errors');
|
||||
break;
|
||||
}
|
||||
|
||||
if ($invoice->generateDocument($invoice->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref) < 0) {
|
||||
$errors++;
|
||||
$error++;
|
||||
setEventMessages($invoice->error, $invoice->errors, 'errors');
|
||||
break;
|
||||
}
|
||||
@ -159,12 +158,12 @@ if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->facture
|
||||
|
||||
$db->free($resql);
|
||||
} else {
|
||||
$errors++;
|
||||
$error++;
|
||||
setEventMessages($db->error, $db->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
if (! $errors) {
|
||||
if (! $error) {
|
||||
header('Location: '.$_SERVER['PHP_SELF'].'?id='.$object->id);
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -59,7 +59,7 @@ if (!$sortorder) {
|
||||
$sortorder = "DESC";
|
||||
}
|
||||
if (!$sortfield) {
|
||||
$sortfield = "dp";
|
||||
$sortfield = "bc.date_bordereau";
|
||||
}
|
||||
|
||||
$year = GETPOST("year");
|
||||
@ -94,9 +94,12 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
||||
|
||||
llxHeader('', $langs->trans("ChequesReceipts"));
|
||||
|
||||
$sql = "SELECT bc.rowid, bc.ref as ref, bc.date_bordereau as dp,";
|
||||
$sql = "SELECT bc.rowid, bc.ref, bc.date_bordereau,";
|
||||
$sql .= " bc.nbcheque, bc.amount, bc.statut,";
|
||||
$sql .= " ba.rowid as bid, ba.label";
|
||||
|
||||
$sqlfields = $sql; // $sql fields to remove for count total
|
||||
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."bordereau_cheque as bc,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."bank_account as ba";
|
||||
$sql .= " WHERE bc.fk_bank_account = ba.rowid";
|
||||
@ -114,19 +117,31 @@ if ($search_amount) {
|
||||
}
|
||||
$sql .= dolSqlDateFilter('bc.date_bordereau', 0, $month, $year);
|
||||
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
/* The fast and low memory method to get and count full list converts the sql into a sql count */
|
||||
$sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
|
||||
$sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
|
||||
$resql = $db->query($sqlforcount);
|
||||
if ($resql) {
|
||||
$objforcount = $db->fetch_object($resql);
|
||||
$nbtotalofrecords = $objforcount->nbtotalofrecords;
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
$page = 0;
|
||||
$offset = 0;
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
if ($limit) {
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
}
|
||||
//print "$sql";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
@ -193,7 +208,7 @@ if ($resql) {
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "bc.ref", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("DateCreation", $_SERVER["PHP_SELF"], "dp", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("DateCreation", $_SERVER["PHP_SELF"], "bc.date_bordereau", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("NbOfCheques", $_SERVER["PHP_SELF"], "bc.nbcheque", "", $param, 'class="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "bc.amount", "", $param, 'class="right"', $sortfield, $sortorder);
|
||||
@ -216,7 +231,7 @@ if ($resql) {
|
||||
print '</td>';
|
||||
|
||||
// Date
|
||||
print '<td class="center">'.dol_print_date($db->jdate($objp->dp), 'day').'</td>'; // TODO Use date hour
|
||||
print '<td class="center">'.dol_print_date($db->jdate($objp->date_bordereau), 'day').'</td>'; // TODO Use date hour
|
||||
|
||||
// Bank
|
||||
print '<td>';
|
||||
|
||||
@ -195,6 +195,9 @@ if (GETPOST("orphelins", "alpha")) {
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
|
||||
$sqlfields = $sql; // $sql fields to remove for count total
|
||||
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."paiement as p";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_paiement = c.id";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON p.fk_bank = b.rowid";
|
||||
@ -255,21 +258,33 @@ if (GETPOST("orphelins", "alpha")) {
|
||||
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
}
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
/* The fast and low memory method to get and count full list converts the sql into a sql count */
|
||||
$sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
|
||||
$sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
|
||||
$resql = $db->query($sqlforcount);
|
||||
if ($resql) {
|
||||
$objforcount = $db->fetch_object($resql);
|
||||
$nbtotalofrecords = $objforcount->nbtotalofrecords;
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
// if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
if (($page * $limit) > $nbtotalofrecords) {
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
$page = 0;
|
||||
$offset = 0;
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
// Complete request and execute it with limit
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
if ($limit) {
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
}
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if (!$resql) {
|
||||
|
||||
@ -1209,7 +1209,7 @@ class BonPrelevement extends CommonObject
|
||||
$result = '';
|
||||
|
||||
$labeltoshow = 'PaymentByDirectDebit';
|
||||
if ($this->type == 'bank-transfer') {
|
||||
if (!empty($this->type) && $this->type == 'bank-transfer') {
|
||||
$labeltoshow = 'PaymentByBankTransfer';
|
||||
}
|
||||
|
||||
@ -1221,7 +1221,7 @@ class BonPrelevement extends CommonObject
|
||||
}
|
||||
|
||||
$url = DOL_URL_ROOT.'/compta/prelevement/card.php?id='.$this->id;
|
||||
if ($this->type == 'bank-transfer') {
|
||||
if (!empty($this->type) && $this->type == 'bank-transfer') {
|
||||
$url = DOL_URL_ROOT.'/compta/prelevement/card.php?id='.$this->id;
|
||||
}
|
||||
|
||||
|
||||
@ -62,7 +62,7 @@ if ($sortfield == "") {
|
||||
$sortfield = "pl.fk_soc";
|
||||
}
|
||||
|
||||
$type = $object->type;
|
||||
|
||||
if ($type == 'bank-transfer') {
|
||||
$result = restrictedArea($user, 'paymentbybanktransfer', '', '', '');
|
||||
} else {
|
||||
|
||||
@ -112,6 +112,9 @@ $sql = "SELECT p.rowid, p.ref, p.statut as status, p.datec";
|
||||
$sql .= " , f.rowid as facid, f.ref as invoiceref, f.total_ttc";
|
||||
$sql .= " , s.rowid as socid, s.nom as name, s.code_client, s.code_fournisseur, s.email";
|
||||
$sql .= " , pl.amount, pl.statut as statut_ligne, pl.rowid as rowid_ligne";
|
||||
|
||||
$sqlfields = $sql; // $sql fields to remove for count total
|
||||
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."prelevement as pf";
|
||||
@ -152,20 +155,31 @@ if ($search_company) {
|
||||
$sql .= natural_search("s.nom", $search_company);
|
||||
}
|
||||
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
/* The fast and low memory method to get and count full list converts the sql into a sql count */
|
||||
$sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
|
||||
$sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
|
||||
$resql = $db->query($sqlforcount);
|
||||
if ($resql) {
|
||||
$objforcount = $db->fetch_object($resql);
|
||||
$nbtotalofrecords = $objforcount->nbtotalofrecords;
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
$page = 0;
|
||||
$offset = 0;
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
if ($limit) {
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
}
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
|
||||
@ -97,6 +97,9 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
||||
llxHeader('', $langs->trans("WithdrawalsReceipts"));
|
||||
|
||||
$sql = "SELECT p.rowid, p.ref, p.amount, p.statut, p.datec";
|
||||
|
||||
$sqlfields = $sql; // $sql fields to remove for count total
|
||||
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
|
||||
$sql .= " WHERE p.entity IN (".getEntity('invoice').")";
|
||||
if ($type == 'bank-transfer') {
|
||||
@ -111,20 +114,32 @@ if ($search_amount) {
|
||||
$sql .= natural_search("p.amount", $search_amount, 1);
|
||||
}
|
||||
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
/* The fast and low memory method to get and count full list converts the sql into a sql count */
|
||||
$sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
|
||||
$sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
|
||||
$resql = $db->query($sqlforcount);
|
||||
if ($resql) {
|
||||
$objforcount = $db->fetch_object($resql);
|
||||
$nbtotalofrecords = $objforcount->nbtotalofrecords;
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
$page = 0;
|
||||
$offset = 0;
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
// Complete request and execute it with limit
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
if ($limit) {
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
}
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
|
||||
@ -302,7 +302,7 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
if (!empty($date_start) && !empty($date_end)) {
|
||||
$sql .= " AND f.doc_date >= '".$db->idate($date_start)."' AND f.doc_date <= '".$db->idate($date_end)."'";
|
||||
}
|
||||
$sql .= " GROUP BY pcg_type DESC";
|
||||
$sql .= " GROUP BY pcg_type";
|
||||
if ($showaccountdetail == 'no') {
|
||||
$sql .= ", name, socid"; // group by "accounting group" (INCOME/EXPENSE), then "customer".
|
||||
}
|
||||
|
||||
@ -194,6 +194,9 @@ if (isModEnabled('project')) {
|
||||
$sql .= " c.libelle as type_label, c.accountancy_code as type_accountancy_code,";
|
||||
$sql .= " ba.label as blabel, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.iban_prefix as iban, ba.bic, ba.currency_code, ba.clos,";
|
||||
$sql .= " SUM(pc.amount) as alreadypayed, pay.code as payment_code";
|
||||
|
||||
$sqlfields = $sql; // $sql fields to remove for count total
|
||||
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."chargesociales as cs";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON (cs.fk_account = ba.rowid)";
|
||||
@ -251,14 +254,33 @@ $sql .= " GROUP BY cs.rowid, cs.fk_type, cs.fk_user, cs.amount, cs.date_ech, cs.
|
||||
if (isModEnabled('project')) {
|
||||
$sql .= ", p.rowid, p.ref, p.title";
|
||||
}
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
$totalnboflines = 0;
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$totalnboflines = $db->num_rows($result);
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
/* The fast and low memory method to get and count full list converts the sql into a sql count */
|
||||
$sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
|
||||
$sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
|
||||
$resql = $db->query($sqlforcount);
|
||||
if ($resql) {
|
||||
$objforcount = $db->fetch_object($resql);
|
||||
$nbtotalofrecords = $objforcount->nbtotalofrecords;
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
$page = 0;
|
||||
$offset = 0;
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
|
||||
// Complete request and execute it with limit
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
if ($limit) {
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
}
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if (!$resql) {
|
||||
@ -363,7 +385,7 @@ print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
|
||||
$center = '';
|
||||
|
||||
print_barre_liste($langs->trans("SocialContributions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $totalnboflines, 'bill', 0, $newcardbutton, '', $limit, 0, 0, 1);
|
||||
print_barre_liste($langs->trans("SocialContributions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $nbtotalofrecords, 'bill', 0, $newcardbutton, '', $limit, 0, 0, 1);
|
||||
|
||||
if (empty($mysoc->country_id) && empty($mysoc->country_code)) {
|
||||
print '<div class="error">';
|
||||
|
||||
@ -150,6 +150,9 @@ $sql = 'SELECT t.rowid, t.amount, t.label, t.datev, t.datep, t.paye, t.fk_typepa
|
||||
$sql.= ' ba.label as blabel, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.iban_prefix as iban, ba.bic, ba.currency_code, ba.clos,';
|
||||
$sql.= ' t.num_payment, pst.code as payment_code,';
|
||||
$sql .= ' SUM(ptva.amount) as alreadypayed';
|
||||
|
||||
$sqlfields = $sql; // $sql fields to remove for count total
|
||||
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'tva as t';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as pst ON (t.fk_typepayment = pst.id)';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as ba ON (t.fk_account = ba.rowid)';
|
||||
@ -188,21 +191,33 @@ if ($search_status != '' && $search_status >= 0) {
|
||||
}
|
||||
|
||||
$sql .= " GROUP BY t.rowid, t.amount, t.label, t.datev, t.datep, t.paye, t.fk_typepayment, t.fk_account, ba.label, ba.ref, ba.number, ba.account_number, ba.iban_prefix, ba.bic, ba.currency_code, ba.clos, t.num_payment, pst.code";
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
$resql = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($resql);
|
||||
/* The fast and low memory method to get and count full list converts the sql into a sql count */
|
||||
$sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
|
||||
$sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
|
||||
$resql = $db->query($sqlforcount);
|
||||
if ($resql) {
|
||||
$objforcount = $db->fetch_object($resql);
|
||||
$nbtotalofrecords = $objforcount->nbtotalofrecords;
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
// if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
if (($page * $limit) > $nbtotalofrecords) {
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
$page = 0;
|
||||
$offset = 0;
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
// Complete request and execute it with limit
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
if ($limit) {
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
}
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if (!$resql) {
|
||||
|
||||
@ -86,6 +86,7 @@ $hookmanager->initHooks(array('contactcard', 'globalcard'));
|
||||
|
||||
if ($id > 0) {
|
||||
$object->fetch($id);
|
||||
$object->info($id);
|
||||
}
|
||||
|
||||
if (!($object->id > 0) && $action == 'view') {
|
||||
@ -101,6 +102,9 @@ $permissiontoadd = $user->rights->societe->contact->creer;
|
||||
if ($user->socid) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
if ($object->priv && $object->user_creation->id != $user->id) {
|
||||
accessforbidden();
|
||||
}
|
||||
$result = restrictedArea($user, 'contact', $id, 'socpeople&societe', '', '', 'rowid', 0); // If we create a contact with no company (shared contacts), no check on write permission
|
||||
|
||||
|
||||
|
||||
@ -392,6 +392,9 @@ if (isModEnabled('mailing')) {
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
|
||||
$sqlfields = $sql; // $sql fields to remove for count total
|
||||
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p";
|
||||
if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (p.rowid = ef.fk_object)";
|
||||
@ -623,26 +626,38 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
// Add order
|
||||
if ($view == "recent") {
|
||||
$sql .= $db->order("p.datec", "DESC");
|
||||
} else {
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
}
|
||||
//print $sql;
|
||||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
$resql = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($resql);
|
||||
/* The fast and low memory method to get and count full list converts the sql into a sql count */
|
||||
$sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
|
||||
$sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
|
||||
$resql = $db->query($sqlforcount);
|
||||
if ($resql) {
|
||||
$objforcount = $db->fetch_object($resql);
|
||||
$nbtotalofrecords = $objforcount->nbtotalofrecords;
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
$page = 0;
|
||||
$offset = 0;
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
// Complete request and execute it with limit
|
||||
if ($view == "recent") {
|
||||
$sql .= $db->order("p.datec", "DESC");
|
||||
} else {
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
}
|
||||
if ($limit) {
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
}
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if (!$resql) {
|
||||
|
||||
@ -38,6 +38,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
if (!empty($conf->categorie->enabled)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
}
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('contracts', 'products', 'companies', 'compta'));
|
||||
@ -76,6 +79,13 @@ $search_date_endmonth = GETPOST('search_date_endmonth', 'int');
|
||||
$search_date_endyear = GETPOST('search_date_endyear', 'int');
|
||||
$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver
|
||||
$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
|
||||
$searchCategoryCustomerOperator = 0;
|
||||
if (GETPOSTISSET('formfilteraction')) {
|
||||
$searchCategoryCustomerOperator = GETPOST('search_category_customer_operator', 'int');
|
||||
} elseif (!empty($conf->global->MAIN_SEARCH_CAT_OR_BY_DEFAULT)) {
|
||||
$searchCategoryCustomerOperator = $conf->global->MAIN_SEARCH_CAT_OR_BY_DEFAULT;
|
||||
}
|
||||
$searchCategoryCustomerList = GETPOST('search_category_customer_list', 'array');
|
||||
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
|
||||
@ -206,6 +216,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
||||
$search_status = "";
|
||||
$toselect = array();
|
||||
$search_type_thirdparty = '';
|
||||
$searchCategoryCustomerList = array();
|
||||
$search_array_options = array();
|
||||
}
|
||||
|
||||
@ -349,6 +360,50 @@ if (!empty($searchCategoryProductList)) {
|
||||
}
|
||||
}
|
||||
}
|
||||
$searchCategoryCustomerSqlList = array();
|
||||
if ($searchCategoryCustomerOperator == 1) {
|
||||
$existsCategoryCustomerList = array();
|
||||
foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
|
||||
if (intval($searchCategoryCustomer) == -2) {
|
||||
$sqlCategoryCustomerNotExists = " NOT EXISTS (";
|
||||
$sqlCategoryCustomerNotExists .= " SELECT cat_cus.fk_soc";
|
||||
$sqlCategoryCustomerNotExists .= " FROM ".$db->prefix()."categorie_societe AS cat_cus";
|
||||
$sqlCategoryCustomerNotExists .= " WHERE cat_cus.fk_soc = s.rowid";
|
||||
$sqlCategoryCustomerNotExists .= " )";
|
||||
$searchCategoryCustomerSqlList[] = $sqlCategoryCustomerNotExists;
|
||||
} elseif (intval($searchCategoryCustomer) > 0) {
|
||||
$existsCategoryCustomerList[] = $db->escape($searchCategoryCustomer);
|
||||
}
|
||||
}
|
||||
if (!empty($existsCategoryCustomerList)) {
|
||||
$sqlCategoryCustomerExists = " EXISTS (";
|
||||
$sqlCategoryCustomerExists .= " SELECT cat_cus.fk_soc";
|
||||
$sqlCategoryCustomerExists .= " FROM ".$db->prefix()."categorie_societe AS cat_cus";
|
||||
$sqlCategoryCustomerExists .= " WHERE cat_cus.fk_soc = s.rowid";
|
||||
$sqlCategoryCustomerExists .= " AND cat_cus.fk_categorie IN (".$db->sanitize(implode(',', $existsCategoryCustomerList)).")";
|
||||
$sqlCategoryCustomerExists .= " )";
|
||||
$searchCategoryCustomerSqlList[] = $sqlCategoryCustomerExists;
|
||||
}
|
||||
if (!empty($searchCategoryCustomerSqlList)) {
|
||||
$sql .= " AND (".implode(' OR ', $searchCategoryCustomerSqlList).")";
|
||||
}
|
||||
} else {
|
||||
foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
|
||||
if (intval($searchCategoryCustomer) == -2) {
|
||||
$sqlCategoryCustomerNotExists = " NOT EXISTS (";
|
||||
$sqlCategoryCustomerNotExists .= " SELECT cat_cus.fk_soc";
|
||||
$sqlCategoryCustomerNotExists .= " FROM ".$db->prefix()."categorie_societe AS cat_cus";
|
||||
$sqlCategoryCustomerNotExists .= " WHERE cat_cus.fk_soc = s.rowid";
|
||||
$sqlCategoryCustomerNotExists .= " )";
|
||||
$searchCategoryCustomerSqlList[] = $sqlCategoryCustomerNotExists;
|
||||
} elseif (intval($searchCategoryCustomer) > 0) {
|
||||
$searchCategoryCustomerSqlList[] = "s.rowid IN (SELECT fk_soc FROM ".$db->prefix()."categorie_societe WHERE fk_categorie = ".((int) $searchCategoryCustomer).")";
|
||||
}
|
||||
}
|
||||
if (!empty($searchCategoryCustomerSqlList)) {
|
||||
$sql .= " AND (".implode(' AND ', $searchCategoryCustomerSqlList).")";
|
||||
}
|
||||
}
|
||||
// Add where from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
||||
// Add where from hooks
|
||||
@ -527,6 +582,9 @@ if ($show_files) {
|
||||
if ($optioncss != '') {
|
||||
$param .= '&optioncss='.urlencode($optioncss);
|
||||
}
|
||||
foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
|
||||
$param .= "&search_category_customer_list[]=".urlencode($searchCategoryCustomer);
|
||||
}
|
||||
// Add $param from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||
|
||||
@ -602,6 +660,18 @@ if (isModEnabled('categorie') && $user->rights->categorie->lire && ($user->right
|
||||
$moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$form->selectarray('search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0, '', 0, 0, 0, 0, 'widthcentpercentminusx maxwidth300', 1);
|
||||
$moreforfilter .= '</div>';
|
||||
}
|
||||
// Filter on customer categories
|
||||
if (!empty($conf->global->MAIN_SEARCH_CATEGORY_CUSTOMER_ON_CONTRACT_LIST) && !empty($conf->categorie->enabled) && $user->rights->categorie->lire) {
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$tmptitle = $langs->transnoentities('CustomersProspectsCategoriesShort');
|
||||
$moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"');
|
||||
$categoriesArr = $form->select_all_categories(Categorie::TYPE_CUSTOMER, '', '', 64, 0, 1);
|
||||
$categoriesArr[-2] = '- '.$langs->trans('NotCategorized').' -';
|
||||
$moreforfilter .= Form::multiselectarray('search_category_customer_list', $categoriesArr, $searchCategoryCustomerList, 0, 0, 'minwidth300', 0, 0, '', 'category', $tmptitle);
|
||||
$moreforfilter .= ' <input type="checkbox" class="valignmiddle" id="search_category_customer_operator" name="search_category_customer_operator" value="1"'.($searchCategoryCustomerOperator == 1 ? ' checked="checked"' : '').'/>';
|
||||
$moreforfilter .= $form->textwithpicto('', $langs->trans('UseOrOperatorForCategories') . ' : ' . $tmptitle, 1, 'help', '', 0, 2, 'tooltip_cat_cus'); // Tooltip on click
|
||||
$moreforfilter .= '</div>';
|
||||
}
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
|
||||
@ -44,6 +44,7 @@ if (empty($objectclass) || empty($uploaddir)) {
|
||||
if (empty($massaction)) {
|
||||
$massaction = '';
|
||||
}
|
||||
$error = 0;
|
||||
|
||||
// For backward compatibility
|
||||
if (!empty($permtoread) && empty($permissiontoread)) {
|
||||
|
||||
@ -322,17 +322,17 @@ class CMailFile
|
||||
}
|
||||
|
||||
$this->subject = $subject;
|
||||
$this->addr_to = $to;
|
||||
$this->addr_from = $from;
|
||||
$this->addr_to = dol_sanitizeEmail($to);
|
||||
$this->addr_from = dol_sanitizeEmail($from);
|
||||
$this->msg = $msg;
|
||||
$this->addr_cc = $addr_cc;
|
||||
$this->addr_bcc = $addr_bcc;
|
||||
$this->addr_cc = dol_sanitizeEmail($addr_cc);
|
||||
$this->addr_bcc = dol_sanitizeEmail($addr_bcc);
|
||||
$this->deliveryreceipt = $deliveryreceipt;
|
||||
if (empty($replyto)) {
|
||||
$replyto = $from;
|
||||
$replyto = dol_sanitizeEmail($from);
|
||||
}
|
||||
$this->reply_to = $replyto;
|
||||
$this->errors_to = $errors_to;
|
||||
$this->reply_to = dol_sanitizeEmail($replyto);
|
||||
$this->errors_to = dol_sanitizeEmail($errors_to);
|
||||
$this->trackid = $trackid;
|
||||
// Set arrays with attached files info
|
||||
$this->filename_list = $filename_list;
|
||||
@ -341,7 +341,7 @@ class CMailFile
|
||||
$this->cid_list = $cid_list;
|
||||
|
||||
if (!empty($conf->global->MAIN_MAIL_FORCE_SENDTO)) {
|
||||
$this->addr_to = $conf->global->MAIN_MAIL_FORCE_SENDTO;
|
||||
$this->addr_to = dol_sanitizeEmail($conf->global->MAIN_MAIL_FORCE_SENDTO);
|
||||
$this->addr_cc = '';
|
||||
$this->addr_bcc = '';
|
||||
}
|
||||
|
||||
@ -4978,7 +4978,7 @@ abstract class CommonObject
|
||||
// Line in view mode
|
||||
if ($action != 'editline' || $selected != $line->id) {
|
||||
// Product
|
||||
if ($line->fk_product > 0) {
|
||||
if (!empty($line->fk_product) && $line->fk_product > 0) {
|
||||
$product_static = new Product($this->db);
|
||||
$product_static->fetch($line->fk_product);
|
||||
|
||||
@ -8410,6 +8410,8 @@ abstract class CommonObject
|
||||
$element = 'facture';
|
||||
} elseif ($element == 'invoice_supplier_rec') {
|
||||
return $user->rights->fournisseur->facture;
|
||||
} elseif ($element == 'evaluation') {
|
||||
return $user->rights->hrm->evaluation;
|
||||
}
|
||||
|
||||
return $user->rights->{$element};
|
||||
@ -8957,7 +8959,11 @@ abstract class CommonObject
|
||||
// $this->{$field} may be null, '', 0, '0', 123, '123'
|
||||
if ((isset($this->{$field}) && $this->{$field} != '') || !empty($info['notnull'])) {
|
||||
if (!isset($this->{$field})) {
|
||||
$queryarray[$field] = 0;
|
||||
if (!empty($info['default'])) {
|
||||
$queryarray[$field] = $info['default'];
|
||||
} else {
|
||||
$queryarray[$field] = 0;
|
||||
}
|
||||
} else {
|
||||
$queryarray[$field] = (int) $this->{$field}; // If '0', it may be set to null later if $info['notnull'] == -1
|
||||
}
|
||||
@ -9487,7 +9493,7 @@ abstract class CommonObject
|
||||
* @param User $user User that deletes
|
||||
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
||||
* @param int $forcechilddeletion 0=no, 1=Force deletion of children
|
||||
* @return int <=0 if KO, 0=Nothing done because object has child, >0 if OK
|
||||
* @return int <0 if KO, 0=Nothing done because object has child, >0 if OK
|
||||
*/
|
||||
public function deleteCommon(User $user, $notrigger = false, $forcechilddeletion = 0)
|
||||
{
|
||||
|
||||
@ -9304,7 +9304,7 @@ class Form
|
||||
} elseif ($object->element == 'ecm_directories') {
|
||||
$ret .= '';
|
||||
} elseif ($fieldref != 'none') {
|
||||
$ret .= dol_htmlentities($object->$fieldref);
|
||||
$ret .= dol_htmlentities(!empty($object->$fieldref) ? $object->$fieldref : "");
|
||||
}
|
||||
|
||||
if ($morehtmlref) {
|
||||
|
||||
@ -293,12 +293,17 @@ class FormActions
|
||||
print '</td>';
|
||||
|
||||
$actionstatic = $actioncomm;
|
||||
|
||||
// Example: Email sent from invoice card
|
||||
//$actionstatic->code = 'AC_BILL_SENTBYMAIL
|
||||
//$actionstatic->type_code = 'AC_OTHER_AUTO'
|
||||
|
||||
// Type
|
||||
$labeltype = $actionstatic->type_code;
|
||||
if (empty($conf->global->AGENDA_USE_EVENT_TYPE) && empty($arraylist[$labeltype])) {
|
||||
$labeltype = 'AC_OTH';
|
||||
}
|
||||
if ($actionstatic->type_code == 'AC_OTH' && $actionstatic->code == 'TICKET_MSG') {
|
||||
if (preg_match('/^TICKET_MSG/', $actionstatic->code)) {
|
||||
$labeltype = $langs->trans("Message");
|
||||
} else {
|
||||
if (!empty($arraylist[$labeltype])) {
|
||||
|
||||
@ -1279,7 +1279,7 @@ class FormMail extends Form
|
||||
*
|
||||
* @param DoliDB $dbs Database handler
|
||||
* @param string $type_template Get message for model/type=$type_template, type='all' also included.
|
||||
* @param User $user Get template public or limited to this user
|
||||
* @param User $user Get templates public + limited to this user
|
||||
* @param Translate $outputlangs Output lang object
|
||||
* @param int $id Id of template to get, or -1 for first found with position 0, or 0 for first found whatever is position (priority order depends on lang provided or not) or -2 for exact match with label (no answer if not found)
|
||||
* @param int $active 1=Only active template, 0=Only disabled, -1=All
|
||||
|
||||
@ -66,14 +66,15 @@ class FormProjets
|
||||
* @param int $forcefocus Force focus on field (works with javascript only)
|
||||
* @param int $disabled Disabled
|
||||
* @param int $mode 0 for HTML mode and 1 for JSON mode
|
||||
* @param string $filterkey Key to filter
|
||||
* @param string $filterkey Key to filter on ref or title
|
||||
* @param int $nooutput No print output. Return it only.
|
||||
* @param int $forceaddid Force to add project id in list, event if not qualified
|
||||
* @param string $morecss More css
|
||||
* @param int $htmlid Html id to use instead of htmlname
|
||||
* @param string $morefilter More filters (Must be a sql sanitized string)
|
||||
* @return string Return html content
|
||||
*/
|
||||
public function select_projects($socid = -1, $selected = '', $htmlname = 'projectid', $maxlength = 16, $option_only = 0, $show_empty = 1, $discard_closed = 0, $forcefocus = 0, $disabled = 0, $mode = 0, $filterkey = '', $nooutput = 0, $forceaddid = 0, $morecss = '', $htmlid = '')
|
||||
public function select_projects($socid = -1, $selected = '', $htmlname = 'projectid', $maxlength = 16, $option_only = 0, $show_empty = 1, $discard_closed = 0, $forcefocus = 0, $disabled = 0, $mode = 0, $filterkey = '', $nooutput = 0, $forceaddid = 0, $morecss = '', $htmlid = '', $morefilter = '')
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs, $conf, $form;
|
||||
@ -96,16 +97,14 @@ class FormProjets
|
||||
$selected_input_value = $project->ref;
|
||||
}
|
||||
$urloption = 'socid='.((int) $socid).'&htmlname='.urlencode($htmlname).'&discardclosed='.((int) $discard_closed);
|
||||
|
||||
if ($morefilter == 'usage_organize_event=1') {
|
||||
$urloption .= '&usage_organize_event=1';
|
||||
}
|
||||
$out .= '<input type="text" class="minwidth200'.($morecss ? ' '.$morecss : '').'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' />';
|
||||
|
||||
$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projects.php', $urloption, $conf->global->PROJECT_USE_SEARCH_TO_SELECT, 0, array(
|
||||
// 'update' => array(
|
||||
// 'projectid' => 'id'
|
||||
// )
|
||||
));
|
||||
$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projects.php', $urloption, $conf->global->PROJECT_USE_SEARCH_TO_SELECT, 0, array());
|
||||
} else {
|
||||
$out .= $this->select_projects_list($socid, $selected, $htmlname, $maxlength, $option_only, $show_empty, abs($discard_closed), $forcefocus, $disabled, 0, $filterkey, 1, $forceaddid, $htmlid, $morecss);
|
||||
$out .= $this->select_projects_list($socid, $selected, $htmlname, $maxlength, $option_only, $show_empty, abs($discard_closed), $forcefocus, $disabled, 0, $filterkey, 1, $forceaddid, $htmlid, $morecss, $morefilter);
|
||||
}
|
||||
if ($discard_closed > 0) {
|
||||
if (!empty($form)) {
|
||||
@ -135,14 +134,15 @@ class FormProjets
|
||||
* @param int $forcefocus Force focus on field (works with javascript only)
|
||||
* @param int $disabled Disabled
|
||||
* @param int $mode 0 for HTML mode and 1 for array return (to be used by json_encode for example)
|
||||
* @param string $filterkey Key to filter
|
||||
* @param string $filterkey Key to filter on title or ref
|
||||
* @param int $nooutput No print output. Return it only.
|
||||
* @param int $forceaddid Force to add project id in list, event if not qualified
|
||||
* @param int $htmlid Html id to use instead of htmlname
|
||||
* @param string $morecss More CSS
|
||||
* @param string $morefilter More filters (Must be a sql sanitized string)
|
||||
* @return int Nb of project if OK, <0 if KO
|
||||
*/
|
||||
public function select_projects_list($socid = -1, $selected = '', $htmlname = 'projectid', $maxlength = 24, $option_only = 0, $show_empty = 1, $discard_closed = 0, $forcefocus = 0, $disabled = 0, $mode = 0, $filterkey = '', $nooutput = 0, $forceaddid = 0, $htmlid = '', $morecss = 'maxwidth500')
|
||||
public function select_projects_list($socid = -1, $selected = '', $htmlname = 'projectid', $maxlength = 24, $option_only = 0, $show_empty = 1, $discard_closed = 0, $forcefocus = 0, $disabled = 0, $mode = 0, $filterkey = '', $nooutput = 0, $forceaddid = 0, $htmlid = '', $morecss = 'maxwidth500', $morefilter = '')
|
||||
{
|
||||
// phpcs:enable
|
||||
global $user, $conf, $langs;
|
||||
@ -187,6 +187,9 @@ class FormProjets
|
||||
if (!empty($filterkey)) {
|
||||
$sql .= natural_search(array('p.title', 'p.ref'), $filterkey);
|
||||
}
|
||||
if ($morefilter) {
|
||||
$sql .= ' AND ('.$this->db->sanitize($morefilter, 0, 1).')';
|
||||
}
|
||||
$sql .= " ORDER BY p.ref ASC";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
@ -372,7 +375,7 @@ class FormProjets
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
|
||||
$comboenhancement = ajax_combobox($htmlname, '', 0, $forcefocus);
|
||||
$out .= $comboenhancement;
|
||||
$morecss = 'minwidth200 maxwidth500';
|
||||
$morecss .= ' minwidth200 maxwidth500';
|
||||
}
|
||||
|
||||
if (empty($option_only)) {
|
||||
|
||||
@ -175,7 +175,7 @@ class FormTicket
|
||||
print dol_get_fiche_head(null, 'card', '', 0, '');
|
||||
}
|
||||
|
||||
print '<form method="POST" '.($withdolfichehead ? '' : 'style="margin-bottom: 30px;" ').'name="ticket" id="form_create_ticket" enctype="multipart/form-data" action="'.(!empty($this->param["returnurl"]) ? $this->param["returnurl"] : "").'">';
|
||||
print '<form method="POST" '.($withdolfichehead ? '' : 'style="margin-bottom: 30px;" ').'name="ticket" id="form_create_ticket" enctype="multipart/form-data" action="'.(!empty($this->param["returnurl"]) ? $this->param["returnurl"] : $_SERVER['PHP_SELF']).'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="'.$this->action.'">';
|
||||
foreach ($this->param as $key => $value) {
|
||||
|
||||
@ -136,15 +136,12 @@ abstract class DoliDB implements Database
|
||||
*
|
||||
* @param string $stringtosanitize String to escape
|
||||
* @param int $allowsimplequote 1=Allow simple quotes in string. When string is used as a list of SQL string ('aa', 'bb', ...)
|
||||
* @param string $allowsequals 1=Allow equals sign
|
||||
* @return string String escaped
|
||||
*/
|
||||
public function sanitize($stringtosanitize, $allowsimplequote = 0)
|
||||
public function sanitize($stringtosanitize, $allowsimplequote = 0, $allowsequals = 0)
|
||||
{
|
||||
if ($allowsimplequote) {
|
||||
return preg_replace('/[^a-z0-9_\-\.,\']/i', '', $stringtosanitize);
|
||||
} else {
|
||||
return preg_replace('/[^a-z0-9_\-\.,]/i', '', $stringtosanitize);
|
||||
}
|
||||
return preg_replace('/[^a-z0-9_\-\.,'.($allowsequals ? '=' : '').($allowsimplequote ? "\'" : '').']/i', '', $stringtosanitize);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -130,7 +130,10 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen
|
||||
$("#search_'.$htmlnamejquery.'").val(item.value);
|
||||
$("#'.$htmlnamejquery.'").val(item.key).trigger("change");
|
||||
}
|
||||
var label = item.label.toString();
|
||||
var label = "";
|
||||
if (item.label != null) {
|
||||
label = item.label.toString();
|
||||
}
|
||||
var update = {};
|
||||
if (options.update) {
|
||||
$.each(options.update, function(key, value) {
|
||||
|
||||
@ -1123,6 +1123,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as t";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople_extrafields as ef on (t.rowid = ef.fk_object)";
|
||||
$sql .= " WHERE t.fk_soc = ".((int) $object->id);
|
||||
$sql .= " AND ((t.fk_user_creat = ".((int) $user->id)." AND t.priv = 1) OR t.priv = 0)";
|
||||
if ($search_rowid) {
|
||||
$sql .= natural_search('t.rowid', $search_rowid);
|
||||
}
|
||||
@ -1575,7 +1576,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
|
||||
$sql .= ", ".MAIN_DB_PREFIX."bom_bom as o";
|
||||
} elseif (is_object($filterobj) && get_class($filterobj) == 'Contrat') {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."contrat as o";
|
||||
} elseif (is_object($filterobj) && is_array($filterobj->fields) && is_array($filterobj->fields['rowid']) && (is_array($filterobj->fields['ref']) || is_array($filterobj->fields['label'])) && $filterobj->table_element && $filterobj->element) {
|
||||
} elseif (is_object($filterobj) && is_array($filterobj->fields) && is_array($filterobj->fields['rowid']) && (!empty($filterobj->fields['ref']) && is_array($filterobj->fields['ref']) || $filterobj->fields['label'] && is_array($filterobj->fields['label'])) && $filterobj->table_element && $filterobj->element) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX.$filterobj->table_element." as o";
|
||||
}
|
||||
|
||||
@ -1617,7 +1618,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
|
||||
if ($filterobj->id) {
|
||||
$sql .= " AND a.fk_element = ".((int) $filterobj->id);
|
||||
}
|
||||
} elseif (is_object($filterobj) && is_array($filterobj->fields) && is_array($filterobj->fields['rowid']) && (is_array($filterobj->fields['ref']) || is_array($filterobj->fields['label'])) && $filterobj->table_element && $filterobj->element) {
|
||||
} elseif (is_object($filterobj) && is_array($filterobj->fields) && is_array($filterobj->fields['rowid']) && (!empty($filterobj->fields['ref']) && is_array($filterobj->fields['ref']) || $filterobj->fields['label'] && is_array($filterobj->fields['label'])) && $filterobj->table_element && $filterobj->element) {
|
||||
// Generic case
|
||||
$sql .= " AND a.fk_element = o.rowid AND a.elementtype = '".$db->escape($filterobj->element).($module ? "@".$module : "")."'";
|
||||
if ($filterobj->id) {
|
||||
@ -1896,7 +1897,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
|
||||
if (empty($conf->global->AGENDA_USE_EVENT_TYPE) && empty($arraylist[$labeltype])) {
|
||||
$labeltype = 'AC_OTH';
|
||||
}
|
||||
if ($actionstatic->type_code == 'AC_OTH' && $actionstatic->code == 'TICKET_MSG') {
|
||||
if (preg_match('/^TICKET_MSG/', $actionstatic->code)) {
|
||||
$labeltype = $langs->trans("Message");
|
||||
} else {
|
||||
if (!empty($arraylist[$labeltype])) {
|
||||
|
||||
@ -1657,7 +1657,12 @@ function dol_add_file_process($upload_dir, $allowoverwrite = 0, $donotupdatesess
|
||||
|
||||
if (!empty($_FILES[$varfiles])) { // For view $_FILES[$varfiles]['error']
|
||||
dol_syslog('dol_add_file_process upload_dir='.$upload_dir.' allowoverwrite='.$allowoverwrite.' donotupdatesession='.$donotupdatesession.' savingdocmask='.$savingdocmask, LOG_DEBUG);
|
||||
|
||||
$maxfilesinform = getDolGlobalInt("MAIN_SECURITY_MAX_ATTACHMENT_ON_FORMS", 10);
|
||||
if (is_array($_FILES[$varfiles]["name"]) && count($_FILES[$varfiles]["name"]) > $maxfilesinform) {
|
||||
$langs->load("errors"); // key must be loaded because we can't rely on loading during output, we need var substitution to be done now.
|
||||
setEventMessages($langs->trans("ErrorTooMuchFileInForm", $maxfilesinform), null, "errors");
|
||||
return -1;
|
||||
}
|
||||
$result = dol_mkdir($upload_dir);
|
||||
// var_dump($result);exit;
|
||||
if ($result >= 0) {
|
||||
|
||||
@ -178,7 +178,10 @@ function ordersupplier_prepare_head(CommandeFournisseur $object)
|
||||
$sumQtyAllreadyDispatched = $sumQtyAllreadyDispatched + $dispachedLines[$line]['qty'];
|
||||
}
|
||||
for ($line = 0 ; $line < $nbLinesOrdered; $line++) {
|
||||
$sumQtyOrdered = $sumQtyOrdered + $object->lines[$line]->qty;
|
||||
//If line is a product of conf to manage stocks for services
|
||||
if ($object->lines[$line]->product_type == 0 || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
|
||||
$sumQtyOrdered = $sumQtyOrdered + $object->lines[$line]->qty;
|
||||
}
|
||||
}
|
||||
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.price2num($sumQtyAllreadyDispatched, 'MS').' / '.price2num($sumQtyOrdered, 'MS').'</span>';
|
||||
}
|
||||
|
||||
@ -908,63 +908,7 @@ function sanitizeVal($out = '', $check = 'alphanohtml', $filter = null, $options
|
||||
break;
|
||||
case 'restricthtml': // Recommended for most html textarea
|
||||
case 'restricthtmlallowunvalid':
|
||||
do {
|
||||
$oldstringtoclean = $out;
|
||||
|
||||
if (!empty($out) && !empty($conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML) && $check != 'restricthtmlallowunvalid') {
|
||||
try {
|
||||
$dom = new DOMDocument;
|
||||
// Add a trick to solve pb with text without parent tag
|
||||
// like '<h1>Foo</h1><p>bar</p>' that ends up with '<h1>Foo<p>bar</p></h1>'
|
||||
// like 'abc' that ends up with '<p>abc</p>'
|
||||
$out = '<div class="tricktoremove">'.$out.'</div>';
|
||||
|
||||
$dom->loadHTML($out, LIBXML_ERR_NONE|LIBXML_HTML_NOIMPLIED|LIBXML_HTML_NODEFDTD|LIBXML_NONET|LIBXML_NOWARNING|LIBXML_NOXMLDECL);
|
||||
$out = trim($dom->saveHTML());
|
||||
|
||||
// Remove the trick added to solve pb with text without parent tag
|
||||
$out = preg_replace('/^<div class="tricktoremove">/', '', $out);
|
||||
$out = preg_replace('/<\/div>$/', '', $out);
|
||||
} catch (Exception $e) {
|
||||
//print $e->getMessage();
|
||||
return 'InvalidHTMLString';
|
||||
}
|
||||
}
|
||||
|
||||
// Ckeditor use the numeric entitic for apostrophe so we force it to text entity (all other special chars are
|
||||
// encoded using text entities) so we can then exclude all numeric entities.
|
||||
$out = preg_replace('/'/i', ''', $out);
|
||||
|
||||
// We replace chars from a/A to z/Z encoded with numeric HTML entities with the real char so we won't loose the chars at the next step (preg_replace).
|
||||
// No need to use a loop here, this step is not to sanitize (this is done at next step, this is to try to save chars, even if they are
|
||||
// using a non coventionnel way to be encoded, to not have them sanitized just after)
|
||||
//$out = preg_replace_callback('/&#(x?[0-9][0-9a-f]+;?)/i', 'realCharForNumericEntities', $out);
|
||||
$out = preg_replace_callback('/&#(x?[0-9][0-9a-f]+;?)/i', function ($m) {
|
||||
return realCharForNumericEntities($m); }, $out);
|
||||
|
||||
|
||||
// Now we remove all remaining HTML entities starting with a number. We don't want such entities.
|
||||
$out = preg_replace('/&#x?[0-9]+/i', '', $out); // For example if we have javascript with an entities without the ; to hide the 'a' of 'javascript'.
|
||||
|
||||
$out = dol_string_onlythesehtmltags($out, 0, 1, 1);
|
||||
|
||||
// We should also exclude non expected HTML attributes and clean content of some attributes.
|
||||
if (!empty($conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES)) {
|
||||
// Warning, the function may add a LF so we are forced to trim to compare with old $out without having always a difference and an infinit loop.
|
||||
$out = dol_string_onlythesehtmlattributes($out);
|
||||
}
|
||||
|
||||
// Restore entity ' into ' (restricthtml is for html content so we can use html entity)
|
||||
$out = preg_replace('/'/i', "'", $out);
|
||||
} while ($oldstringtoclean != $out);
|
||||
|
||||
// Check the limit of external links in a Rich text content. We count '<img' and 'url('
|
||||
$reg = array();
|
||||
preg_match_all('/(<img|url\()/i', $out, $reg);
|
||||
if (count($reg[0]) > getDolGlobalInt("MAIN_SECURITY_MAX_IMG_IN_HTML_CONTENT", 1000)) {
|
||||
return 'TooManyLinksIntoHTMLString';
|
||||
}
|
||||
|
||||
$out = dol_htmlwithnojs($out, 1, $check);
|
||||
break;
|
||||
case 'custom':
|
||||
if (!empty($out)) {
|
||||
@ -1314,6 +1258,22 @@ function dol_sanitizeUrl($stringtoclean, $type = 1)
|
||||
return $stringtoclean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean a string to use it as an Email.
|
||||
*
|
||||
* @param string $stringtoclean String to clean. Example 'abc@mycompany.com <My name>'
|
||||
* @return string Escaped string.
|
||||
*/
|
||||
function dol_sanitizeEmail($stringtoclean)
|
||||
{
|
||||
do {
|
||||
$oldstringtoclean = $stringtoclean;
|
||||
$stringtoclean = str_ireplace(array('"', ':', '[', ']',"\n", "\r", '\\', '\/'), '', $stringtoclean);
|
||||
} while ($oldstringtoclean != $stringtoclean);
|
||||
|
||||
return $stringtoclean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean a string from all accent characters to be used as ref, login or by dol_sanitizeFileName
|
||||
*
|
||||
@ -1813,7 +1773,7 @@ function dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $di
|
||||
* @param array $links Array of tabs (0=>url, 1=>label, 2=>code, 3=>not used, 4=>text after link, 5=>morecssonlink). Currently initialized by calling a function xxx_admin_prepare_head. Note that label into $links[$i][1] must be already HTML escaped.
|
||||
* @param string $active Active tab name (document', 'info', 'ldap', ....)
|
||||
* @param string $title Title
|
||||
* @param int $notab -1 or 0=Add tab header, 1=no tab header (if you set this to 1, using print dol_get_fiche_end() to close tab is not required), -2=Add tab header with no seaparation under tab (to start a tab just after)
|
||||
* @param int $notab -1 or 0=Add tab header, 1=no tab header (if you set this to 1, using print dol_get_fiche_end() to close tab is not required), -2=Add tab header with no sepaaration under tab (to start a tab just after), -3=Add tab header but no footer separation
|
||||
* @param string $picto Add a picto on tab title
|
||||
* @param int $pictoisfullpath If 1, image path is a full path. If you set this to 1, you can use url returned by dol_buildpath('/mymodyle/img/myimg.png',1) for $picto.
|
||||
* @param string $morehtmlright Add more html content on right of tabs title
|
||||
@ -2297,11 +2257,13 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
|
||||
$tmptxt = $object->getLibStatut(5);
|
||||
$morehtmlstatus .= $tmptxt; // No status on task
|
||||
} else { // Generic case
|
||||
$tmptxt = $object->getLibStatut(6);
|
||||
if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3)) {
|
||||
$tmptxt = $object->getLibStatut(5);
|
||||
if (isset($object->status)) {
|
||||
$tmptxt = $object->getLibStatut(6);
|
||||
if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3)) {
|
||||
$tmptxt = $object->getLibStatut(5);
|
||||
}
|
||||
$morehtmlstatus .= $tmptxt;
|
||||
}
|
||||
$morehtmlstatus .= $tmptxt;
|
||||
}
|
||||
|
||||
// Add if object was dispatched "into accountancy"
|
||||
@ -7131,6 +7093,88 @@ function dol_nl2br($stringtoencode, $nl2brmode = 0, $forxml = false)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitize a HTML to remove js and dangerous content
|
||||
*
|
||||
* @param string $stringtoencode String to encode
|
||||
* @param int $nouseofiframesandbox Allow use of option MAIN_SECURITY_USE_SANDBOX_FOR_HTMLWITHNOJS for html sanitizing
|
||||
* @param string $check 'restricthtml' or 'restricthtmlallowunvalid'
|
||||
* @return string HTML sanitized
|
||||
*/
|
||||
function dol_htmlwithnojs($stringtoencode, $nouseofiframesandbox = 0, $check = 'restricthtml')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
if (empty($nouseofiframesandbox) && !empty($conf->global->MAIN_SECURITY_USE_SANDBOX_FOR_HTMLWITHNOJS)) {
|
||||
// TODO using sandbox on inline html content is not possible yet with current browsers
|
||||
//$s = '<iframe class="iframewithsandbox" sandbox><html><body>';
|
||||
//$s .= $stringtoencode;
|
||||
//$s .= '</body></html></iframe>';
|
||||
return $stringtoencode;
|
||||
} else {
|
||||
$out = $stringtoencode;
|
||||
|
||||
do {
|
||||
$oldstringtoclean = $out;
|
||||
|
||||
if (!empty($out) && !empty($conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML) && $check != 'restricthtmlallowunvalid') {
|
||||
try {
|
||||
$dom = new DOMDocument;
|
||||
// Add a trick to solve pb with text without parent tag
|
||||
// like '<h1>Foo</h1><p>bar</p>' that wrongly ends up without the trick into '<h1>Foo<p>bar</p></h1>'
|
||||
// like 'abc' that wrongly ends up without the tric into with '<p>abc</p>'
|
||||
$out = '<div class="tricktoremove">'.$out.'</div>';
|
||||
|
||||
$dom->loadHTML($out, LIBXML_ERR_NONE|LIBXML_HTML_NOIMPLIED|LIBXML_HTML_NODEFDTD|LIBXML_NONET|LIBXML_NOWARNING|LIBXML_NOXMLDECL);
|
||||
$out = trim($dom->saveHTML());
|
||||
|
||||
// Remove the trick added to solve pb with text without parent tag
|
||||
$out = preg_replace('/^<div class="tricktoremove">/', '', $out);
|
||||
$out = preg_replace('/<\/div>$/', '', $out);
|
||||
} catch (Exception $e) {
|
||||
// If error, invalid HTML string with no way to clean it
|
||||
//print $e->getMessage();
|
||||
$out = 'InvalidHTMLString';
|
||||
}
|
||||
}
|
||||
|
||||
// Ckeditor use the numeric entitic for apostrophe so we force it to text entity (all other special chars are
|
||||
// encoded using text entities) so we can then exclude all numeric entities.
|
||||
$out = preg_replace('/'/i', ''', $out);
|
||||
|
||||
// We replace chars from a/A to z/Z encoded with numeric HTML entities with the real char so we won't loose the chars at the next step (preg_replace).
|
||||
// No need to use a loop here, this step is not to sanitize (this is done at next step, this is to try to save chars, even if they are
|
||||
// using a non coventionnel way to be encoded, to not have them sanitized just after)
|
||||
//$out = preg_replace_callback('/&#(x?[0-9][0-9a-f]+;?)/i', 'realCharForNumericEntities', $out);
|
||||
$out = preg_replace_callback('/&#(x?[0-9][0-9a-f]+;?)/i', function ($m) {
|
||||
return realCharForNumericEntities($m); }, $out);
|
||||
|
||||
|
||||
// Now we remove all remaining HTML entities starting with a number. We don't want such entities.
|
||||
$out = preg_replace('/&#x?[0-9]+/i', '', $out); // For example if we have javascript with an entities without the ; to hide the 'a' of 'javascript'.
|
||||
|
||||
$out = dol_string_onlythesehtmltags($out, 0, 1, 1);
|
||||
|
||||
// We should also exclude non expected HTML attributes and clean content of some attributes.
|
||||
if (!empty($conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES)) {
|
||||
// Warning, the function may add a LF so we are forced to trim to compare with old $out without having always a difference and an infinit loop.
|
||||
$out = dol_string_onlythesehtmlattributes($out);
|
||||
}
|
||||
|
||||
// Restore entity ' into ' (restricthtml is for html content so we can use html entity)
|
||||
$out = preg_replace('/'/i', "'", $out);
|
||||
} while ($oldstringtoclean != $out);
|
||||
|
||||
// Check the limit of external links in a Rich text content. We count '<img' and 'url('
|
||||
$reg = array();
|
||||
preg_match_all('/(<img|url\()/i', $out, $reg);
|
||||
if (count($reg[0]) > getDolGlobalInt("MAIN_SECURITY_MAX_IMG_IN_HTML_CONTENT", 1000)) {
|
||||
$out = 'TooManyLinksIntoHTMLString';
|
||||
}
|
||||
|
||||
return $out;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is called to encode a string into a HTML string but differs from htmlentities because
|
||||
@ -7608,7 +7652,11 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
|
||||
$substitutionarray['__REF_SUPPLIER__'] = (isset($object->ref_supplier) ? $object->ref_supplier : null);
|
||||
$substitutionarray['__NOTE_PUBLIC__'] = (isset($object->note_public) ? $object->note_public : null);
|
||||
$substitutionarray['__NOTE_PRIVATE__'] = (isset($object->note_private) ? $object->note_private : null);
|
||||
$substitutionarray['__DATE_DELIVERY__'] = (isset($object->date_livraison) ? dol_print_date($object->date_livraison, 'day', 0, $outputlangs) : '');
|
||||
if ($object->element == "shipping") {
|
||||
$substitutionarray['__DATE_DELIVERY__'] = (isset($object->date_delivery) ? dol_print_date($object->date_delivery, 'day', 0, $outputlangs) : '');
|
||||
} else {
|
||||
$substitutionarray['__DATE_DELIVERY__'] = (isset($object->date_livraison) ? dol_print_date($object->date_livraison, 'day', 0, $outputlangs) : '');
|
||||
}
|
||||
$substitutionarray['__DATE_DELIVERY_DAY__'] = (isset($object->date_livraison) ? dol_print_date($object->date_livraison, "%d") : '');
|
||||
$substitutionarray['__DATE_DELIVERY_DAY_TEXT__'] = (isset($object->date_livraison) ? dol_print_date($object->date_livraison, "%A") : '');
|
||||
$substitutionarray['__DATE_DELIVERY_MON__'] = (isset($object->date_livraison) ? dol_print_date($object->date_livraison, "%m") : '');
|
||||
@ -9316,7 +9364,7 @@ function complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type,
|
||||
|
||||
// No need to make a return $head. Var is modified as a reference
|
||||
if (!empty($hookmanager)) {
|
||||
$parameters = array('object' => $object, 'mode' => $mode, 'head' => &$head);
|
||||
$parameters = array('object' => $object, 'mode' => $mode, 'head' => &$head, 'filterorigmodule' => $filterorigmodule);
|
||||
$reshook = $hookmanager->executeHooks('completeTabsHead', $parameters);
|
||||
if ($reshook > 0) { // Hook ask to replace completely the array
|
||||
$head = $hookmanager->resArray;
|
||||
@ -11450,9 +11498,9 @@ function getTimelineIcon($actionstatic, &$histo, $key)
|
||||
$iconClass = 'fa fa-ticket';
|
||||
} elseif ($actionstatic->code == 'AC_TICKET_MODIFY') {
|
||||
$iconClass = 'fa fa-pencilxxx';
|
||||
} elseif ($actionstatic->code == 'TICKET_MSG') {
|
||||
} elseif (preg_match('/^TICKET_MSG/', $actionstatic->code)) {
|
||||
$iconClass = 'fa fa-comments';
|
||||
} elseif ($actionstatic->code == 'TICKET_MSG_PRIVATE') {
|
||||
} elseif (preg_match('/^TICKET_MSG_PRIVATE/', $actionstatic->code)) {
|
||||
$iconClass = 'fa fa-mask';
|
||||
} elseif (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
|
||||
if ($actionstatic->type_picto) {
|
||||
@ -11997,9 +12045,9 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = '', $n
|
||||
// Title
|
||||
$out .= ' <span class="messaging-title">';
|
||||
|
||||
if ($actionstatic->code == 'TICKET_MSG') {
|
||||
if (preg_match('/^TICKET_MSG/', $actionstatic->code)) {
|
||||
$out .= $langs->trans('TicketNewMessage');
|
||||
} elseif ($actionstatic->code == 'TICKET_MSG_PRIVATE') {
|
||||
} elseif (preg_match('/^TICKET_MSG_PRIVATE/', $actionstatic->code)) {
|
||||
$out .= $langs->trans('TicketNewMessage').' <em>('.$langs->trans('Private').')</em>';
|
||||
} else {
|
||||
if (isset($histo[$key]['type']) && $histo[$key]['type'] == 'action') {
|
||||
|
||||
@ -1215,7 +1215,7 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $
|
||||
} elseif ($yearlen == 2) {
|
||||
$yearcomp = sprintf("%02d", date("y", $date) + $yearoffset);
|
||||
} elseif ($yearlen == 1) {
|
||||
$yearcomp = substr(date("y", $date), 2, 1) + $yearoffset;
|
||||
$yearcomp = substr(date('y', $date), 1, 1) + $yearoffset;
|
||||
}
|
||||
if ($monthcomp > 1 && empty($resetEveryMonth)) { // Test with month is useless if monthcomp = 0 or 1 (0 is same as 1) (regis: $monthcomp can't equal 0)
|
||||
if ($yearlen == 4) {
|
||||
|
||||
@ -356,7 +356,7 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir = '
|
||||
}
|
||||
}
|
||||
}
|
||||
$texttoinsert .= (($val['notnull'] > 0) ? ' NOT NULL' : '');
|
||||
$texttoinsert .= ((!empty($val['notnull']) && $val['notnull'] > 0) ? ' NOT NULL' : '');
|
||||
if ($i < count($object->fields)) {
|
||||
$texttoinsert .= ", ";
|
||||
}
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
* Copyright (C) 2015-2016 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2019 Lenin Rivas <lenin.rivas@servcom-it.com>
|
||||
* Copyright (C) 2020 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
* Copyright (C) 2021-2022 Anthony Berton <bertonanthony@gmail.com>
|
||||
* Copyright (C) 2021-2022 Anthony Berton <anthony.berton@bb2a.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -400,9 +400,16 @@ function pdfBuildThirdpartyName($thirdparty, Translate $outputlangs, $includeali
|
||||
}
|
||||
}
|
||||
} elseif ($thirdparty instanceof Contact) {
|
||||
$socname = $thirdparty->socname;
|
||||
if (($includealias || getDolGlobalInt('PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME')) && !empty($thirdparty->name_alias)) {
|
||||
// TODO PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME not completely implemented
|
||||
if ($thirdparty->socid > 0) {
|
||||
$thirdparty->fetch_thirdparty();
|
||||
$socname = $thirdparty->thirdparty->name;
|
||||
if (($includealias || getDolGlobalInt('PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME')) && !empty($thirdparty->thirdparty->name_alias)) {
|
||||
if (getDolGlobalInt('PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME') == 2) {
|
||||
$socname = $thirdparty->thirdparty->name_alias." - ".$thirdparty->thirdparty->name;
|
||||
} else {
|
||||
$socname = $thirdparty->thirdparty->name." - ".$thirdparty->thirdparty->name_alias;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new InvalidArgumentException('Parameter 1 $thirdparty is not a Societe nor Contact');
|
||||
|
||||
@ -192,8 +192,8 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
|
||||
|
||||
// initialize total (may be HT or TTC depending on price_base_type)
|
||||
$tot_sans_remise = $pu * $qty * $progress / 100;
|
||||
$tot_avec_remise_ligne = $tot_sans_remise * (1 - ($remise_percent_ligne / 100));
|
||||
$tot_avec_remise = $tot_avec_remise_ligne * (1 - ($remise_percent_global / 100));
|
||||
$tot_avec_remise_ligne = $tot_sans_remise * (1 - ((float) $remise_percent_ligne / 100));
|
||||
$tot_avec_remise = $tot_avec_remise_ligne * (1 - ((float) $remise_percent_global / 100));
|
||||
|
||||
// initialize result array
|
||||
for ($i = 0; $i <= 15; $i++) {
|
||||
|
||||
@ -722,11 +722,31 @@ function checkPHPCode($phpfullcodestringold, $phpfullcodestring)
|
||||
setEventMessages($langs->trans("DynamicPHPCodeContainsAForbiddenInstruction", '$...('), null, 'errors');
|
||||
}
|
||||
|
||||
if (!$error && empty($user->rights->website->writephp)) {
|
||||
if ($phpfullcodestringold != $phpfullcodestring) {
|
||||
if ($phpfullcodestringold != $phpfullcodestring) {
|
||||
if (!$error && empty($user->rights->website->writephp)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("NotAllowedToAddDynamicContent"), null, 'errors');
|
||||
}
|
||||
if (!$error) {
|
||||
$dolibarrdataroot = preg_replace('/([\\/]+)$/i', '', DOL_DATA_ROOT);
|
||||
$allowimportsite = true;
|
||||
if (dol_is_file($dolibarrdataroot.'/installmodules.lock')) {
|
||||
$allowimportsite = false;
|
||||
}
|
||||
|
||||
if (!$allowimportsite) {
|
||||
$error++;
|
||||
// Blocked by installmodules.lock
|
||||
if (getDolGlobalString('MAIN_MESSAGE_INSTALL_MODULES_DISABLED_CONTACT_US')) {
|
||||
// Show clean corporate message
|
||||
$message = $langs->trans('InstallModuleFromWebHasBeenDisabledContactUs');
|
||||
} else {
|
||||
// Show technical generic message
|
||||
$message = $langs->trans("InstallModuleFromWebHasBeenDisabledByFile", $dolibarrdataroot.'/installmodules.lock');
|
||||
}
|
||||
setEventMessages($message, null, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $error;
|
||||
|
||||
@ -126,7 +126,7 @@ class html_cerfafr extends ModeleDon
|
||||
} else {
|
||||
$paymentmode = '';
|
||||
}
|
||||
$modepaymentcode = $formclass->cache_types_paiements[$don->modepaymentid]['code'];
|
||||
$modepaymentcode = !empty($formclass->cache_types_paiements[$don->modepaymentid]['code']) ? $formclass->cache_types_paiements[$don->modepaymentid]['code'] : "";
|
||||
if ($modepaymentcode == 'CHQ') {
|
||||
$ModePaiement = '<td width="25%"><input type="checkbox"> Remise d\'espèces</td><td width="25%"><input type="checkbox" disabled="true" checked="checked"> Chèque</td><td width="50%"><input type="checkbox"> Virement, prélèvement, carte bancaire</td>';
|
||||
} elseif ($modepaymentcode == 'LIQ') {
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2017-2018 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2022 Anthony Berton <anthony.berton@bb2a.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -579,7 +580,8 @@ class pdf_crabe extends ModelePDFFactures
|
||||
$pdf->useTemplate($tplidx);
|
||||
}
|
||||
if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
|
||||
$this->_pagehead($pdf, $object, 0, $outputlangs);
|
||||
$top_shift = $this->_pagehead($pdf, $object, 0, $outputlangs);
|
||||
$tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
|
||||
}
|
||||
$pdf->setPage($pageposbefore + 1);
|
||||
|
||||
@ -622,7 +624,8 @@ class pdf_crabe extends ModelePDFFactures
|
||||
$pdf->useTemplate($tplidx);
|
||||
}
|
||||
if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
|
||||
$this->_pagehead($pdf, $object, 0, $outputlangs);
|
||||
$top_shift = $this->_pagehead($pdf, $object, 0, $outputlangs);
|
||||
$tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
|
||||
}
|
||||
$pdf->setPage($pageposafter + 1);
|
||||
}
|
||||
@ -798,7 +801,8 @@ class pdf_crabe extends ModelePDFFactures
|
||||
$pdf->setPage($pagenb);
|
||||
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
|
||||
if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
|
||||
$this->_pagehead($pdf, $object, 0, $outputlangs);
|
||||
$top_shift = $this->_pagehead($pdf, $object, 0, $outputlangs);
|
||||
$tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
|
||||
}
|
||||
if (!empty($tplidx)) {
|
||||
$pdf->useTemplate($tplidx);
|
||||
@ -818,7 +822,8 @@ class pdf_crabe extends ModelePDFFactures
|
||||
}
|
||||
$pagenb++;
|
||||
if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
|
||||
$this->_pagehead($pdf, $object, 0, $outputlangs);
|
||||
$top_shift = $this->_pagehead($pdf, $object, 0, $outputlangs);
|
||||
$tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -943,7 +948,8 @@ class pdf_crabe extends ModelePDFFactures
|
||||
$pdf->useTemplate($tplidx);
|
||||
}
|
||||
if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
|
||||
$this->_pagehead($pdf, $object, 0, $outputlangs);
|
||||
$top_shift = $this->_pagehead($pdf, $object, 0, $outputlangs);
|
||||
$tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
|
||||
}
|
||||
$pdf->setPage($current_page);
|
||||
$this->_tableau_versements_header($pdf, $object, $outputlangs, $default_font_size, $tab3_posx, $tab3_top + $y - 3, $tab3_width, $tab3_height);
|
||||
@ -1005,7 +1011,8 @@ class pdf_crabe extends ModelePDFFactures
|
||||
$pdf->useTemplate($tplidx);
|
||||
}
|
||||
if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
|
||||
$this->_pagehead($pdf, $object, 0, $outputlangs);
|
||||
$top_shift = $this->_pagehead($pdf, $object, 0, $outputlangs);
|
||||
$tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
|
||||
}
|
||||
$pdf->setPage($current_page);
|
||||
$this->_tableau_versements_header($pdf, $object, $outputlangs, $default_font_size, $tab3_posx, $tab3_top + $y - 3, $tab3_width, $tab3_height);
|
||||
@ -1180,7 +1187,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
// Decret n°2099-1299 2022-10-07
|
||||
// French mention : "Option pour le paiement de la taxe d'après les débits"
|
||||
if ($this->emetteur->country_code == 'FR') {
|
||||
if ($conf->global->TAX_MODE == 1) {
|
||||
if (isset($conf->global->TAX_MODE) && $conf->global->TAX_MODE == 1) {
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
$pdf->writeHTMLCell(80, 5, '', '', $outputlangs->transnoentities("MentionVATDebitOptionIsOn"), 0, 1);
|
||||
|
||||
@ -2056,6 +2063,43 @@ class pdf_crabe extends ModelePDFFactures
|
||||
$pdf->SetFont('', '', $default_font_size - 1);
|
||||
$pdf->SetXY($posx + 2, $posy);
|
||||
$pdf->MultiCell($widthrecbox - 2, 4, $carac_client, 0, $ltrdirection);
|
||||
|
||||
// Show shipping address
|
||||
if (getDolGlobalInt('INVOICE_SHOW_SHIPPING_ADDRESS')) {
|
||||
$idaddressshipping = $object->getIdContact('external', 'SHIPPING');
|
||||
|
||||
if (!empty($idaddressshipping)) {
|
||||
$contactshipping = $object->fetch_Contact($idaddressshipping[0]);
|
||||
$object->fetch_thirdparty($object->contact->fk_soc);
|
||||
$carac_client_name_shipping=pdfBuildThirdpartyName($object->contact, $outputlangs);
|
||||
$carac_client_shipping = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, $object->contact, $usecontact, 'target', $object);
|
||||
} else {
|
||||
$carac_client_name_shipping=pdfBuildThirdpartyName($object->thirdparty, $outputlangs);
|
||||
$carac_client_shipping=pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'target', $object);;
|
||||
}
|
||||
if (!empty($carac_client_shipping) && (isset($object->contact->socid) && $object->contact->socid != $object->socid)) {
|
||||
$posy += $hautcadre;
|
||||
|
||||
// Show shipping frame
|
||||
$pdf->SetXY($posx + 2, $posy - 5);
|
||||
$pdf->SetFont('', '', $default_font_size - 2);
|
||||
$pdf->MultiCell($widthrecbox, '', $langs->trans('ShippingTo'), 0, 'L', 0);
|
||||
$pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
|
||||
|
||||
// Show shipping name
|
||||
$pdf->SetXY($posx + 2, $posy + 3);
|
||||
$pdf->SetFont('', 'B', $default_font_size);
|
||||
$pdf->MultiCell($widthrecbox - 2, 2, $carac_client_name_shipping, '', 'L');
|
||||
|
||||
$posy = $pdf->getY();
|
||||
|
||||
// Show shipping information
|
||||
$pdf->SetXY($posx+2, $posy);
|
||||
$pdf->SetFont('', '', $default_font_size - 1);
|
||||
$pdf->MultiCell($widthrecbox - 2, 2, $carac_client_shipping, '', 'L');
|
||||
$top_shift += $hautcadre;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$pdf->SetTextColor(0, 0, 0);
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2022 Anthony Berton <anthony.berton@bb2a.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -448,7 +449,9 @@ class pdf_sponge extends ModelePDFFactures
|
||||
$pagenb++;
|
||||
|
||||
// Output header (logo, ref and address blocks). This is first call for first page.
|
||||
$top_shift = $this->_pagehead($pdf, $object, 1, $outputlangs, $outputlangsbis);
|
||||
$pagehead = $this->_pagehead($pdf, $object, 1, $outputlangs, $outputlangsbis);
|
||||
$top_shift = $pagehead['top_shift'];
|
||||
$shipp_shift = $pagehead['shipp_shift'];
|
||||
$pdf->SetFont('', '', $default_font_size - 1);
|
||||
$pdf->MultiCell(0, 3, ''); // Set interline to 3
|
||||
$pdf->SetTextColor(0, 0, 0);
|
||||
@ -456,7 +459,7 @@ class pdf_sponge extends ModelePDFFactures
|
||||
// $pdf->GetY() here can't be used. It is bottom of the second addresse box but first one may be higher
|
||||
|
||||
// $this->tab_top is y where we must continue content (90 = 42 + 48: 42 is height of logo and ref, 48 is address blocks)
|
||||
$this->tab_top = 90 + $top_shift; // top_shift is an addition for linked objects or addons (0 in most cases)
|
||||
$this->tab_top = 90 + $top_shift + $shipp_shift; // top_shift is an addition for linked objects or addons (0 in most cases)
|
||||
$this->tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
|
||||
|
||||
// You can add more thing under header here, if you increase $extra_under_address_shift too.
|
||||
@ -1290,7 +1293,7 @@ class pdf_sponge extends ModelePDFFactures
|
||||
// Decret n°2099-1299 2022-10-07
|
||||
// French mention : "Option pour le paiement de la taxe d'après les débits"
|
||||
if ($this->emetteur->country_code == 'FR') {
|
||||
if ($conf->global->TAX_MODE == 1) {
|
||||
if (isset($conf->global->TAX_MODE) && $conf->global->TAX_MODE == 1) {
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
$pdf->writeHTMLCell(80, 5, '', '', $outputlangs->transnoentities("MentionVATDebitOptionIsOn"), 0, 1);
|
||||
|
||||
@ -2222,6 +2225,7 @@ class pdf_sponge extends ModelePDFFactures
|
||||
$posy += 1;
|
||||
|
||||
$top_shift = 0;
|
||||
$shipp_shift = 0;
|
||||
// Show list of linked objects
|
||||
$current_y = $pdf->getY();
|
||||
$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, $w, 3, 'R', $default_font_size);
|
||||
@ -2244,7 +2248,6 @@ class pdf_sponge extends ModelePDFFactures
|
||||
$hautcadre = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 38 : 40;
|
||||
$widthrecbox = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 82;
|
||||
|
||||
|
||||
// Show sender frame
|
||||
if (empty($conf->global->MAIN_PDF_NO_SENDER_FRAME)) {
|
||||
$pdf->SetTextColor(0, 0, 0);
|
||||
@ -2322,10 +2325,49 @@ class pdf_sponge extends ModelePDFFactures
|
||||
$pdf->SetFont('', '', $default_font_size - 1);
|
||||
$pdf->SetXY($posx + 2, $posy);
|
||||
$pdf->MultiCell($widthrecbox - 2, 4, $carac_client, 0, $ltrdirection);
|
||||
|
||||
// Show shipping address
|
||||
if (getDolGlobalInt('INVOICE_SHOW_SHIPPING_ADDRESS')) {
|
||||
$idaddressshipping = $object->getIdContact('external', 'SHIPPING');
|
||||
|
||||
if (!empty($idaddressshipping)) {
|
||||
$contactshipping = $object->fetch_Contact($idaddressshipping[0]);
|
||||
$object->fetch_thirdparty($object->contact->fk_soc);
|
||||
$carac_client_name_shipping=pdfBuildThirdpartyName($object->contact, $outputlangs);
|
||||
$carac_client_shipping = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, $object->contact, $usecontact, 'target', $object);
|
||||
} else {
|
||||
$carac_client_name_shipping=pdfBuildThirdpartyName($object->thirdparty, $outputlangs);
|
||||
$carac_client_shipping=pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'target', $object);;
|
||||
}
|
||||
if (!empty($carac_client_shipping) && (isset($object->contact->socid) && $object->contact->socid != $object->socid)) {
|
||||
$posy += $hautcadre;
|
||||
|
||||
// Show shipping frame
|
||||
$pdf->SetXY($posx + 2, $posy - 5);
|
||||
$pdf->SetFont('', '', $default_font_size - 2);
|
||||
$pdf->MultiCell($widthrecbox, '', $langs->trans('ShippingTo'), 0, 'L', 0);
|
||||
$pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
|
||||
|
||||
// Show shipping name
|
||||
$pdf->SetXY($posx + 2, $posy + 3);
|
||||
$pdf->SetFont('', 'B', $default_font_size);
|
||||
$pdf->MultiCell($widthrecbox - 2, 2, $carac_client_name_shipping, '', 'L');
|
||||
|
||||
$posy = $pdf->getY();
|
||||
|
||||
// Show shipping information
|
||||
$pdf->SetXY($posx+2, $posy);
|
||||
$pdf->SetFont('', '', $default_font_size - 1);
|
||||
$pdf->MultiCell($widthrecbox - 2, 2, $carac_client_shipping, '', 'L');
|
||||
$shipp_shift += $hautcadre;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$pdf->SetTextColor(0, 0, 0);
|
||||
return $top_shift;
|
||||
|
||||
$pagehead = array('top_shift' => $top_shift, 'shipp_shift' => $shipp_shift);
|
||||
return $pagehead;
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2007 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
||||
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
||||
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2007 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
||||
* Copyright (C) 2013 uanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2022 Anthony Berton <anthony.berton@bb2a.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -143,16 +144,28 @@ class mod_facture_mercure extends ModeleNumRefFactures
|
||||
// Get Mask value
|
||||
$mask = '';
|
||||
if (is_object($invoice) && $invoice->type == 1) {
|
||||
$mask = $conf->global->FACTURE_MERCURE_MASK_REPLACEMENT;
|
||||
if (isset($conf->global->FACTURE_MERCURE_MASK_REPLACEMENT)) {
|
||||
$mask = $conf->global->FACTURE_MERCURE_MASK_REPLACEMENT;
|
||||
}
|
||||
if (!$mask) {
|
||||
$mask = $conf->global->FACTURE_MERCURE_MASK_INVOICE;
|
||||
if (isset($conf->global->FACTURE_MERCURE_MASK_INVOICE)) {
|
||||
$mask = $conf->global->FACTURE_MERCURE_MASK_INVOICE;
|
||||
}
|
||||
}
|
||||
} elseif (is_object($invoice) && $invoice->type == 2) {
|
||||
$mask = $conf->global->FACTURE_MERCURE_MASK_CREDIT;
|
||||
if (isset($conf->global->FACTURE_MERCURE_MASK_CREDIT)) {
|
||||
$mask = $conf->global->FACTURE_MERCURE_MASK_CREDIT;
|
||||
}
|
||||
} elseif (is_object($invoice) && $invoice->type == 3) {
|
||||
$mask = $conf->global->FACTURE_MERCURE_MASK_DEPOSIT;
|
||||
if (isset($conf->global->FACTURE_MERCURE_MASK_DEPOSIT)) {
|
||||
$mask = $conf->global->FACTURE_MERCURE_MASK_DEPOSIT;
|
||||
}
|
||||
} else {
|
||||
$mask = $conf->global->FACTURE_MERCURE_MASK_INVOICE;
|
||||
if (isset($conf->global->FACTURE_MERCURE_MASK_INVOICE)) {
|
||||
$mask = $conf->global->FACTURE_MERCURE_MASK_INVOICE;
|
||||
} else {
|
||||
$mask = '';
|
||||
}
|
||||
}
|
||||
if (!$mask) {
|
||||
$this->error = 'NotConfigured';
|
||||
|
||||
@ -42,7 +42,7 @@ class mailing_advthirdparties extends MailingTargets
|
||||
*/
|
||||
public $db;
|
||||
|
||||
public $enabled = '$conf->societe->enabled';
|
||||
public $enabled = 'isModEnabled("societe")';
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -38,7 +38,7 @@ class mailing_contacts1 extends MailingTargets
|
||||
public $require_module = array("societe"); // Module mailing actif si modules require_module actifs
|
||||
public $require_admin = 0; // Module mailing actif pour user admin ou non
|
||||
|
||||
public $enabled = '$conf->societe->enabled';
|
||||
public $enabled = 'isModEnabled("societe")';
|
||||
|
||||
/**
|
||||
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
|
||||
@ -388,6 +388,7 @@ class mailing_contacts1 extends MailingTargets
|
||||
}
|
||||
$sql .= " WHERE sp.entity IN (".getEntity('contact').")";
|
||||
$sql .= " AND sp.email <> ''";
|
||||
|
||||
$sql .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = sp.email) = 0";
|
||||
// Exclude unsubscribed email adresses
|
||||
$sql .= " AND sp.statut = 1";
|
||||
@ -409,7 +410,7 @@ class mailing_contacts1 extends MailingTargets
|
||||
|
||||
// Filter on language
|
||||
if ($filter_lang != '') {
|
||||
$sql .= " AND sp.default_lang = '".$this->db->escape($filter_lang)."'";
|
||||
$sql .= " AND sp.default_lang LIKE '".$this->db->escape($filter_lang)."%'";
|
||||
}
|
||||
|
||||
// Filter on nature
|
||||
|
||||
212
htdocs/core/modules/mailings/eventorganization.modules.php
Normal file
212
htdocs/core/modules/mailings/eventorganization.modules.php
Normal file
@ -0,0 +1,212 @@
|
||||
<?php
|
||||
/* Copyright (C) 2018-2018 Andre Schild <a.schild@aarboard.ch>
|
||||
* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
|
||||
*
|
||||
* This file is an example to follow to add your own email selector inside
|
||||
* the Dolibarr email tool.
|
||||
* Follow instructions given in README file to know what to change to build
|
||||
* your own emailing list selector.
|
||||
* Code that need to be changed in this file are marked by "CHANGE THIS" tag.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/modules/mailings/eventorganization.modules.php
|
||||
* \ingroup mailing
|
||||
* \brief Example file to provide a list of recipients for mailing module
|
||||
*/
|
||||
|
||||
|
||||
// Load Dolibarr Environment
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/modules/mailings/modules_mailings.php';
|
||||
|
||||
|
||||
/**
|
||||
* Class to manage a list of personalised recipients for mailing feature
|
||||
*/
|
||||
class mailing_eventorganization extends MailingTargets
|
||||
{
|
||||
// This label is used if no translation is found for key XXX neither MailingModuleDescXXX where XXX=name is found
|
||||
public $name = 'AttendeesOfOrganizedEvent';
|
||||
public $desc = "Attendees of an organized event";
|
||||
|
||||
public $require_admin = 0;
|
||||
|
||||
public $require_module = array(); // This module allows to select by categories must be also enabled if category module is not activated
|
||||
|
||||
/**
|
||||
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
|
||||
*/
|
||||
public $picto = 'conferenceorbooth';
|
||||
|
||||
/**
|
||||
* @var DoliDB Database handler.
|
||||
*/
|
||||
public $db;
|
||||
|
||||
public $enabled = 'isModEnabled("eventorganization")';
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
public function __construct($db)
|
||||
{
|
||||
global $conf, $langs;
|
||||
$langs->load('companies');
|
||||
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* This is the main function that returns the array of emails
|
||||
*
|
||||
* @param int $mailing_id Id of mailing. No need to use it.
|
||||
* @return int <0 if error, number of emails added if ok
|
||||
*/
|
||||
public function add_to_target($mailing_id)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf, $langs;
|
||||
|
||||
$cibles = array();
|
||||
$addDescription = '';
|
||||
|
||||
$sql = "SELECT p.ref, p.entity, e.rowid as id, e.fk_project, e.email as email, e.email_company as company_name, e.firstname as firstname, e.lastname as lastname,";
|
||||
$sql .= " 'eventorganizationattendee' as source";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."eventorganization_conferenceorboothattendee as e,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."projet as p";
|
||||
$sql .= " WHERE e.email <> ''";
|
||||
$sql .= " AND e.fk_project = p.rowid";
|
||||
$sql .= " AND p.entity IN (".getEntity('project').")";
|
||||
$sql .= " AND e.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".((int) $mailing_id).")";
|
||||
$sql .= " AND e.fk_project = ".((int) GETPOST('filter_eventorganization', 'int'));
|
||||
$sql .= " ORDER BY e.email";
|
||||
|
||||
// Stock recipients emails into targets table
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$num = $this->db->num_rows($result);
|
||||
$i = 0;
|
||||
$j = 0;
|
||||
|
||||
dol_syslog(get_class($this)."::add_to_target mailing ".$num." targets found");
|
||||
|
||||
$old = '';
|
||||
while ($i < $num) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
if ($old <> $obj->email) {
|
||||
$otherTxt = ($obj->ref ? $langs->transnoentities("Project").'='.$obj->ref : '');
|
||||
if (strlen($addDescription) > 0 && strlen($otherTxt) > 0) {
|
||||
$otherTxt .= ";";
|
||||
}
|
||||
$otherTxt .= $addDescription;
|
||||
$cibles[$j] = array(
|
||||
'email' => $obj->email,
|
||||
'fk_project' => $obj->fk_project,
|
||||
'lastname' => $obj->lastname,
|
||||
'firstname' => $obj->firstname,
|
||||
'other' => $otherTxt,
|
||||
'source_url' => $this->url($obj->id, $obj->source),
|
||||
'source_id' => $obj->id,
|
||||
'source_type' => $obj->source
|
||||
);
|
||||
$old = $obj->email;
|
||||
$j++;
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
dol_syslog($this->db->error());
|
||||
$this->error = $this->db->error();
|
||||
return -1;
|
||||
}
|
||||
|
||||
return parent::addTargetsToDatabase($mailing_id, $cibles);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* On the main mailing area, there is a box with statistics.
|
||||
* If you want to add a line in this report you must provide an
|
||||
* array of SQL request that returns two field:
|
||||
* One called "label", One called "nb".
|
||||
*
|
||||
* @return array Array with SQL requests
|
||||
*/
|
||||
public function getSqlArrayForStats()
|
||||
{
|
||||
// CHANGE THIS: Optionnal
|
||||
|
||||
//var $statssql=array();
|
||||
//$this->statssql[0]="SELECT field1 as label, count(distinct(email)) as nb FROM mytable WHERE email IS NOT NULL";
|
||||
return array();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return here number of distinct emails returned by your selector.
|
||||
* For example if this selector is used to extract 500 different
|
||||
* emails from a text file, this function must return 500.
|
||||
*
|
||||
* @param string $sql Requete sql de comptage
|
||||
* @return int|string Nb of recipient, or <0 if error, or '' if NA
|
||||
*/
|
||||
public function getNbOfRecipients($sql = '')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT COUNT(DISTINCT(e.email)) as nb";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."eventorganization_conferenceorboothattendee as e, ";
|
||||
$sql .= " ".MAIN_DB_PREFIX."projet as p";
|
||||
$sql .= " WHERE e.email <> ''";
|
||||
$sql .= " AND e.fk_project = p.rowid";
|
||||
$sql .= " AND p.entity IN (".getEntity('project').")";
|
||||
|
||||
//print $sql;
|
||||
|
||||
// La requete doit retourner un champ "nb" pour etre comprise par parent::getNbOfRecipients
|
||||
return parent::getNbOfRecipients($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* This is to add a form filter to provide variant of selector
|
||||
* If used, the HTML select must be called "filter"
|
||||
*
|
||||
* @return string A html select zone
|
||||
*/
|
||||
public function formFilter()
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
$langs->load("companies");
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
|
||||
$formproject = new FormProjets($this->db);
|
||||
$s .= $formproject->select_projects(-1, 0, "filter_eventorganization", 0, 0, 1, 1, 0, 0, 0, '', 1, 0, '', '', 'usage_organize_event=1');
|
||||
|
||||
return $s;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Can include an URL link on each record provided by selector shown on target page.
|
||||
*
|
||||
* @param int $id ID
|
||||
* @param string $sourcetype Source type
|
||||
* @return string Url link
|
||||
*/
|
||||
public function url($id, $sourcetype = 'thirdparty')
|
||||
{
|
||||
if ($sourcetype == 'project') {
|
||||
return '<a href="'.DOL_URL_ROOT.'/eventorganization/conferenceorboothattendee_card.php?id='.((int) $id).'">'.img_object('', "eventorganization").'</a>';
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@ -1,154 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This file is an example to follow to add your own email selector inside
|
||||
* the Dolibarr email tool.
|
||||
* Follow instructions given in README file to know what to change to build
|
||||
* your own emailing list selector.
|
||||
* Code that need to be changed in this file are marked by "CHANGE THIS" tag.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/modules/mailings/example.modules.php
|
||||
* \ingroup mailing
|
||||
* \brief Example file to provide a list of recipients for mailing module
|
||||
*/
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/modules/mailings/modules_mailings.php';
|
||||
|
||||
|
||||
// CHANGE THIS: Class name must be called mailing_xxx with xxx=name of your selector
|
||||
|
||||
/**
|
||||
\class mailing_example
|
||||
\brief Class to manage a list of personalised recipients for mailing feature
|
||||
*/
|
||||
class mailing_example extends MailingTargets
|
||||
{
|
||||
// CHANGE THIS: Put here a name not already used
|
||||
public $name = 'example';
|
||||
// CHANGE THIS: Put here a description of your selector module.
|
||||
// This label is used if no translation is found for key MailingModuleDescXXX where XXX=name is found
|
||||
public $desc = 'Put here a description';
|
||||
// CHANGE THIS: Set to 1 if selector is available for admin users only
|
||||
public $require_admin = 0;
|
||||
// CHANGE THIS: Add a tooltip language key to add a tooltip help icon after the email target selector
|
||||
public $tooltip = 'MyTooltipLangKey';
|
||||
|
||||
public $require_module = array();
|
||||
|
||||
/**
|
||||
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
|
||||
*/
|
||||
public $picto = '';
|
||||
|
||||
/**
|
||||
* @var DoliDB Database handler.
|
||||
*/
|
||||
public $db;
|
||||
|
||||
|
||||
// CHANGE THIS: Constructor name must be called mailing_xxx with xxx=name of your selector
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
public function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* This is the main function that returns the array of emails
|
||||
*
|
||||
* @param int $mailing_id Id of mailing. No need to use it.
|
||||
* @return int <0 if error, number of emails added if ok
|
||||
*/
|
||||
public function add_to_target($mailing_id)
|
||||
{
|
||||
// phpcs:enable
|
||||
$target = array();
|
||||
|
||||
// CHANGE THIS
|
||||
// ----- Your code start here -----
|
||||
|
||||
// You must fill the $target array with record like this
|
||||
// $target[0]=array('email'=>'email_0','name'=>'name_0','firstname'=>'firstname_0', 'other'=>'other_0');
|
||||
// ...
|
||||
// $target[n]=array('email'=>'email_n','name'=>'name_n','firstname'=>'firstname_n', 'other'=>'other_n');
|
||||
|
||||
// Example: $target[0]=array('email'=>'myemail@example.com', 'name'=>'Doe', 'firstname'=>'John', 'other'=>'Other information');
|
||||
|
||||
// ----- Your code end here -----
|
||||
|
||||
return parent::addTargetsToDatabase($mailing_id, $target);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* On the main mailing area, there is a box with statistics.
|
||||
* If you want to add a line in this report you must provide an
|
||||
* array of SQL request that returns two field:
|
||||
* One called "label", One called "nb".
|
||||
*
|
||||
* @return array Array with SQL requests
|
||||
*/
|
||||
public function getSqlArrayForStats()
|
||||
{
|
||||
// CHANGE THIS: Optionnal
|
||||
|
||||
//var $statssql=array();
|
||||
//$this->statssql[0]="SELECT field1 as label, count(distinct(email)) as nb FROM mytable WHERE email IS NOT NULL";
|
||||
return array();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return here number of distinct emails returned by your selector.
|
||||
* For example if this selector is used to extract 500 different
|
||||
* emails from a text file, this function must return 500.
|
||||
*
|
||||
* @param string $sql Requete sql de comptage
|
||||
* @return int|string Nb of recipient, or <0 if error, or '' if NA
|
||||
*/
|
||||
public function getNbOfRecipients($sql = '')
|
||||
{
|
||||
// CHANGE THIS: Optionnal
|
||||
|
||||
// Example: return parent::getNbOfRecipients("SELECT count(*) as nb from dolibarr_table");
|
||||
// Example: return 500;
|
||||
return '?';
|
||||
}
|
||||
|
||||
/**
|
||||
* This is to add a form filter to provide variant of selector
|
||||
* If used, the HTML select must be called "filter"
|
||||
*
|
||||
* @return string A html select zone
|
||||
*/
|
||||
public function formFilter()
|
||||
{
|
||||
// CHANGE THIS: Optionnal
|
||||
|
||||
$s = '';
|
||||
return $s;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Can include an URL link on each record provided by selector
|
||||
* shown on target page.
|
||||
*
|
||||
* @param int $id ID
|
||||
* @return string Url link
|
||||
*/
|
||||
public function url($id)
|
||||
{
|
||||
// CHANGE THIS: Optionnal
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@ -41,7 +41,7 @@ class mailing_fraise extends MailingTargets
|
||||
|
||||
public $require_module = array('adherent');
|
||||
|
||||
public $enabled = '$conf->adherent->enabled';
|
||||
public $enabled = 'isModEnabled("adherent")';
|
||||
|
||||
/**
|
||||
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
|
||||
|
||||
@ -44,7 +44,7 @@ class mailing_partnership extends MailingTargets
|
||||
*/
|
||||
public $db;
|
||||
|
||||
public $enabled = '$conf->partnership->enabled';
|
||||
public $enabled = 'isModEnabled("partnership")';
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -31,7 +31,7 @@ class mailing_thirdparties extends MailingTargets
|
||||
|
||||
public $require_module = array("societe"); // This module allows to select by categories must be also enabled if category module is not activated
|
||||
|
||||
public $enabled = '$conf->societe->enabled';
|
||||
public $enabled = 'isModEnabled("societe")';
|
||||
|
||||
/**
|
||||
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
|
||||
|
||||
@ -29,7 +29,7 @@ class mailing_thirdparties_services_expired extends MailingTargets
|
||||
|
||||
public $require_module = array('contrat');
|
||||
|
||||
public $enabled = '$conf->societe->enabled';
|
||||
public $enabled = 'isModEnabled("societe")';
|
||||
|
||||
/**
|
||||
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
|
||||
@ -219,6 +219,7 @@ class mailing_thirdparties_services_expired extends MailingTargets
|
||||
|
||||
$s = '<select id="filter_services_expired" name="filter" class="flat">';
|
||||
if (count($this->arrayofproducts)) {
|
||||
$langs->loadLangs(array("products"));
|
||||
$s .= '<option value="-1">'.$langs->trans("ProductOrService").'</option>';
|
||||
} else {
|
||||
$s .= '<option value="0">'.$langs->trans("ContactsAllShort").'</option>';
|
||||
|
||||
@ -63,7 +63,7 @@ class modAsset extends DolibarrModules
|
||||
$this->descriptionlong = "Asset module to manage assets module and depreciation charge on Dolibarr";
|
||||
|
||||
// Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'
|
||||
$this->version = 'development';
|
||||
$this->version = 'experimental';
|
||||
// Key used in llx_const table to save module status enabled/disabled (where ASSETS is value of property name of module in uppercase)
|
||||
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
|
||||
// Name of image file used for this module.
|
||||
|
||||
@ -62,7 +62,7 @@ class modEventOrganization extends DolibarrModules
|
||||
// Key used in llx_const table to save module status enabled/disabled (where EVENTORGANIZATION is value of property name of module in uppercase)
|
||||
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
|
||||
|
||||
$this->picto = 'action';
|
||||
$this->picto = 'conferenceorbooth';
|
||||
|
||||
// Define some features supported by module (triggers, login, substitutions, menus, css, etc...)
|
||||
$this->module_parts = array(
|
||||
|
||||
@ -56,7 +56,7 @@ class modHRM extends DolibarrModules
|
||||
// Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)
|
||||
$this->description = "HRM";
|
||||
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
|
||||
$this->version = 'experimental';
|
||||
$this->version = 'dolibarr';
|
||||
// Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
|
||||
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
|
||||
// Name of image file used for this module.
|
||||
|
||||
@ -63,7 +63,7 @@ class modStockTransfer extends DolibarrModules
|
||||
// Used only if file README.md and README-LL.md not found.
|
||||
$this->descriptionlong = "StockTransfer description (Long)";
|
||||
// Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'
|
||||
$this->version = 'development';
|
||||
$this->version = 'experimental';
|
||||
// Url to the file with your last numberversion of this module
|
||||
//$this->url_last_version = 'http://www.example.com/versionmodule.txt';
|
||||
|
||||
|
||||
@ -234,14 +234,14 @@ if (($line->info_bits & 2) == 2) {
|
||||
}
|
||||
}
|
||||
|
||||
if ($user->rights->fournisseur->lire && $line->fk_fournprice > 0 && empty($conf->global->SUPPLIER_HIDE_SUPPLIER_OBJECTLINES)) {
|
||||
if ($user->hasRight('fournisseur', 'lire') && isset($line->fk_fournprice) && $line->fk_fournprice > 0 && empty($conf->global->SUPPLIER_HIDE_SUPPLIER_OBJECTLINES)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
|
||||
$productfourn = new ProductFournisseur($this->db);
|
||||
$productfourn->fetch_product_fournisseur_price($line->fk_fournprice);
|
||||
print '<div class="clearboth"></div>';
|
||||
print '<span class="opacitymedium">'.$langs->trans('Supplier').' : </span>'.$productfourn->getSocNomUrl(1, 'supplier').' - <span class="opacitymedium">'.$langs->trans('Ref').' : </span>';
|
||||
// Supplier ref
|
||||
if ($user->rights->produit->creer || $user->rights->service->creer) { // change required right here
|
||||
if ($user->hasRight('produit', 'creer') || $user->hasRight('service', 'creer')) { // change required right here
|
||||
print $productfourn->getNomUrl();
|
||||
} else {
|
||||
print $productfourn->ref_supplier;
|
||||
|
||||
@ -638,7 +638,7 @@ class Delivery extends CommonObject
|
||||
$sql .= " WHERE rowid = ".((int) $lineid);
|
||||
|
||||
if ($this->db->query($sql)) {
|
||||
$this->update_price();
|
||||
$this->update_price(1);
|
||||
|
||||
return 1;
|
||||
} else {
|
||||
|
||||
@ -123,6 +123,7 @@ class ConferenceOrBoothAttendee extends CommonObject
|
||||
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>'1', 'position'=>1000, 'notnull'=>-1, 'visible'=>-2,),
|
||||
'model_pdf' => array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>'1', 'position'=>1010, 'notnull'=>-1, 'visible'=>0,),
|
||||
'status' => array('type'=>'smallint', 'label'=>'Status', 'enabled'=>'1', 'position'=>1000, 'default'=>0, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Validated', '9'=>'Canceled'),),
|
||||
'ip' => array('type'=>'varchar(250)', 'label'=>'Ip', 'enabled'=>'1', 'position'=>1000, 'notnull'=>-1, 'visible'=>-2,),
|
||||
);
|
||||
public $rowid;
|
||||
public $ref;
|
||||
|
||||
@ -284,6 +284,9 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
|
||||
$sqlfields = $sql; // $sql fields to remove for count total
|
||||
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."expedition as e";
|
||||
if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (e.rowid = ef.fk_object)";
|
||||
@ -446,19 +449,31 @@ $parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$sql .= empty($hookmanager->resPrint) ? "" : " HAVING 1=1 ".$hookmanager->resPrint;
|
||||
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
/* The fast and low memory method to get and count full list converts the sql into a sql count */
|
||||
$sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
|
||||
$sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
|
||||
$resql = $db->query($sqlforcount);
|
||||
if ($resql) {
|
||||
$objforcount = $db->fetch_object($resql);
|
||||
$nbtotalofrecords = $objforcount->nbtotalofrecords;
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
$page = 0;
|
||||
$offset = 0;
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
// Complete request and execute it with limit
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
if ($limit) {
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
}
|
||||
|
||||
//print $sql;
|
||||
$resql = $db->query($sql);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user