Merge branch 'develop' of github.com:Dolibarr/dolibarr into develop#3

This commit is contained in:
Lucas Marcouiller 2022-05-21 19:19:02 +02:00
commit adfee839d7
262 changed files with 3276 additions and 2434 deletions

174
ChangeLog
View File

@ -10,20 +10,176 @@ For users:
---------------
NEW: PHP 8.1 compatibility
NEW: Support for recurring purchase invoices.
NEW: #20292 Include German public holidays
NEW: #17123 added ExtraFields for Stock Mouvement
NEW: #20609 : new massaction to assign a sale representatives on a selection of thirdparties
NEW: #20653 edit discount pourcentage for all lines in one shot
NEW: Accept 'auto' for ref of object on import of purchase order/proposal
NEW: Accountancy - Add more filters and info on page to bind accounting accounts
NEW: Accountancy - Add subledger account when we generate a transaction with a deposit invoice
NEW: Accountancy - Add a massaction to preselect an account (customer and supplier list)
NEW: ACE Editor is restored at same cursor position after a save.
NEW: Add "addMoreActionsButtons" hook to subscription form
NEW: Add an option in GUI to show a Quick add button into top menu bar
NEW: Module Recruitment - Add a public page with all list of open job positions.
NEW: Module Recruitment - Add a tab with list of application on the jobposition file.
NEW: Add a workflow to auto link contract on a ticket
NEW: Add column date of Signature on proposal list
NEW: Add column template invoice in invoice list
NEW: Add column "Total HT" to products array on document creation card
NEW: ADD configuration for text color of button action
NEW: Add constant to hide categories in TakePos
NEW: Add constant to show category description in TakePos
NEW: Add constant to show only the products in stock in TakePos
NEW: Add entity filter in exports
NEW: Show the event block on recurring invoices #20870
NEW: Add filter "opportunity status" on statistics of projects.
NEW: Add firstname, lastname and max number of attendees for module "Event Organization"
NEW: add margin info in proposal and order list
NEW: Add massaction "Edit Extrafield" for Product
NEW: Add more fields to detect duplicate during import of thirdparties
NEW: Add option to foce delivery on email for purchase order receipt to yes
NEW: Add param boder table for md theme
NEW: Add param color button action
NEW: Add possibility to create contract from invoice
NEW: Add possibility with constant MAIN_LOGIN_BADCHARUNAUTHORIZED to define bad character unauthorized into login name
NEW: Add private and public notes on tax files.
NEW: Add status "Obsolete" to KM articles
NEW: Add substitutions "user numbers"
NEW: Add the possibility to add sub-BOMs to BOM
NEW: allow a ticket to be automatically marked as read when created from backend.
NEW: allow cut&paste as real numeric value to excel
NEW: A public form to send a message and create a lead is available
NEW: automatically set totally received status in reception
NEW: Auto set invoice paid when adding credit not and remain to pay is 0
NEW: Availibility dictionnary has a new column unit and number
NEW: barcode rule to insert product in takepos
NEW: Can change value of AWP during the inventory
NEW: Can enter price with tax for predefined products on purchase objects
NEW: Can filter on a thirdparty on product statistics
NEW: Can removed doc templates from setup page of thirdparty
NEW: Can set the parent company during the creation of thirdparty (action=add of societe/card.php)
NEW: Can use ! to make a search that exclude a string
NEW: Change in theme colors does not need to use the refresh button
NEW: clean values and amount in FEC import
NEW: const MAIL_MASS_ACTION_ADD_LAST_IF_MAIN_DOC_NOT_FOUND for mailing mass action
NEW: Contact filter project list
NEW: Create contract from invoice
NEW: create third-party with contact if not found on public ticket
NEW: Default value for MAIN_SECURITY_CSRF_WITH_TOKEN is now 2 (GET are also protected agains CSRF attacks)
NEW: deposit payment terms: add field into dictionary admin page to define default percentage of deposit.
NEW: Dictionaries - add possibility to manage countries in EEC
NEW: display errors in a message box after generating documents
NEW: Display physical and virtual stock of the products when creating OF from a BOM
NEW: Display product ref in "Object link" product tab for BOM
NEW: Enhance the import. Can use 'auto' for the ref (import of orders)
NEW: Events on Proposal to Return to Draft
NEW: Page to list expense report payments
NEW: JS inventory autocalc input
NEW: language support for more emailing target selectors
NEW: leave requests: add field into type dictionary to block request if balance is negative
NEW: MAIN_MAIL_AUTOCOPY_TO can accept several email and special keys
NEW: MAIN_SEARCH_CAT_OR_BY_DEFAULT const for search by category
NEW: Mass action "Close shipments"
NEW: Module website now supports the multicompany module
NEW: More mode for THEME_TOPMENU_DISABLE_IMAGE (2, 3, ...)
NEW: Add option to move checkbox column as first column on Thirdparty list (only few screens)
NEW: Add tabs for nets Bom
NEW: on redirect of page in website module, GET parameters are kept.
NEW: optional display warning icons on ticket list
NEW: option to default check "notify tier at creation" in ticket module
NEW: option update prices on proposal cloning
NEW: payment conditions enabling semi-automatic deposit creation (Issue #18439)
NEW: possibility to consume multiple batch
NEW: Reverse movement product consumption
NEW: Send email to the supplier order contact
NEW: New permission to report time on timesheet.
NEW: SEPA XML - option to place payment Type Info at Credit transfer Transaction level
NEW: Show number of votes into the label of tab "Results" of a survey
NEW: Show product reference in Takepos
NEW: Some core tables are created only at module activation
NEW: split consumption line on MO
NEW: stock filter in reassort lists
NEW: stock limit in stock export CSV
NEW: Sub-bom are availables
NEW: Supplier order - Show ref supplier of reception in linked object block
NEW: support user_modif in order
NEW: TakePos - pagination on search results
NEW: The backup tools has an "lowmemory" option for mysqldump on large database
NEW: The 'reposition' class works on ajax constantonoff that make redirects
NEW: Thirdparty - Add rules "customer accountancy code" is mandatory to validate invoice
NEW: thumbnail field in product list
NEW: total mark rate in list
NEW: uncheck "send message" by default on a ticket when private messages has been checked
NEW: VAT Report by month - Show detail by rate and also by code
NEW: Ticket triggers: allow to automatically send messages on new tickets
NEW: Accountancy - Add hidden feature for accounting reconciliation
NEW: Can store the session into database (instead of beeing managed by PHP)
Modules
NEW: Module Partnership Management
NEW: Experimental module Event Organization Management
NEW: Experimental module Workstations Management
NEW: Experimental module Partnership Management
For developers:
---------------
NEW: A lot of addition of hooks.
For developers or integrators:
------------------------------
NEW: dol_uncompress() supports more extensions (.gz, .bz2, .zstd). Only .zip was supported before.
NEW: Implement a generic method for Kaban views
NEW: Upgrade chartjs library to 3.7.1
NEW: update rank line is possible on API for customer invoices, sales orders and supplier invoice
NEW: stripe element with more gateways
NEW: solde() function evolution to be able to get solde until a chosen date
NEW: Suggest a way to run upgrade per entities.
NEW: Support html content for multiselect component.
NEW: ModuleBuilder - Add tabs view in module builder
NEW: ModuleBuilder - More feature that can be modifed after module generation
NEW: Hook getNomUrl available everywhere in tooltip of ref links
NEW: Identification of tr is possible with by attribute data-id on some pages
NEW: Import with select boxes V2
NEW: Can update rank of invoice, proposal and order lines with API update
NEW: Can use current entity filter on 'chkbxlst'
NEW: Creation of the function select_bom() used to display bom select list
NEW: add printFieldListWhere hook in product reassort card
NEW: Add trigger and event on completely received status change
NEW: Add utility function send backup by mail
NEW: add WordPress OAuth to save a token (not SSO)
NEW: A module can embed a sql script run at each Dolibarr upgrade
NEW: API Proposals - Add POST lines
NEW: API REST filter states by country
NEW: Add option INVOICEREC_SET_AUTOFILL_DATE_START/END
NEW: Add option MAIN_API_DEBUG to save API logs into a file
NEW: Add param to keep the robot=index meta tag on public pages
NEW: Add method hintindex() in database handlers.
NEW: add modifications for new function "$db->prefix()"
NEW: addMoreActionsButtonsList hook for button in list
NEW: Add API to get a template invoice
NEW: Standardize a lot of code.
NEW: #20736 Allow extrafields SQL filters on REST API product lookup
NEW: #19294 implement detailed timespent in task of project API
NEW: Add a protection into PHPunit to avoid to forget a var_dump
NEW: Add datem and type parameters to API to create movements
NEW: Add hidden option on contract PDF line to hide qty and price
NEW: Option MAIL_MASS_ACTION_ADD_LAST_IF_MAIN_DOC_NOT_FOUND to send last document in mass mailing action
NEW: Add hooks: selectContactListWhere hook, selectThirdpartyListWhere hook
NEW: TakePos - add hooks complete product display
NEW: TakePos - add hooks for cart display
NEW: TakePos - add hooks to complete ajax return array
NEW: Add hook before the public ticket list
NEW: Add hook doaction in takepos invoice
NEW: Add Hook for Notif
NEW: Add hook for more buttons
NEW: Add hook printFieldListWhere in "show_contacts" function
NEW: Add hook printFieldWhere in load_state_board function
NEW: Add hooks contact tab badge and hooks parameter for avoid conflicts
NEW: Add hook selectProductsListWhere in select_produits_list function
NEW: Add hooks in commercial index
NEW: Add hooks in customers and products boxes
NEW: Add hooks in thirdparty index page
NEW: Add hooks on project task time page
NEW: Add hooks on salaries and sociales card
NEW: Add hooks select product list and select thirdparty list function
NEW: Add hook to getSellPrice function
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:

View File

@ -349,7 +349,7 @@ if ($action != 'export_csv') {
$sql .= " GROUP BY t.numero_compte";
$resql = $db->query($sql);
$nrows = $resql->num_rows;
$nrows = $db->num_rows($resql);
$opening_balances = array();
for ($i = 0; $i < $nrows; $i++) {
$arr = $resql->fetch_array();

View File

@ -748,6 +748,7 @@ class AccountingAccount extends CommonObject
$reshook = $hookmanager->executeHooks('accoutancyBindingCalculation', $parameters); // Note that $action and $object may have been modified by some hooks
if (empty($reshook)) {
$const_name = '';
if ($type == 'customer') {
$const_name = "SOLD";
} elseif ($type == 'supplier') {

View File

@ -1883,7 +1883,7 @@ class BookKeeping extends CommonObject
$sql .= ' doc_ref, fk_doc, fk_docdet, entity, thirdparty_code, subledger_account, subledger_label,';
$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, '.((int) $next_piecenum).", '".$this->db->idate($now)."'";
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND numero_compte IS NOT NULL AND entity = ' .((int) $conf->entity);
$resql = $this->db->query($sql);
if (!$resql) {
$error++;

View File

@ -699,6 +699,8 @@ class Lettering extends BookKeeping
return $grouped_payments;
}
$save_payment_by_element = null;
$save_element_by_payment = null;
if ($element_id == 0) {
// Save list when is the begin of recursive function
$save_payment_by_element = $payment_by_element;

View File

@ -43,17 +43,6 @@ if ($in_bookkeeping == '') {
$in_bookkeeping = 'notyet';
}
// Security check
if (empty($conf->accounting->enabled)) {
accessforbidden();
}
if ($user->socid > 0) {
accessforbidden();
}
if (empty($user->rights->accounting->mouvements->lire)) {
accessforbidden();
}
// Get information of journal
$object = new AccountingJournal($db);
$result = $object->fetch($id_journal);
@ -65,7 +54,7 @@ if ($result > 0) {
accessforbidden($langs->trans('ErrorRecordNotFound'));
}
$hookmanager->initHooks(array('globaljournal', $object->nature_text . 'journal'));
$hookmanager->initHooks(array('globaljournal', $object->nature.'journal'));
$parameters = array();
$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
@ -93,6 +82,18 @@ if (!is_array($journal_data)) {
setEventMessages($object->error, $object->errors, 'errors');
}
// Security check
if (empty($conf->accounting->enabled)) {
accessforbidden();
}
if ($user->socid > 0) {
accessforbidden();
}
if (empty($user->rights->accounting->mouvements->lire)) {
accessforbidden();
}
/*
* Actions
*/

View File

@ -248,8 +248,8 @@ if (!empty($conf->banque->enabled) && !empty($conf->societe->enabled) && !empty(
$arraychoices['bankviainvoice'] = $langs->trans("MoreActionBankViaInvoice");
}
print '<td>';
print $form->selectarray('ADHERENT_BANK_USE', $arraychoices, $conf->global->ADHERENT_BANK_USE, 0);
if ($conf->global->ADHERENT_BANK_USE == 'bankdirect' || $conf->global->ADHERENT_BANK_USE == 'bankviainvoice') {
print $form->selectarray('ADHERENT_BANK_USE', $arraychoices, getDolGlobalString('ADHERENT_BANK_USE'), 0);
if (getDolGlobalString('ADHERENT_BANK_USE') == 'bankdirect' || getDolGlobalString('ADHERENT_BANK_USE') == 'bankviainvoice') {
print '<br><div style="padding-top: 5px;"><span class="opacitymedium">'.$langs->trans("ABankAccountMustBeDefinedOnPaymentModeSetup").'</span></div>';
}
print '</td>';
@ -378,16 +378,16 @@ foreach ($dirmodels as $reldir) {
print '</td>';
} else {
print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set_default&token='.newToken().'&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set_default&token='.newToken().'&value='.$name.'&scandir='.(!empty($module->scandir) ? $module->scandir : '').'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>";
}
// Defaut
print '<td class="center">';
if ($conf->global->MEMBER_ADDON_PDF == $name) {
if (getDolGlobalString('MEMBER_ADDON_PDF') == $name) {
print img_picto($langs->trans("Default"), 'on');
} else {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&value='.$name.'&scandir='.(!empty($module->scandir) ? $module->scandir : '').'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
}
print '</td>';
@ -398,8 +398,8 @@ foreach ($dirmodels as $reldir) {
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
}
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn(!empty($module->option_logo) ? $module->option_logo : 0, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn(!empty($module->option_multilang) ? $module->option_multilang : 0, 1, 1);
print '<td class="center">';

View File

@ -2030,7 +2030,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$MAX = 10;
$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-list-alt imgforviewmode', DOL_URL_ROOT.'/adherents/agenda.php?id='.$object->id);
$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/adherents/agenda.php?id='.$object->id);
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';

View File

@ -121,6 +121,9 @@ class AdherentType extends CommonObject
/** @var array Array of members */
public $members = array();
/** @var string string other */
public $other = array();
public $multilangs = array();

View File

@ -305,6 +305,8 @@ $formother = new FormOther($db);
$membertypestatic = new AdherentType($db);
$memberstatic = new Adherent($db);
$title = $langs->trans("Members");
$now = dol_now();
if ((!empty($search_categ) && $search_categ > 0) || !empty($catid)) {
@ -471,42 +473,41 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $
exit;
}
llxHeader('', $langs->trans("Member"), 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros');
llxHeader('', $title, 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros');
$titre = $langs->trans("MembersList");
if (GETPOSTISSET("search_status")) {
if ($search_status == '-1,1') { // TODO : check this test as -1 == Adherent::STATUS_DRAFT and -2 == Adherent::STATUS_EXLCUDED
$titre = $langs->trans("MembersListQualified");
$title = $langs->trans("MembersListQualified");
}
if ($search_status == Adherent::STATUS_DRAFT) {
$titre = $langs->trans("MembersListToValid");
$title = $langs->trans("MembersListToValid");
}
if ($search_status == Adherent::STATUS_VALIDATED && $filter == '') {
$titre = $langs->trans("MenuMembersValidated");
$title = $langs->trans("MenuMembersValidated");
}
if ($search_status == Adherent::STATUS_VALIDATED && $filter == 'withoutsubscription') {
$titre = $langs->trans("MembersWithSubscriptionToReceive");
$title = $langs->trans("MembersWithSubscriptionToReceive");
}
if ($search_status == Adherent::STATUS_VALIDATED && $filter == 'uptodate') {
$titre = $langs->trans("MembersListUpToDate");
$title = $langs->trans("MembersListUpToDate");
}
if ($search_status == Adherent::STATUS_VALIDATED && $filter == 'outofdate') {
$titre = $langs->trans("MembersListNotUpToDate");
$title = $langs->trans("MembersListNotUpToDate");
}
if ((string) $search_status == (string) Adherent::STATUS_RESILIATED) { // The cast to string is required to have test false when search_status is ''
$titre = $langs->trans("MembersListResiliated");
$title = $langs->trans("MembersListResiliated");
}
if ($search_status == Adherent::STATUS_EXCLUDED) {
$titre = $langs->trans("MembersListExcluded");
$title = $langs->trans("MembersListExcluded");
}
} elseif ($action == 'search') {
$titre = $langs->trans("MembersListQualified");
$title = $langs->trans("MembersListQualified");
}
if ($search_type > 0) {
$membertype = new AdherentType($db);
$result = $membertype->fetch($search_type);
$titre .= " (".$membertype->label.")";
$title .= " (".$membertype->label.")";
}
$param = '';
@ -623,7 +624,7 @@ print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
$topicmail = "Information";
$modelmail = "member";

View File

@ -225,7 +225,7 @@ $tabsql[24] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFI
$tabsql[25] = "SELECT rowid as rowid, code, label, active, module FROM ".MAIN_DB_PREFIX."c_type_container as t WHERE t.entity = ".getEntity($tabname[25]);
//$tabsql[26]= "SELECT rowid as rowid, code, label, short_label, active FROM ".MAIN_DB_PREFIX."c_units";
$tabsql[27] = "SELECT id as rowid, code, libelle, picto, active FROM ".MAIN_DB_PREFIX."c_stcomm";
$tabsql[28] = "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newbymonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.block_if_negative, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid";
$tabsql[28] = "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newbymonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.block_if_negative, h.sortorder, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid";
$tabsql[29] = "SELECT rowid as rowid, code, label, percent, position, active FROM ".MAIN_DB_PREFIX."c_lead_status";
$tabsql[30] = "SELECT rowid, code, name, paper_size, orientation, metric, leftmargin, topmargin, nx, ny, spacex, spacey, width, height, font_size, custom_x, custom_y, active FROM ".MAIN_DB_PREFIX."c_format_cards";
//$tabsql[31]= "SELECT s.rowid as rowid, pcg_version, s.label, s.active FROM ".MAIN_DB_PREFIX."accounting_system as s";
@ -272,7 +272,7 @@ $tabsqlsort[24] = "code ASC, label ASC";
$tabsqlsort[25] = "t.module ASC, t.code ASC, t.label ASC";
//$tabsqlsort[26]="code ASC";
$tabsqlsort[27] = "code ASC";
$tabsqlsort[28] = "country ASC, code ASC";
$tabsqlsort[28] = "sortorder ASC, country ASC, code ASC";
$tabsqlsort[29] = "position ASC";
$tabsqlsort[30] = "code ASC";
//$tabsqlsort[31]="pcg_version ASC";
@ -319,7 +319,7 @@ $tabfield[24] = "code,label";
$tabfield[25] = "code,label";
//$tabfield[26]= "code,label,short_label";
$tabfield[27] = "code,libelle,picto";
$tabfield[28] = "code,label,affect,delay,newbymonth,country_id,country,block_if_negative";
$tabfield[28] = "code,label,affect,delay,newbymonth,country_id,country,block_if_negative,sortorder";
$tabfield[29] = "code,label,percent,position";
$tabfield[30] = "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
//$tabfield[31]= "pcg_version,label";
@ -366,7 +366,7 @@ $tabfieldvalue[24] = "code,label";
$tabfieldvalue[25] = "code,label";
//$tabfieldvalue[26]= "code,label,short_label";
$tabfieldvalue[27] = "code,libelle,picto";
$tabfieldvalue[28] = "code,label,affect,delay,newbymonth,country,block_if_negative";
$tabfieldvalue[28] = "code,label,affect,delay,newbymonth,country,block_if_negative,sortorder";
$tabfieldvalue[29] = "code,label,percent,position";
$tabfieldvalue[30] = "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
//$tabfieldvalue[31]= "pcg_version,label";
@ -413,7 +413,7 @@ $tabfieldinsert[24] = "code,label";
$tabfieldinsert[25] = "code,label";
//$tabfieldinsert[26]= "code,label,short_label";
$tabfieldinsert[27] = "code,libelle,picto";
$tabfieldinsert[28] = "code,label,affect,delay,newbymonth,fk_country,block_if_negative";
$tabfieldinsert[28] = "code,label,affect,delay,newbymonth,fk_country,block_if_negative,sortorder";
$tabfieldinsert[29] = "code,label,percent,position";
$tabfieldinsert[30] = "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
//$tabfieldinsert[31]= "pcg_version,label";

View File

@ -420,7 +420,7 @@ if (!empty($moreforfilter)) {
}
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields
$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table

View File

@ -36,10 +36,10 @@ $langs->loadLangs(array("admin", "trips", "errors", "other", "dict"));
$error = 0;
$action = GETPOST('action', 'aZ09');
$id = GETPOST('id', 'int');
$ikoffset = GETPOST('ikoffset', 'int');
$coef = GETPOST('coef', 'int');
$fk_c_exp_tax_cat = GETPOST('fk_c_exp_tax_cat');
$fk_range = GETPOST('fk_range', 'int');
@ -62,9 +62,16 @@ if ($action == 'updateik') {
}
}
$expIk->setValues($_POST);
$result = $expIk->create($user);
$expIk->coef = $coef;
$expIk->ikoffset = $ikoffset;
$expIk->fk_c_exp_tax_cat = $fk_c_exp_tax_cat;
$expIk->fk_range = $fk_range;
if ($expIk->id > 0) {
$result = $expIk->update($user);
} else {
$result = $expIk->create($user);
}
if ($result > 0) {
setEventMessages('SetupSaved', null, 'mesgs');

View File

@ -34,13 +34,19 @@ require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport_rule.class.ph
// Load translation files required by the page
$langs->loadLangs(array("admin", "other", "trips", "errors", "dict"));
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('admin', 'dictionaryadmin','expensereport_rules'));
$object = new ExpenseReportRule($db);
if (!$user->admin) {
accessforbidden();
}
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('admin', 'dictionaryadmin','expensereport_rules'));
/*
* Action
*/
$parameters = array();
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
@ -51,7 +57,6 @@ if ($reshook < 0) {
if (empty($reshook)) {
//Init error
$error = false;
$message = false;
$action = GETPOST('action', 'aZ09');
$id = GETPOST('id', 'int');
@ -59,21 +64,20 @@ if (empty($reshook)) {
$apply_to = GETPOST('apply_to');
$fk_user = GETPOST('fk_user', 'int');
$fk_usergroup = GETPOST('fk_usergroup', 'int');
$fk_c_type_fees = GETPOST('fk_c_type_fees');
$restrictive = GETPOST('restrictive', 'int');
$fk_c_type_fees = GETPOST('fk_c_type_fees', 'int');
$code_expense_rules_type = GETPOST('code_expense_rules_type');
$dates = dol_mktime(12, 0, 0, GETPOST('startmonth'), GETPOST('startday'), GETPOST('startyear'));
$datee = dol_mktime(12, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear'));
$amount = GETPOST('amount');
$amount = price2num(GETPOST('amount'), 'MT', 2);
$object = new ExpenseReportRule($db);
if (!empty($id)) {
$result = $object->fetch($id);
if ($result < 0) {
dol_print_error('', $object->error, $object->errors);
}
}
// TODO do action
if ($action == 'save') {
$error = 0;
@ -104,8 +108,6 @@ if (empty($reshook)) {
}
if (empty($error)) {
$object->setValues($_POST);
if ($apply_to == 'U') {
$object->fk_user = (int) $fk_user;
$object->fk_usergroup = 0;
@ -122,18 +124,30 @@ if (empty($reshook)) {
$object->dates = $dates;
$object->datee = $datee;
$object->restrictive = $restrictive;
$object->fk_c_type_fees = $fk_c_type_fees;
$object->code_expense_rules_type = $code_expense_rules_type;
$object->amount = $amount;
$object->entity = $conf->entity;
$res = $object->create($user);
if ($object->id > 0) {
$res = $object->update($user);
} else {
$res = $object->create($user);
}
if ($res > 0) {
setEventMessages($langs->trans('ExpenseReportRuleSave'), null);
} else {
dol_print_error($object->db);
$error++;
}
header('Location: ' . $_SERVER['PHP_SELF']);
exit;
if (!$error) {
header('Location: ' . $_SERVER['PHP_SELF']);
exit;
} else {
$action = '';
}
}
} elseif ($action == 'delete') {
// TODO add confirm
@ -207,7 +221,7 @@ if ($action != 'edit') {
echo '<td class="linecoltyperule">' . $form->selectarray('code_expense_rules_type', $tab_rules_type, '', 0) . '</td>';
echo '<td class="linecoldatestart">' . $form->selectDate(strtotime(date('Y-m-01', dol_now())), 'start', '', '', 0, '', 1, 0) . '</td>';
echo '<td class="linecoldateend>' . $form->selectDate(strtotime(date('Y-m-t', dol_now())), 'end', '', '', 0, '', 1, 0) . '</td>';
echo '<td class="linecolamount"><input type="text" value="" class="maxwidth100" name="amount" class="amount" /> ' . $conf->currency . '</td>';
echo '<td class="linecolamount"><input type="text" value="" class="maxwidth100" name="amount" class="amount right" /></td>';
echo '<td class="linecolrestrictive">' . $form->selectyesno('restrictive', 0, 1) . '</td>';
echo '<td class="right linecolbutton"><input type="submit" class="button button-add" value="' . $langs->trans('Add') . '" /></td>';
echo '</tr>';
@ -304,10 +318,10 @@ foreach ($rules as $rule) {
}
echo '</td>';
// Amount
echo '<td class="linecolamount">';
if ($action == 'edit' && $object->id == $rule->id) {
echo '<input type="text" value="' . price2num($object->amount) . '" name="amount" class="amount" />' . $conf->currency;
echo '<input type="text" value="' . price2num($object->amount) . '" name="amount" class="amount width50 right" />';
} else {
echo price($rule->amount, 0, $langs, 1, -1, -1, $conf->currency);
}

View File

@ -529,7 +529,7 @@ if ($mode == 'common' || $mode == 'commonkanban') {
$moreforfilter .= dolGetButtonTitle($langs->trans('CheckForModuleUpdate'), $langs->trans('CheckForModuleUpdate').'<br>'.$langs->trans('CheckForModuleUpdateHelp'), 'fa fa-sync', $_SERVER["PHP_SELF"].'?action=checklastversion&token='.newToken().'&mode='.$mode.$param, '', 1, array('morecss'=>'reposition'));
$moreforfilter .= dolGetButtonTitleSeparator();
$moreforfilter .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=commonkanban'.$param, '', ($mode == 'commonkanban' ? 2 : 1), array('morecss'=>'reposition'));
$moreforfilter .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-list-alt imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.$param, '', ($mode == 'common' ? 2 : 1), array('morecss'=>'reposition'));
$moreforfilter .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.$param, '', ($mode == 'common' ? 2 : 1), array('morecss'=>'reposition'));
$moreforfilter .= '</li></ul></div>';
//$moreforfilter .= '<div class="floatright center marginrightonly hideonsmartphone" style="padding-top: 3px"><span class="paddingright">'.$moreinfo.'</span> '.$moreinfo2.'</div>';

View File

@ -78,7 +78,7 @@ print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameters").'</td>'."\n";
print '<td class="right" width="60">'.$langs->trans("Value").'</td>'."\n";
print '<td class="right">'.$langs->trans("Value").'</td>'."\n";
print '<td></td>';
@ -106,6 +106,15 @@ if (empty($conf->use_javascript_ajax)) {
print '</tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans('EnableResourceUsedInEventCheck').'</td>';
print '<td class="right">';
echo ajax_constantonoff('RESOURCE_USED_IN_EVENT_CHECK');
print '</td>';
print '<td></td>';
print '</tr>';
/*
print '<tr class="oddeven">';
print '<td>'.$langs->trans('DisabledResourceLinkUser').'</td>';
print '<td class="right">';
@ -122,15 +131,7 @@ echo ajax_constantonoff('RESOURCE_HIDE_ADD_CONTACT_THIPARTY');
print '</td>';
print '<td></td>';
print '</tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans('EnableResourceUsedInEventCheck').'</td>';
print '<td class="right">';
echo ajax_constantonoff('RESOURCE_USED_IN_EVENT_CHECK');
print '</td>';
print '<td></td>';
print '</tr>';
*/
print '</table>';
print '</div>';

View File

@ -74,7 +74,6 @@ llxHeader('', $langs->trans("ResourceSetup"));
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("ResourceSetup"), $linkback, 'title_setup');
print "<br>\n";
$head = resource_admin_prepare_head();

View File

@ -408,7 +408,7 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
print '<br><br>';
print_fiche_titre($langs->trans("Emails"));
print load_fiche_titre($langs->trans("Emails"));
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';

View File

@ -257,7 +257,7 @@ if (in_array($type, array('mysql', 'mysqli'))) {
}
if ($execmethod == 1) {
// If we use the "exec" method for shell, we ask if we need to use the alternative low memory exec mode.
print '<input type="checkbox" name="lowmemorydump" value="yes" id="lowmemorydump"'.(GETPOSTISSET('lowmemorydump') ? GETPOST('lowmemorydump', 'alpha') : getDolGlobalString('MAIN_LOW_MEMORY_DUMP') ? ' checked="checked"' : '').'" />';
print '<input type="checkbox" name="lowmemorydump" value="yes" id="lowmemorydump"'.((GETPOSTISSET('lowmemorydump') ? GETPOST('lowmemorydump', 'alpha') : getDolGlobalString('MAIN_LOW_MEMORY_DUMP')) ? ' checked="checked"' : '').'" />';
print '<label for="lowmemorydump">';
print $form->textwithpicto($langs->trans('ExportUseLowMemoryMode'), $langs->trans('ExportUseLowMemoryModeHelp'));
print '</label>';

View File

@ -100,7 +100,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
$url = $_SERVER['PHP_SELF'];
if (preg_match('/api\/index\.php$/', $url)) { // sometimes $_SERVER['PHP_SELF'] is 'api\/index\.php' instead of 'api\/index\.php/explorer.php' or 'api\/index\.php/method'
$url = $_SERVER['PHP_SELF'].$_SERVER['PATH_INFO'];
$url = $_SERVER['PHP_SELF'].(empty($_SERVER['PATH_INFO']) ? $_SERVER['ORIG_PATH_INFO'] : $_SERVER['PATH_INFO']);
}
// Fix for some NGINX setups (this should not be required even with NGINX, however setup of NGINX are often mysterious and this may help is such cases)
if (!empty($conf->global->MAIN_NGINX_FIX)) {

View File

@ -408,7 +408,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$MAXEVENT = 10;
$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-list-alt imgforviewmode', DOL_URL_ROOT.'/asset/agenda.php?id='.$object->id);
$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/asset/agenda.php?id='.$object->id);
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';

View File

@ -144,6 +144,7 @@ class Asset extends CommonObject
public $fk_disposal_type;
public $disposal_depreciated;
public $disposal_subject_to_vat;
public $supplier_invoice_id;
public $note_public;
public $note_private;
public $date_creation;

View File

@ -129,6 +129,7 @@ class AssetModel extends CommonObject
public $import_key;
public $model_pdf;
public $status;
public $asset_depreciation_options;
// /**
// * @var string Field with ID of parent key if this object has a parent

View File

@ -315,7 +315,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// $MAXEVENT = 10;
//
// $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-list-alt imgforviewmode', DOL_URL_ROOT . '/asset/model/agenda.php?id=' . $object->id);
// $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT . '/asset/model/agenda.php?id=' . $object->id);
//
// // List of actions on element
// include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';

View File

@ -40,6 +40,7 @@ $ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha');
$socid = GETPOST('socid', 'int');
if (GETPOST('actioncode', 'array')) {
$actioncode = GETPOST('actioncode', 'array', 3);
@ -79,7 +80,7 @@ $extrafields->fetch_name_optionals_label($object->table_element);
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
if ($id > 0 || !empty($ref)) {
$upload_dir = $conf->bom->multidir_output[$object->entity]."/".$object->id;
$upload_dir = (!empty($conf->bom->multidir_output[$object->entity]) ? $conf->bom->multidir_output[$object->entity] : $conf->bom->dir_output)."/".$object->id;
}
// Security check - Protection if external user

View File

@ -742,7 +742,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$MAXEVENT = 10;
$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-list-alt imgforviewmode', DOL_URL_ROOT.'/bom/bom_agenda.php?id='.$object->id);
$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/bom/bom_agenda.php?id='.$object->id);
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';

View File

@ -104,6 +104,7 @@ $form = new Form($db);
$title = $langs->trans("BillOfMaterials").' - '.$langs->trans("Files");
$help_url = 'EN:Module_BOM';
$morehtmlref = "";
llxHeader('', $title, $help_url);

View File

@ -34,6 +34,7 @@ $langs->loadLangs(array("mrp", "other", "stocks"));
// Get parameters
$id = GETPOST('id', 'int');
$lineid = GETPOST('lineid', 'int');
$ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
@ -184,7 +185,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print dol_get_fiche_end();
$viewlink = dolGetButtonTitle($langs->trans('GroupByProduct'), '', 'fa fa-list-alt imgforviewmode', $_SERVER['PHP_SELF'].'?id='.$object->id.'&token='.newToken(), '', 1, array('morecss' => 'reposition '.($action !== 'treeview' ? 'btnTitleSelected':'')));
$viewlink = dolGetButtonTitle($langs->trans('GroupByProduct'), '', 'fa fa-bars imgforviewmode', $_SERVER['PHP_SELF'].'?id='.$object->id.'&token='.newToken(), '', 1, array('morecss' => 'reposition '.($action !== 'treeview' ? 'btnTitleSelected':'')));
$viewlink .= dolGetButtonTitle($langs->trans('TreeStructure'), '', 'fa fa-stream imgforviewmode', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=treeview&token='.newToken(), '', 1, array('morecss' => 'reposition marginleftonly '.($action == 'treeview' ? 'btnTitleSelected':'')));
print load_fiche_titre($langs->trans("BillOfMaterials"), $viewlink, 'cubes');

View File

@ -54,7 +54,7 @@ $extrafields->fetch_name_optionals_label($object->table_element);
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
if ($id > 0 || !empty($ref)) {
$upload_dir = $conf->bom->multidir_output[$object->entity]."/".$object->id;
$upload_dir = (!empty($conf->bom->multidir_output[$object->entity]) ? $conf->bom->multidir_output[$object->entity] : $conf->bom->dir_output)."/".$object->id;
}
$permissionnote = $user->rights->bom->write; // Used by the include of actions_setnotes.inc.php

View File

@ -916,27 +916,27 @@ class BOM extends CommonObject
if ($this->db->num_rows($result)) {
$obj = $this->db->fetch_object($result);
$this->id = $obj->rowid;
if ($obj->fk_user_author) {
if (!empty($obj->fk_user_author)) {
$cuser = new User($this->db);
$cuser->fetch($obj->fk_user_author);
$this->user_creation = $cuser;
}
if ($obj->fk_user_valid) {
if (!empty($obj->fk_user_valid)) {
$vuser = new User($this->db);
$vuser->fetch($obj->fk_user_valid);
$this->user_validation = $vuser;
}
if ($obj->fk_user_cloture) {
if (!empty($obj->fk_user_cloture)) {
$cluser = new User($this->db);
$cluser->fetch($obj->fk_user_cloture);
$this->user_cloture = $cluser;
}
$this->date_creation = $this->db->jdate($obj->datec);
$this->date_modification = $this->db->jdate($obj->datem);
$this->date_validation = $this->db->jdate($obj->datev);
$this->date_modification = !empty($obj->datem) ? $this->db->jdate($obj->datem) : "";
$this->date_validation = !empty($obj->datev) ? $this->db->jdate($obj->datev) : "";
}
$this->db->free($result);
@ -1134,6 +1134,9 @@ class BOM extends CommonObject
if (! empty($line->childBom)) {
foreach ($line->childBom as $childBom) $childBom->getNetNeeds($TNetNeeds, $line->qty*$qty);
} else {
if (empty($TNetNeeds[$line->fk_product])) {
$TNetNeeds[$line->fk_product] = 0;
}
$TNetNeeds[$line->fk_product] += $line->qty*$qty;
}
}

View File

@ -113,7 +113,7 @@ class Categorie extends CommonObject
*
* @todo Move to const array when PHP 5.6 will be our minimum target
*/
protected $MAP_CAT_FK = array(
public $MAP_CAT_FK = array(
'customer' => 'soc',
'supplier' => 'soc',
'contact' => 'socpeople',
@ -125,7 +125,7 @@ class Categorie extends CommonObject
*
* @note Move to const array when PHP 5.6 will be our minimum target
*/
protected $MAP_CAT_TABLE = array(
public $MAP_CAT_TABLE = array(
'customer' => 'societe',
'supplier' => 'fournisseur',
'bank_account'=> 'account',
@ -136,7 +136,7 @@ class Categorie extends CommonObject
*
* @note Move to const array when PHP 5.6 will be our minimum target
*/
protected $MAP_OBJ_CLASS = array(
public $MAP_OBJ_CLASS = array(
'product' => 'Product',
'customer' => 'Societe',
'supplier' => 'Fournisseur',
@ -178,7 +178,7 @@ class Categorie extends CommonObject
*
* @note Move to const array when PHP 5.6 will be our minimum target
*/
protected $MAP_OBJ_TABLE = array(
public static $MAP_OBJ_TABLE = array(
'customer' => 'societe',
'supplier' => 'societe',
'member' => 'adherent',
@ -258,6 +258,12 @@ class Categorie extends CommonObject
*/
public $motherof = array();
/**
* @var array Childs
*/
public $childs = array();
/**
* Constructor
*

View File

@ -461,6 +461,13 @@ if (empty($reshook) && $action == 'add') {
}
}
// Modify $moreparam so we are sure to see the event we have just created, whatever are the default value of filter on next page.
/*$moreparam .= ($moreparam ? '&' : '').'search_actioncode=0';
$moreparam .= ($moreparam ? '&' : '').'search_status=-1';
$moreparam .= ($moreparam ? '&' : '').'search_filtert='.$object->userownerid;
*/
$moreparam .= ($moreparam ? '&' : '').'disabledefaultvalues=1';
if ($error) {
$db->rollback();
} else {
@ -674,7 +681,7 @@ if (empty($reshook) && $action == 'update') {
$object->errors[] = $object->error;
} else {
if ($db->num_rows($resql) > 0) {
// already in use
// Resource already in use
$error++;
$object->error = $langs->trans('ErrorResourcesAlreadyInUse').' : ';
while ($obj = $db->fetch_object($resql)) {
@ -853,7 +860,7 @@ if (empty($reshook) && GETPOST('actionmove', 'alpha') == 'mupdate') {
$object->errors[] = $object->error;
} else {
if ($db->num_rows($resql) > 0) {
// already in use
// Resource already in use
$error++;
$object->error = $langs->trans('ErrorResourcesAlreadyInUse').' : ';
while ($obj = $db->fetch_object($resql)) {
@ -952,16 +959,17 @@ if ($action == 'create') {
console.log("setdatefields");
setdatefields();
});
$("#selectcomplete").change(function() {
if ($("#selectcomplete").val() == 100)
{
console.log("we change the complete status - set the doneby");
if ($("#selectcomplete").val() == 100) {
if ($("#doneby").val() <= 0) $("#doneby").val(\''.((int) $user->id).'\');
}
if ($("#selectcomplete").val() == 0)
{
if ($("#selectcomplete").val() == 0) {
$("#doneby").val(-1);
}
});
$("#actioncode").change(function() {
if ($("#actioncode").val() == \'AC_RDV\') $("#dateend").addClass("fieldrequired");
else $("#dateend").removeClass("fieldrequired");
@ -1019,59 +1027,15 @@ if ($action == 'create') {
print '<tr><td'.(empty($conf->global->AGENDA_USE_EVENT_TYPE) ? ' class="fieldrequired titlefieldcreate"' : '').'>'.$langs->trans("Label").'</td><td><input type="text" id="label" name="label" class="soixantepercent" value="'.GETPOST('label').'"></td></tr>';
// Full day
print '<tr><td><label for="fullday">'.$langs->trans("EventOnFullDay").'</label></td><td><input type="checkbox" id="fullday" name="fullday" '.(GETPOST('fullday') ? ' checked' : '').'></td></tr>';
print '<tr><td><span class="fieldrequired">'.$langs->trans("Date").'</span></td><td class="valignmiddle height30 small"><input type="checkbox" id="fullday" name="fullday" '.(GETPOST('fullday') ? ' checked' : '').'><label for="fullday">'.$langs->trans("EventOnFullDay").'</label>';
$datep = ($datep ? $datep : (is_null($object->datep) ? '' : $object->datep));
if (GETPOST('datep', 'int', 1)) {
$datep = dol_stringtotime(GETPOST('datep', 'int', 1), 'tzuser');
}
$datef = ($datef ? $datef : $object->datef);
if (GETPOST('datef', 'int', 1)) {
$datef = dol_stringtotime(GETPOST('datef', 'int', 1), 'tzuser');
}
if (empty($datef) && !empty($datep)) {
if (GETPOST("actioncode", 'aZ09') == 'AC_RDV' || empty($conf->global->AGENDA_USE_EVENT_TYPE_DEFAULT)) {
$datef = dol_time_plus_duree($datep, (empty($conf->global->AGENDA_AUTOSET_END_DATE_WITH_DELTA_HOURS) ? 1 : $conf->global->AGENDA_AUTOSET_END_DATE_WITH_DELTA_HOURS), 'h');
}
}
// 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"
} else {
print $form->selectDate($datep, 'ap', 1, 1, 1, "action", 1, 2, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuserrel');
}
print ' <span class="hideonsmartphone">&nbsp; &nbsp; - &nbsp; &nbsp;</span> ';
//print ' - ';
if (GETPOST("afaire") == 1) {
print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend', '', '', '', 1, '', '', 'tzuserrel');
} else {
print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend', '', '', '', 1, '', '', 'tzuserrel');
}
print '</td></tr>';
// Date end
/*print '<tr><td>';
print '<span id="dateend"'.(GETPOST("actioncode", 'aZ09') == 'AC_RDV' ? ' class="fieldrequired"' : '').'>'.$langs->trans("DateActionEnd").'</span>';
print '</td>';
print '<td>';
if (GETPOST("afaire") == 1) {
print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 2, 0, 'fulldayend');
} else {
print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 2, 0, 'fulldayend');
}
print '</td></tr>';*/
// Dev in progress
// Recurring event
$userepeatevent = ($conf->global->MAIN_FEATURES_LEVEL == 2 ? 1 : 0);
if ($userepeatevent) {
// Repeat
print '<tr><td></td><td colspan="3">';
//print '<tr><td></td><td colspan="3" class="opacitymedium">';
print ' &nbsp; &nbsp; &nbsp; &nbsp; <div class="opacitymedium inline-block">';
print img_picto($langs->trans("Recurrence"), 'recurring', 'class="paddingright2"');
print '<input type="hidden" name="recurid" value="'.$object->recurid.'">';
$selectedrecurrulefreq = 'no';
$selectedrecurrulebymonthday = '';
@ -1120,34 +1084,51 @@ if ($action == 'create') {
});
});
</script>';
print '</td></tr>';
print '</div>';
//print '</td></tr>';
}
// Status
print '<tr><td>'.$langs->trans("Status").' / '.$langs->trans("Percentage").'</td>';
print '<td>';
$percent = $complete !=='' ? $complete : -1;
if (GETPOSTISSET('status')) {
$percent = GETPOST('status');
} elseif (GETPOSTISSET('percentage')) {
$percent = GETPOST('percentage', 'int');
} else {
if ($complete == '0' || GETPOST("afaire") == 1) {
$percent = '0';
} elseif ($complete == 100 || GETPOST("afaire") == 2) {
$percent = 100;
}
}
$formactions->form_select_status_action('formaction', $percent, 1, 'complete', 0, 0, 'maxwidth200');
print '</td></tr>';
// Location
if (empty($conf->global->AGENDA_DISABLE_LOCATION)) {
print '<tr><td>'.$langs->trans("Location").'</td><td><input type="text" name="location" class="minwidth300 maxwidth150onsmartphone" value="'.(GETPOST('location') ? GETPOST('location') : $object->location).'"></td></tr>';
$datep = ($datep ? $datep : (is_null($object->datep) ? '' : $object->datep));
if (GETPOST('datep', 'int', 1)) {
$datep = dol_stringtotime(GETPOST('datep', 'int', 1), 'tzuser');
}
$datef = ($datef ? $datef : $object->datef);
if (GETPOST('datef', 'int', 1)) {
$datef = dol_stringtotime(GETPOST('datef', 'int', 1), 'tzuser');
}
if (empty($datef) && !empty($datep)) {
if (GETPOST("actioncode", 'aZ09') == 'AC_RDV' || empty($conf->global->AGENDA_USE_EVENT_TYPE_DEFAULT)) {
$datef = dol_time_plus_duree($datep, (empty($conf->global->AGENDA_AUTOSET_END_DATE_WITH_DELTA_HOURS) ? 1 : $conf->global->AGENDA_AUTOSET_END_DATE_WITH_DELTA_HOURS), 'h');
}
}
// 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"
} else {
print $form->selectDate($datep, 'ap', 1, 1, 1, "action", 1, 2, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuserrel');
}
print ' <span class="hideonsmartphone">&nbsp; &nbsp; - &nbsp; &nbsp;</span> ';
if (GETPOST("afaire") == 1) {
print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend', '', '', '', 1, '', '', 'tzuserrel');
} else {
print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend', '', '', '', 1, '', '', 'tzuserrel');
}
print '</td></tr>';
print '<tr><td class="">&nbsp;</td><td></td></tr>';
// Assigned to
print '<tr><td class="tdtop nowrap">'.$langs->trans("ActionAffectedTo").'</td><td>';
print '<tr><td class="tdtop nowrap"><span class="fieldrequired">'.$langs->trans("ActionAffectedTo").'</span></td><td>';
$listofuserid = array();
$listofcontactid = array();
$listofotherid = array();
@ -1181,6 +1162,29 @@ if ($action == 'create') {
print '</td></tr>';
}
// Location
if (empty($conf->global->AGENDA_DISABLE_LOCATION)) {
print '<tr><td>'.$langs->trans("Location").'</td><td><input type="text" name="location" class="minwidth300 maxwidth150onsmartphone" value="'.(GETPOST('location') ? GETPOST('location') : $object->location).'"></td></tr>';
}
// Status
print '<tr><td>'.$langs->trans("Status").' / '.$langs->trans("Percentage").'</td>';
print '<td>';
$percent = $complete !=='' ? $complete : -1;
if (GETPOSTISSET('status')) {
$percent = GETPOST('status');
} elseif (GETPOSTISSET('percentage')) {
$percent = GETPOST('percentage', 'int');
} else {
if ($complete == '0' || GETPOST("afaire") == 1) {
$percent = '0';
} elseif ($complete == 100 || GETPOST("afaire") == 2) {
$percent = 100;
}
}
$formactions->form_select_status_action('formaction', $percent, 1, 'complete', 0, 0, 'maxwidth200');
print '</td></tr>';
if ($conf->categorie->enabled) {
// Categories
print '<tr><td>'.$langs->trans("Categories").'</td><td>';
@ -1523,6 +1527,7 @@ if ($id > 0) {
if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
print '<tr><td class="fieldrequired">'.$langs->trans("Type").'</td><td colspan="3">';
if ($object->type_code != 'AC_OTH_AUTO') {
print img_picto($langs->trans("ActionType"), 'square', 'class="fawidth30 inline-block" style="color: #ddd;"');
print $formactions->select_type_actions(GETPOST("actioncode", 'aZ09') ? GETPOST("actioncode", 'aZ09') : $object->type_code, "actioncode", "systemauto", 0, 0, 0, 1);
} else {
print '<input type="hidden" name="actioncode" value="'.$object->type_code.'">';
@ -1533,40 +1538,19 @@ if ($id > 0) {
}
// Title
print '<tr><td class="fieldrequired">'.$langs->trans("Title").'</td><td colspan="3"><input type="text" name="label" class="soixantepercent" value="'.$object->label.'"></td></tr>';
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>';
// Full day event
print '<tr><td>'.$langs->trans("EventOnFullDay").'</td><td colspan="3"><input type="checkbox" id="fullday" name="fullday" '.($object->fulldayevent ? ' checked' : '').'></td></tr>';
print '<tr><td><span class="fieldrequired">'.$langs->trans("Date").'</span></td><td colspan="3" class="valignmiddle height30 small"><input type="checkbox" id="fullday" name="fullday" '.($object->fulldayevent ? ' checked' : '').'>';
print '<label for="fullday">'.$langs->trans("EventOnFullDay").'</label>';
// Date start - end
print '<tr><td class="nowrap">';
print '<span class="fieldrequired">'.$langs->trans("DateActionStart").'</span>';
print ' - ';
print '<span id="dateend"'.($object->type_code == 'AC_RDV' ? ' class="fieldrequired"' : '').'>'.$langs->trans("DateActionEnd").'</span>';
print '</td><td td colspan="3">';
$tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT');
if (GETPOST("afaire") == 1) {
print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 0, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
} elseif (GETPOST("afaire") == 2) {
print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
} else {
print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
}
print ' - ';
if (GETPOST("afaire") == 1) {
print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
} elseif (GETPOST("afaire") == 2) {
print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
} else {
print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
}
print '</td></tr>';
// Dev in progress
// Recurring event
$userepeatevent = ($conf->global->MAIN_FEATURES_LEVEL == 2 ? 1 : 0);
if ($userepeatevent) {
// Repeat
print '<tr><td></td><td colspan="3">';
//print '<tr><td></td><td colspan="3">';
print ' &nbsp; &nbsp; &nbsp; &nbsp; <div class="opacitymedium inline-block">';
print img_picto($langs->trans("Recurrence"), 'recurring', 'class="paddingright2"');
print '<input type="hidden" name="recurid" value="'.$object->recurid.'">';
$selectedrecurrulefreq = 'no';
$selectedrecurrulebymonthday = '';
@ -1615,19 +1599,37 @@ if ($id > 0) {
});
});
</script>';
print '</td></tr>';
print '</div>';
//print '</td></tr>';
}
// Status
print '<tr><td class="nowrap">'.$langs->trans("Status").' / '.$langs->trans("Percentage").'</td><td colspan="3">';
$percent = GETPOSTISSET("percentage") ? GETPOST("percentage", "int") : $object->percentage;
$formactions->form_select_status_action('formaction', $percent, 1, 'complete', 0, 0, 'maxwidth200');
print '</td></tr>';
// Location
if (empty($conf->global->AGENDA_DISABLE_LOCATION)) {
print '<tr><td>'.$langs->trans("Location").'</td><td colspan="3"><input type="text" name="location" class="width500" value="'.$object->location.'"></td></tr>';
// Date start - end
print '<tr><td class="nowrap">';
/*print '<span class="fieldrequired">'.$langs->trans("DateActionStart").'</span>';
print ' - ';
print '<span id="dateend"'.($object->type_code == 'AC_RDV' ? ' class="fieldrequired"' : '').'>'.$langs->trans("DateActionEnd").'</span>';
*/
print '</td><td td colspan="3">';
$tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT');
if (GETPOST("afaire") == 1) {
print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 0, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
} elseif (GETPOST("afaire") == 2) {
print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
} else {
print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
}
print ' <span class="hideonsmartphone">&nbsp; &nbsp; - &nbsp; &nbsp;</span> ';
if (GETPOST("afaire") == 1) {
print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
} elseif (GETPOST("afaire") == 2) {
print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
} else {
print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
}
print '</td></tr>';
print '<tr><td class="">&nbsp;</td><td></td></tr>';
// Assigned to
$listofuserid = array(); // User assigned
@ -1678,6 +1680,18 @@ if ($id > 0) {
print $form->select_dolusers($object->userdoneid > 0 ? $object->userdoneid : -1, 'doneby', 1);
print '</td></tr>';
}
// Location
if (empty($conf->global->AGENDA_DISABLE_LOCATION)) {
print '<tr><td>'.$langs->trans("Location").'</td><td colspan="3"><input type="text" name="location" class="width500" value="'.$object->location.'"></td></tr>';
}
// Status
print '<tr><td class="nowrap">'.$langs->trans("Status").' / '.$langs->trans("Percentage").'</td><td colspan="3">';
$percent = GETPOSTISSET("percentage") ? GETPOST("percentage", "int") : $object->percentage;
$formactions->form_select_status_action('formaction', $percent, 1, 'complete', 0, 0, 'maxwidth200');
print '</td></tr>';
// Tags-Categories
if ($conf->categorie->enabled) {
print '<tr><td>'.$langs->trans("Categories").'</td><td colspan="3">';
@ -1786,7 +1800,7 @@ if ($id > 0) {
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
// Editeur wysiwyg
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor('note', $object->note_private, '', 200, 'dolibarr_notes', 'In', true, true, $conf->fckeditor->enabled, ROWS_5, '90%');
$doleditor = new DolEditor('note', $object->note_private, '', 120, 'dolibarr_notes', 'In', true, true, $conf->fckeditor->enabled, ROWS_4, '90%');
$doleditor->Create();
print '</td></tr>';

View File

@ -1621,7 +1621,7 @@ class ActionComm extends CommonObject
$label = $langs->trans("ShowAction");
$linkclose .= ' alt="'.dol_escape_htmltag($tooltip, 1).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($tooltip, 1, 0, 0, '', 1).'"';
$linkclose .= ' title="'.dol_escape_htmltag($tooltip, 1, 0, '', 1).'"';
$linkclose .= ' class="'.$classname.' classfortooltip"';
/*
$hookmanager->initHooks(array('actiondao'));

View File

@ -49,6 +49,8 @@ if (empty($conf->global->AGENDA_EXT_NB)) {
}
$MAXAGENDA = $conf->global->AGENDA_EXT_NB;
$disabledefaultvalues = GETPOST('disabledefaultvalues', 'int');
$check_holiday = GETPOST('check_holiday', 'int');
$filter = GETPOST("search_filter", 'alpha', 3) ? GETPOST("search_filter", 'alpha', 3) : GETPOST("filter", 'alpha', 3);
$filtert = GETPOST("search_filtert", "int", 3) ? GETPOST("search_filtert", "int", 3) : GETPOST("filtert", "int", 3);
@ -110,7 +112,7 @@ $week = GETPOST("week", "int") ?GETPOST("week", "int") : date("W");
$day = GETPOST("day", "int") ?GETPOST("day", "int") : date("d");
$pid = GETPOST("search_projectid", "int", 3) ? GETPOST("search_projectid", "int", 3) : GETPOST("projectid", "int", 3);
$status = GETPOSTISSET("search_status") ? GETPOST("search_status", 'aZ09') : GETPOST("status", 'aZ09'); // status may be 0, 50, 100, 'todo'
$type = GETPOSTISSET("search_type", 'aZ09') ? GETPOST("search_type", 'aZ09') : GETPOST("type", 'aZ09');
$type = GETPOSTISSET("search_type") ? GETPOST("search_type", 'aZ09') : GETPOST("type", 'aZ09');
$maxprint = GETPOSTISSET("maxprint") ? GETPOST("maxprint", 'int') : $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW;
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
@ -128,14 +130,11 @@ if (GETPOST('search_actioncode', 'array:aZ09')) {
$actioncode = '0';
}
} else {
$actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE));
}
if ($actioncode == '' && empty($actioncodearray)) {
$actioncode = (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE);
$actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode") == '0' ? '0' : ((empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE));
}
if ($status == '' && !GETPOSTISSET('search_status')) {
$status = (empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS);
$status = ((empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS);
}
$defaultview = (empty($conf->global->AGENDA_DEFAULT_VIEW) ? 'show_month' : $conf->global->AGENDA_DEFAULT_VIEW);

View File

@ -45,6 +45,11 @@ $langs->loadLangs(array("users", "companies", "agenda", "commercial", "other", "
$action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'actioncommlist'; // To manage different context of search
$optioncss = GETPOST('optioncss', 'alpha');
$toselect = GETPOST('toselect', 'array');
$confirm = GETPOST('confirm', 'alpha');
$disabledefaultvalues = GETPOST('disabledefaultvalues', 'int');
$mode = GETPOST('mode', 'aZ09');
if (empty($mode) && preg_match('/show_/', $action)) {
@ -54,12 +59,9 @@ $resourceid = GETPOST("search_resourceid", "int") ?GETPOST("search_resourceid",
$pid = GETPOST("search_projectid", 'int', 3) ?GETPOST("search_projectid", 'int', 3) : GETPOST("projectid", 'int', 3);
$search_status = (GETPOST("search_status", 'aZ09') != '') ? GETPOST("search_status", 'aZ09') : GETPOST("status", 'aZ09');
$type = GETPOST('search_type', 'alphanohtml') ?GETPOST('search_type', 'alphanohtml') : GETPOST('type', 'alphanohtml');
$optioncss = GETPOST('optioncss', 'alpha');
$year = GETPOST("year", 'int');
$month = GETPOST("month", 'int');
$day = GETPOST("day", 'int');
$toselect = GETPOST('toselect', 'array');
$confirm = GETPOST('confirm', 'alpha');
// Set actioncode (this code must be same for setting actioncode into peruser, listacton and index)
if (GETPOST('search_actioncode', 'array')) {
@ -68,11 +70,9 @@ if (GETPOST('search_actioncode', 'array')) {
$actioncode = '0';
}
} else {
$actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE));
}
if ($actioncode == '' && empty($actioncodearray)) {
$actioncode = (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE);
$actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode") == '0' ? '0' : ((empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE));
}
$search_id = GETPOST('search_id', 'alpha');
$search_title = GETPOST('search_title', 'alpha');
$search_note = GETPOST('search_note', 'alpha');
@ -83,7 +83,7 @@ $datestart_dtend = dol_mktime(23, 59, 59, GETPOST('datestart_dtendmonth', 'int')
$dateend_dtstart = dol_mktime(0, 0, 0, GETPOST('dateend_dtstartmonth', 'int'), GETPOST('dateend_dtstartday', 'int'), GETPOST('dateend_dtstartyear', 'int'), 'tzuserrel');
$dateend_dtend = dol_mktime(23, 59, 59, GETPOST('dateend_dtendmonth', 'int'), GETPOST('dateend_dtendday', 'int'), GETPOST('dateend_dtendyear', 'int'), 'tzuserrel');
if ($search_status == '' && !GETPOSTISSET('search_status')) {
$search_status = (empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS);
$search_status = ((empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS);
}
if (empty($mode) && !GETPOSTISSET('mode')) {
$mode = (empty($conf->global->AGENDA_DEFAULT_VIEW) ? 'show_month' : $conf->global->AGENDA_DEFAULT_VIEW);
@ -216,7 +216,14 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$datestart_dtend = '';
$dateend_dtstart = '';
$dateend_dtend = '';
$actioncode = '';
$search_status = '';
$pid = '';
$socid = '';
$resourceid = '';
$filter = '';
$filtert = '';
$usergroup = '';
$toselect = array();
$search_array_options = array();
}
@ -299,7 +306,7 @@ if ($actioncode != '') {
if ($resourceid > 0) {
$param .= "&search_resourceid=".urlencode($resourceid);
}
if ($search_status != '' && $search_status > -1) {
if ($search_status != '') {
$param .= "&search_status=".urlencode($search_status);
}
if ($filter) {

View File

@ -45,6 +45,8 @@ if (!isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) {
$action = GETPOST('action', 'aZ09');
$disabledefaultvalues = GETPOST('disabledefaultvalues', 'int');
$filter = GETPOST("search_filter", 'alpha', 3) ? GETPOST("search_filter", 'alpha', 3) : GETPOST("filter", 'alpha', 3);
$filtert = GETPOST("search_filtert", "int", 3) ? GETPOST("search_filtert", "int", 3) : GETPOST("filtert", "int", 3);
$usergroup = GETPOST("search_usergroup", "int", 3) ? GETPOST("search_usergroup", "int", 3) : GETPOST("usergroup", "int", 3);
@ -110,10 +112,7 @@ if (GETPOST('search_actioncode', 'array')) {
$actioncode = '0';
}
} else {
$actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode", "alpha") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE));
}
if ($actioncode == '' && empty($actioncodearray)) {
$actioncode = (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE);
$actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode", "alpha") == '0' ? '0' : ((empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE));
}
$dateselect = dol_mktime(0, 0, 0, GETPOST('dateselectmonth', 'int'), GETPOST('dateselectday', 'int'), GETPOST('dateselectyear', 'int'));
@ -145,7 +144,7 @@ $begin_d = 1;
$end_d = 53;
if ($status == '' && !GETPOSTISSET('search_status')) {
$status = (empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS);
$status = ((empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS);
}
if (empty($mode) && !GETPOSTISSET('mode')) {
$mode = (empty($conf->global->AGENDA_DEFAULT_VIEW) ? 'show_month' : $conf->global->AGENDA_DEFAULT_VIEW);

View File

@ -45,6 +45,8 @@ if (!isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) {
$action = GETPOST('action', 'aZ09');
$disabledefaultvalues = GETPOST('disabledefaultvalues', 'int');
$filter = GETPOST("search_filter", 'alpha', 3) ? GETPOST("search_filter", 'alpha', 3) : GETPOST("filter", 'alpha', 3);
$filtert = GETPOST("search_filtert", "int", 3) ? GETPOST("search_filtert", "int", 3) : GETPOST("filtert", "int", 3);
$usergroup = GETPOST("search_usergroup", "int", 3) ? GETPOST("search_usergroup", "int", 3) : GETPOST("usergroup", "int", 3);
@ -110,10 +112,7 @@ if (GETPOST('search_actioncode', 'array:aZ09')) {
$actioncode = '0';
}
} else {
$actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode", "alpha") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE));
}
if ($actioncode == '' && empty($actioncodearray)) {
$actioncode = (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE);
$actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode", "alpha") == '0' ? '0' : ((empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE));
}
$dateselect = dol_mktime(0, 0, 0, GETPOST('dateselectmonth', 'int'), GETPOST('dateselectday', 'int'), GETPOST('dateselectyear', 'int'));
@ -154,7 +153,7 @@ if ($end_d < $begin_d) {
}
if ($status == '' && !GETPOSTISSET('search_status')) {
$status = (empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS);
$status = ((empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS);
}
if (empty($mode) && !GETPOSTISSET('mode')) {

View File

@ -961,7 +961,7 @@ if ($action == 'create') {
if (GETPOST('cancel', 'alpha') || $confirm == 'no' || $action == '' || in_array($action, array('settodraft', 'valid', 'delete', 'sendall', 'clone', 'test'))) {
print "\n\n<div class=\"tabsAction\">\n";
if (($object->statut == 1) && ($user->rights->mailing->valider || $object->fk_user_valid == $user->id)) {
if (($object->statut == 1) && ($user->rights->mailing->valider || $object->user_validation == $user->id)) {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=settodraft&token='.newToken().'&id='.$object->id.'">'.$langs->trans("SetToDraft").'</a>';
}
@ -1066,7 +1066,7 @@ if ($action == 'create') {
print dol_get_fiche_end();
print dol_set_focus('#sendto');
dol_set_focus('#sendto');
}

View File

@ -86,6 +86,11 @@ class Mailing extends CommonObject
*/
public $email_from;
/**
* @var string email to
*/
public $sendto;
/**
* @var string email reply to
*/
@ -175,6 +180,11 @@ class Mailing extends CommonObject
*/
public $statuts = array();
/**
* @var array substitutionarray
*/
public $substitutionarray;
/**
* Constructor

View File

@ -135,8 +135,13 @@ class Proposals extends DolibarrApi
}
// Add external contacts ids.
$this->propal->contacts_ids = $this->propal->liste_contact(-1, 'external', $contact_list);
$tmparray = $this->propal->liste_contact(-1, 'external', $contact_list);
if (is_array($tmparray)) {
$this->propal->contacts_ids = $tmparray;
}
$this->propal->fetchObjectLinked();
return $this->_cleanObjectDatas($this->propal);
}
@ -228,7 +233,10 @@ class Proposals extends DolibarrApi
$proposal_static = new Propal($this->db);
if ($proposal_static->fetch($obj->rowid)) {
// Add external contacts ids
$proposal_static->contacts_ids = $proposal_static->liste_contact(-1, 'external', 1);
$tmparray = $proposal_static->liste_contact(-1, 'external', 1);
if (is_array($tmparray)) {
$proposal_static->contacts_ids = $tmparray;
}
$obj_ret[] = $this->_cleanObjectDatas($proposal_static);
}
$i++;
@ -645,7 +653,7 @@ class Proposals extends DolibarrApi
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$contacts = $this->invoice->liste_contact();
$contacts = $this->propal->liste_contact();
foreach ($contacts as $contact) {
if ($contact['id'] == $contactid && $contact['code'] == $type) {

View File

@ -296,8 +296,8 @@ class Propal extends CommonObject
'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>20),
'ref_client' =>array('type'=>'varchar(255)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>22),
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'RefExt', 'enabled'=>1, 'visible'=>0, 'position'=>40),
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'position'=>23),
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>1, 'visible'=>-1, 'position'=>24),
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'position'=>23),
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>'$conf->projet->enabled', 'visible'=>-1, 'position'=>24),
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>25),
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>55),
'datep' =>array('type'=>'date', 'label'=>'Date', 'enabled'=>1, 'visible'=>-1, 'position'=>60),
@ -317,7 +317,7 @@ class Propal extends CommonObject
'localtax1' =>array('type'=>'double(24,8)', 'label'=>'LocalTax1', 'enabled'=>1, 'visible'=>-1, 'position'=>135, 'isameasure'=>1),
'localtax2' =>array('type'=>'double(24,8)', 'label'=>'LocalTax2', 'enabled'=>1, 'visible'=>-1, 'position'=>140, 'isameasure'=>1),
'total_ttc' =>array('type'=>'double(24,8)', 'label'=>'TotalTTC', 'enabled'=>1, 'visible'=>-1, 'position'=>145, 'isameasure'=>1),
'fk_account' =>array('type'=>'integer', 'label'=>'BankAccount', 'enabled'=>1, 'visible'=>-1, 'position'=>150),
'fk_account' =>array('type'=>'integer', 'label'=>'BankAccount', 'enabled'=>'$conf->banque->enabled', 'visible'=>-1, 'position'=>150),
'fk_currency' =>array('type'=>'varchar(3)', 'label'=>'Currency', 'enabled'=>1, 'visible'=>-1, 'position'=>155),
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'position'=>160),
'deposit_percent' =>array('type'=>'varchar(63)', 'label'=>'DepositPercent', 'enabled'=>1, 'visible'=>-1, 'position'=>161),
@ -327,7 +327,7 @@ class Propal extends CommonObject
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'PDFTemplate', 'enabled'=>1, 'visible'=>0, 'position'=>180),
'date_livraison' =>array('type'=>'date', 'label'=>'DateDeliveryPlanned', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
'fk_shipping_method' =>array('type'=>'integer', 'label'=>'ShippingMethod', 'enabled'=>1, 'visible'=>-1, 'position'=>190),
'fk_warehouse' =>array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Fk warehouse', 'enabled'=>1, 'visible'=>-1, 'position'=>191),
'fk_warehouse' =>array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Fk warehouse', 'enabled'=>'$conf->stock->enabled', 'visible'=>-1, 'position'=>191),
'fk_availability' =>array('type'=>'integer', 'label'=>'Availability', 'enabled'=>1, 'visible'=>-1, 'position'=>195),
'fk_delivery_address' =>array('type'=>'integer', 'label'=>'DeliveryAddress', 'enabled'=>1, 'visible'=>0, 'position'=>200), // deprecated
'fk_input_reason' =>array('type'=>'integer', 'label'=>'InputReason', 'enabled'=>1, 'visible'=>-1, 'position'=>205),
@ -490,7 +490,6 @@ class Propal extends CommonObject
$line->subprice = -$remise->amount_ht;
$line->fk_product = 0; // Id produit predefined
$line->qty = 1;
$line->remise = 0;
$line->remise_percent = 0;
$line->rang = -1;
$line->info_bits = 2;
@ -736,7 +735,6 @@ class Propal extends CommonObject
// TODO deprecated
$this->line->price = $price;
$this->line->remise = $remise;
if (is_array($array_options) && count($array_options) > 0) {
$this->line->array_options = $array_options;
@ -936,7 +934,6 @@ class Propal extends CommonObject
// TODO deprecated
$this->line->price = $price;
$this->line->remise = $remise;
if (is_array($array_options) && count($array_options) > 0) {
// We replace values in this->line->array_options only for entries defined into $array_options
@ -1520,6 +1517,7 @@ class Propal extends CommonObject
$sql = "SELECT p.rowid, p.ref, p.entity, p.remise, p.remise_percent, p.remise_absolue, p.fk_soc";
$sql .= ", p.total_ttc, p.total_tva, p.localtax1, p.localtax2, p.total_ht";
$sql .= ", p.datec";
$sql .= ", p.date_signature as dates";
$sql .= ", p.date_valid as datev";
$sql .= ", p.datep as dp";
$sql .= ", p.fin_validite as dfv";
@ -1603,6 +1601,7 @@ class Propal extends CommonObject
$this->date_creation = $this->db->jdate($obj->datec); //Creation date
$this->date_validation = $this->db->jdate($obj->datev); //Validation date
$this->date_modification = $this->db->jdate($obj->date_modification); // tms
$this->date_signature = $this->db->jdate($obj->dates); // Signature date
$this->date = $this->db->jdate($obj->dp); // Proposal date
$this->datep = $this->db->jdate($obj->dp); // deprecated
$this->fin_validite = $this->db->jdate($obj->dfv);
@ -1900,14 +1899,15 @@ class Propal extends CommonObject
// multilangs
if (!empty($conf->global->MAIN_MULTILANGS) && !empty($objp->fk_product) && !empty($loadalsotranslation)) {
$line = new Product($this->db);
$line->fetch($objp->fk_product);
$line->getMultiLangs();
$tmpproduct = new Product($this->db);
$tmpproduct->fetch($objp->fk_product);
$tmpproduct->getMultiLangs();
$line->multilangs = $tmpproduct->multilangs;
}
$this->lines[$i] = $line;
//dol_syslog("1 ".$line->fk_product);
//print "xx $i ".$this->lines[$i]->fk_product;
$i++;
}
@ -3993,6 +3993,7 @@ class PropaleLigne extends CommonObjectLine
public $multicurrency_total_tva;
public $multicurrency_total_ttc;
/**
* Class line Contructor
*
@ -4132,9 +4133,6 @@ class PropaleLigne extends CommonObjectLine
if (empty($this->rang)) {
$this->rang = 0;
}
if (empty($this->remise)) {
$this->remise = 0;
}
if (empty($this->remise_percent) || !is_numeric($this->remise_percent)) {
$this->remise_percent = 0;
}
@ -4364,9 +4362,6 @@ class PropaleLigne extends CommonObjectLine
if (empty($this->price)) {
$this->price = 0; // TODO A virer
}
if (empty($this->remise)) {
$this->remise = 0; // TODO A virer
}
if (empty($this->remise_percent)) {
$this->remise_percent = 0;
}

View File

@ -377,14 +377,14 @@ if ($action == 'validate' && $permissiontovalidate) {
if ($tmpproposal->fetch($checked) > 0) {
if ($tmpproposal->statut == $tmpproposal::STATUS_DRAFT) {
if ($tmpproposal->valid($user) > 0) {
setEventMessage($langs->trans('hasBeenValidated', $tmpproposal->ref), 'mesgs');
setEventMessages($langs->trans('hasBeenValidated', $tmpproposal->ref), null, 'mesgs');
} else {
setEventMessage($tmpproposal->error, $tmpproposal->errors, 'errors');
setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors');
$error++;
}
} else {
$langs->load("errors");
setEventMessage($langs->trans('ErrorIsNotADraft', $tmpproposal->ref), 'errors');
setEventMessages($langs->trans('ErrorIsNotADraft', $tmpproposal->ref), null, 'errors');
$error++;
}
} else {
@ -410,7 +410,7 @@ if ($action == "sign" && $permissiontoclose) {
if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED) {
$tmpproposal->statut = $tmpproposal::STATUS_SIGNED;
if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_SIGNED) >= 0) {
setEventMessage($tmpproposal->ref." ".$langs->trans('Signed'), 'mesgs');
setEventMessages($tmpproposal->ref." ".$langs->trans('Signed'), null, 'mesgs');
} else {
setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors');
$error++;

View File

@ -133,7 +133,10 @@ class Orders extends DolibarrApi
}
// Add external contacts ids
$this->commande->contacts_ids = $this->commande->liste_contact(-1, 'external', $contact_list);
$tmparray = $this->commande->liste_contact(-1, 'external', $contact_list);
if (is_array($tmparray)) {
$this->commande->contacts_ids = $tmparray;
}
$this->commande->fetchObjectLinked();
// Add online_payment_url, cf #20477
@ -234,7 +237,10 @@ class Orders extends DolibarrApi
$commande_static = new Commande($this->db);
if ($commande_static->fetch($obj->rowid)) {
// Add external contacts ids
$commande_static->contacts_ids = $commande_static->liste_contact(-1, 'external', 1);
$tmparray = $commande_static->liste_contact(-1, 'external', 1);
if (is_array($tmparray)) {
$commande_static->contacts_ids = $tmparray;
}
// Add online_payment_url, cf #20477
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
$commande_static->online_payment_url = getOnlinePaymentUrl(0, 'order', $commande_static->ref);

View File

@ -313,8 +313,8 @@ class Commande extends CommonOrder
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'RefExt', 'enabled'=>1, 'visible'=>0, 'position'=>26),
'ref_int' =>array('type'=>'varchar(255)', 'label'=>'RefInt', 'enabled'=>1, 'visible'=>0, 'position'=>27), // deprecated
'ref_client' =>array('type'=>'varchar(255)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>28),
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>20),
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>25),
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>20),
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>'$conf->projet->enabled', 'visible'=>-1, 'position'=>25),
'date_commande' =>array('type'=>'date', 'label'=>'Date', 'enabled'=>1, 'visible'=>1, 'position'=>60),
'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>62),
'date_cloture' =>array('type'=>'datetime', 'label'=>'DateClosing', 'enabled'=>1, 'visible'=>-1, 'position'=>65),
@ -334,14 +334,14 @@ class Commande extends CommonOrder
'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>155),
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'PDFTemplate', 'enabled'=>1, 'visible'=>0, 'position'=>160),
//'facture' =>array('type'=>'tinyint(4)', 'label'=>'ParentInvoice', 'enabled'=>1, 'visible'=>-1, 'position'=>165),
'fk_account' =>array('type'=>'integer', 'label'=>'BankAccount', 'enabled'=>1, 'visible'=>-1, 'position'=>170),
'fk_account' =>array('type'=>'integer', 'label'=>'BankAccount', 'enabled'=>'$conf->banque->enabled', 'visible'=>-1, 'position'=>170),
'fk_currency' =>array('type'=>'varchar(3)', 'label'=>'MulticurrencyID', 'enabled'=>1, 'visible'=>-1, 'position'=>175),
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'position'=>180),
'deposit_percent' =>array('type'=>'varchar(63)', 'label'=>'DepositPercent', 'enabled'=>1, 'visible'=>-1, 'position'=>181),
'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'PaymentMode', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
'date_livraison' =>array('type'=>'date', 'label'=>'DateDeliveryPlanned', 'enabled'=>1, 'visible'=>-1, 'position'=>190),
'fk_shipping_method' =>array('type'=>'integer', 'label'=>'ShippingMethod', 'enabled'=>1, 'visible'=>-1, 'position'=>195),
'fk_warehouse' =>array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Fk warehouse', 'enabled'=>1, 'visible'=>-1, 'position'=>200),
'fk_warehouse' =>array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Fk warehouse', 'enabled'=>'$conf->stock->enabled', 'visible'=>-1, 'position'=>200),
'fk_availability' =>array('type'=>'integer', 'label'=>'Availability', 'enabled'=>1, 'visible'=>-1, 'position'=>205),
'fk_input_reason' =>array('type'=>'integer', 'label'=>'InputReason', 'enabled'=>1, 'visible'=>-1, 'position'=>210),
//'fk_delivery_address' =>array('type'=>'integer', 'label'=>'DeliveryAddress', 'enabled'=>1, 'visible'=>-1, 'position'=>215),
@ -1666,7 +1666,6 @@ class Commande extends CommonOrder
// TODO Ne plus utiliser
$this->line->price = $price;
$this->line->remise = $remise;
if (is_array($array_options) && count($array_options) > 0) {
$this->line->array_options = $array_options;
@ -2010,7 +2009,6 @@ class Commande extends CommonOrder
$line->price = -$remise->amount_ht;
$line->fk_product = 0; // Id produit predefini
$line->qty = 1;
$line->remise = 0;
$line->remise_percent = 0;
$line->rang = -1;
$line->info_bits = 2;
@ -2154,9 +2152,11 @@ class Commande extends CommonOrder
// multilangs
if (!empty($conf->global->MAIN_MULTILANGS) && !empty($objp->fk_product) && !empty($loadalsotranslation)) {
$line = new Product($this->db);
$line->fetch($objp->fk_product);
$line->getMultiLangs();
$tmpproduct = new Product($this->db);
$tmpproduct->fetch($objp->fk_product);
$tmpproduct->getMultiLangs();
$line->multilangs = $tmpproduct->multilangs;
}
$this->lines[$i] = $line;
@ -3262,7 +3262,6 @@ class Commande extends CommonOrder
// TODO deprecated
$this->line->price = $price;
$this->line->remise = $remise;
if (is_array($array_options) && count($array_options) > 0) {
// We replace values in this->line->array_options only for entries defined into $array_options
@ -4404,9 +4403,6 @@ class OrderLine extends CommonOrderLine
if (empty($this->rang)) {
$this->rang = 0;
}
if (empty($this->remise)) {
$this->remise = 0;
}
if (empty($this->remise_percent)) {
$this->remise_percent = 0;
}
@ -4447,7 +4443,7 @@ class OrderLine extends CommonOrderLine
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'commandedet';
$sql .= ' (fk_commande, fk_parent_line, label, description, qty, ref_ext,';
$sql .= ' vat_src_code, tva_tx, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type,';
$sql .= ' fk_product, product_type, remise_percent, subprice, price, remise, fk_remise_except,';
$sql .= ' fk_product, product_type, remise_percent, subprice, price, fk_remise_except,';
$sql .= ' special_code, rang, fk_product_fournisseur_price, buy_price_ht,';
$sql .= ' info_bits, total_ht, total_tva, total_localtax1, total_localtax2, total_ttc, date_start, date_end,';
$sql .= ' fk_unit';
@ -4470,7 +4466,6 @@ class OrderLine extends CommonOrderLine
$sql .= " '".price2num($this->remise_percent)."',";
$sql .= " ".(price2num($this->subprice) !== '' ?price2num($this->subprice) : "null").",";
$sql .= " ".($this->price != '' ? "'".price2num($this->price)."'" : "null").",";
$sql .= " '".price2num($this->remise)."',";
$sql .= ' '.(!empty($this->fk_remise_except) ? $this->fk_remise_except : "null").',';
$sql .= ' '.((int) $this->special_code).',';
$sql .= ' '.((int) $this->rang).',';
@ -4579,9 +4574,6 @@ class OrderLine extends CommonOrderLine
if (empty($this->marge_tx)) {
$this->marge_tx = 0;
}
if (empty($this->remise)) {
$this->remise = 0;
}
if (empty($this->remise_percent)) {
$this->remise_percent = 0;
}

View File

@ -165,7 +165,7 @@ class PaymentVarious extends CommonObject
*
* @param DoliDB $db Database handler
*/
public function __construct($db)
public function __construct(DoliDB $db)
{
$this->db = $db;
$this->element = 'payment_various';

View File

@ -121,7 +121,7 @@ class Deplacement extends CommonObject
*
* @param DoliDB $db Database handler
*/
public function __construct($db)
public function __construct(DoliDB $db)
{
$this->db = $db;

View File

@ -158,7 +158,7 @@ if ($resql) {
print '<input class="flat" type="text" size="1" maxlength="2" name="day" value="'.$day.'">';
}
print '<input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">';
$formother->select_year($year ? $year : -1, 'year', 1, 20, 5);
print $formother->selectyear($year ? $year : -1, 'year', 1, 20, 5);
print '</td>';
print '<td class="liste_titre">';
print '<input class="flat" size="10" type="text" name="search_name" value="'.$search_name.'">';

View File

@ -1700,7 +1700,7 @@ if ($action == 'create') {
$MAXEVENT = 10;
//$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-list-alt imgforviewmode', dol_buildpath('/mymodule/myobject_agenda.php', 1).'?id='.$object->id);
//$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', dol_buildpath('/mymodule/myobject_agenda.php', 1).'?id='.$object->id);
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';

View File

@ -142,9 +142,9 @@ if (!empty($conf->global->INVOICE_DISALLOW_REOPEN)) {
$usercanunvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($usercancreate)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->facture->invoice_advance->unvalidate)));
$usercanproductignorepricemin = ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS));
$usercancreatemargin = $user->rights->margins->creer;
$usercanreadallmargin = $user->rights->margins->liretous;
$usercancreatewithdrarequest = $user->rights->prelevement->bons->creer;
$usercancreatemargin = (!empty($user->rights->margins->creer) ? $user->rights->margins->creer : 0);
$usercanreadallmargin = (!empty($user->rights->margins->liretous) ? $user->rights->margins->liretous : 0);
$usercancreatewithdrarequest = (!empty($user->rights->prelevement->bons->creer) ? $user->rights->prelevement->bons->creer : 0);
$permissionnote = $usercancreate; // Used by the include of actions_setnotes.inc.php
$permissiondellink = $usercancreate; // Used by the include of actions_dellink.inc.php

View File

@ -148,7 +148,10 @@ class Invoices extends DolibarrApi
// Add external contacts ids
if ($contact_list > -1) {
$this->invoice->contacts_ids = $this->invoice->liste_contact(-1, 'external', $contact_list);
$tmparray = $this->invoice->liste_contact(-1, 'external', $contact_list);
if(is_array($tmparray)) {
$this->invoice->contacts_ids = $tmparray;
}
}
$this->invoice->fetchObjectLinked();
@ -267,8 +270,10 @@ class Invoices extends DolibarrApi
$invoice_static->remaintopay = price2num($invoice_static->total_ttc - $invoice_static->totalpaid - $invoice_static->totalcreditnotes - $invoice_static->totaldeposits, 'MT');
// Add external contacts ids
$invoice_static->contacts_ids = $invoice_static->liste_contact(-1, 'external', 1);
$tmparray = $invoice_static->liste_contact(-1, 'external', 1);
if (is_array($tmparray)) {
$invoice_static->contacts_ids = $tmparray;
}
$obj_ret[] = $this->_cleanObjectDatas($invoice_static);
}
$i++;
@ -1768,7 +1773,10 @@ class Invoices extends DolibarrApi
// Add external contacts ids
if ($contact_list > -1) {
$this->template_invoice->contacts_ids = $this->template_invoice->liste_contact(-1, 'external', $contact_list);
$tmparray = $this->template_invoice->liste_contact(-1, 'external', $contact_list);
if (is_array($tmparray)) {
$this->template_invoice->contacts_ids = $tmparray;
}
}
$this->template_invoice->fetchObjectLinked();

View File

@ -169,7 +169,7 @@ class FactureRec extends CommonInvoice
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
'titre' =>array('type'=>'varchar(100)', 'label'=>'Titre', 'enabled'=>1, 'showoncombobox' => 1, 'visible'=>-1, 'position'=>15),
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>20, 'index'=>1),
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>25),
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>25),
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>30),
//'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35),
'remise' =>array('type'=>'double', 'label'=>'Remise', 'enabled'=>1, 'visible'=>-1, 'position'=>40),
@ -181,7 +181,7 @@ class FactureRec extends CommonInvoice
'total_ht' =>array('type'=>'double(24,8)', 'label'=>'Total', 'enabled'=>1, 'visible'=>-1, 'position'=>70, 'isameasure'=>1),
'total_ttc' =>array('type'=>'double(24,8)', 'label'=>'Total ttc', 'enabled'=>1, 'visible'=>-1, 'position'=>75, 'isameasure'=>1),
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'position'=>80),
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>1, 'visible'=>-1, 'position'=>85),
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>'$conf->projet->enabled', 'visible'=>-1, 'position'=>85),
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'Fk cond reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>90),
'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'Fk mode reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>95),
'date_lim_reglement' =>array('type'=>'date', 'label'=>'Date lim reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>100),
@ -199,7 +199,7 @@ class FactureRec extends CommonInvoice
'revenuestamp' =>array('type'=>'double(24,8)', 'label'=>'RevenueStamp', 'enabled'=>1, 'visible'=>-1, 'position'=>160, 'isameasure'=>1),
'auto_validate' =>array('type'=>'integer', 'label'=>'Auto validate', 'enabled'=>1, 'visible'=>-1, 'position'=>165),
'generate_pdf' =>array('type'=>'integer', 'label'=>'Generate pdf', 'enabled'=>1, 'visible'=>-1, 'position'=>170),
'fk_account' =>array('type'=>'integer', 'label'=>'Fk account', 'enabled'=>1, 'visible'=>-1, 'position'=>175),
'fk_account' =>array('type'=>'integer', 'label'=>'Fk account', 'enabled'=>'$conf->banque->enabled', 'visible'=>-1, 'position'=>175),
'fk_multicurrency' =>array('type'=>'integer', 'label'=>'Fk multicurrency', 'enabled'=>1, 'visible'=>-1, 'position'=>180),
'multicurrency_code' =>array('type'=>'varchar(255)', 'label'=>'Multicurrency code', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
'multicurrency_tx' =>array('type'=>'double(24,8)', 'label'=>'Multicurrency tx', 'enabled'=>1, 'visible'=>-1, 'position'=>190, 'isameasure'=>1),
@ -222,7 +222,7 @@ class FactureRec extends CommonInvoice
*
* @param DoliDB $db Database handler
*/
public function __construct($db)
public function __construct(DoliDB $db)
{
$this->db = $db;
}

View File

@ -428,7 +428,7 @@ class Facture extends CommonInvoice
*
* @param DoliDB $db Database handler
*/
public function __construct($db)
public function __construct(DoliDB $db)
{
$this->db = $db;
}
@ -560,7 +560,6 @@ class Facture extends CommonInvoice
$this->array_options = $_facrec->array_options;
//if (! $this->remise) $this->remise = 0;
if (!$this->mode_reglement_id) {
$this->mode_reglement_id = 0;
}
@ -1652,13 +1651,13 @@ class Facture extends CommonInvoice
0, // date_start
0, // date_end
0,
$lines[$i]->info_bits, // info_bits
0, // info_bits
0,
'HT',
0,
0, // product_type
1,
$lines[$i]->special_code,
0, // special_code
$deposit->origin,
0,
0,
@ -2194,9 +2193,11 @@ class Facture extends CommonInvoice
// multilangs
if (!empty($conf->global->MAIN_MULTILANGS) && !empty($objp->fk_product) && !empty($loadalsotranslation)) {
$line = new Product($this->db);
$line->fetch($objp->fk_product);
$line->getMultiLangs();
$tmpproduct = new Product($this->db);
$tmpproduct->fetch($objp->fk_product);
$tmpproduct->getMultiLangs();
$line->multilangs = $tmpproduct->multilangs;
}
$this->lines[$i] = $line;
@ -5024,7 +5025,7 @@ class Facture extends CommonInvoice
$sql .= " WHERE f.entity IN (".getEntity('invoice', 0).")";
$resql = $this->db->query($sql);
if ($resql) {
if ($resql->num_rows > 0) {
if ($this->db->num_rows($resql) > 0) {
$res = $this->db->fetch_array($resql);
$ref = $res['max(situation_cycle_ref)'];
$ref++;
@ -5069,7 +5070,7 @@ class Facture extends CommonInvoice
$sql .= ' AND entity = '.($this->entity > 0 ? $this->entity : $conf->entity);
$resql = $this->db->query($sql);
$res = array();
if ($resql && $resql->num_rows > 0) {
if ($resql && $this->db->num_rows($resql) > 0) {
while ($row = $this->db->fetch_object($resql)) {
$id = $row->rowid;
$situation = new Facture($this->db);
@ -5147,7 +5148,7 @@ class Facture extends CommonInvoice
$sql .= ' AND entity = '.($this->entity > 0 ? $this->entity : $conf->entity);
$resql = $this->db->query($sql);
if ($resql && $resql->num_rows > 0) {
if ($resql && $this->db->num_rows($resql) > 0) {
$res = $this->db->fetch_array($resql);
$last = $res['max(situation_counter)'];
return ($last == $this->situation_counter);
@ -5503,6 +5504,7 @@ class Facture extends CommonInvoice
$sendContent = make_substitutions($content, $substitutionarray, $outputlangs, 1);
// Recipient
$to = '';
$res = $tmpinvoice->fetch_thirdparty();
$recipient = $tmpinvoice->thirdparty;
if ($res > 0) {
@ -5524,7 +5526,7 @@ class Facture extends CommonInvoice
$error++;
}
if (!$error) {
if (!$error && $to) {
// Errors Recipient
$errors_to = $conf->global->MAIN_MAIL_ERRORS_TO;
@ -6286,7 +6288,7 @@ class FactureLigne extends CommonInvoiceLine
$sql = "SELECT situation_percent FROM ".MAIN_DB_PREFIX."facturedet WHERE rowid = ".((int) $this->fk_prev_id);
$resql = $this->db->query($sql);
if ($resql && $resql->num_rows > 0) {
if ($resql && $this->db->num_rows($resql) > 0) {
$res = $this->db->fetch_array($resql);
$returnPercent = floatval($res['situation_percent']);

View File

@ -57,7 +57,7 @@ class FactureStats extends Stats
* @param int $typentid Id typent of thirdpary for filter
* @param int $categid Id category of thirdpary for filter
*/
public function __construct($db, $socid, $mode, $userid = 0, $typentid = 0, $categid = 0)
public function __construct(DoliDB $db, $socid, $mode, $userid = 0, $typentid = 0, $categid = 0)
{
global $user, $conf;

View File

@ -68,7 +68,7 @@ class PaymentTerm // extends CommonObject
*
* @param DoliDB $db Database handler
*/
public function __construct($db)
public function __construct(DoliDB $db)
{
$this->db = $db;
}

View File

@ -52,7 +52,7 @@ if ($user->socid) {
$object = new Facture($db);
// Load object
if ($id > 0 || !empty($ref)) {
$ret = $object->fetch($id, $ref, '', '', $conf->global->INVOICE_USE_SITUATION);
$ret = $object->fetch($id, $ref, '', '', (!empty($conf->global->INVOICE_USE_SITUATION) ? $conf->global->INVOICE_USE_SITUATION : 0));
}
$result = restrictedArea($user, 'facture', $object->id);

View File

@ -47,7 +47,7 @@ $extrafields->fetch_name_optionals_label($object->table_element);
// Load object
if ($id > 0 || !empty($ref)) {
$ret = $object->fetch($id, $ref, '', '', $conf->global->INVOICE_USE_SITUATION);
$ret = $object->fetch($id, $ref, '', '', (!empty($conf->global->INVOICE_USE_SITUATION) ? $conf->global->INVOICE_USE_SITUATION : 0));
}
// Security check

View File

@ -857,7 +857,7 @@ if ($resql) {
}
}
if (!empty($arrayfields['f.datec']['checked'])) {
print '<td class="center">';
print '<td class="center nowraponall">';
print dol_print_date($db->jdate($objp->datec), 'dayhour');
print '</td>';
if (!$i) {
@ -865,7 +865,7 @@ if ($resql) {
}
}
if (!empty($arrayfields['f.tms']['checked'])) {
print '<td class="center">';
print '<td class="center nowraponall">';
print dol_print_date($db->jdate($objp->tms), 'dayhour');
print '</td>';
if (!$i) {

View File

@ -245,7 +245,7 @@ $arrayfields = array(
'f.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>292),
'multicurrency_dynamount_payed'=>array('label'=>'MulticurrencyAlreadyPaid', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>295),
'multicurrency_rtp'=>array('label'=>'MulticurrencyRemainderToPay', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>296), // Not enabled by default because slow
'total_pa' => array('label' => ($conf->global->MARGIN_TYPE == '1' ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) ? 0 : 1)),
'total_pa' => array('label' => ((isset($conf->global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE == '1') ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) ? 0 : 1)),
'total_margin' => array('label' => 'Margin', 'checked' => 0, 'position' => 301, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) ? 0 : 1)),
'total_margin_rate' => array('label' => 'MarginRate', 'checked' => 0, 'position' => 302, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)),
'total_mark_rate' => array('label' => 'MarkRate', 'checked' => 0, 'position' => 303, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) || empty($conf->global->DISPLAY_MARK_RATES) ? 0 : 1)),
@ -1112,7 +1112,7 @@ if ($resql) {
if (!empty($user->rights->facture->paiement)) {
$arrayofmassactions['makepayment'] = img_picto('', 'payment', 'class="pictofixedwidth"').$langs->trans("MakePaymentAndClassifyPayed");
}
if ($conf->prelevement->enabled && !empty($user->rights->prelevement->bons->creer)) {
if (!empty($conf->prelevement->enabled) && !empty($user->rights->prelevement->bons->creer)) {
$langs->load("withdrawals");
$arrayofmassactions['withdrawrequest'] = img_picto('', 'payment', 'class="pictofixedwidth"').$langs->trans("MakeWithdrawRequest");
}

View File

@ -44,7 +44,7 @@ $action = GETPOST('action', 'aZ09');
$object = new Facture($db);
// Load object
if ($id > 0 || !empty($ref)) {
$object->fetch($id, $ref, '', '', $conf->global->INVOICE_USE_SITUATION);
$object->fetch($id, $ref, '', '', (!empty($conf->global->INVOICE_USE_SITUATION) ? $conf->global->INVOICE_USE_SITUATION : 0));
}
$permissionnote = $user->rights->facture->creer; // Used by the include of actions_setnotes.inc.php

View File

@ -281,8 +281,8 @@ if ($object->id > 0) {
}
$author = new User($db);
if ($object->user_author) {
$author->fetch($object->user_author);
if ($object->fk_user_author) {
$author->fetch($object->fk_user_author);
}
if ($type == 'bank-transfer') {

View File

@ -172,7 +172,7 @@ if ($resql) {
print '<input class="flat" type="text" size="1" maxlength="2" name="day" value="'.$day.'">';
}
print '<input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">';
$formother->select_year($year ? $year : -1, 'year', 1, 20, 5);
print $formother->selectyear($year ? $year : -1, 'year', 1, 20, 5);
print '</td>';
print '<td class="liste_titre">';
$form->select_comptes($search_account, 'search_account', 0, '', 1);

View File

@ -102,7 +102,7 @@ $syear = GETPOST("reyear") ?GETPOST("reyear") : date("Y", time());
print $formother->select_month($cmonth, 'remonth');
print $formother->select_year($syear, 'reyear');
print $formother->selectyear($syear, 'reyear');
print '<input type="submit" class="button" value="'.$langs->trans("Create").'">';
print '</form>';

View File

@ -291,7 +291,7 @@ if ($action == 'create') {
print "</tr>\n";
$total += $objp->total;
$total_ttc += $objp->total_ttc;
$totalrecu += $objp->am;
$totalrecu += $objp->amount;
$i++;
}
if ($i > 1) {

View File

@ -863,7 +863,7 @@ if ($id > 0) {
/*
$MAXEVENT = 10;
$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-list-alt imgforviewmode', dol_buildpath('/mymodule/myobject_agenda.php', 1).'?id='.$object->id);
$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', dol_buildpath('/mymodule/myobject_agenda.php', 1).'?id='.$object->id);
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';

View File

@ -113,6 +113,11 @@ class ChargeSociales extends CommonObject
*/
public $fk_user;
/**
* @var double total
*/
public $total;
const STATUS_UNPAID = 0;
const STATUS_PAID = 1;
@ -123,7 +128,7 @@ class ChargeSociales extends CommonObject
*
* @param DoliDB $db Database handler
*/
public function __construct($db)
public function __construct(DoliDB $db)
{
$this->db = $db;
}

View File

@ -100,12 +100,28 @@ class PaymentSocialContribution extends CommonObject
*/
public $fk_user_modif;
/**
* @var int ID
*/
public $chid;
/**
* @var integer|string datepaye
*/
public $datepaye;
/**
* @var integer|string paiementtype
*/
public $paiementtype;
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
public function __construct($db)
public function __construct(DoliDB $db)
{
$this->db = $db;
}

View File

@ -853,7 +853,7 @@ if ($id > 0) {
/*
$MAXEVENT = 10;
$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-list-alt imgforviewmode', dol_buildpath('/mymodule/myobject_agenda.php', 1).'?id='.$object->id);
$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', dol_buildpath('/mymodule/myobject_agenda.php', 1).'?id='.$object->id);
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';

View File

@ -316,8 +316,9 @@ if (empty($reshook)) {
$result = $object->delete(); // TODO Add $user as first param
if ($result > 0) {
if ($backtopage) {
header("Location: ".$backtopage);
setEventMessages("RecordDeleted", null, 'mesgs');
if ($backurlforlist) {
header("Location: ".$backurlforlist);
exit;
} else {
header("Location: ".DOL_URL_ROOT.'/contact/list.php');
@ -1550,7 +1551,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$MAXEVENT = 10;
$morehtmlright = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-list-alt imgforviewmode', DOL_URL_ROOT.'/contact/agenda.php?id='.$object->id);
$morehtmlright = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/contact/agenda.php?id='.$object->id);
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';

View File

@ -181,6 +181,12 @@ class Contact extends CommonObject
*/
public $email;
/**
* URL
* @var string
*/
public $url;
/**
* Unsuscribe all : 1 = contact has globaly unsubscribe of all mass emailings
* @var int
@ -315,6 +321,7 @@ class Contact extends CommonObject
*/
public $stcomm_picto;
/**
* Constructor
*

View File

@ -410,7 +410,7 @@ if ($sql_select) {
print '</td>';
print '<td class="liste_titre nowrap center">'; // date
print $formother->select_month($month ? $month : -1, 'month', 1, 0, 'valignmiddle');
$formother->select_year($year ? $year : -1, 'year', 1, 20, 1);
print $formother->selectyear($year ? $year : -1, 'year', 1, 20, 1);
print '</td>';
print '<td class="liste_titre center">';
print '</td>';

View File

@ -2161,7 +2161,7 @@ if ($action == 'create') {
$MAXEVENT = 10;
$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-list-alt imgforviewmode', DOL_URL_ROOT.'/contrat/agenda.php?id='.$object->id);
$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/contrat/agenda.php?id='.$object->id);
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';

View File

@ -232,8 +232,8 @@ class Contrat extends CommonObject
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35),
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>40),
'date_contrat' =>array('type'=>'datetime', 'label'=>'Date contrat', 'enabled'=>1, 'visible'=>-1, 'position'=>45),
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>70),
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>75),
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>70),
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>'$conf->projet->enabled', 'visible'=>-1, 'position'=>75),
'fk_commercial_signature' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'SaleRepresentative Signature', 'enabled'=>1, 'visible'=>-1, 'position'=>80),
'fk_commercial_suivi' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'SaleRepresentative follower', 'enabled'=>1, 'visible'=>-1, 'position'=>85),
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>90),
@ -871,9 +871,11 @@ class Contrat extends CommonObject
// multilangs
if (!empty($conf->global->MAIN_MULTILANGS) && !empty($objp->fk_product) && !empty($loadalsotranslation)) {
$line = new Product($this->db);
$line->fetch($objp->fk_product);
$line->getMultiLangs();
$tmpproduct = new Product($this->db);
$tmpproduct->fetch($objp->fk_product);
$tmpproduct->getMultiLangs();
$line->multilangs = $tmpproduct->multilangs;
}
$this->lines[$pos] = $line;
@ -2744,6 +2746,7 @@ class ContratLigne extends CommonObjectLine
public $commentaire;
const STATUS_INITIAL = 0;
const STATUS_OPEN = 4;
const STATUS_CLOSED = 5;
@ -2988,7 +2991,6 @@ class ContratLigne extends CommonObjectLine
$this->localtax2_type = $obj->localtax2_type;
$this->qty = $obj->qty;
$this->remise_percent = $obj->remise_percent;
$this->remise = $obj->remise;
$this->fk_remise_except = $obj->fk_remise_except;
$this->subprice = $obj->subprice;
$this->price_ht = $obj->price_ht;
@ -3046,7 +3048,6 @@ class ContratLigne extends CommonObjectLine
$this->localtax2_tx = trim($this->localtax2_tx);
$this->qty = trim($this->qty);
$this->remise_percent = trim($this->remise_percent);
$this->remise = trim($this->remise);
$this->fk_remise_except = (int) $this->fk_remise_except;
$this->subprice = price2num($this->subprice);
$this->price_ht = price2num($this->price_ht);

View File

@ -693,7 +693,7 @@ if (!empty($arrayfields['lower_planned_end_date']['checked'])) {
print '</br>';
print $formother->select_month($search_dfmonth, 'search_dfmonth', 1, 0);
print ' ';
$formother->select_year($search_dfyear, 'search_dfyear', 1, 20, 5, 0, 0, '');
print $formother->selectyear($search_dfyear, 'search_dfyear', 1, 20, 5, 0, 0, '');
print '</td>';
}
// Status

View File

@ -101,10 +101,10 @@ if ($action == 'add' && !empty($permissiontoadd)) {
//var_dump($key.' '.$value.' '.$object->fields[$key]['type']);
$object->$key = $value;
if ($val['notnull'] > 0 && $object->$key == '' && !is_null($val['default']) && $val['default'] == '(PROV)') {
if (!empty($val['notnull']) && $val['notnull'] > 0 && $object->$key == '' && isset($val['default']) && $val['default'] == '(PROV)') {
$object->$key = '(PROV)';
}
if ($val['notnull'] > 0 && $object->$key == '' && is_null($val['default'])) {
if (!empty($val['notnull']) && $val['notnull'] > 0 && $object->$key == '' && !isset($val['default'])) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv($val['label'])), null, 'errors');
}

View File

@ -1468,6 +1468,7 @@ if (!$error && ($massaction == 'approveleave' || ($action == 'approveleave' && $
$trackid = 'leav'.$objecttmp->id;
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
$mail = new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(), '', '', 0, 0, '', '', $trackid);
// Sending email

View File

@ -0,0 +1,122 @@
<?php
/* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010 Cyrille de Lambert <info@auguria.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/core/ajax/ajaxcompanies.php
* \brief File to return Ajax response on third parties request
*/
if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); // Disables token renewal
if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1');
require '../../main.inc.php';
/*
* View
*/
// Ajout directives pour resoudre bug IE
//header('Cache-Control: Public, must-revalidate');
//header('Pragma: public');
//top_htmlhead("", "", 1); // Replaced with top_httphead. An ajax page does not need html header.
top_httphead();
//print '<!-- Ajax page called with url '.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]).' -->'."\n";
dol_syslog(join(',', $_GET));
// Generation liste des societes
if (GETPOST('newcompany') || GETPOST('socid', 'int') || GETPOST('id_fourn')) {
$return_arr = array();
// Define filter on text typed
$socid = $_GET['newcompany'] ? $_GET['newcompany'] : '';
if (!$socid) $socid = $_GET['socid'] ? $_GET['socid'] : '';
if (!$socid) $socid = $_GET['id_fourn'] ? $_GET['id_fourn'] : '';
$sql = "SELECT s.rowid, s.nom, s.name_alias, s.code_client, s.code_fournisseur, s.address, s.zip, s.town, s.email, s.siren, s.siret, s.ape, s.idprof4, s.client, s.fournisseur, s.datec, s.logo";
$sql .= " , c.label as country, d.nom as departement";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = s.fk_pays";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as d ON d.rowid = s.fk_departement";
$sql .= " WHERE s.entity IN (".getEntity('societe').")";
if ($socid) {
$sql .= " AND (";
// Add criteria on name/code
if (!empty($conf->global->COMPANY_DONOTSEARCH_ANYWHERE)) { // Can use index
$sql .= "s.nom LIKE '".$db->escape($socid)."%'";
$sql .= " OR s.code_client LIKE '".$db->escape($socid)."%'";
$sql .= " OR s.code_fournisseur LIKE '".$db->escape($socid)."%'";
} else {
$sql .= "s.nom LIKE '%".$db->escape($socid)."%'";
$sql .= " OR s.code_client LIKE '%".$db->escape($socid)."%'";
$sql .= " OR s.code_fournisseur LIKE '%".$db->escape($socid)."%'";
}
if (!empty($conf->global->SOCIETE_ALLOW_SEARCH_ON_ROWID)) $sql .= " OR s.rowid = '".$db->escape($socid)."'";
$sql .= ")";
}
//if (GETPOST("filter")) $sql.= " AND (".GETPOST("filter", "alpha").")"; // Add other filters
$sql .= " ORDER BY s.nom ASC";
//dol_syslog("ajaxcompanies", LOG_DEBUG);
$resql = $db->query($sql);
if ($resql) {
while ($row = $db->fetch_array($resql)) {
$label = $row['nom'];
if ($socid) $label = $label;
$row_array['label'] = $label;
$row_array['value'] = $row['nom'];
$row_array['key'] = $row['rowid'];
$row_array['name_alias'] = $row['name_alias'];
$row_array['code_client'] = $row['code_client'];
$row_array['code_fournisseur'] = $row['code_fournisseur'];
$row_array['address'] = $row['address'];
$row_array['zip'] = $row['zip'];
$row_array['town'] = $row['town'];
$row_array['email'] = $row['email'];
$row_array['siren'] = $row['siren'];
$row_array['siret'] = $row['siret'];
$row_array['ape'] = $row['ape'];
$row_array['idprof4'] = $row['idprof4'];
$row_array['client'] = $row['client'];
$row_array['fournisseur'] = $row['fournisseur'];
$row_array['datec'] = $row['datec'];
$row_array['logo'] = $row['logo'];
$row_array['country'] = $row['country'];
$row_array['departement'] = $row['departement'];
array_push($return_arr, $row_array);
}
echo json_encode($return_arr);
} else {
echo json_encode(array('nom'=>'Error', 'label'=>'Error', 'key'=>'Error', 'value'=>'Error'));
}
} else {
echo json_encode(array('nom'=>'ErrorBadParameter', 'label'=>'ErrorBadParameter', 'key'=>'ErrorBadParameter', 'value'=>'ErrorBadParameter'));
}

View File

@ -329,7 +329,7 @@ class box_activity extends ModeleBoxes
if (!empty($data)) {
$j = 0;
while ($j < count($data)) {
$billurl = "search_status=2&amp;paye=1&amp;year=".$data[$j]->annee;
$billurl = "search_status=2&amp;paye=1";
$this->info_box_contents[$line][0] = array(
'td' => 'class="left" width="16"',
'tooltip' => $langs->trans('Bills').'&nbsp;'.$facturestatic->LibStatut(1, $data[$j]->fk_statut, 0),
@ -339,7 +339,7 @@ class box_activity extends ModeleBoxes
$this->info_box_contents[$line][1] = array(
'td' => '',
'text' => $langs->trans("Bills")."&nbsp;".$facturestatic->LibStatut(1, $data[$j]->fk_statut, 0)." ".$data[$j]->annee,
'text' => $langs->trans("Bills")."&nbsp;".$facturestatic->LibStatut(1, $data[$j]->fk_statut, 0),
);
$this->info_box_contents[$line][2] = array(

View File

@ -597,7 +597,7 @@ class CMailFile
}
$sendingmode = $this->sendmode;
if ($this->context == 'emailing' && !empty($conf->global->MAILING_NO_USING_PHPMAIL) && $sendingmode == 'mail') {
if ($this->sendcontext == 'emailing' && !empty($conf->global->MAILING_NO_USING_PHPMAIL) && $sendingmode == 'mail') {
// List of sending methods
$listofmethods = array();
$listofmethods['mail'] = 'PHP mail function';

View File

@ -65,6 +65,26 @@ abstract class CommonDocGenerator
*/
public $scandir;
public $page_hauteur;
public $page_largeur;
public $marge_gauche;
public $marge_droite;
public $marge_haute;
public $marge_basse;
public $option_logo;
public $option_tva;
public $option_multilang;
public $option_freetext;
public $option_draft_watermark;
public $option_modereg;
public $option_condreg;
public $option_escompte;
public $option_credit_note;
public $emetteur;
/**
* Constructor

View File

@ -93,12 +93,17 @@ abstract class CommonInvoice extends CommonObject
const STATUS_ABANDONED = 3;
public $totalpaid; // duplicate with sumpayed
public $totaldeposits; // duplicate with sumdeposit
public $totalcreditnotes; // duplicate with sumcreditnote
public $sumpayed;
public $sumpayed_multicurrency;
public $sumdeposit;
public $sumdeposit_multicurrency;
public $sumcreditnote;
public $sumcreditnote_multicurrency;
public $remaintopay;
/**

View File

@ -115,6 +115,16 @@ abstract class CommonObject
*/
public $array_languages = null; // Value is array() when load already tried
/**
* @var array To store result of ->liste_contact()
*/
public $contacts_ids;
/**
* @var mixed Array of linked objects, set and used when calling ->create() to be able to create links during the creation of object
*/
public $linked_objects;
/**
* @var int[][] Array of linked objects ids. Loaded by ->fetchObjectLinked
*/
@ -201,7 +211,7 @@ abstract class CommonObject
public $user;
/**
* @var string The type of originating object ('commande', 'facture', ...)
* @var string The type of originating object ('commande', 'facture', ...). Note: on some object this field is called $origin_type
* @see fetch_origin()
*/
public $origin;
@ -4879,7 +4889,7 @@ abstract class CommonObject
$product_static->fetch($line->fk_product);
$product_static->ref = $line->ref; //can change ref in hook
$product_static->label = $line->label; //can change label in hook
$product_static->label = !empty($line->label) ? $line->label : ""; //can change label in hook
$text = $product_static->getNomUrl(1);
@ -4915,7 +4925,7 @@ abstract class CommonObject
$description .= (!empty($conf->global->PRODUIT_DESC_IN_FORM) ? '' : dol_htmlentitiesbr($line->description)); // Description is what to show on popup. We shown nothing if already into desc.
}
$line->pu_ttc = price2num($line->subprice * (1 + ($line->tva_tx / 100)), 'MU');
$line->pu_ttc = price2num((!empty($line->subprice) ? $line->subprice : 0) * (1 + ((!empty($line->tva_tx) ? $line->tva_tx : 0) / 100)), 'MU');
// Output template part (modules that overwrite templates must declare this into descriptor)
// Use global variables + $dateSelector + $seller and $buyer
@ -6837,7 +6847,7 @@ abstract class CommonObject
if ((string) $key == '') {
continue;
}
list($val, $parent) = explode('|', $val);
if (strpos($val, "|") !== false) list($val, $parent) = explode('|', $val);
$out .= '<option value="'.$key.'"';
$out .= (((string) $value == (string) $key) ? ' selected' : '');
$out .= (!empty($parent) ? ' parent="'.$parent.'"' : '');
@ -8809,7 +8819,7 @@ abstract class CommonObject
}
}
} else {
$this->{$field} = $obj->{$field};
$this->{$field} = !empty($obj->{$field}) ? $obj->{$field} : null;
}
}

View File

@ -61,6 +61,34 @@ abstract class CommonObjectLine extends CommonObject
public $date_fin_prevue;
public $date_fin_reel;
public $weight;
public $weight_units;
public $width;
public $width_units;
public $height;
public $height_units;
public $length;
public $length_units;
public $surface;
public $surface_units;
public $volume;
public $volume_units;
public $multilangs;
public $product_type; // type in line
public $product_ref; // ref in product table
public $product_label; // label in product table
public $product_desc; // desc in product table
public $fk_product_type; // type in product table
public $qty;
public $duree;
public $remise_percent;
public $info_bits;
public $special_code;
/**
* Constructor

View File

@ -64,10 +64,40 @@ abstract class CommonStickerGenerator
public $code; // Code of format
/**
* @var array format Array with informations
* @var int page_largeur
*/
public $page_largeur;
/**
* @var int page_hauteur
*/
public $page_hauteur;
/**
* @var array format
*/
public $format;
/**
* @var int marge_gauche
*/
public $marge_gauche;
/**
* @var int marge_droite
*/
public $marge_droite;
/**
* @var int marge_haute
*/
public $marge_haute;
/**
* @var int marge_basse
*/
public $marge_basse;
// phpcs:disable PEAR.NamingConventions.ValidVariableName.PublicUnderscore
// protected
// Nom du format de l'etiquette
@ -100,6 +130,8 @@ abstract class CommonStickerGenerator
protected $_COUNTY = 1;
protected $_First = 1;
public $Tformat;
// phpcs:enable
/**
* Constructor

View File

@ -1,413 +0,0 @@
<?php
/* EXPERIMENTAL
*
* Copyright (C) 2016 ATM Consulting <support@atm-consulting.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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/core/class/coreobject.class.php
* \ingroup core
* \brief File of class to manage all object. Might be replace or merge into commonobject
*/
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
// TODO Remove this class (used in Expensereportik and ExpenseReportRule
/**
* CoreObject
*/
class CoreObject extends CommonObject
{
public $withChild = true;
/**
* @var Array $_fields Fields to synchronize with Database
*/
protected $fields = array();
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
public function __construct(DoliDB &$db)
{
$this->db = $db;
}
/**
* Function to init fields
*
* @return bool
*/
protected function init()
{
$this->id = 0;
$this->datec = 0;
$this->tms = 0;
if (!empty($this->fields)) {
foreach ($this->fields as $field => $info) {
if ($this->isDate($info)) {
$this->{$field} = time();
} elseif ($this->isArray($info)) {
$this->{$field} = array();
} elseif ($this->isInt($info)) {
$this->{$field} = (int) 0;
} elseif ($this->isFloat($info)) {
$this->{$field} = (double) 0;
} else {
$this->{$field} = '';
}
}
$this->to_delete = false;
$this->is_clone = false;
return true;
} else {
return false;
}
}
/**
* Test type of field
*
* @param string $field name of field
* @param string $type type of field to test
* @return boolean value of field or false
*/
private function checkFieldType($field, $type)
{
if (isset($this->fields[$field]) && method_exists($this, 'is_'.$type)) {
return $this->{'is_'.$type}($this->fields[$field]);
} else {
return false;
}
}
/**
* Get object and children from database
*
* @param int $id Id of object to load
* @param bool $loadChild used to load children from database
* @return int >0 if OK, <0 if KO, 0 if not found
*/
public function fetch($id, $loadChild = true)
{
$res = $this->fetchCommon($id);
if ($res > 0) {
if ($loadChild) {
$this->fetchChild();
}
}
return $res;
}
/**
* Function to instantiate a new child
*
* @param string $tabName Table name of child
* @param int $id If id is given, we try to return his key if exist or load if we try_to_load
* @param string $key Attribute name of the object id
* @param bool $try_to_load Force the fetch if an id is given
* @return int
*/
public function addChild($tabName, $id = 0, $key = 'id', $try_to_load = false)
{
if (!empty($id)) {
foreach ($this->{$tabName} as $k => &$object) {
if ($object->{$key} === $id) {
return $k;
}
}
}
$k = count($this->{$tabName});
$className = ucfirst($tabName);
$this->{$tabName}[$k] = new $className($this->db);
if ($id > 0 && $key === 'id' && $try_to_load) {
$this->{$tabName}[$k]->fetch($id);
}
return $k;
}
/**
* Function to set a child as to delete
*
* @param string $tabName Table name of child
* @param int $id Id of child to set as to delete
* @param string $key Attribute name of the object id
* @return bool
*/
public function removeChild($tabName, $id, $key = 'id')
{
foreach ($this->{$tabName} as &$object) {
if ($object->{$key} == $id) {
$object->to_delete = true;
return true;
}
}
return false;
}
/**
* Function to fetch children objects
*
* @return void
*/
public function fetchChild()
{
if ($this->withChild && !empty($this->childtables) && !empty($this->fk_element)) {
foreach ($this->childtables as &$childTable) {
$className = ucfirst($childTable);
$this->{$className} = array();
$sql = "SELECT rowid FROM ".$this->db->prefix().$childTable." WHERE ".$this->fk_element." = ".((int) $this->id);
$res = $this->db->query($sql);
if ($res) {
while ($obj = $this->db->fetch_object($res)) {
$o = new $className($this->db);
$o->fetch($obj->rowid);
$this->{$className}[] = $o;
}
} else {
$this->errors[] = $this->db->lasterror();
}
}
}
}
/**
* Function to update children data
*
* @param User $user user object
* @return void
*/
public function saveChild(User &$user)
{
if ($this->withChild && !empty($this->childtables) && !empty($this->fk_element)) {
foreach ($this->childtables as &$childTable) {
$className = ucfirst($childTable);
if (!empty($this->{$className})) {
foreach ($this->{$className} as $i => &$object) {
$object->{$this->fk_element} = $this->id;
$object->update($user);
if ($this->unsetChildDeleted && isset($object->to_delete) && $object->to_delete == true) {
unset($this->{$className}[$i]);
}
}
}
}
}
}
/**
* Function to update object or create or delete if needed
*
* @param User $user User object
* @return int < 0 if KO, > 0 if OK
*/
public function update(User &$user)
{
if (empty($this->id)) {
return $this->create($user); // To test, with that, no need to test on high level object, the core decide it, update just needed
} elseif (isset($this->to_delete) && $this->to_delete == true) {
return $this->delete($user);
}
$error = 0;
$this->db->begin();
$res = $this->updateCommon($user);
if ($res) {
$result = $this->call_trigger(strtoupper($this->element).'_MODIFY', $user);
if ($result < 0) {
$error++;
} else {
$this->saveChild($user);
}
} else {
$error++;
$this->error = $this->db->lasterror();
$this->errors[] = $this->error;
}
if (empty($error)) {
$this->db->commit();
return $this->id;
} else {
$this->db->rollback();
return -1;
}
}
/**
* Function to create object in database
*
* @param User $user User object
* @return int < 0 if KO, > 0 if OK
*/
public function create(User $user)
{
if ($this->id > 0) {
return $this->update($user);
}
$error = 0;
$this->db->begin();
$res = $this->createCommon($user);
if ($res) {
$this->id = $this->db->last_insert_id($this->table_element);
$result = $this->call_trigger(strtoupper($this->element).'_CREATE', $user);
if ($result < 0) {
$error++;
} else {
$this->saveChild($user);
}
} else {
$error++;
$this->error = $this->db->lasterror();
$this->errors[] = $this->error;
}
if (empty($error)) {
$this->db->commit();
return $this->id;
} else {
$this->db->rollback();
return -1;
}
}
/**
* Function to delete object in database
*
* @param User $user user object
* @return int < 0 if KO, > 0 if OK
*/
public function delete(User &$user)
{
if ($this->id <= 0) {
return 0;
}
$error = 0;
$this->db->begin();
$result = $this->call_trigger(strtoupper($this->element).'_DELETE', $user);
if ($result < 0) {
$error++;
}
if (!$error) {
$this->deleteCommon($user);
if ($this->withChild && !empty($this->childtables)) {
foreach ($this->childtables as &$childTable) {
$className = ucfirst($childTable);
if (!empty($this->{$className})) {
foreach ($this->{$className} as &$object) {
$object->delete($user);
}
}
}
}
}
if (empty($error)) {
$this->db->commit();
return 1;
} else {
$this->error = $this->db->lasterror();
$this->errors[] = $this->error;
$this->db->rollback();
return -1;
}
}
/**
* Function to get a formatted date
*
* @param string $field Attribute to return
* @param string $format Output date format
* @return string
*/
public function getDate($field, $format = '')
{
if (empty($this->{$field})) {
return '';
} else {
return dol_print_date($this->{$field}, $format);
}
}
/**
* Function to set date in field
*
* @param string $field field to set
* @param string $date formatted date to convert
* @return mixed
*/
public function setDate($field, $date)
{
if (empty($date)) {
$this->{$field} = 0;
} else {
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
$this->{$field} = dol_stringtotime($date);
}
return $this->{$field};
}
/**
* Function to update current object
*
* @param array $Tab Array of values
* @return int
*/
public function setValues(&$Tab)
{
foreach ($Tab as $key => $value) {
if ($this->checkFieldType($key, 'date')) {
$this->setDate($key, $value);
} elseif ($this->checkFieldType($key, 'float')) {
$this->{$key} = (double) price2num($value);
} elseif ($this->checkFieldType($key, 'int')) {
$this->{$key} = (int) price2num($value);
} else {
$this->{$key} = dol_string_nohtmltag($value);
}
}
return 1;
}
}

View File

@ -917,44 +917,46 @@ class dolReceiptPrinter extends Printer
$resql = $this->db->query($sql);
if ($resql) {
$obj = $this->db->fetch_array($resql);
if (empty($obj)) {
$error++;
$this->errors[] = 'PrinterDontExist';
}
if (!$error) {
$parameter = (isset($obj['parameter']) ? $obj['parameter'] : '');
try {
$type = $obj['fk_type'];
switch ($type) {
case 1:
$this->connector = new DummyPrintConnector();
break;
case 2:
$this->connector = new FilePrintConnector($parameter);
break;
case 3:
$parameters = explode(':', $parameter);
$this->connector = new NetworkPrintConnector($parameters[0], $parameters[1]);
break;
case 4: // LPT1, smb://...
$this->connector = new WindowsPrintConnector(dol_sanitizePathName($parameter));
break;
case 5:
$this->connector = new CupsPrintConnector($parameter);
break;
default:
$this->connector = 'CONNECTOR_UNKNOWN';
break;
}
$this->printer = new Printer($this->connector, $this->profile);
} catch (Exception $e) {
$this->errors[] = $e->getMessage();
$error++;
}
}
} else {
$error++;
$this->errors[] = $this->db->lasterror;
}
if (empty($obj)) {
$error++;
$this->errors[] = 'PrinterDontExist';
}
if (!$error) {
$parameter = $obj['parameter'];
try {
switch ($obj['fk_type']) {
case 1:
$this->connector = new DummyPrintConnector();
break;
case 2:
$this->connector = new FilePrintConnector($parameter);
break;
case 3:
$parameters = explode(':', $parameter);
$this->connector = new NetworkPrintConnector($parameters[0], $parameters[1]);
break;
case 4: // LPT1, smb://...
$this->connector = new WindowsPrintConnector(dol_sanitizePathName($parameter));
break;
case 5:
$this->connector = new CupsPrintConnector($parameter);
break;
default:
$this->connector = 'CONNECTOR_UNKNOWN';
break;
}
$this->printer = new Printer($this->connector, $this->profile);
} catch (Exception $e) {
$this->errors[] = $e->getMessage();
$error++;
}
}
return $error;
}
}

View File

@ -56,6 +56,8 @@ class EmailSenderProfile extends CommonObject
*/
public $picto = 'emailsenderprofile';
public $fk_user_creat;
const STATUS_DISABLED = 0;
const STATUS_ENABLED = 1;

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2011-2012 Regis Houssin <regis.houssin@inodbox.com>
/* Copyright (C) 2011-2022 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011-2012 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
@ -216,7 +216,7 @@ class FileUpload
/**
* Set delete url
*
* @param string $file Filename
* @param object $file Filename
* @return void
*/
protected function setFileDeleteUrl($file)
@ -301,7 +301,7 @@ class FileUpload
* Enter description here ...
*
* @param string $uploaded_file Uploade file
* @param string $file File
* @param object $file File
* @param string $error Error
* @param string $index Index
* @return boolean True if OK, False if KO
@ -538,7 +538,7 @@ class FileUpload
/**
* Delete uploaded file
*
* @return void
* @return string
*/
public function delete()
{

View File

@ -466,6 +466,8 @@ class Form
$ext_element = false;
$button_only = false;
$inputOption = '';
$rows = '';
$cols = '';
if (is_object($object)) {
$element = $object->element;
@ -1001,9 +1003,10 @@ class Form
* @param string $htmloption Options html on select object
* @param int $forcecombo Force to load all values and output a standard combobox (with no beautification)
* @param array $events Event options to run on change. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))
* @param array $disableautocomplete Disable autocomplete
* @return string HTML string with select and input
*/
public function select_incoterms($selected = '', $location_incoterms = '', $page = '', $htmlname = 'incoterm_id', $htmloption = '', $forcecombo = 1, $events = array())
public function select_incoterms($selected = '', $location_incoterms = '', $page = '', $htmlname = 'incoterm_id', $htmloption = '', $forcecombo = 1, $events = array(), $disableautocomplete = 0)
{
// phpcs:enable
global $conf, $langs;
@ -1038,8 +1041,6 @@ class Form
$num = $this->db->num_rows($resql);
$i = 0;
if ($num) {
$foundselected = false;
while ($i < $num) {
$obj = $this->db->fetch_object($resql);
$incotermArray[$i]['rowid'] = $obj->rowid;
@ -1901,6 +1902,7 @@ class Form
{
// phpcs:enable
global $conf, $user, $langs, $hookmanager;
global $action;
// If no preselected user defined, we take current user
if ((is_numeric($selected) && ($selected < -2 || empty($selected))) && empty($conf->global->SOCIETE_DISABLE_DEFAULT_SALESREPRESENTATIVE)) {
@ -2414,6 +2416,7 @@ class Form
if (!$forcecombo) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
$events = array();
$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("PRODUIT_USE_SEARCH_TO_SELECT"));
}
@ -2752,7 +2755,6 @@ class Form
$objp->price = $objp2->price;
$objp->unitprice = $objp2->unitprice;
$objp->remise_percent = $objp2->remise_percent;
$objp->remise = $objp2->remise;
//$objp->tva_tx is not overwritten by $objp2 value
//$objp->default_vat_code is not overwritten by $objp2 value
@ -3506,7 +3508,7 @@ class Form
$opt .= ' disabled';
}
if (!empty($objp->idprodfournprice) && $objp->idprodfournprice > 0) {
$opt .= ' data-product-id="'.$objp->rowid.'" data-price-id="'.$objp->idprodfournprice.'" data-qty="'.$objp->quantity.'" data-up="'.$objp->unitprice.'" data-discount="'.$outdiscount.'"';
$opt .= ' data-product-id="'.$objp->rowid.'" data-price-id="'.$objp->idprodfournprice.'" data-qty="'.$objp->quantity.'" data-up="'.$objp->unitprice.'" data-discount="'.$outdiscount.'" data-tvatx="'.$objp->tva_tx.'"';
}
$opt .= ' data-description="'.dol_escape_htmltag($objp->description, 0, 1).'"';
$opt .= ' data-html="'.dol_escape_htmltag($optlabel).'"';
@ -4192,6 +4194,7 @@ class Form
}
}
$out .= '>';
$value = '';
if ($format == 0) {
$value = ($maxlength ?dol_trunc($arraytypes['label'], $maxlength) : $arraytypes['label']);
} elseif ($format == 1) {
@ -6333,6 +6336,9 @@ class Form
// Analysis of the pre-selection date
$reg = array();
$shour = '';
$smin = '';
$ssec = '';
if (preg_match('/^([0-9]+)\-([0-9]+)\-([0-9]+)\s?([0-9]+)?:?([0-9]+)?/', $set_time, $reg)) { // deprecated usage
// Date format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS'
$syear = (!empty($reg[1]) ? $reg[1] : '');
@ -6349,10 +6355,6 @@ class Form
$shour = dol_print_date($set_time, "%H", $gm);
$smin = dol_print_date($set_time, "%M", $gm);
$ssec = dol_print_date($set_time, "%S", $gm);
} else {
$shour = '';
$smin = '';
$ssec = '';
}
} else {
// Date est '' ou vaut -1
@ -6878,6 +6880,7 @@ class Form
unset($tickettmpselect);
}
$urloption = '';
$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/ticket/ajax/tickets.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
if (empty($hidelabel)) $out .= $langs->trans("RefOrLabel").' : ';
@ -7020,16 +7023,11 @@ class Form
protected function constructTicketListOption(&$objp, &$opt, &$optJson, $selected, $filterkey = '')
{
$outkey = '';
$outval = '';
$outref = '';
$outlabel = '';
$outtype = '';
$label = $objp->label;
$outkey = $objp->rowid;
$outref = $objp->ref;
$outlabel = $objp->label;
$outtype = $objp->fk_product_type;
$opt = '<option value="'.$objp->rowid.'"';
@ -7038,10 +7036,9 @@ class Form
$opt .= $objp->ref;
$objRef = $objp->ref;
if (!empty($filterkey) && $filterkey != '') $objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1);
$outval .= $objRef;
$opt .= "</option>\n";
$optJson = array('key'=>$outkey, 'value'=>$outref, 'type'=>$outtypem);
$optJson = array('key'=>$outkey, 'value'=>$outref, 'type'=>$outtype);
}
/**
@ -7621,7 +7618,7 @@ class Form
if (!empty($objecttmp->fields)) { // For object that declare it, it is better to use declared fields (like societe, contact, ...)
$tmpfieldstoshow = '';
foreach ($objecttmp->fields as $key => $val) {
if (!dol_eval($val['enabled'], 1, 1, 1, '1')) {
if (!dol_eval($val['enabled'], 1, 1, '1')) {
continue;
}
if (!empty($val['showoncombobox'])) {
@ -7648,6 +7645,7 @@ class Form
$out = '';
$outarray = array();
$tmparray = array();
$num = 0;
@ -8286,7 +8284,7 @@ class Form
* @param string $htmlname Name of HTML field
* @param array $array Array with array of fields we could show. This array may be modified according to setup of user.
* @param string $varpage Id of context for page. Can be set by caller with $varpage=(empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage);
* @param string $pos position colon on liste value left or right
* @param string $pos Position colon on liste value 'left' or '' (meaning 'right').
* @return string HTML multiselect string
* @see selectarray()
*/
@ -8631,10 +8629,26 @@ class Form
}
$possiblelinks = array(
'propal'=>array('enabled'=>$conf->propal->enabled, 'perms'=>1, 'label'=>'LinkToProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."propal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('propal').')'),
'order'=>array('enabled'=>$conf->commande->enabled, 'perms'=>1, 'label'=>'LinkToOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande').')'),
'invoice'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('invoice').')'),
'invoice_template'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToTemplateInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.titre as ref, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture_rec as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('invoice').')'),
'propal'=>array(
'enabled'=>$conf->propal->enabled,
'perms'=>1,
'label'=>'LinkToProposal',
'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."propal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('propal').')'),
'order'=>array(
'enabled'=>$conf->commande->enabled,
'perms'=>1,
'label'=>'LinkToOrder',
'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande').')'),
'invoice'=>array(
'enabled'=>$conf->facture->enabled,
'perms'=>1,
'label'=>'LinkToInvoice',
'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('invoice').')'),
'invoice_template'=>array(
'enabled'=>$conf->facture->enabled,
'perms'=>1,
'label'=>'LinkToTemplateInvoice',
'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.titre as ref, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture_rec as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('invoice').')'),
'contrat'=>array(
'enabled'=>$conf->contrat->enabled,
'perms'=>1,
@ -8642,12 +8656,35 @@ class Form
'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_customer as ref_client, t.ref_supplier, SUM(td.total_ht) as total_ht
FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."contrat as t, ".$this->db->prefix()."contratdet as td WHERE t.fk_soc = s.rowid AND td.fk_contrat = t.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('contract').') GROUP BY s.rowid, s.nom, s.client, t.rowid, t.ref, t.ref_customer, t.ref_supplier'
),
'fichinter'=>array('enabled'=>!empty($conf->ficheinter->enabled) ? $conf->ficheinter->enabled : 0, 'perms'=>1, 'label'=>'LinkToIntervention', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('intervention').')'),
'supplier_proposal'=>array('enabled'=>$conf->supplier_proposal->enabled, 'perms'=>1, 'label'=>'LinkToSupplierProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('supplier_proposal').')'),
'order_supplier'=>array('enabled'=>$conf->supplier_order->enabled, 'perms'=>1, 'label'=>'LinkToSupplierOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande_fournisseur').')'),
'invoice_supplier'=>array('enabled'=>$conf->supplier_invoice->enabled, 'perms'=>1, 'label'=>'LinkToSupplierInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture_fourn as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('facture_fourn').')'),
'ticket'=>array('enabled'=>$conf->ticket->enabled, 'perms'=>1, 'label'=>'LinkToTicket', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.track_id, '0' as total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."ticket as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('ticket').')'),
'mo'=>array('enabled'=>$conf->mrp->enabled, 'perms'=>1, 'label'=>'LinkToMo', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.rowid, '0' as total_ht FROM ".$this->db->prefix()."societe as s INNER JOIN ".$this->db->prefix()."mrp_mo as t ON t.fk_soc = s.rowid WHERE t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('mo').')')
'fichinter'=>array(
'enabled'=>(!empty($conf->ficheinter->enabled) ? $conf->ficheinter->enabled : 0),
'perms'=>1,
'label'=>'LinkToIntervention',
'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('intervention').')'),
'supplier_proposal'=>array(
'enabled'=>(!empty($conf->supplier_proposal->enabled) ? $conf->supplier_proposal->enabled : 0),
'perms'=>1,
'label'=>'LinkToSupplierProposal',
'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('supplier_proposal').')'),
'order_supplier'=>array(
'enabled'=>(!empty($conf->supplier_order->enabled) ? $conf->supplier_order->enabled : 0),
'perms'=>1,
'label'=>'LinkToSupplierOrder',
'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande_fournisseur').')'),
'invoice_supplier'=>array(
'enabled'=>(!empty($conf->supplier_invoice->enabled) ? $conf->supplier_invoice->enabled : 0),
'perms'=>1, 'label'=>'LinkToSupplierInvoice',
'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture_fourn as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('facture_fourn').')'),
'ticket'=>array(
'enabled'=>(!empty($conf->ticket->enabled) ? $conf->ticket->enabled : 0),
'perms'=>1,
'label'=>'LinkToTicket',
'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.track_id, '0' as total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."ticket as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('ticket').')'),
'mo'=>array(
'enabled'=>(!empty($conf->mrp->enabled) ? $conf->mrp->enabled : 0),
'perms'=>1,
'label'=>'LinkToMo',
'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.rowid, '0' as total_ht FROM ".$this->db->prefix()."societe as s INNER JOIN ".$this->db->prefix()."mrp_mo as t ON t.fk_soc = s.rowid WHERE t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('mo').')')
);
}
@ -9353,10 +9390,12 @@ class Form
global $conf, $user, $langs;
// Permettre l'exclusion de groupes
$excludeGroups = null;
if (is_array($exclude)) {
$excludeGroups = implode(",", $exclude);
}
// Permettre l'inclusion de groupes
$includeGroups = null;
if (is_array($include)) {
$includeGroups = implode(",", $include);
}
@ -9920,7 +9959,7 @@ class Form
//if ($disabled) $out.=' disabled'; // with select2, field can't be preselected if disabled
$out .= '>' . $labeltoshow . '</option>';
} else {
if ($hideunselectables && $disabled && ($selected != $obj->rowid)) {
if ($disabled && ($selected != $obj->rowid)) {
$resultat = '';
} else {
$resultat = '<option value="' . $obj->rowid . '"';
@ -10141,9 +10180,6 @@ class Form
window.parent.jQuery(\'#idfordialog'.$dol_openinpopup.'\').dialog(\'close\');
});';
$retstring .= '</script>';
// TODO @LDR for the save button, in action "add", set parent var to return data and close the window
//$retstring .= '<a onclick="javascript:$(\'#varforreturndialogid'.$dol_openinpopup.'\', window.parent.document).text(\'setid\');">setid</a> ';
//$retstring .= '<a onclick="javascript:$(\'#varforreturndialoglabel'.$dol_openinpopup.'\', window.parent.document).text(\'setlabel\');">setlabel</a>';
}
return $retstring;

View File

@ -86,23 +86,21 @@ class FormActions
select_status();
$('#select' + htmlname).change(function() {
console.log('We change field select '+htmlname);
select_status();
});
// FIXME use another method for update combobox
//$('#val' + htmlname).change(function() {
//select_status();
//});
});
function select_status() {
var defaultvalue = $('#select' + htmlname).val();
console.log('val='+defaultvalue);
var percentage = $('input[name=percentage]');
var selected = '".(isset($selected) ? dol_escape_js($selected) : '')."';
var value = (selected>0?selected:(defaultvalue>=0?defaultvalue:''));
percentage.val(value);
if (defaultvalue == -1) {
if (defaultvalue == 'na' || defaultvalue == -1) {
percentage.prop('disabled', true);
$('.hideifna').hide();
}
@ -131,7 +129,7 @@ class FormActions
}
print '<select '.($canedit ? '' : 'disabled ').'name="'.$htmlname.'" id="select'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'">';
if ($showempty) {
print '<option value=""'.($selected == '' ? ' selected' : '').'>&nbsp;</option>';
print '<option value="-1"'.($selected == '' ? ' selected' : '').'>&nbsp;</option>';
}
foreach ($listofstatus as $key => $val) {
print '<option value="'.$key.'"'.(($selected == $key && strlen($selected) == strlen($key)) || (($selected > 0 && $selected < 100) && $key == '50') ? ' selected' : '').'>'.$val.'</option>';

View File

@ -240,10 +240,24 @@ class FormSetup
* saveConfFromPost
*
* @param bool $noMessageInUpdate display event message on errors and success
* @return void|null
* @return int -1 if KO, 1 if OK
*/
public function saveConfFromPost($noMessageInUpdate = false)
{
global $hookmanager;
$parameters = array();
$reshook = $hookmanager->executeHooks('formSetupBeforeSaveConfFromPost', $parameters, $this); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
$this->setErrors($hookmanager->errors);
return -1;
}
if ($reshook > 0) {
return $reshook;
}
if (empty($this->items)) {
return null;
}
@ -265,11 +279,13 @@ class FormSetup
if (empty($noMessageInUpdate)) {
setEventMessages($this->langs->trans("SetupSaved"), null);
}
return 1;
} else {
$this->db->rollback();
if (empty($noMessageInUpdate)) {
setEventMessages($this->langs->trans("SetupNotSaved"), null, 'errors');
}
return -1;
}
}
@ -406,7 +422,7 @@ class FormSetup
if (!array($this->items)) { return false; }
foreach ($this->items as $item) {
$item->reloadValueFromConf();
$item->loadValueFromConf();
}
return true;
@ -571,8 +587,11 @@ class FormSetupItem
/** @var string $fieldValue */
public $fieldValue;
/** @var string $defaultFieldValue */
public $defaultFieldValue = null;
/** @var array $fieldAttr fields attribute only for compatible fields like input text */
public $fieldAttr;
public $fieldAttr = array();
/** @var bool|string set this var to override field output will override $fieldInputOverride and $fieldOutputOverride too */
public $fieldOverride = false;
@ -632,17 +651,33 @@ class FormSetupItem
$this->entity = $conf->entity;
$this->confKey = $confKey;
$this->fieldValue = $conf->global->{$this->confKey};
$this->loadValueFromConf();
}
/**
* reload conf value from databases
* @return null
* load conf value from databases
* @return bool
*/
public function loadValueFromConf()
{
global $conf;
if (isset($conf->global->{$this->confKey})) {
$this->fieldValue = $conf->global->{$this->confKey};
return true;
} else {
$this->fieldValue = null;
return false;
}
}
/**
* reload conf value from databases is an aliase of loadValueFromConf
* @deprecated
* @return bool
*/
public function reloadValueFromConf()
{
global $conf;
$this->fieldValue = $conf->global->{$this->confKey};
return $this->loadValueFromConf();
}
@ -652,8 +687,22 @@ class FormSetupItem
*/
public function saveConfValue()
{
global $hookmanager;
$parameters = array();
$reshook = $hookmanager->executeHooks('formSetupBeforeSaveConfValue', $parameters, $this); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
$this->setErrors($hookmanager->errors);
return -1;
}
if ($reshook > 0) {
return $reshook;
}
if (!empty($this->saveCallBack) && is_callable($this->saveCallBack)) {
return call_user_func($this->saveCallBack);
return call_user_func($this->saveCallBack, $this);
}
// Modify constant only if key was posted (avoid resetting key to the null value)
@ -761,6 +810,12 @@ class FormSetupItem
return $this->fieldInputOverride;
}
// Set default value
if (is_null($this->fieldValue)) {
$this->fieldValue = $this->defaultFieldValue;
}
$this->fieldAttr['name'] = $this->confKey;
$this->fieldAttr['id'] = 'setup-'.$this->confKey;
$this->fieldAttr['value'] = $this->fieldValue;
@ -777,6 +832,8 @@ class FormSetupItem
$out.= $this->generateInputFieldTextarea();
} elseif ($this->type== 'html') {
$out.= $this->generateInputFieldHtml();
} elseif ($this->type== 'color') {
$out.= $this->generateInputFieldColor();
} elseif ($this->type == 'yesno') {
$out.= $this->form->selectyesno($this->confKey, $this->fieldValue, 1);
} elseif (preg_match('/emailtemplate:/', $this->type)) {
@ -795,14 +852,22 @@ class FormSetupItem
$out.= $this->form->select_produits($selected, $this->confKey, '', 0, 0, 1, 2, '', 0, array(), 0, '1', 0, $this->cssClass, 0, '', null, 1);
}
} else {
if (empty($this->fieldAttr)) { $this->fieldAttr['class'] = 'flat '.(empty($this->cssClass) ? 'minwidth200' : $this->cssClass); }
$out.= '<input '.FormSetup::generateAttributesStringFromArray($this->fieldAttr).' />';
$out.= $this->generateInputFieldText();
}
return $out;
}
/**
* generatec default input field
* @return string
*/
public function generateInputFieldText()
{
if (empty($this->fieldAttr)) { $this->fieldAttr['class'] = 'flat '.(empty($this->cssClass) ? 'minwidth200' : $this->cssClass); }
return '<input '.FormSetup::generateAttributesStringFromArray($this->fieldAttr).' />';
}
/**
* generate input field for textarea
* @return string
@ -999,6 +1064,8 @@ class FormSetupItem
$out.= $this->generateOutputFieldSelect();
} elseif ($this->type== 'html') {
$out.= $this->fieldValue;
} elseif ($this->type== 'color') {
$out.= $this->generateOutputFieldColor();
} elseif ($this->type == 'yesno') {
$out.= ajax_constantonoff($this->confKey);
} elseif (preg_match('/emailtemplate:/', $this->type)) {
@ -1013,6 +1080,7 @@ class FormSetupItem
}
$out.= $this->langs->trans($template->label);
} elseif (preg_match('/category:/', $this->type)) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$c = new Categorie($this->db);
$result = $c->fetch($this->fieldValue);
if ($result < 0) {
@ -1071,6 +1139,22 @@ class FormSetupItem
return $outPut;
}
/**
* @return string
*/
public function generateOutputFieldColor()
{
$this->fieldAttr['disabled']=null;
return $this->generateInputField();
}
/**
* @return string
*/
public function generateInputFieldColor()
{
$this->fieldAttr['type']= 'color';
return $this->generateInputFieldText();
}
/**
* @return string
@ -1099,6 +1183,16 @@ class FormSetupItem
return $this;
}
/**
* Set type of input as color
* @return self
*/
public function setAsColor()
{
$this->type = 'color';
return $this;
}
/**
* Set type of input as textarea
* @return self

View File

@ -73,6 +73,7 @@ class FormTicket
public $ispublic; // To show information or not into public form
public $withtitletopic;
public $withtopicreadonly;
public $withcompany; // affiche liste déroulante company
public $withfromsocid;
public $withfromcontactid;
@ -84,6 +85,11 @@ class FormTicket
public $withcancel;
public $type_code;
public $category_code;
public $severity_code;
/**
*
* @var array $substit Substitutions
@ -113,7 +119,7 @@ class FormTicket
$this->withcompany = $conf->societe->enabled ? 1 : 0;
$this->withfromsocid = 0;
$this->withfromcontactid = 0;
//$this->withthreadid=0;
//$this->withreadid=0;
//$this->withtitletopic='';
$this->withnotifytiersatcreate = 0;
$this->withusercreate = 1;
@ -280,6 +286,7 @@ class FormTicket
}
// If ticket created from another object
$subelement = '';
if (isset($this->param['origin']) && $this->param['originid'] > 0) {
// Parse element/subelement (ex: project_task)
$element = $subelement = $this->param['origin'];
@ -331,8 +338,8 @@ class FormTicket
print $langs->trans('SubjectAnswerToTicket').' '.$this->topic_title;
print '</td></tr>';
} else {
if ($this->withthreadid > 0) {
$subject = $langs->trans('SubjectAnswerToTicket').' '.$this->withthreadid.' : '.$this->topic_title.'';
if ($this->withreadid > 0) {
$subject = $langs->trans('SubjectAnswerToTicket').' '.$this->withreadid.' : '.$this->topic_title.'';
}
print '<input class="text minwidth500" id="subject" name="subject" value="'.(GETPOST('subject', 'alpha') ? GETPOST('subject', 'alpha') : $subject).'" autofocus />';
print '</td></tr>';
@ -628,11 +635,11 @@ class FormTicket
print '<br>';
print $form->buttonsSaveCancel((($this->withthreadid > 0) ? "SendResponse" : "CreateTicket"), ($this->withcancel ? "Cancel" : ""));
print $form->buttonsSaveCancel((($this->withreadid > 0) ? "SendResponse" : "CreateTicket"), ($this->withcancel ? "Cancel" : ""));
/*
print '<div class="center">';
print '<input type="submit" class="button" name="add" value="'.$langs->trans(($this->withthreadid > 0 ? "SendResponse" : "CreateTicket")).'" />';
print '<input type="submit" class="button" name="add" value="'.$langs->trans(($this->withreadid > 0 ? "SendResponse" : "CreateTicket")).'" />';
if ($this->withcancel) {
print " &nbsp; &nbsp; &nbsp;";
print '<input class="button button-cancel" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
@ -1267,7 +1274,7 @@ class FormTicket
if (GETPOST('mode', 'alpha') == 'init' || (GETPOST('modelmailselected', 'alpha') && GETPOST('modelmailselected', 'alpha') != '-1')) {
if (!empty($arraydefaultmessage->joinfiles) && is_array($this->param['fileinit'])) {
foreach ($this->param['fileinit'] as $file) {
$this->add_attached_files($file, basename($file), dol_mimetype($file));
$formmail->add_attached_files($file, basename($file), dol_mimetype($file));
}
}
}
@ -1365,6 +1372,9 @@ class FormTicket
// External users can't send message email
if ($user->rights->ticket->write && !$user->socid) {
$ticketstat = new Ticket($this->db);
$res = $ticketstat->fetch('', '', $this->track_id);
print '<tr><td></td><td>';
$checkbox_selected = (GETPOST('send_email') == "1" ? ' checked' : ($conf->global->TICKETS_MESSAGE_FORCE_MAIL?'checked':''));
print '<input type="checkbox" name="send_email" value="1" id="send_msg_email" '.$checkbox_selected.'/> ';
@ -1395,18 +1405,18 @@ class FormTicket
// Subject
print '<tr class="email_line"><td>'.$langs->trans('Subject').'</td>';
print '<td><input type="text" class="text minwidth500" name="subject" value="['.$conf->global->MAIN_INFO_SOCIETE_NOM.' - '.$langs->trans("Ticket").' '.$this->ref.'] '.$langs->trans('TicketNewMessage').'" />';
print '<td><input type="text" class="text minwidth500" name="subject" value="['.$conf->global->MAIN_INFO_SOCIETE_NOM.' - '.$langs->trans("Ticket").' '.$ticketstat->ref.'] '.$langs->trans('TicketNewMessage').'" />';
print '</td></tr>';
// Destinataires
print '<tr class="email_line"><td>'.$langs->trans('MailRecipients').'</td><td>';
$ticketstat = new Ticket($this->db);
$res = $ticketstat->fetch('', '', $this->track_id);
if ($res) {
// Retrieve email of all contacts (internal and external)
$contacts = $ticketstat->getInfosTicketInternalContact();
$contacts = array_merge($contacts, $ticketstat->getInfosTicketExternalContact());
$sendto = array();
// Build array to display recipient list
if (is_array($contacts) && count($contacts) > 0) {
foreach ($contacts as $key => $info_sendto) {
@ -1416,7 +1426,7 @@ class FormTicket
}
}
if ($ticketstat->origin_email && !in_array($this->dao->origin_email, $sendto)) {
if ($ticketstat->origin_email && !in_array($ticketstat->origin_email, $sendto)) {
$sendto[] = dol_escape_htmltag($ticketstat->origin_email).' <small class="opacitymedium">('.$langs->trans("TicketEmailOriginIssuer").")</small>";
}

View File

@ -342,7 +342,7 @@ class Utils
$handle = '';
$lowmemorydump = GETPOSTISSET("lowmemorydump", "alpha") ? GETPOST("lowmemorydump") : getDolGlobalString('MAIN_LOW_MEMORY_DUMP');
$lowmemorydump = GETPOSTISSET("lowmemorydump") ? GETPOST("lowmemorydump") : getDolGlobalString('MAIN_LOW_MEMORY_DUMP');
// Start call method to execute dump
$fullcommandcrypted = $command." ".$paramcrypted." 2>&1";

View File

@ -465,7 +465,7 @@ print '</div>';
$count = 0;
print '<div class="divadvancedsearchfield">';
print '<div class="inline-block opacitymedium"><span class="fas fa-ruler-horizontal paddingright pictofixedwidth" title="'.dol_escape_htmltag($langs->trans("GroupBy")).'"></span></div>';
print $formother->selectGroupByField($object, $search_groupby, $arrayofgroupby, 'minwidth200 maxwidth250', $langs->trans("GroupBy")); // Fill the array $arrayofgroupby with possible fields
print $formother->selectGroupByField($object, $search_groupby, $arrayofgroupby, 'minwidth250 maxwidth300', $langs->trans("GroupBy")); // Fill the array $arrayofgroupby with possible fields
print '</div>';

View File

@ -38,7 +38,10 @@ class DoliDBSqlite3 extends DoliDB
const LABEL = 'Sqlite3';
//! Version min database
const VERSIONMIN = '3.0.0';
/** @var SQLite3Result Resultset of last query */
/**
* @var SQLite3Result|boolean Resultset of last query
*/
private $_results;
const WEEK_MONDAY_FIRST = 1;
@ -1026,7 +1029,7 @@ class DoliDBSqlite3 extends DoliDB
*
* @param string $table Name of table
* @param string $field Optionnel : Name of field if we want description of field
* @return SQLite3Result Resource
* @return bool|SQLite3Result Resource
*/
public function DDLDescTable($table, $field = "")
{

View File

@ -272,7 +272,8 @@ function dol_dir_list_in_database($path, $filter = "", $excludefilter = null, $s
"cover" => $obj->cover,
"position" => (int) $obj->position,
"acl" => $obj->acl,
"share" => $obj->share
"share" => $obj->share,
"description" => $obj->description
);
}
$i++;
@ -2801,7 +2802,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
if ($fuser->rights->facture->{$lire} || preg_match('/^specimen/i', $original_file)) {
$accessallowed = 1;
}
if ($fuser->societe_id > 0) {
if ($fuser->socid > 0) {
$original_file = $conf->facture->dir_output.'/payments/private/'.$fuser->id.'/'.$original_file;
} else {
$original_file = $conf->facture->dir_output.'/payments/'.$original_file;

View File

@ -547,6 +547,9 @@ function GETPOST($paramname, $check = 'alphanohtml', $method = 0, $filter = null
}
} elseif (isset($user->default_values[$relativepathstring]['filters'])) {
foreach ($user->default_values[$relativepathstring]['filters'] as $defkey => $defval) { // $defkey is a querystring like 'a=b&c=d', $defval is key of user
if (!empty($_GET['disabledefaultvalues'])) { // If set of default values has been disabled by a request parameter
continue;
}
$qualified = 0;
if ($defkey != '_noquery_') {
$tmpqueryarraytohave = explode('&', $defkey);
@ -1581,8 +1584,7 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename =
* @param string $disabled Disabled text
* @param string $morecss More CSS
* @param string $backtopagejsfields The back to page must be managed using javascript instead of a redirect.
* Value is 'Name of html component to set with id:Name of html component to set with label'
* TODO Support this mode, for example when used from the page create a project on thirdparty creation.
* Value is 'keyforpopupid:Name_of_html_component_to_set_with id,Name_of_html_component_to_set_with_label'
* @return string HTML component with button
*/
function dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $disabled = '', $morecss = 'button bordertransp', $backtopagejsfields = '')
@ -1597,10 +1599,16 @@ function dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $di
$backtopagejsfieldsid = ''; $backtopagejsfieldslabel = '';
if ($backtopagejsfields) {
$url .= '&backtopagejsfields='.urlencode($backtopagejsfields);
$tmpbacktopagejsfields = explode(':', $backtopagejsfields);
$backtopagejsfieldsid = empty($tmpbacktopagejsfields[0]) ? '' : $tmpbacktopagejsfields[0];
$backtopagejsfieldslabel = empty($tmpbacktopagejsfields[1]) ? '' : $tmpbacktopagejsfields[1];
if (empty($tmpbacktopagejsfields[1])) { // If the part 'keyforpopupid:' is missing, we add $name for it.
$backtopagejsfields = $name.":".$backtopagejsfields;
$tmp2backtopagejsfields = explode(',', $tmpbacktopagejsfields[0]);
} else {
$tmp2backtopagejsfields = explode(',', $tmpbacktopagejsfields[1]);
}
$backtopagejsfieldsid = empty($tmp2backtopagejsfields[0]) ? '' : $tmp2backtopagejsfields[0];
$backtopagejsfieldslabel = empty($tmp2backtopagejsfields[1]) ? '' : $tmp2backtopagejsfields[1];
$url .= '&backtopagejsfields='.urlencode($backtopagejsfields);
}
//print '<input type="submit" class="button bordertransp"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("MediaFiles")).'" name="file_manager">';
@ -1623,7 +1631,7 @@ function dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $di
width: \'80%\',
title: \''.dol_escape_js($label).'\',
open: function (event, ui) {
console.log("open popup");
console.log("open popup name='.$name.', backtopagejsfields='.$backtopagejsfields.'");
},
close: function (event, ui) {
returnedid = jQuery("#varforreturndialogid'.$name.'").text();
@ -1772,7 +1780,7 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab
$out .= '<div class="tab tab'.($isactive?'active':'unactive').'" style="margin: 0 !important">';
if (!empty($links[$i][0])) {
$titletoshow = preg_replace('/<.*$/', '', $links[$i][1]);
$out .= '<a'.(!empty($links[$i][2]) ? ' id="'.$links[$i][2].'"' : '').' class="tab inline-block'.($morecss ? ' '.$morecss : '').'" href="'.$links[$i][0].'" title="'.dol_escape_htmltag($titletoshow).'">';
$out .= '<a'.(!empty($links[$i][2]) ? ' id="'.$links[$i][2].'"' : '').' class="tab inline-block valignmiddle'.($morecss ? ' '.$morecss : '').'" href="'.$links[$i][0].'" title="'.dol_escape_htmltag($titletoshow).'">';
}
$out .= $links[$i][1];
if (!empty($links[$i][0])) {
@ -1820,7 +1828,7 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab
if (empty($tabsname)) {
$tabsname = str_replace("@", "", $picto);
}
$out .= '<div id="moretabs'.$tabsname.'" class="inline-block tabsElem">';
$out .= '<div id="moretabs'.$tabsname.'" class="inline-block tabsElem valignmiddle">';
$out .= '<div class="tab"><a href="#" class="tab moretab inline-block tabunactive"><span class="hideonsmartphone">'.$langs->trans("More").'</span>... ('.$nbintab.')</a></div>'; // Do not use "reposition" class in the "More".
$out .= '<div id="moretabsList'.$tabsname.'" style="width: '.$widthofpopup.'px; position: absolute; '.$left.': -999em; text-align: '.$left.'; margin:0px; padding:2px; z-index:10;">';
$out .= $outmore;

View File

@ -128,46 +128,46 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir =
$texttoinsert .= " 'position'=>".($val['position'] !== '' ? $val['position'] : 50).",";
$texttoinsert .= " 'notnull'=>".(empty($val['notnull']) ? 0 : $val['notnull']).",";
$texttoinsert .= " 'visible'=>".($val['visible'] !== '' ? $val['visible'] : -1).",";
if ($val['noteditable']) {
if (!empty($val['noteditable'])) {
$texttoinsert .= " 'noteditable'=>'".$val['noteditable']."',";
}
if ($val['default'] || $val['default'] === '0') {
if (!empty($val['default']) || (isset($val['default']) && $val['default'] === '0')) {
$texttoinsert .= " 'default'=>'".$val['default']."',";
}
if ($val['index']) {
if (!empty($val['index'])) {
$texttoinsert .= " 'index'=>".$val['index'].",";
}
if ($val['foreignkey']) {
if (!empty($val['foreignkey'])) {
$texttoinsert .= " 'foreignkey'=>'".$val['foreignkey']."',";
}
if ($val['searchall']) {
if (!empty($val['searchall'])) {
$texttoinsert .= " 'searchall'=>".$val['searchall'].",";
}
if ($val['isameasure']) {
if (!empty($val['isameasure'])) {
$texttoinsert .= " 'isameasure'=>'".$val['isameasure']."',";
}
if ($val['css']) {
if (!empty($val['css'])) {
$texttoinsert .= " 'css'=>'".$val['css']."',";
}
if ($val['cssview']) {
if (!empty($val['cssview'])) {
$texttoinsert .= " 'cssview'=>'".$val['cssview']."',";
}
if ($val['csslist']) {
if (!empty($val['csslist'])) {
$texttoinsert .= " 'csslist'=>'".$val['csslist']."',";
}
if ($val['help']) {
if (!empty($val['help'])) {
$texttoinsert .= " 'help'=>\"".preg_replace('/"/', '', $val['help'])."\",";
}
if ($val['showoncombobox']) {
if (!empty($val['showoncombobox'])) {
$texttoinsert .= " 'showoncombobox'=>'".$val['showoncombobox']."',";
}
if ($val['disabled']) {
if (!empty($val['disabled'])) {
$texttoinsert .= " 'disabled'=>'".$val['disabled']."',";
}
if ($val['autofocusoncreate']) {
if (!empty($val['autofocusoncreate'])) {
$texttoinsert .= " 'autofocusoncreate'=>'".$val['autofocusoncreate']."',";
}
if ($val['arrayofkeyval']) {
if (!empty($val['arrayofkeyval'])) {
$texttoinsert .= " 'arrayofkeyval'=>array(";
$i = 0;
foreach ($val['arrayofkeyval'] as $key2 => $val2) {
@ -179,10 +179,10 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir =
}
$texttoinsert .= "),";
}
if ($val['validate']) {
if (!empty($val['validate'])) {
$texttoinsert .= " 'validate'=>'".$val['validate']."',";
}
if ($val['comment']) {
if (!empty($val['comment'])) {
$texttoinsert .= " 'comment'=>\"".preg_replace('/"/', '', $val['comment'])."\"";
}
@ -314,7 +314,7 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir = '
if ($key == 'entity') {
$texttoinsert .= ' DEFAULT 1';
} else {
if ($val['default'] != '') {
if (!empty($val['default'])) {
if (preg_match('/^null$/i', $val['default'])) {
$texttoinsert .= " DEFAULT NULL";
} elseif (preg_match('/varchar/', $type)) {

View File

@ -527,102 +527,100 @@ function pdf_build_address($outputlangs, $sourcecompany, $targetcompany = '', $t
if ($mode == 'target' || preg_match('/targetwithdetails/', $mode)) {
if ($usecontact) {
$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset($targetcontact->getFullName($outputlangs, 1));
if (is_object($targetcontact)) {
$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset($targetcontact->getFullName($outputlangs, 1));
if (!empty($targetcontact->address)) {
$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset(dol_format_address($targetcontact));
} else {
$companytouseforaddress = $targetcompany;
if (!empty($targetcontact->address)) {
$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset(dol_format_address($targetcontact));
} else {
$companytouseforaddress = $targetcompany;
// Contact on a thirdparty that is a different thirdparty than the thirdparty of object
if ($targetcontact->socid > 0 && $targetcontact->socid != $targetcompany->id) {
$targetcontact->fetch_thirdparty();
$companytouseforaddress = $targetcontact->thirdparty;
// Contact on a thirdparty that is a different thirdparty than the thirdparty of object
if ($targetcontact->socid > 0 && $targetcontact->socid != $targetcompany->id) {
$targetcontact->fetch_thirdparty();
$companytouseforaddress = $targetcontact->thirdparty;
}
$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset(dol_format_address($companytouseforaddress));
}
// Country
if (!empty($targetcontact->country_code) && $targetcontact->country_code != $sourcecompany->country_code) {
$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcontact->country_code));
} elseif (empty($targetcontact->country_code) && !empty($targetcompany->country_code) && ($targetcompany->country_code != $sourcecompany->country_code)) {
$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcompany->country_code));
}
$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset(dol_format_address($companytouseforaddress));
}
// Country
if (!empty($targetcontact->country_code) && $targetcontact->country_code != $sourcecompany->country_code) {
$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcontact->country_code));
} elseif (empty($targetcontact->country_code) && !empty($targetcompany->country_code) && ($targetcompany->country_code != $sourcecompany->country_code)) {
$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcompany->country_code));
}
if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || preg_match('/targetwithdetails/', $mode)) {
// Phone
if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_phone/', $mode)) {
if (!empty($targetcontact->phone_pro) || !empty($targetcontact->phone_mobile)) {
$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Phone").": ";
if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || preg_match('/targetwithdetails/', $mode)) {
// Phone
if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_phone/', $mode)) {
if (!empty($targetcontact->phone_pro) || !empty($targetcontact->phone_mobile)) {
$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Phone").": ";
}
if (!empty($targetcontact->phone_pro)) {
$stringaddress .= $outputlangs->convToOutputCharset($targetcontact->phone_pro);
}
if (!empty($targetcontact->phone_pro) && !empty($targetcontact->phone_mobile)) {
$stringaddress .= " / ";
}
if (!empty($targetcontact->phone_mobile)) {
$stringaddress .= $outputlangs->convToOutputCharset($targetcontact->phone_mobile);
}
}
if (!empty($targetcontact->phone_pro)) {
$stringaddress .= $outputlangs->convToOutputCharset($targetcontact->phone_pro);
// Fax
if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_fax/', $mode)) {
if ($targetcontact->fax) {
$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($targetcontact->fax);
}
}
if (!empty($targetcontact->phone_pro) && !empty($targetcontact->phone_mobile)) {
$stringaddress .= " / ";
// EMail
if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_email/', $mode)) {
if ($targetcontact->email) {
$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Email").": ".$outputlangs->convToOutputCharset($targetcontact->email);
}
}
if (!empty($targetcontact->phone_mobile)) {
$stringaddress .= $outputlangs->convToOutputCharset($targetcontact->phone_mobile);
}
}
// Fax
if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_fax/', $mode)) {
if ($targetcontact->fax) {
$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($targetcontact->fax);
}
}
// EMail
if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_email/', $mode)) {
if ($targetcontact->email) {
$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Email").": ".$outputlangs->convToOutputCharset($targetcontact->email);
}
}
// Web
if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_url/', $mode)) {
if ($targetcontact->url) {
$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($targetcontact->url);
// Web
if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_url/', $mode)) {
if ($targetcontact->url) {
$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($targetcontact->url);
}
}
}
}
} else {
$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset(dol_format_address($targetcompany));
// Country
if (!empty($targetcompany->country_code) && $targetcompany->country_code != $sourcecompany->country_code) {
$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcompany->country_code));
}
if (is_object($targetcompany)) {
$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset(dol_format_address($targetcompany));
// Country
if (!empty($targetcompany->country_code) && $targetcompany->country_code != $sourcecompany->country_code) {
$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcompany->country_code));
}
if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || preg_match('/targetwithdetails/', $mode)) {
// Phone
if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_phone/', $mode)) {
if (!empty($targetcompany->phone) || !empty($targetcompany->phone_mobile)) {
$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Phone").": ";
if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || preg_match('/targetwithdetails/', $mode)) {
// Phone
if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_phone/', $mode)) {
if (!empty($targetcompany->phone)) {
$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Phone").": ";
}
if (!empty($targetcompany->phone)) {
$stringaddress .= $outputlangs->convToOutputCharset($targetcompany->phone);
}
}
if (!empty($targetcompany->phone)) {
$stringaddress .= $outputlangs->convToOutputCharset($targetcompany->phone);
// Fax
if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_fax/', $mode)) {
if ($targetcompany->fax) {
$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($targetcompany->fax);
}
}
if (!empty($targetcompany->phone) && !empty($targetcompany->phone_mobile)) {
$stringaddress .= " / ";
// EMail
if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_email/', $mode)) {
if ($targetcompany->email) {
$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Email").": ".$outputlangs->convToOutputCharset($targetcompany->email);
}
}
if (!empty($targetcompany->phone_mobile)) {
$stringaddress .= $outputlangs->convToOutputCharset($targetcompany->phone_mobile);
}
}
// Fax
if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_fax/', $mode)) {
if ($targetcompany->fax) {
$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($targetcompany->fax);
}
}
// EMail
if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_email/', $mode)) {
if ($targetcompany->email) {
$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Email").": ".$outputlangs->convToOutputCharset($targetcompany->email);
}
}
// Web
if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_url/', $mode)) {
if ($targetcompany->url) {
$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($targetcompany->url);
// Web
if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_url/', $mode)) {
if ($targetcompany->url) {
$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($targetcompany->url);
}
}
}
}

View File

@ -63,6 +63,14 @@ class CommActionRapport
public $marge_basse;
public $format;
public $type;
public $page_hauteur;
public $page_largeur;
/**
* Constructor

View File

@ -89,7 +89,6 @@ class doc_generic_asset_odt extends ModelePDFAsset
$this->option_tva = 0; // Manage the vat option FACTURE_TVAOPTION
$this->option_modereg = 0; // Display payment mode
$this->option_condreg = 0; // Display payment terms
$this->option_codeproduitservice = 0; // Display product-service code
$this->option_multilang = 1; // Available in several languages
$this->option_escompte = 0; // Displays if there has been a discount
$this->option_credit_note = 0; // Support credit notes

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