Merge branch 'Dolibarr:develop' into new-resource-full-address

This commit is contained in:
William Mead 2023-11-16 11:08:18 +01:00 committed by GitHub
commit e8bf058fe8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 814 additions and 172 deletions

View file

@ -8,7 +8,9 @@ English Dolibarr ChangeLog
For users:
----------
NEW: Compatibility with PHP 8.2
NEW: Module for Advanced stock transfert is now stable (#26594)
NEW: Add a confirmation popup when deleting extrafields
NEW: Add type 'icon' type for extrafields
NEW: Close #20930 Use ajax for state loading after country change
NEW: #23331 Add support for parent projects (#24856)
NEW: #22531 Expense report - Add two fields into export : Qty & Unit price (excl.) (#26309)
@ -101,7 +103,6 @@ NEW: Date d'entree en stock sur les exped au moment de la création
NEW: Date field for shipment export (#25574)
NEW: Date format dayhoursec is using year on 2 char on smartphones
NEW: Default customer, category and product when enable TakePOS (#25031)
NEW: Disable not used PHP streams
NEW: do not add default value in list
NEW: drop down for action button show a simple button if only 1 action
NEW: Enhance github_commits_perversion to get more stats on git commits
@ -172,6 +173,7 @@ NEW: When an user unset the batch management of products, transformation of each
SEC: #25512 applicative anti bruteforce - security on too many login attempts (#25520)
SEC: Add action confirm_... as sensitive to need a CSRF token
SEC: Disable not used PHP streams
For developers or integrators:

View file

@ -0,0 +1,109 @@
<?php
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2012 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2018 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2023 Nick Fragoulis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/admin/supplierinvoice_rec_extrafields.php
* \ingroup fourn
* \brief Page to setup extra fields of recurring supplierinvoice
*/
// Load Dolibarr environment
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
// Load translation files required by the page
$langs->loadLangs(array("admin", "other", "bills", "orders", "suppliers"));
if (!$user->admin) {
accessforbidden();
}
$extrafields = new ExtraFields($db);
$form = new Form($db);
// List of supported format
$tmptype2label = ExtraFields::$type2label;
$type2label = array('');
foreach ($tmptype2label as $key => $val) {
$type2label[$key] = $langs->transnoentitiesnoconv($val);
}
$action = GETPOST('action', 'aZ09');
$attrname = GETPOST('attrname', 'alpha');
$elementtype = 'facture_fourn_rec'; //Must be the $table_element of the class that manage extrafield
if (!$user->admin) {
accessforbidden();
}
/*
* Actions
*/
require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
/*
* View
*/
$textobject = $langs->transnoentitiesnoconv("BillsSuppliers");
llxHeader('', $langs->trans("SuppliersSetup"));
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("SuppliersSetup"), $linkback, 'title_setup');
print "<br>\n";
$head = supplierorder_admin_prepare_head();
print dol_get_fiche_head($head, 'attributesrec', $langs->trans("Suppliers"), -1, 'company');
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
print dol_get_fiche_end();
// Creation of an optional field
if ($action == 'create') {
print '<br><div id="newattrib"></div>';
print load_fiche_titre($langs->trans('NewAttribute'));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
}
// Edition of an optional field
if ($action == 'edit' && !empty($attrname)) {
print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
}
// End of page
llxFooter();
$db->close();

View file

@ -0,0 +1,111 @@
<?php
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2012 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Claudio Aschieri <c.aschieri@19.coop>
* Copyright (C) 2023 Nick Fragoulis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/admin/supplierinvoicedet_rec_extrafields.php
* \ingroup fourn
* \brief Page to setup extra fields of recurring supplierinvoice line
*/
// Load Dolibarr environment
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
if (!$user->admin) {
accessforbidden();
}
// Load translation files required by the page
$langs->loadLangs(array('admin', 'other', 'bills', 'orders', 'suppliers'));
$extrafields = new ExtraFields($db);
$form = new Form($db);
// List of supported format
$tmptype2label = ExtraFields::$type2label;
$type2label = array('');
foreach ($tmptype2label as $key => $val) {
$type2label[$key] = $langs->transnoentitiesnoconv($val);
}
$action = GETPOST('action', 'aZ09');
$attrname = GETPOST('attrname', 'alpha');
$elementtype = 'facture_fourn_det_rec'; //Must be the $table_element of the class that manage extrafield
if (!$user->admin) {
accessforbidden();
}
/*
* Actions
*/
require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
/*
* View
*/
$textobject = $langs->transnoentitiesnoconv("BillsSuppliers");
llxHeader('', $langs->trans("SuppliersSetup"));
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("SuppliersSetup"), $linkback, 'title_setup');
print "<br>\n";
$head = supplierorder_admin_prepare_head();
print dol_get_fiche_head($head, 'attributeslinesrec', $langs->trans("Suppliers"), -1, 'company');
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
print dol_get_fiche_end();
// Creation of an optional field
if ($action == 'create') {
print '<br><div id="newattrib"></div>';
print load_fiche_titre($langs->trans('NewAttribute'));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
}
// Edition of an optional field
if ($action == 'edit' && !empty($attrname)) {
print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
}
// End of page
llxFooter();
$db->close();

View file

@ -42,6 +42,14 @@ if ($user->socid) {
$result = restrictedArea($user, 'banque', '', '');
$search_ref = GETPOST('search_ref', 'alpha');
$search_date_startday = GETPOST('search_date_startday', 'int');
$search_date_startmonth = GETPOST('search_date_startmonth', 'int');
$search_date_startyear = GETPOST('search_date_startyear', 'int');
$search_date_endday = GETPOST('search_date_endday', 'int');
$search_date_endmonth = GETPOST('search_date_endmonth', 'int');
$search_date_endyear = GETPOST('search_date_endyear', 'int');
$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver
$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
$search_account = GETPOST('search_account', 'int');
$search_amount = GETPOST('search_amount', 'alpha');
$mode = GETPOST('mode', 'alpha');
@ -63,8 +71,6 @@ if (!$sortfield) {
$sortfield = "bc.date_bordereau";
}
$year = GETPOST("year");
$month = GETPOST("month");
$optioncss = GETPOST('optioncss', 'alpha');
$view = GETPOST("view", 'alpha');
@ -83,18 +89,48 @@ foreach ($arrayofpaymentmodetomanage as $key => $val) {
$arrayoflabels[$key] = $labelval;
}
$arrayfields = array(
'bc.ref' => array('label'=>"Ref", 'checked'=>1, 'position'=>10),
'bc.type' => array('label'=>"Type", 'checked'=>1, 'position'=>20),
'bc.date_bordereau' => array('label'=>"DateCreation", 'checked'=>1, 'position'=>30),
'ba.label' => array('label'=>"Account", 'checked'=>1, 'position'=>40),
'bc.nbcheque' => array('label'=>"NbOfCheques", 'checked'=>1, 'position'=>50),
'bc.amount' => array('label'=>"Amount", 'checked'=>1, 'position'=>60),
'bc.statut' => array('label'=>"Status", 'checked'=>1, 'position'=>70)
);
$arrayfields = dol_sort_array($arrayfields, 'position');
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('chequelist'));
$object = new RemiseCheque($db);
/*
* Actions
*/
// If click on purge search criteria ?
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
$search_ref = '';
$search_amount = '';
$search_account = '';
$year = '';
$month = '';
$parameters = array('socid'=>$socid);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
if (empty($reshook)) {
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
// All tests are required to be compatible with all browsers
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
$search_ref = '';
$search_amount = '';
$search_account = '';
$search_date_startday = '';
$search_date_startmonth = '';
$search_date_startyear = '';
$search_date_endday = '';
$search_date_endmonth = '';
$search_date_endyear = '';
$search_date_start = '';
$search_date_end = '';
}
}
@ -103,12 +139,19 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
* View
*/
$form = new Form($db);
llxHeader('', $langs->trans("ChequeDeposits"));
$sql = "SELECT bc.rowid, bc.ref, bc.date_bordereau,";
$sql .= " bc.nbcheque, bc.amount, bc.statut, bc.type,";
$sql .= " ba.rowid as bid, ba.label";
// Add fields from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sqlfields = $sql; // $sql fields to remove for count total
$sql .= " FROM ".MAIN_DB_PREFIX."bordereau_cheque as bc,";
@ -126,7 +169,17 @@ if ($search_account > 0) {
if ($search_amount) {
$sql .= natural_search("bc.amount", price2num($search_amount));
}
$sql .= dolSqlDateFilter('bc.date_bordereau', 0, $month, $year);
if ($search_date_start) {
$sql .= " AND bc.date_bordereau >= '" . $db->idate($search_date_start) . "'";
}
if ($search_date_end) {
$sql .= " AND bc.date_bordereau <= '" . $db->idate($search_date_end) . "'";
}
// Add where from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
// Count total nb of records
$nbtotalofrecords = '';
@ -149,6 +202,7 @@ if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
$db->free($resql);
}
// Complete request and execute it with limit
$sql .= $db->order($sortfield, $sortorder);
if ($limit) {
$sql .= $db->plimit($limit + 1, $offset);
@ -166,9 +220,33 @@ if ($resql) {
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.$contextpage;
}
if ($search_date_startday) {
$param .= '&search_date_startday='.urlencode($search_date_startday);
}
if ($search_date_startmonth) {
$param .= '&search_date_startmonth='.urlencode($search_date_startmonth);
}
if ($search_date_startyear) {
$param .= '&search_date_startyear='.urlencode($search_date_startyear);
}
if ($search_date_endday) {
$param .= '&search_date_endday='.urlencode($search_date_endday);
}
if ($search_date_endmonth) {
$param .= '&search_date_endmonth='.urlencode($search_date_endmonth);
}
if ($search_date_endyear) {
$param .= '&search_date_endyear='.urlencode($search_date_endyear);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.$limit;
}
if ($search_amount != '') {
$param .= '&search_amount='.urlencode($search_amount);
}
if ($search_account > 0) {
$param .= '&search_account='.urlencode($search_account);
}
$url = DOL_URL_ROOT.'/compta/paiement/cheque/card.php?action=new';
if (!empty($socid)) {
@ -195,54 +273,157 @@ if ($resql) {
print_barre_liste($langs->trans("MenuChequeDeposits"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'bank_account', 0, $newcardbutton, '', $limit);
$moreforfilter = '';
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields
$massactionbutton = '';
if ($massactionbutton) {
$selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
}
$moreforfilter = '';
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : '').'">';
// Fields title search
print '<tr class="liste_titre">';
print '<td class="liste_titre">';
print '<input class="flat" type="text" size="4" name="search_ref" value="'.$search_ref.'">';
print '</td>';
// Type
print '<td class="liste_titre">';
print '</td>';
print '<td class="liste_titre center">';
if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) {
print '<input class="flat" type="text" size="1" maxlength="2" name="day" value="'.$day.'">';
// --------------------------------------------------------------------
print '<tr class="liste_titre_filter">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre center maxwidthsearch actioncolumn">';
$searchpicto = $form->showFilterButtons('left');
print $searchpicto;
print '</td>';
}
print '<input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">';
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);
print '</td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre right">';
print '<input class="flat maxwidth50" type="text" name="search_amount" value="'.$search_amount.'">';
print '</td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre maxwidthsearch">';
$searchpicto = $form->showFilterAndCheckAddButtons(0);
print $searchpicto;
print '</td>';
// Filter: Ref
if (!empty($arrayfields['bc.ref']['checked'])) {
print '<td class="liste_titre">';
print '<input class="flat" type="text" size="4" name="search_ref" value="' . $search_ref . '">';
print '</td>';
}
// Filter: Type
if (!empty($arrayfields['bc.type']['checked'])) {
print '<td class="liste_titre">';
print '</td>';
}
// Filter: Date
if (!empty($arrayfields['bc.date_bordereau']['checked'])) {
print '<td class="liste_titre center">';
print '<div class="nowrap">';
print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
print '</div>';
print '<div class="nowrap">';
print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
print '</div>';
print '</td>';
}
// Filter: Bank account
if (!empty($arrayfields['ba.label']['checked'])) {
print '<td class="liste_titre">';
$form->select_comptes($search_account, 'search_account', 0, '', 1);
print '</td>';
}
// Filter: Number of cheques
if (!empty($arrayfields['bc.nbcheque']['checked'])) {
print '<td class="liste_titre">&nbsp;</td>';
}
// Filter: Amount
if (!empty($arrayfields['bc.amount']['checked'])) {
print '<td class="liste_titre right">';
print '<input class="flat maxwidth50" type="text" name="search_amount" value="' . $search_amount . '">';
print '</td>';
}
// Filter: Status (only placeholder)
if (!empty($arrayfields['bc.statut']['checked'])) {
print '<td class="liste_titre"></td>';
}
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields);
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre center maxwidthsearch actioncolumn">';
$searchpicto = $form->showFilterButtons();
print $searchpicto;
print '</td>';
}
print "</tr>\n";
$totalarray = array();
$totalarray['nbfield'] = 0;
// Fields title label
// --------------------------------------------------------------------
print '<tr class="liste_titre">';
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "bc.ref", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "bc.type", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("DateCreation", $_SERVER["PHP_SELF"], "bc.date_bordereau", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("NbOfCheques", $_SERVER["PHP_SELF"], "bc.nbcheque", "", $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "bc.amount", "", $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "bc.statut", "", $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre('');
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
$totalarray['nbfield']++;
}
if (!empty($arrayfields['bc.ref']['checked'])) {
print_liste_field_titre($arrayfields['bc.ref']['label'], $_SERVER["PHP_SELF"], "bc.ref", "", $param, "", $sortfield, $sortorder);
$totalarray['nbfield']++;
}
if (!empty($arrayfields['bc.type']['checked'])) {
print_liste_field_titre($arrayfields['bc.type']['label'], $_SERVER["PHP_SELF"], "bc.type", "", $param, "", $sortfield, $sortorder);
$totalarray['nbfield']++;
}
if (!empty($arrayfields['bc.date_bordereau']['checked'])) {
print_liste_field_titre($arrayfields['bc.date_bordereau']['label'], $_SERVER["PHP_SELF"], "bc.date_bordereau", "", $param, 'align="center"', $sortfield, $sortorder);
$totalarray['nbfield']++;
}
if (!empty($arrayfields['ba.label']['checked'])) {
print_liste_field_titre($arrayfields['ba.label']['label'], $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder);
$totalarray['nbfield']++;
}
if (!empty($arrayfields['bc.nbcheque']['checked'])) {
print_liste_field_titre($arrayfields['bc.nbcheque']['label'], $_SERVER["PHP_SELF"], "bc.nbcheque", "", $param, 'class="right"', $sortfield, $sortorder);
$totalarray['nbfield']++;
}
if (!empty($arrayfields['bc.amount']['checked'])) {
print_liste_field_titre($arrayfields['bc.amount']['label'], $_SERVER["PHP_SELF"], "bc.amount", "", $param, 'class="right"', $sortfield, $sortorder);
$totalarray['nbfield']++;
}
if (!empty($arrayfields['bc.statut']['checked'])) {
print_liste_field_titre($arrayfields['bc.statut']['label'], $_SERVER["PHP_SELF"], "bc.statut", "", $param, 'class="right"', $sortfield, $sortorder);
$totalarray['nbfield']++;
}
// Hook fields
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
$totalarray['nbfield']++;
}
print "</tr>\n";
$checkedCount = 0;
foreach ($arrayfields as $column) {
if ($column['checked']) {
$checkedCount++;
}
}
if ($num > 0) {
$savnbfield = 8;
$i = 0;
$totalarray = array();
$totalarray['nbfield'] = 0;
$imaxinloop = ($limit ? min($num, $limit) : $num);
while ($i < $imaxinloop) {
$objp = $db->fetch_object($resql);
@ -273,48 +454,111 @@ if ($resql) {
} else {
print '<tr class="oddeven">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="nowrap center"></td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Num ref cheque
print '<td>';
print $checkdepositstatic->getNomUrl(1);
print '</td>';
if (!empty($arrayfields['bc.ref']['checked'])) {
print '<td>';
print $checkdepositstatic->getNomUrl(1);
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Type
$labelpaymentmode = ($langs->transnoentitiesnoconv("PaymentType".$checkdepositstatic->type) != "PaymentType".$checkdepositstatic->type ? $langs->transnoentitiesnoconv("PaymentType".$checkdepositstatic->type) : $checkdepositstatic->type);
print '<td>'.dol_escape_htmltag($labelpaymentmode).'</td>';
if (!empty($arrayfields['bc.type']['checked'])) {
$labelpaymentmode = ($langs->transnoentitiesnoconv("PaymentType".$checkdepositstatic->type) != "PaymentType".$checkdepositstatic->type ? $langs->transnoentitiesnoconv("PaymentType".$checkdepositstatic->type) : $checkdepositstatic->type);
print '<td>'.dol_escape_htmltag($labelpaymentmode).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Date
print '<td class="center">'.dol_print_date($db->jdate($objp->date_bordereau), 'dayhour', 'tzuser').'</td>';
if (!empty($arrayfields['bc.date_bordereau']['checked'])) {
print '<td class="center">'.dol_print_date($db->jdate($objp->date_bordereau), 'dayhour', 'tzuser').'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Bank
print '<td>';
if ($objp->bid) {
print '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?account='.$objp->bid.'">'.img_object($langs->trans("ShowAccount"), 'account').' '.$objp->label.'</a>';
} else {
print '&nbsp;';
if (!empty($arrayfields['ba.label']['checked'])) {
print '<td>';
if ($objp->bid) {
print '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?account='.$objp->bid.'">'.img_object($langs->trans("ShowAccount"), 'account').' '.$objp->label.'</a>';
} else {
print '&nbsp;';
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
print '</td>';
// Number of cheques
print '<td class="right">'.$objp->nbcheque.'</td>';
if (!empty($arrayfields['bc.nbcheque']['checked'])) {
print '<td class="right">'.$objp->nbcheque.'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Amount
print '<td class="right"><span class="amount">'.price($objp->amount).'</span></td>';
if (!empty($arrayfields['bc.amount']['checked'])) {
print '<td class="right"><span class="amount">'.price($objp->amount).'</span></td>';
if (!$i) {
$totalarray['nbfield']++;
}
if (empty($totalarray['val']['amount'])) {
$totalarray['val']['amount'] = $objp->amount;
} else {
$totalarray['val']['amount'] += $objp->amount;
}
}
// Statut
print '<td class="right">';
print $checkdepositstatic->LibStatut($objp->statut, 5);
print '</td>';
// Status
if (!empty($arrayfields['bc.statut']['checked'])) {
print '<td class="right">';
print $checkdepositstatic->LibStatut($objp->statut, 5);
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
print '<td></td>';
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="nowrap center"></td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
print "</tr>\n";
}
$i++;
}
} else {
print '<tr class="oddeven">';
print '<td colspan="7" class="opacitymedium">'.$langs->trans("None")."</td>";
print '</tr>';
// If no record found
if ($num == 0) {
$colspan = 1;
foreach ($arrayfields as $key => $val) {
if (!empty($val['checked'])) {
$colspan++;
}
}
print '<tr class="oddeven">';
print '<td colspan="' . $colspan . '" class="opacitymedium">' . $langs->trans("NoRecordFound") . "</td>";
print '</tr>';
}
}
print "</table>";
print "</div>";

View file

@ -5,7 +5,7 @@
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2017-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2017-2023 Alexandre Spangaro <aspangaro@easya.solutions>
* Copyright (C) 2018-2021 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Charlene Benke <charlie@patas-monkey.com>
* Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com>
@ -381,7 +381,6 @@ print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" :
print '<tr class="liste_titre_filter">';
// Filters: Lines (placeholder)
print '<tr class="liste_titre_filter">';
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
print '<td class="liste_titre">';
print '</td>';

View file

@ -748,14 +748,14 @@ if ($id > 0) {
print '</tr>';
}
print '<tr><td colspan="'.$nbcols.'" class="right">'.$langs->trans("AlreadyPaid").' :</td><td class="right">'.price($totalpaid)."</td></tr>\n";
print '<tr><td colspan="'.$nbcols.'" class="right">'.$langs->trans("AmountExpected").' :</td><td class="right">'.price($object->amount)."</td></tr>\n";
print '<tr><td colspan="'.$nbcols.'" class="right">'.$langs->trans("AlreadyPaid").' :</td><td class="right nowraponall">'.price($totalpaid)."</td></tr>\n";
print '<tr><td colspan="'.$nbcols.'" class="right">'.$langs->trans("AmountExpected").' :</td><td class="right nowraponall">'.price($object->amount)."</td></tr>\n";
$resteapayer = $object->amount - $totalpaid;
$cssforamountpaymentcomplete = 'amountpaymentcomplete';
print '<tr><td colspan="'.$nbcols.'" class="right">'.$langs->trans("RemainderToPay")." :</td>";
print '<td class="right'.($resteapayer ? ' amountremaintopay' : (' '.$cssforamountpaymentcomplete)).'">'.price($resteapayer)."</td></tr>\n";
print '<td class="right nowraponall'.($resteapayer ? ' amountremaintopay' : (' '.$cssforamountpaymentcomplete)).'">'.price($resteapayer)."</td></tr>\n";
print "</table>";
print '</div>';

View file

@ -687,51 +687,30 @@ abstract class CommonInvoice extends CommonObject
*/
public function getSubtypeLabel($table = '')
{
$subtypeLabel = '';
if ($table === 'facture' || $table === 'facture_fourn') {
$sql = "SELECT s.label FROM " . MAIN_DB_PREFIX . $table . " AS f";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "c_invoice_subtype AS s ON f.subtype = s.rowid";
$sql .= " WHERE f.ref = '".$this->db->escape($this->ref)."'";
$resql = $this->db->query($sql);
if ($resql) {
$subtypeLabel = '';
while ($obj = $this->db->fetch_object($resql)) {
$subtypeLabel = $obj->label;
}
if (!empty($subtypeLabel)) {
return $subtypeLabel;
}
} else {
dol_print_error($this->db);
return -1;
}
} elseif ($table === 'facture_rec' || $table === 'facture_fourn_rec') {
$sql = "SELECT s.label FROM " . MAIN_DB_PREFIX . $table . " AS f";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "c_invoice_subtype AS s ON f.subtype = s.rowid";
$sql .= " WHERE f.titre = '".$this->db->escape($this->titre)."'";
$resql = $this->db->query($sql);
if ($resql) {
$subtypeLabel = '';
while ($obj = $this->db->fetch_object($resql)) {
$subtypeLabel = $obj->label;
}
if (!empty($subtypeLabel)) {
return $subtypeLabel;
}
} else {
dol_print_error($this->db);
return -1;
}
} else {
return -1;
}
return '';
$resql = $this->db->query($sql);
if ($resql) {
while ($obj = $this->db->fetch_object($resql)) {
$subtypeLabel = $obj->label;
}
} else {
dol_print_error($this->db);
return -1;
}
return $subtypeLabel;
}
/**

View file

@ -260,6 +260,21 @@ abstract class CommonObject
*/
public $origin_id;
/**
* @var Object Origin object. This is set by fetch_origin() from this->origin and this->origin_id.
*/
public $origin_object;
// TODO Remove this. Has been replaced with ->origin_object.
// This is set by fetch_origin() from this->origin and this->origin_id
/** @deprecated */
public $expedition;
/** @deprecated */
public $livraison;
/** @deprecated */
public $commandeFournisseur;
/**
* @var string The object's reference
*/
@ -1870,7 +1885,9 @@ abstract class CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Read linked origin object
* Read linked origin object.
* Set ->origin_object
* Set also ->expedition or ->livraison or ->commandFournisseur (deprecated)
*
* @return void
*/
@ -1883,15 +1900,18 @@ abstract class CommonObject
if ($this->origin == 'delivery') {
$this->origin = 'livraison';
}
if ($this->origin == 'order_supplier') {
if ($this->origin == 'order_supplier' || $this->origin == 'supplier_order') {
$this->origin = 'commandeFournisseur';
}
$origin = $this->origin;
$classname = ucfirst($origin);
$this->$origin = new $classname($this->db);
$this->$origin->fetch($this->origin_id);
$this->origin_object = new $classname($this->db);
$this->origin_object->fetch($this->origin_id);
// TODO Remove this line
$this->$origin = $this->origin_object;
}
/**

View file

@ -87,6 +87,7 @@ class ExtraFields
'mail'=>'ExtrafieldMail',
'url'=>'ExtrafieldUrl',
'ip'=>'ExtrafieldIP',
'icon'=>'Icon',
'password' => 'ExtrafieldPassword',
'select' => 'ExtrafieldSelect',
'sellist' => 'ExtrafieldSelectList',
@ -225,7 +226,7 @@ class ExtraFields
} elseif ($type == 'phone') {
$typedb = 'varchar';
$lengthdb = '20';
} elseif ($type == 'mail' || $type == 'ip') {
} elseif ($type == 'mail' || $type == 'ip' || $type == 'icon') {
$typedb = 'varchar';
$lengthdb = '128';
} elseif ($type == 'url') {
@ -579,7 +580,7 @@ class ExtraFields
} elseif ($type == 'phone') {
$typedb = 'varchar';
$lengthdb = '20';
} elseif ($type == 'mail' || $type == 'ip') {
} elseif ($type == 'mail' || $type == 'ip' || $type == 'icon') {
$typedb = 'varchar';
$lengthdb = '128';
} elseif ($type == 'url') {
@ -1070,6 +1071,26 @@ class ExtraFields
$out = '<input type="text" class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" maxlength="'.$size.'" value="'.dol_escape_htmltag($value).'"'.($moreparam ? $moreparam : '').'>';
} elseif (in_array($type, array('mail', 'ip', 'phone', 'url'))) {
$out = '<input type="text" class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.dol_escape_htmltag($value).'" '.($moreparam ? $moreparam : '').'>';
} elseif ($type == 'icon') {
$out ='<link rel="stylesheet" href="'.dol_buildpath('/myfield/css/fontawesome-iconpicker.min.css', 1).'">';
$out.='<script src="'.dol_buildpath('/myfield/js/fontawesome-iconpicker.min.js', 1).'"></script>';
$out.= '<input type="text" class="form-control icp icp-auto iconpicker-element iconpicker-input flat '.$morecss.' maxwidthonsmartphone"';
$out.= ' name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.dol_escape_htmltag($value).'" '.($moreparam ? $moreparam : '').'>';
$out.='<script>';
$options="{ title: '<b>".$langs->trans("IconFieldSelector")."</b>', placement: 'right', showFooter: false, templates: {";
$options.="iconpicker: '<div class=\"iconpicker\"><div style=\"background-color:#EFEFEF;\" class=\"iconpicker-items\"></div></div>',";
$options.="iconpickerItem: '<a role=\"button\" href=\"#\" class=\"iconpicker-item\" style=\"background-color:#DDDDDD;\"><i></i></a>',";
// $options.="buttons: '<button style=\"background-color:#FFFFFF;\" class=\"iconpicker-btn iconpicker-btn-cancel btn btn-default btn-sm\">".$langs->trans("Cancel")."</button>";
// $options.="<button style=\"background-color:#FFFFFF;\" class=\"iconpicker-btn iconpicker-btn-accept btn btn-primary btn-sm\">".$langs->trans("Save")."</button>',";
$options.="footer: '<div class=\"popover-footer\" style=\"background-color:#EFEFEF;\"></div>',";
$options.="search: '<input type=\"search\" class\"form-control iconpicker-search\" placeholder=\"".$langs->trans("TypeToFilter")."\" />',";
$options.="popover: '<div class=\"iconpicker-popover popover\">";
$options.=" <div class=\"arrow\" ></div>";
$options.=" <div class=\"popover-title\" style=\"text-align:center;background-color:#EFEFEF;\"></div>";
$options.=" <div class=\"popover-content \" ></div>";
$options.="</div>'}}";
$out.="$('#".$keyprefix.$key.$keysuffix."').iconpicker(".$options.");";
$out.='</script>';
} elseif ($type == 'text') {
if (!preg_match('/search_/', $keyprefix)) { // If keyprefix is search_ or search_options_, we must just use a simple text field
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
@ -1652,6 +1673,8 @@ class ExtraFields
$value = dol_print_email($value, 0, 0, 0, 64, 1, 1);
} elseif ($type == 'ip') {
$value = dol_print_ip($value, 0);
} elseif ($type == 'icon') {
$value = '<span class="'.$value.'"></span>';
} elseif ($type == 'url') {
$value = dol_print_url($value, '_blank', 32, 1);
} elseif ($type == 'phone') {
@ -1948,11 +1971,11 @@ class ExtraFields
$cssstring = '';
if (in_array($type, array('date', 'datetime', 'datetimegmt'))) {
if (in_array($type, array('date', 'datetime', 'datetimegmt',))) {
$cssstring = "center";
} elseif (in_array($type, array('int', 'price', 'double'))) {
$cssstring = "right";
} elseif (in_array($type, array('boolean', 'radio', 'checkbox', 'ip'))) {
} elseif (in_array($type, array('boolean', 'radio', 'checkbox', 'ip', 'icon'))) {
$cssstring = "center";
}

View file

@ -996,7 +996,7 @@ class FormOther
$file = $conf->$module->dir_temp.'/'.$name.'.png';
// On cree le repertoire contenant les icones
// We create temp directory
if (!file_exists($conf->$module->dir_temp)) {
dol_mkdir($conf->$module->dir_temp);
}

View file

@ -2882,7 +2882,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
//$original_file=$conf->barcode->dir_temp.'/'.$original_file;
$original_file = '';
} elseif ($modulepart == 'iconmailing' && !empty($conf->mailing->dir_temp)) {
// Wrapping pour les icones de background des mailings
// Wrapping for icon of background of mailings
$accessallowed = 1;
$original_file = $conf->mailing->dir_temp.'/'.$original_file;
} elseif ($modulepart == 'scanner_user_temp' && !empty($conf->scanner->dir_temp)) {

View file

@ -4,6 +4,7 @@
* Copyright (C) 2006 Marc Barilley <marc@ocebo.com>
* Copyright (C) 2011-2013 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2022-2023 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2023 Nick Fragoulis
*
* 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
@ -258,6 +259,8 @@ function supplierorder_admin_prepare_head()
$extrafields->fetch_name_optionals_label('commande_fournisseurdet');
$extrafields->fetch_name_optionals_label('facture_fourn');
$extrafields->fetch_name_optionals_label('facture_fourn_det');
$extrafields->fetch_name_optionals_label('facture_fourn_rec');
$extrafields->fetch_name_optionals_label('facture_fourn_det_rec');
$h = 0;
$head = array();
@ -315,6 +318,24 @@ function supplierorder_admin_prepare_head()
$head[$h][2] = 'supplierinvoicedet';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/admin/supplierinvoice_rec_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFieldsSupplierInvoicesRec");
$nbExtrafields = $extrafields->attributes['facture_fourn_rec']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'attributesrec';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/admin/supplierinvoicedet_rec_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFieldsSupplierInvoicesLinesRec");
$nbExtrafields = $extrafields->attributes['facture_fourn_det_rec']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'attributeslinesrec';
$h++;
complete_head_from_modules($conf, $langs, null, $head, $h, 'supplierorder_admin', 'remove');
return $head;

View file

@ -63,7 +63,7 @@ class modStockTransfer extends DolibarrModules
// Used only if file README.md and README-LL.md not found.
$this->descriptionlong = "Advanced management of stock transfer orders with generation of stock transfer sheets";
// Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'
$this->version = 'experimental';
$this->version = 'dolibarr';
// Url to the file with your last numberversion of this module
//$this->url_last_version = 'http://www.example.com/versionmodule.txt';

View file

@ -1272,6 +1272,7 @@ class pdf_azur extends ModelePDFPropales
$pdf->SetTextColor(0, 0, 0);
$resteapayer = 0;
/*
$resteapayer = $object->total_ttc - $deja_regle;
if (!empty($object->paye)) $resteapayer=0;
@ -1287,8 +1288,7 @@ class pdf_azur extends ModelePDFPropales
$pdf->MultiCell($largcol2, $tab2_hl, price($deja_regle, 0, $outputlangs), 0, 'R', 0);
/*
if ($object->close_code == 'discount_vat')
{
if ($object->close_code == 'discount_vat') {
$index++;
$pdf->SetFillColor(255,255,255);

View file

@ -1755,7 +1755,8 @@ if ($action == 'create') {
$typeobject = $object->origin;
$origin = $object->origin;
$origin_id = $object->origin_id;
$object->fetch_origin(); // Load property $object->commande, $object->propal, ...
$object->fetch_origin(); // Load property $object->origin_object (old $object->commande, $object->propal, ...)
}
$soc = new Societe($db);
@ -1768,7 +1769,7 @@ if ($action == 'create') {
$formconfirm = '';
// Confirm deleteion
// Confirm deletion
if ($action == 'delete') {
$formquestion = array();
if ($object->statut == Expedition::STATUS_CLOSED && !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)) {

View file

@ -125,7 +125,10 @@ function addDispatchLine(index, type, mode) {
//create new select2 to avoid duplicate id of cloned one
$row.find("select[name='" + 'entrepot_' + nbrTrs + '_' + index + "']").select2();
// TODO find solution to copy selected option to new select
// Copy selected option to new select
let $prevRow = $("tr[name^='" + type + "_'][name$='_" + index + "']:last")
let $prevEntr = Number($prevRow.find("select[name='" + 'entrepot_' + (nbrTrs-1) + '_' + index + "']").val())
$row.find("select[name='" + 'entrepot_' + nbrTrs + '_' + index + "']").val($prevEntr)
// TODO find solution to keep new tr's after page refresh
//clear value
$row.find("input[name^='qty']").val('');

View file

@ -1103,6 +1103,36 @@ class Job extends CommonObject
$return .= '</div>';
return $return;
}
/**
* function for get required skills associate to job object
* @param int $id Id of object
* @return array|int list of ids skillranks
*/
public function getSkillRankForJob($id)
{
if (empty($id)) {
return -1;
}
$skillranks = array();
$sql = "SELECT rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."hrm_skillrank";
$sql .= " WHERE fk_object = ".((int) $id);
$resql = $this->db->query($sql);
if ($resql) {
$num = $this->db->num_rows($resql);
$i = 0;
while ($i < $num) {
$obj = $this->db->fetch_object($resql);
$skillranks[] = $obj;
$i++;
}
$this->db->free($resql);
} else {
dol_print_error($this->db);
}
return $skillranks;
}
}

View file

@ -234,9 +234,10 @@ class SkillRank extends CommonObject
*
* @param User $user User that creates
* @param int $fromid Id of object to clone
* @param int $fk_object id of Job object (if new job object)
* @return mixed New object created, <0 if KO
*/
public function createFromClone(User $user, $fromid)
public function createFromClone(User $user, $fromid, $fk_object = 0)
{
global $langs, $extrafields;
$error = 0;
@ -261,6 +262,10 @@ class SkillRank extends CommonObject
unset($object->id);
unset($object->fk_user_creat);
unset($object->import_key);
if (!empty($fk_object) && $fk_object > 0) {
unset($object->fk_object);
}
// Clear fields
if (property_exists($object, 'ref')) {
@ -278,6 +283,11 @@ class SkillRank extends CommonObject
if (property_exists($object, 'date_modification')) {
$object->date_modification = null;
}
if (!empty($fk_object) && $fk_object > 0) {
if (property_exists($object, 'fk_object')) {
$object->fk_object = ($fk_object = 0 ? $this->fk_object : $fk_object);
}
}
// ...
// Clear extrafields that are unique
if (is_array($object->array_options) && count($object->array_options) > 0) {

View file

@ -34,6 +34,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
require_once DOL_DOCUMENT_ROOT . '/hrm/class/job.class.php';
require_once DOL_DOCUMENT_ROOT . '/hrm/lib/hrm_job.lib.php';
require_once DOL_DOCUMENT_ROOT . '/hrm/class/skillrank.class.php';
// Load translation files required by the page
$langs->loadLangs(array('hrm', 'other', 'products')); // why products?
@ -120,7 +121,9 @@ if (empty($reshook)) {
// Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen
include DOL_DOCUMENT_ROOT . '/core/actions_addupdatedelete.inc.php';
if ($action != 'confirm_clone') {
include DOL_DOCUMENT_ROOT . '/core/actions_addupdatedelete.inc.php';
}
// Actions when linking object each other
include DOL_DOCUMENT_ROOT . '/core/actions_dellink.inc.php';
@ -146,6 +149,56 @@ if (empty($reshook)) {
$autocopy = 'MAIN_MAIL_AUTOCOPY_JOB_TO';
$trackid = 'job' . $object->id;
include DOL_DOCUMENT_ROOT . '/core/actions_sendmails.inc.php';
if ($action == 'confirm_clone' && $confirm != 'yes') {
$action = '';
}
if ($action == 'confirm_clone' && $confirm == 'yes' && ($user->hasRight('salaries', 'write'))) {
$db->begin();
$originalId = $id;
$object->fetch($id);
$skillRequire = $object->getSkillRankForJob($originalId);
if ($object->id > 0) {
$object->id = $object->ref = null;
if (GETPOST('clone_label', 'alphanohtml')) {
$object->label = GETPOST('clone_label', 'alphanohtml');
} else {
$object->label = $langs->trans("CopyOf").' '.$object->label;
}
if (GETPOST('clone_skills_required')) {
$cloneSkillRequired = GETPOST('clone_skills_required');
}
$id = $object->create($user);
if ($id > 0) {
if (!empty($cloneSkillRequired)) {
$i = 0;
while ($i < count($skillRequire)) {
$skillrank = new SkillRank($db);
$skillrank->createFromClone($user, $skillRequire[$i]->rowid, $id);
$i++;
}
}
$db->commit();
$db->close();
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
exit;
} else {
$id = $originalId;
$db->rollback();
setEventMessages($object->error, $object->errors, 'errors');
}
} else {
$db->rollback();
dol_print_error($db, $object->error);
}
}
}
@ -275,8 +328,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Clone confirmation
if ($action == 'clone') {
// Create an array for form
$formquestion = array();
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneAsk', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
$formquestion = array(
array('type' => 'text', 'name' => 'clone_label', 'label' => $langs->trans("Label"), 'value' => $langs->trans("CopyOf").' '.$object->label),
array('type' => 'checkbox', 'name' => 'clone_skills_required', 'label' => $langs->trans("RequiredSkills"), 'value' => '',),
);
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneAsk', $object->label), 'confirm_clone', $formquestion, 'yes', 1, 280);
}
// Confirmation of action xxxx
@ -413,6 +470,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=edit&token=' . newToken(), '', $permissiontoadd);
print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=clone&token=' . newToken(), '', $permissiontoadd);
// Delete (need delete permission, or if draft, just need create/modify permission)
print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=delete&token=' . newToken(), '', $permissiontodelete);
}

View file

@ -191,3 +191,8 @@ CREATE TABLE llx_mrp_production_extrafields
) ENGINE=innodb;
ALTER TABLE llx_mrp_production_extrafields ADD INDEX idx_mrp_production_fk_object(fk_object);
ALTER TABLE llx_salary ADD COLUM ref_ext varchar(255);
ALTER TABLE llx_salary ADD COLUM note_public text;
ALTER TABLE llx_commande_fournisseur_dispatch ADD COLUMN element_type varchar(50) DEFAULT 'supplier_order' NOT NULL;

View file

@ -14,21 +14,23 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <https://www.gnu.org/licenses/>.
--
-- This table is just an history table to track all receiving done for a
-- This table is just an history table to track all receiption to do or done for a
-- particular supplier order. A movement with same information is also done
-- into stock_movement so this table may be useless.
--
-- Detail of each lines of a reception (qty, batch and into which warehouse must be
-- received or has been receveived a purchase order line).
-- This table should have been named llx_receptiondet_batch
--
-- This table should be renamed into llx_receptiondet_batch
-- ===================================================================
create table llx_commande_fournisseur_dispatch
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
fk_product integer,
fk_commande integer,
fk_commandefourndet integer,
fk_commande integer, -- should be renamed into fk_element
fk_commandefourndet integer, -- should be renamed into fk_elementdet
element_type varchar(50) DEFAULT 'supplier_order' NOT NULL, -- Type of source ('supplier_order', ...)
fk_projet integer DEFAULT NULL,
fk_reception integer DEFAULT NULL,
qty float, -- qty to move

View file

@ -17,6 +17,7 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <https://www.gnu.org/licenses/>.
--
-- Note: a shipment is linked to an order or other object using llx_element_element table.
-- ===================================================================
create table llx_expedition
@ -31,11 +32,11 @@ create table llx_expedition
ref_ext varchar(255), -- reference into an external system (not used by dolibarr)
ref_customer varchar(255), -- customer number
date_creation datetime, -- date de creation
date_creation datetime, -- date of creation
fk_user_author integer, -- author of creation
fk_user_modif integer, -- author of last change
date_valid datetime, -- date de validation
fk_user_valid integer, -- valideur
date_valid datetime, -- date of validation
fk_user_valid integer, -- user that validate
date_delivery datetime DEFAULT NULL, -- date planned of delivery
date_expedition datetime, -- not used (deprecated)
fk_address integer DEFAULT NULL, -- delivery address (deprecated)

View file

@ -17,6 +17,7 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <https://www.gnu.org/licenses/>.
--
-- Note: a reception is linked to a supplier order or other object using llx_element_element table.
-- ===================================================================
create table llx_reception
@ -29,7 +30,7 @@ create table llx_reception
fk_projet integer DEFAULT NULL,
ref_ext varchar(30), -- reference into an external system (not used by dolibarr)
ref_supplier varchar(255), -- supplier number
ref_supplier varchar(255), -- reference of reception on supplier side
date_creation datetime, -- date de creation
fk_user_author integer, -- author of creation

View file

@ -1,6 +1,7 @@
-- ===================================================================
-- Copyright (C) 2011-2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
-- Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
-- Copyright (C) 2011-2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
-- Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
-- Copyright (C) 2023 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
@ -14,13 +15,13 @@
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <https://www.gnu.org/licenses/>.
--
-- ===================================================================
create table llx_salary
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
ref varchar(30) NULL, -- payment reference number (currently NULL because there is no numbering manager yet)
ref_ext varchar(255), -- reference into an external system (not used by dolibarr)
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
datec datetime, -- Create date
fk_user integer NOT NULL,
@ -29,13 +30,14 @@ create table llx_salary
salary double(24,8), -- salary of user when payment was done
amount double(24,8) NOT NULL DEFAULT 0,
fk_projet integer DEFAULT NULL,
fk_typepayment integer NOT NULL,
num_payment varchar(50), -- num cheque or other
fk_typepayment integer NOT NULL, -- default expected payment
num_payment varchar(50), -- num cheque or other (deprecated, now stored into the payment)
label varchar(255),
datesp date, -- date start period
dateep date, -- date end period
entity integer DEFAULT 1 NOT NULL, -- multi company id
note text,
note_public text,
fk_bank integer,
paye smallint default 0 NOT NULL,
fk_account integer,

View file

@ -2427,3 +2427,5 @@ LargeModern=Large - Modern
SpecialCharActivation=Enable the button to open a virtual keyboard to enter special characters
DeleteExtrafield=Delete extrafield
ConfirmDeleteExtrafield=Confirm delete %s extrafield ? All data is going to be lost
ExtraFieldsSupplierInvoicesRec=Complementary attributes (templates invoices)
ExtraFieldsSupplierInvoicesLinesRec=Complementary attributes (invoice lines)

View file

@ -158,6 +158,33 @@ if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massa
$massaction = '';
}
// Definition of fields for list
$arrayfields = array();
$arrayfields['t.element_date'] = array('label'=>$langs->trans("Date"), 'checked'=>1);
$arrayfields['p.fk_soc'] = array('label'=>$langs->trans("ThirdParty"), 'type'=>'integer:Societe:/societe/class/societe.class.php:1','checked'=>1);
$arrayfields['s.name_alias'] = array('label'=>$langs->trans("AliasNameShort"), 'type'=>'integer:Societe:/societe/class/societe.class.php:1');
if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) { // Not a dedicated task
if (! empty($allprojectforuser)) {
$arrayfields['p.project_ref'] = ['label' => $langs->trans('RefProject'), 'checked' => 1];
$arrayfields['p.project_label'] = ['label' => $langs->trans('ProjectLabel'), 'checked' => 1];
}
$arrayfields['t.element_ref'] = array('label'=>$langs->trans("RefTask"), 'checked'=>1);
$arrayfields['t.element_label'] = array('label'=>$langs->trans("LabelTask"), 'checked'=>1);
}
$arrayfields['author'] = array('label' => $langs->trans("By"), 'checked' => 1);
$arrayfields['t.note'] = array('label' => $langs->trans("Note"), 'checked' => 1);
if (isModEnabled('service') && !empty($projectstatic->thirdparty) && $projectstatic->thirdparty->id > 0 && $projectstatic->usage_bill_time) {
$arrayfields['t.fk_product'] = array('label' => $langs->trans("Product"), 'checked' => 1);
}
$arrayfields['t.element_duration'] = array('label'=>$langs->trans("Duration"), 'checked'=>1);
$arrayfields['value'] = array('label'=>$langs->trans("Value"), 'checked'=>1, 'enabled'=>isModEnabled("salaries"));
$arrayfields['valuebilled'] = array('label'=>$langs->trans("Billed"), 'checked'=>1, 'enabled'=>(((getDolGlobalInt('PROJECT_HIDE_TASKS') || !getDolGlobalInt('PROJECT_BILL_TIME_SPENT')) ? 0 : 1) && $projectstatic->usage_bill_time));
// Extra fields
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_array_fields.tpl.php';
$arrayfields = dol_sort_array($arrayfields, 'position');
$parameters = array('socid' => $socid, 'projectid' => $projectid);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
@ -1264,31 +1291,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
// Print form confirm
print $formconfirm;
// Definition of fields for list
$arrayfields = array();
$arrayfields['t.element_date'] = array('label'=>$langs->trans("Date"), 'checked'=>1);
$arrayfields['p.fk_soc'] = array('label'=>$langs->trans("ThirdParty"), 'type'=>'integer:Societe:/societe/class/societe.class.php:1','checked'=>1);
$arrayfields['s.name_alias'] = array('label'=>$langs->trans("AliasNameShort"), 'type'=>'integer:Societe:/societe/class/societe.class.php:1');
if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) { // Not a dedicated task
if (! empty($allprojectforuser)) {
$arrayfields['p.project_ref'] = ['label' => $langs->trans('RefProject'), 'checked' => 1];
$arrayfields['p.project_label'] = ['label' => $langs->trans('ProjectLabel'), 'checked' => 1];
}
$arrayfields['t.element_ref'] = array('label'=>$langs->trans("RefTask"), 'checked'=>1);
$arrayfields['t.element_label'] = array('label'=>$langs->trans("LabelTask"), 'checked'=>1);
}
$arrayfields['author'] = array('label' => $langs->trans("By"), 'checked' => 1);
$arrayfields['t.note'] = array('label' => $langs->trans("Note"), 'checked' => 1);
if (isModEnabled('service') && !empty($projectstatic->thirdparty) && $projectstatic->thirdparty->id > 0 && $projectstatic->usage_bill_time) {
$arrayfields['t.fk_product'] = array('label' => $langs->trans("Product"), 'checked' => 1);
}
$arrayfields['t.element_duration'] = array('label'=>$langs->trans("Duration"), 'checked'=>1);
$arrayfields['value'] = array('label'=>$langs->trans("Value"), 'checked'=>1, 'enabled'=>isModEnabled("salaries"));
$arrayfields['valuebilled'] = array('label'=>$langs->trans("Billed"), 'checked'=>1, 'enabled'=>(((getDolGlobalInt('PROJECT_HIDE_TASKS') || !getDolGlobalInt('PROJECT_BILL_TIME_SPENT')) ? 0 : 1) && $projectstatic->usage_bill_time));
// Extra fields
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_array_fields.tpl.php';
$arrayfields = dol_sort_array($arrayfields, 'position');
$param = '';
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {

View file

@ -122,6 +122,7 @@ if ($id > 0 || !empty($ref)) {
$object->fetch($id, $ref);
$object->fetch_thirdparty();
$typeobject = '';
if (!empty($object->origin)) {
$origin = $object->origin;
@ -129,11 +130,10 @@ if ($id > 0 || !empty($ref)) {
$typeobject = $object->origin;
}
// Linked documents
if ($origin == 'order_supplier' && $object->$typeobject->id && isModEnabled("supplier_order")) {
$origin_id = $object->$typeobject->id;
$objectsrc = new CommandeFournisseur($db);
$objectsrc->fetch($object->$typeobject->id);
// Set $origin_id and $objectsrc
if (($origin == 'order_supplier' || $origin == 'supplier_order') && is_object($object->origin_object) && isModEnabled("supplier_order")) {
$origin_id = $object->origin_object->id;
$objectsrc = $object->origin_object;
}
}

View file

@ -576,7 +576,7 @@ class SecurityTest extends PHPUnit\Framework\TestCase
$result=GETPOST("param15", 'restricthtml'); // param15 = <img onerror<=alert(document.domain)> src=>0xbeefed that is a dangerous string
print __METHOD__." result=".$result."\n";
$this->assertEquals('InvalidHTMLStringCantBeCleaned', $result, 'Test 15b'); // With some PHP and libxml version, we got this result when parsing invalid HTML, but ...
// $this->assertEquals('InvalidHTMLStringCantBeCleaned', $result, 'Test 15b'); // With some PHP and libxml version, we got this result when parsing invalid HTML, but ...
//$this->assertEquals('<img onerror> src=&gt;0xbeefed', $result, 'Test 15b'); // ... on other PHP and libxml versions, we got a HTML that has been cleaned
@ -641,7 +641,22 @@ class SecurityTest extends PHPUnit\Framework\TestCase
$_POST["pagecontentwithlinks"]='<img src="aaa"><img src="bbb"><img src="ccc"><span style="background: url(/ddd)"></span>';
$result=GETPOST("pagecontentwithlinks", 'restricthtml');
print __METHOD__." result=".$result."\n";
$this->assertEquals('TooManyLinksIntoHTMLString', $result, 'Test on limit on GETPOST fails');
$this->assertEquals('ErrorTooManyLinksIntoHTMLString', $result, 'Test on limit on GETPOST fails');
// Test that img src="data:..." is excluded from the count of external links
$conf->global->MAIN_SECURITY_MAX_IMG_IN_HTML_CONTENT = 3;
$_POST["pagecontentwithlinks"]='<img src="data:abc"><img src="bbb"><img src="ccc"><span style="background: url(/ddd)"></span>';
$result=GETPOST("pagecontentwithlinks", 'restricthtml');
print __METHOD__." result=".$result."\n";
$this->assertEquals('<img src="data:abc"><img src="bbb"><img src="ccc"><span style="background: url(/ddd)"></span>', $result, 'Test on limit on GETPOST fails');
// Test that no links is allowed
$conf->global->MAIN_DISALLOW_URL_INTO_DESCRIPTIONS = 1;
$_POST["pagecontentwithlinks"]='<img src="data:abc"><img src="bbb"><img src="ccc"><span style="background: url(/ddd)"></span>';
$result=GETPOST("pagecontentwithlinks", 'restricthtml');
print __METHOD__." result=".$result."\n";
$this->assertEquals('ErrorHTMLLinksNotAllowed', $result, 'Test on limit on GETPOST fails');
return $result;
}