mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-06 17:48:25 +01:00
Merge branch '21.0' of git@github.com:Dolibarr/dolibarr.git into 22.0
This commit is contained in:
@@ -253,6 +253,8 @@ if (!empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' || $
|
|||||||
$modulenameforenabled = 'supplier_proposal';
|
$modulenameforenabled = 'supplier_proposal';
|
||||||
} elseif ($module == 'ficheinter') {
|
} elseif ($module == 'ficheinter') {
|
||||||
$modulenameforenabled = 'intervention';
|
$modulenameforenabled = 'intervention';
|
||||||
|
} elseif ($module == 'product' && !isModEnabled('product') && isModEnabled('service')) {
|
||||||
|
$modulenameforenabled = 'service';
|
||||||
}
|
}
|
||||||
|
|
||||||
dol_syslog("Found module file ".$file." - module=".$module." - modulenameforenabled=".$modulenameforenabled." - moduledirforclass=".$moduledirforclass);
|
dol_syslog("Found module file ".$file." - module=".$module." - modulenameforenabled=".$modulenameforenabled." - moduledirforclass=".$moduledirforclass);
|
||||||
|
|||||||
@@ -486,17 +486,14 @@ if ($search_status != '') {
|
|||||||
$sql .= ' AND c.fk_statut = '.((int) $search_status); // draft, validated, in process or canceled
|
$sql .= ' AND c.fk_statut = '.((int) $search_status); // draft, validated, in process or canceled
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($search_status == -2) { // To process
|
if ($search_status == -2) { // "validated + in progress"
|
||||||
//$sql.= ' AND c.fk_statut IN (1,2,3) AND c.facture = 0';
|
//$sql.= ' AND c.fk_statut IN (1,2,3) AND c.facture = 0';
|
||||||
$sql .= " AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))"; // If status is 2 and facture=1, it must be selected
|
$sql .= " AND c.fk_statut IN (1,2)";
|
||||||
}
|
}
|
||||||
if ($search_status == -3) { // To bill
|
if ($search_status == -3) { // "validated + in progress + shipped"
|
||||||
//$sql.= ' AND c.fk_statut in (1,2,3)';
|
//$sql.= ' AND c.fk_statut in (1,2,3)';
|
||||||
//$sql.= ' AND c.facture = 0'; // invoice not created
|
//$sql.= ' AND c.facture = 0'; // invoice not created
|
||||||
$sql .= ' AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))'; // validated, in process or closed but not billed
|
$sql .= ' AND c.fk_statut IN (1,2,3)'; // validated, in process or closed
|
||||||
}
|
|
||||||
if ($search_status == -4) { // "validate and in progress"
|
|
||||||
$sql .= ' AND (c.fk_statut IN (1,2))'; // validated, in process
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -725,9 +722,6 @@ if ($resql) {
|
|||||||
if ($search_status == -3) {
|
if ($search_status == -3) {
|
||||||
$title .= ' - '.$langs->trans('StatusOrderValidated').', '.(!isModEnabled('shipping') ? '' : $langs->trans("StatusOrderSent").', ').$langs->trans('StatusOrderToBill');
|
$title .= ' - '.$langs->trans('StatusOrderValidated').', '.(!isModEnabled('shipping') ? '' : $langs->trans("StatusOrderSent").', ').$langs->trans('StatusOrderToBill');
|
||||||
}
|
}
|
||||||
if ($search_status == -4) {
|
|
||||||
$title .= ' - '.$langs->trans("StatusOrderValidatedShort").'+'.$langs->trans("StatusOrderSentShort");
|
|
||||||
}
|
|
||||||
|
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
|
|
||||||
|
|||||||
@@ -380,6 +380,7 @@ class Invoices extends DolibarrApi
|
|||||||
*
|
*
|
||||||
* @throws RestException 400
|
* @throws RestException 400
|
||||||
* @throws RestException 401
|
* @throws RestException 401
|
||||||
|
* @throws RestException 403 Access not allowed for login
|
||||||
* @throws RestException 404
|
* @throws RestException 404
|
||||||
* @throws RestException 405
|
* @throws RestException 405
|
||||||
*/
|
*/
|
||||||
@@ -396,6 +397,9 @@ class Invoices extends DolibarrApi
|
|||||||
if (empty($orderid)) {
|
if (empty($orderid)) {
|
||||||
throw new RestException(400, 'Order ID is mandatory');
|
throw new RestException(400, 'Order ID is mandatory');
|
||||||
}
|
}
|
||||||
|
if (!DolibarrApi::_checkAccessToResource('commande', $orderid)) {
|
||||||
|
throw new RestException(403, 'Access not allowed on order for login '.DolibarrApiAccess::$user->login);
|
||||||
|
}
|
||||||
|
|
||||||
$order = new Commande($this->db);
|
$order = new Commande($this->db);
|
||||||
$result = $order->fetch($orderid);
|
$result = $order->fetch($orderid);
|
||||||
|
|||||||
@@ -4204,7 +4204,7 @@ class Facture extends CommonInvoice
|
|||||||
if (empty($fk_prev_id)) {
|
if (empty($fk_prev_id)) {
|
||||||
$fk_prev_id = 'null';
|
$fk_prev_id = 'null';
|
||||||
}
|
}
|
||||||
if (!isset($situation_percent) || $situation_percent > 100 || (string) $situation_percent == '' || $situation_percent == null) {
|
if (!isset($situation_percent) || $situation_percent > 100 || (string) $situation_percent == '' || $situation_percent === null) {
|
||||||
// INVOICE_USE_SITUATION = 2 - Lines situation percent on new lines must be 0 (No cumulative)
|
// INVOICE_USE_SITUATION = 2 - Lines situation percent on new lines must be 0 (No cumulative)
|
||||||
if ($this->isSituationInvoice() && getDolGlobalInt('INVOICE_USE_SITUATION') == 2) {
|
if ($this->isSituationInvoice() && getDolGlobalInt('INVOICE_USE_SITUATION') == 2) {
|
||||||
$situation_percent = 0;
|
$situation_percent = 0;
|
||||||
|
|||||||
@@ -843,6 +843,11 @@ while ($i < $imaxinloop) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fields from hook
|
||||||
|
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$objp, 'i'=>$i, 'totalarray'=>&$totalarray);
|
||||||
|
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||||
|
print $hookmanager->resPrint;
|
||||||
|
|
||||||
// Status
|
// Status
|
||||||
if (!empty($arrayfields['p.statut']['checked'])) {
|
if (!empty($arrayfields['p.statut']['checked'])) {
|
||||||
print '<td class="right">';
|
print '<td class="right">';
|
||||||
|
|||||||
@@ -914,9 +914,9 @@ class FormSetupItem
|
|||||||
$revertonoff = !empty($this->fieldParams['revertonoff']) ? 1 : 0;
|
$revertonoff = !empty($this->fieldParams['revertonoff']) ? 1 : 0;
|
||||||
$forcereload = !empty($this->fieldParams['forcereload']) ? 1 : 0;
|
$forcereload = !empty($this->fieldParams['forcereload']) ? 1 : 0;
|
||||||
|
|
||||||
$out .= ajax_constantonoff($this->confKey, $input, $this->entity, $revertonoff, 0, $forcereload);
|
$out .= ajax_constantonoff($this->confKey, $input, $this->entity, $revertonoff, 0, $forcereload, 2, 0, 0, '', '', $this->cssClass);
|
||||||
} else {
|
} else {
|
||||||
$out .= $this->form->selectyesno($this->confKey, $this->fieldValue, 1);
|
$out .= $this->form->selectyesno($this->confKey, $this->fieldValue, 1, false, 0, 0, $this->cssClass);
|
||||||
}
|
}
|
||||||
} elseif (preg_match('/emailtemplate:/', $this->type)) {
|
} elseif (preg_match('/emailtemplate:/', $this->type)) {
|
||||||
$out .= $this->generateInputFieldEmailTemplate();
|
$out .= $this->generateInputFieldEmailTemplate();
|
||||||
@@ -1230,7 +1230,7 @@ class FormSetupItem
|
|||||||
$revertonoff = empty($this->fieldParams['revertonoff']) ? 0 : 1;
|
$revertonoff = empty($this->fieldParams['revertonoff']) ? 0 : 1;
|
||||||
$forcereload = empty($this->fieldParams['forcereload']) ? 0 : 1;
|
$forcereload = empty($this->fieldParams['forcereload']) ? 0 : 1;
|
||||||
|
|
||||||
$out .= ajax_constantonoff($this->confKey, array(), $this->entity, $revertonoff, 0, $forcereload);
|
$out .= ajax_constantonoff($this->confKey, array(), $this->entity, $revertonoff, 0, $forcereload, 2, 0, 0, '', '', $this->cssClass); // TODO possibility to add $input parameter
|
||||||
} else {
|
} else {
|
||||||
if ($this->fieldValue == 1) {
|
if ($this->fieldValue == 1) {
|
||||||
$out .= $langs->trans('yes');
|
$out .= $langs->trans('yes');
|
||||||
|
|||||||
@@ -668,7 +668,8 @@ class Notify
|
|||||||
$application = (preg_match('/^\+/', $applicationcustom) ? $application : '').$applicationcustom;
|
$application = (preg_match('/^\+/', $applicationcustom) ? $application : '').$applicationcustom;
|
||||||
}
|
}
|
||||||
|
|
||||||
$from = getDolGlobalString('NOTIFICATION_EMAIL_FROM');
|
$from = getDolGlobalString('NOTIFICATION_EMAIL_FROM', getDolGlobalString('MAIN_MAIL_EMAIL_FROM'));
|
||||||
|
|
||||||
$object_type = '';
|
$object_type = '';
|
||||||
$link = '';
|
$link = '';
|
||||||
$num = 0;
|
$num = 0;
|
||||||
|
|||||||
@@ -1578,14 +1578,20 @@ jQuery(document).ready(function() {
|
|||||||
|
|
||||||
// Code to manage the js for combo list with dependencies (called by extrafields_view.tpl.php)
|
// Code to manage the js for combo list with dependencies (called by extrafields_view.tpl.php)
|
||||||
function showOptions(child_list, parent_list) {
|
function showOptions(child_list, parent_list) {
|
||||||
var val = $("select[name="+parent_list+"]").val();
|
var parentInput = $("select[name="+parent_list+"]");
|
||||||
var parentVal = parent_list + ":" + val;
|
if (parentInput.length === 0) { // when parent extra-field is in view mode and the child is edited directly on card (on line edit)
|
||||||
if(val > 0) {
|
parentInput = $("input[name="+parent_list+"]");
|
||||||
$("select[name=\""+child_list+"\"] option[parent]").hide();
|
}
|
||||||
$("select[name=\""+child_list+"\"] option[parent=\""+parentVal+"\"]").show();
|
if (parentInput.length > 0) {
|
||||||
|
var val = parentInput.val();
|
||||||
|
var parentVal = parent_list + ":" + val;
|
||||||
|
if (val > 0) {
|
||||||
|
$("select[name=\""+child_list+"\"] option[parent]").prop("disabled", true).hide(); // hide not work with select2 element so disabled it
|
||||||
|
$("select[name=\""+child_list+"\"] option[parent=\""+parentVal+"\"]").prop('disabled', false).show(); // show not work with select2 element so enabled it
|
||||||
} else {
|
} else {
|
||||||
$("select[name=\""+child_list+"\"] option").show();
|
$("select[name=\""+child_list+"\"] option").prop("disabled", false).show(); // show not work with select2 element so enabled it
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
function setListDependencies() {
|
function setListDependencies() {
|
||||||
console.log("setListDependencies");
|
console.log("setListDependencies");
|
||||||
|
|||||||
@@ -235,7 +235,7 @@ function societe_prepare_head(Societe $object)
|
|||||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe_rib as n";
|
$sql .= " FROM ".MAIN_DB_PREFIX."societe_rib as n";
|
||||||
$sql .= " WHERE n.fk_soc = ".((int) $object->id);
|
$sql .= " WHERE n.fk_soc = ".((int) $object->id);
|
||||||
if (!isModEnabled('stripe')) {
|
if (!isModEnabled('stripe')) {
|
||||||
$sql .= " AND n.stripe_card_ref IS NULL";
|
$sql .= " AND (n.stripe_card_ref IS NULL OR n.stripe_card_ref ='')";
|
||||||
} else {
|
} else {
|
||||||
$sql .= " AND (n.stripe_card_ref IS NULL OR (n.stripe_card_ref IS NOT NULL AND n.status = ".((int) $servicestatus)."))";
|
$sql .= " AND (n.stripe_card_ref IS NULL OR (n.stripe_card_ref IS NOT NULL AND n.status = ".((int) $servicestatus)."))";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1052,7 +1052,7 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl
|
|||||||
$sql .= " AND (sc.fk_user = ".((int) $user->id);
|
$sql .= " AND (sc.fk_user = ".((int) $user->id);
|
||||||
if (getDolGlobalInt('MAIN_SEE_SUBORDINATES')) {
|
if (getDolGlobalInt('MAIN_SEE_SUBORDINATES')) {
|
||||||
$userschilds = $user->getAllChildIds();
|
$userschilds = $user->getAllChildIds();
|
||||||
$sql .= " OR sc.fk_user IN (".$db->sanitize(implode(',', $userschilds)).")";
|
if (!empty($userschilds)) $sql .= " OR sc.fk_user IN (".$db->sanitize(implode(',', $userschilds)).")";
|
||||||
}
|
}
|
||||||
$sql .= ")";
|
$sql .= ")";
|
||||||
$sql .= " AND sc.fk_soc = s.rowid";
|
$sql .= " AND sc.fk_soc = s.rowid";
|
||||||
@@ -1162,9 +1162,7 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl
|
|||||||
$sql .= " AND (sc.fk_user = ".((int) $user->id);
|
$sql .= " AND (sc.fk_user = ".((int) $user->id);
|
||||||
if (getDolGlobalInt('MAIN_SEE_SUBORDINATES')) {
|
if (getDolGlobalInt('MAIN_SEE_SUBORDINATES')) {
|
||||||
$userschilds = $user->getAllChildIds();
|
$userschilds = $user->getAllChildIds();
|
||||||
foreach ($userschilds as $key => $value) {
|
if (!empty($userschilds)) $sql .= " OR sc.fk_user IN (".$db->sanitize(implode(',', $userschilds)).")";
|
||||||
$sql .= ' OR sc.fk_user = '.((int) $value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
$sql .= ')';
|
$sql .= ')';
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -322,6 +322,7 @@ if (empty($reshook) && !empty($object->table_element) && isset($extrafields->att
|
|||||||
|
|
||||||
//var_dump($tmpkeyextra.'-'.$value.'-'.$object->table_element);
|
//var_dump($tmpkeyextra.'-'.$value.'-'.$object->table_element);
|
||||||
print $extrafields->showOutputField($tmpkeyextra, $value, '', $object->table_element, null, $object);
|
print $extrafields->showOutputField($tmpkeyextra, $value, '', $object->table_element, null, $object);
|
||||||
|
print '<input type="hidden" value="' . $value . '" name="options_' . $tmpkeyextra . '" id="options_' . $tmpkeyextra . '"/>'; // it's needed when to get parent value when extra-field list depend on parent extra-field list
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|||||||
@@ -204,7 +204,7 @@ if (!empty($captcha)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// List of directories where we can find captcha handlers
|
// List of directories where we can find captcha handlers
|
||||||
$dirModCaptcha = array_merge(array('main' => '/core/modules/security/captcha/'), is_array($conf->modules_parts['captcha']) ? $conf->modules_parts['captcha'] : array());
|
$dirModCaptcha = array_merge(array('main' => '/core/modules/security/captcha/'), ((isset($conf->modules_parts['captcha']) && is_array($conf->modules_parts['captcha'])) ? $conf->modules_parts['captcha'] : array()));
|
||||||
$fullpathclassfile = '';
|
$fullpathclassfile = '';
|
||||||
foreach ($dirModCaptcha as $dir) {
|
foreach ($dirModCaptcha as $dir) {
|
||||||
$fullpathclassfile = dol_buildpath($dir."modCaptcha".ucfirst($captcha).'.class.php', 0, 2);
|
$fullpathclassfile = dol_buildpath($dir."modCaptcha".ucfirst($captcha).'.class.php', 0, 2);
|
||||||
|
|||||||
@@ -730,6 +730,11 @@ while ($i < $imaxinloop) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fields from hook
|
||||||
|
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$objp, 'i'=>$i, 'totalarray'=>&$totalarray);
|
||||||
|
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||||
|
print $hookmanager->resPrint;
|
||||||
|
|
||||||
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||||
print '<td class="nowrap center">';
|
print '<td class="nowrap center">';
|
||||||
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||||
@@ -747,6 +752,7 @@ while ($i < $imaxinloop) {
|
|||||||
|
|
||||||
print '</tr>'."\n";
|
print '</tr>'."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ if (getDolGlobalString('MAIN_MOTD')) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Specific warning to propose to upgrade invoice situation to progressive mode
|
// Specific warning to propose to upgrade invoice situation to progressive mode
|
||||||
if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1) {
|
if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1 && (float) DOL_VERSION >= 22.0) {
|
||||||
$langs->loadLangs(array("admin"));
|
$langs->loadLangs(array("admin"));
|
||||||
print info_admin($langs->trans("WarningExperimentalFeatureInvoiceSituationNeedToUpgradeToProgressiveMode", 'https://partners.dolibarr.org'));
|
print info_admin($langs->trans("WarningExperimentalFeatureInvoiceSituationNeedToUpgradeToProgressiveMode", 'https://partners.dolibarr.org'));
|
||||||
//print "<br>";
|
//print "<br>";
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ if ($id > 0 || !empty($ref)) {
|
|||||||
//if ($user->socid > 0) accessforbidden();
|
//if ($user->socid > 0) accessforbidden();
|
||||||
//if ($user->socid > 0) $socid = $user->socid;
|
//if ($user->socid > 0) $socid = $user->socid;
|
||||||
$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
|
$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
|
||||||
restrictedArea($user, $object->module, $object->id, $object->table_element, $object->element, '', 'rowid', $isdraft);
|
restrictedArea($user, $object->module, $object->id, $object->table_element.'&'.$object->element, $object->element, '', 'rowid', $isdraft);
|
||||||
|
|
||||||
$permissiontoadd = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write'); // Used by the include of actions_addupdatedelete.inc.php
|
$permissiontoadd = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write'); // Used by the include of actions_addupdatedelete.inc.php
|
||||||
|
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ $upload_dir = $conf->knowledgemanagement->multidir_output[isset($object->entity)
|
|||||||
//if ($user->socid > 0) accessforbidden();
|
//if ($user->socid > 0) accessforbidden();
|
||||||
//if ($user->socid > 0) $socid = $user->socid;
|
//if ($user->socid > 0) $socid = $user->socid;
|
||||||
$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
|
$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
|
||||||
restrictedArea($user, $object->module, $object->id, $object->table_element, $object->element, '', 'rowid', $isdraft);
|
restrictedArea($user, $object->module, $object->id, $object->table_element.'&'.$object->element, $object->element, '', 'rowid', $isdraft);
|
||||||
//if (empty($conf->knowledgemanagement->enabled)) accessforbidden();
|
//if (empty($conf->knowledgemanagement->enabled)) accessforbidden();
|
||||||
//if (empty($permissiontoread)) accessforbidden();
|
//if (empty($permissiontoread)) accessforbidden();
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be 'inclu
|
|||||||
//if ($user->socid > 0) accessforbidden();
|
//if ($user->socid > 0) accessforbidden();
|
||||||
//if ($user->socid > 0) $socid = $user->socid;
|
//if ($user->socid > 0) $socid = $user->socid;
|
||||||
$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
|
$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
|
||||||
restrictedArea($user, $object->module, $object->id, $object->table_element, $object->element, '', 'rowid', $isdraft);
|
restrictedArea($user, $object->module, $object->id, $object->table_element.'&'.$object->element, $object->element, '', 'rowid', $isdraft);
|
||||||
|
|
||||||
$permission = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write');
|
$permission = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write');
|
||||||
|
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ if ($id > 0 || !empty($ref)) {
|
|||||||
//if ($user->socid > 0) accessforbidden();
|
//if ($user->socid > 0) accessforbidden();
|
||||||
//if ($user->socid > 0) $socid = $user->socid;
|
//if ($user->socid > 0) $socid = $user->socid;
|
||||||
$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
|
$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
|
||||||
restrictedArea($user, $object->module, $object->id, $object->table_element, $object->element, '', 'rowid', $isdraft);
|
restrictedArea($user, $object->module, $object->id, $object->table_element.'&'.$object->element, $object->element, '', 'rowid', $isdraft);
|
||||||
|
|
||||||
$permissiontoadd = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php
|
$permissiontoadd = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php
|
||||||
|
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ $permissiontoadd = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'wr
|
|||||||
//if ($user->socid > 0) accessforbidden();
|
//if ($user->socid > 0) accessforbidden();
|
||||||
//if ($user->socid > 0) $socid = $user->socid;
|
//if ($user->socid > 0) $socid = $user->socid;
|
||||||
$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
|
$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
|
||||||
restrictedArea($user, $object->module, $object->id, $object->table_element, $object->element, '', 'rowid', $isdraft);
|
restrictedArea($user, $object->module, $object->id, $object->table_element.'&'.$object->element, $object->element, '', 'rowid', $isdraft);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -3074,8 +3074,8 @@ class Product extends CommonObject
|
|||||||
|
|
||||||
$this->duration = $obj->duration;
|
$this->duration = $obj->duration;
|
||||||
$matches = [];
|
$matches = [];
|
||||||
preg_match('/(\d+)(\w+)/', $obj->duration, $matches);
|
preg_match('/([\d.]+)(\w+)/', $obj->duration, $matches);
|
||||||
$this->duration_value = !empty($matches[1]) ? (int) $matches[1] : 0;
|
$this->duration_value = !empty($matches[1]) ? (float) $matches[1] : 0;
|
||||||
$this->duration_unit = !empty($matches[2]) ? (string) $matches[2] : null;
|
$this->duration_unit = !empty($matches[2]) ? (string) $matches[2] : null;
|
||||||
$this->canvas = $obj->canvas;
|
$this->canvas = $obj->canvas;
|
||||||
$this->net_measure = $obj->net_measure;
|
$this->net_measure = $obj->net_measure;
|
||||||
|
|||||||
@@ -296,7 +296,7 @@ if (!empty($search_fk_warehouse)) {
|
|||||||
}
|
}
|
||||||
// Add fields from hooks
|
// Add fields from hooks
|
||||||
$parameters = array();
|
$parameters = array();
|
||||||
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
|
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||||
$sql .= $hookmanager->resPrint;
|
$sql .= $hookmanager->resPrint;
|
||||||
|
|
||||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'product as p';
|
$sql .= ' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||||
@@ -305,7 +305,7 @@ if (!empty($search_fk_warehouse)) {
|
|||||||
}
|
}
|
||||||
// Add fields from hooks
|
// Add fields from hooks
|
||||||
$parameters = array();
|
$parameters = array();
|
||||||
$reshook = $hookmanager->executeHooks('printFieldListJoin', $parameters); // Note that $action and $object may have been modified by hook
|
$reshook = $hookmanager->executeHooks('printFieldListJoin', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||||
$sql .= $hookmanager->resPrint;
|
$sql .= $hookmanager->resPrint;
|
||||||
$sql .= ' WHERE p.entity IN ('.getEntity('product').')';
|
$sql .= ' WHERE p.entity IN ('.getEntity('product').')';
|
||||||
if ($productid > 0) {
|
if ($productid > 0) {
|
||||||
@@ -323,8 +323,24 @@ if ($search_ref) {
|
|||||||
if ($search_nom) {
|
if ($search_nom) {
|
||||||
$sql .= natural_search('p.label', $search_nom);
|
$sql .= natural_search('p.label', $search_nom);
|
||||||
}
|
}
|
||||||
$sql .= ' GROUP BY p.rowid, p.ref, p.label, p.description, p.price, p.pmp, p.price_ttc, p.price_base_type, p.fk_product_type, p.desiredstock, p.seuil_stock_alerte,';
|
|
||||||
$sql .= ' p.tms, p.duration, p.tobuy, p.stock';
|
$sqlGroupBy = ' GROUP BY p.rowid, p.ref, p.label, p.description, p.price, p.pmp, p.price_ttc, p.price_base_type, p.fk_product_type, p.desiredstock, p.seuil_stock_alerte,';
|
||||||
|
$sqlGroupBy .= ' p.tms, p.duration, p.tobuy, p.stock';
|
||||||
|
|
||||||
|
$parameters = array('sqlGroupBy' => $sqlGroupBy);
|
||||||
|
$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||||
|
|
||||||
|
if ($reshook == 0) {
|
||||||
|
// Allows the hook to add things (old behavior)
|
||||||
|
$sql .= $hookmanager->resPrint;
|
||||||
|
// Allows the hook to REPLACE the clause (new behavior)
|
||||||
|
if (!empty($hookmanager->resArray['sqlGroupBy'])) {
|
||||||
|
$sqlGroupBy = $hookmanager->resArray['sqlGroupBy'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql .= $sqlGroupBy;
|
||||||
|
|
||||||
// Add where from hooks
|
// Add where from hooks
|
||||||
$parameters = array();
|
$parameters = array();
|
||||||
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
|
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
|
||||||
|
|||||||
@@ -93,6 +93,8 @@ if (empty($sortfield)) {
|
|||||||
$sortfield = "t.ref";
|
$sortfield = "t.ref";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$search_all = trim(GETPOST('search_all', 'alphanohtml'));
|
||||||
|
|
||||||
// Load variable for pagination
|
// Load variable for pagination
|
||||||
$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
|
$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
|
||||||
|
|
||||||
@@ -356,7 +358,7 @@ if (!$resql) {
|
|||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
|
|
||||||
// Direct jump if only one record found
|
// Direct jump if only one record found
|
||||||
if ($num == 1 && getDolGlobalString('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && !$page) {
|
if ($num == 1 && getDolGlobalString('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
|
||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
$id = $obj->rowid;
|
$id = $obj->rowid;
|
||||||
header("Location: ".dol_buildpath('/resource/card.php', 1).'?id='.$id);
|
header("Location: ".dol_buildpath('/resource/card.php', 1).'?id='.$id);
|
||||||
@@ -459,9 +461,10 @@ print '<table class="tagtable liste">'."\n";
|
|||||||
// Fields title search
|
// Fields title search
|
||||||
|
|
||||||
print '<tr class="liste_titre_filter">';
|
print '<tr class="liste_titre_filter">';
|
||||||
|
// Action column
|
||||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||||
print '<td class="liste_titre center maxwidthsearch">';
|
print '<td class="liste_titre maxwidthsearch center">';
|
||||||
$searchpicto = $form->showFilterButtons();
|
$searchpicto = $form->showFilterButtons('left');
|
||||||
print $searchpicto;
|
print $searchpicto;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
@@ -538,6 +541,7 @@ $totalarray['nbfield'] = 0;
|
|||||||
// Fields title label
|
// Fields title label
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
|
// Action column
|
||||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
|
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
|
||||||
}
|
}
|
||||||
@@ -605,7 +609,22 @@ while ($i < $imaxinloop) {
|
|||||||
$objectstatic->max_users = $obj->max_users;
|
$objectstatic->max_users = $obj->max_users;
|
||||||
$objectstatic->url = $obj->url;
|
$objectstatic->url = $obj->url;
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr data-rowid="'.$obj->rowid.'" class="oddeven">';
|
||||||
|
// Action column
|
||||||
|
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||||
|
print '<td class="nowrap center">';
|
||||||
|
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||||
|
$selected = 0;
|
||||||
|
if (in_array($obj->rowid, $arrayofselected)) {
|
||||||
|
$selected = 1;
|
||||||
|
}
|
||||||
|
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
if (!$i) {
|
||||||
|
$totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Action column
|
// Action column
|
||||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||||
|
|||||||
@@ -1320,10 +1320,13 @@ class Societe extends CommonObject
|
|||||||
$array_to_check = array('IDPROF1', 'IDPROF2', 'IDPROF3', 'IDPROF4', 'IDPROF5', 'IDPROF6', 'EMAIL', 'TVA_INTRA', 'ACCOUNTANCY_CODE_CUSTOMER', 'ACCOUNTANCY_CODE_SUPPLIER');
|
$array_to_check = array('IDPROF1', 'IDPROF2', 'IDPROF3', 'IDPROF4', 'IDPROF5', 'IDPROF6', 'EMAIL', 'TVA_INTRA', 'ACCOUNTANCY_CODE_CUSTOMER', 'ACCOUNTANCY_CODE_SUPPLIER');
|
||||||
foreach ($array_to_check as $key) {
|
foreach ($array_to_check as $key) {
|
||||||
$keymin = strtolower($key);
|
$keymin = strtolower($key);
|
||||||
|
$keyfield_db = $keymin;
|
||||||
if ($key == 'ACCOUNTANCY_CODE_CUSTOMER') {
|
if ($key == 'ACCOUNTANCY_CODE_CUSTOMER') {
|
||||||
$keymin = 'code_compta_client';
|
$keymin = 'code_compta_client';
|
||||||
|
$keyfield_db = 'code_compta';
|
||||||
} elseif ($key == 'ACCOUNTANCY_CODE_SUPPLIER') {
|
} elseif ($key == 'ACCOUNTANCY_CODE_SUPPLIER') {
|
||||||
$keymin = 'code_compta_fournisseur';
|
$keymin = 'code_compta_fournisseur';
|
||||||
|
$keyfield_db = 'code_compta_fournisseur';
|
||||||
}
|
}
|
||||||
$i = (int) preg_replace('/[^0-9]/', '', $key);
|
$i = (int) preg_replace('/[^0-9]/', '', $key);
|
||||||
$vallabel = $this->$keymin;
|
$vallabel = $this->$keymin;
|
||||||
@@ -1385,7 +1388,7 @@ class Societe extends CommonObject
|
|||||||
} elseif ($key == 'ACCOUNTANCY_CODE_CUSTOMER' && !empty($this->client)) {
|
} elseif ($key == 'ACCOUNTANCY_CODE_CUSTOMER' && !empty($this->client)) {
|
||||||
// Check for unicity
|
// Check for unicity
|
||||||
if ($vallabel && getDolGlobalString('SOCIETE_ACCOUNTANCY_CODE_CUSTOMER_UNIQUE')) {
|
if ($vallabel && getDolGlobalString('SOCIETE_ACCOUNTANCY_CODE_CUSTOMER_UNIQUE')) {
|
||||||
if ($this->id_prof_exists($keymin, $vallabel, ($this->id > 0 ? $this->id : 0))) {
|
if ($this->id_prof_exists($keyfield_db, $vallabel, ($this->id > 0 ? $this->id : 0))) {
|
||||||
$langs->loadLangs(array("errors", 'compta'));
|
$langs->loadLangs(array("errors", 'compta'));
|
||||||
$error++;
|
$error++;
|
||||||
$this->errors[] = $langs->trans('CustomerAccountancyCodeShort') . " " . $langs->trans("ErrorProdIdAlreadyExist", $vallabel) . ' (' . $langs->trans("ForbiddenBySetupRules") . ')';
|
$this->errors[] = $langs->trans('CustomerAccountancyCodeShort') . " " . $langs->trans("ErrorProdIdAlreadyExist", $vallabel) . ' (' . $langs->trans("ForbiddenBySetupRules") . ')';
|
||||||
@@ -1401,7 +1404,7 @@ class Societe extends CommonObject
|
|||||||
} elseif ($key == 'ACCOUNTANCY_CODE_SUPPLIER' && !empty($this->fournisseur)) {
|
} elseif ($key == 'ACCOUNTANCY_CODE_SUPPLIER' && !empty($this->fournisseur)) {
|
||||||
// Check for unicity
|
// Check for unicity
|
||||||
if ($vallabel && getDolGlobalString('SOCIETE_ACCOUNTANCY_CODE_SUPPLIER_UNIQUE')) {
|
if ($vallabel && getDolGlobalString('SOCIETE_ACCOUNTANCY_CODE_SUPPLIER_UNIQUE')) {
|
||||||
if ($this->id_prof_exists($keymin, $vallabel, ($this->id > 0 ? $this->id : 0))) {
|
if ($this->id_prof_exists($keyfield_db, $vallabel, ($this->id > 0 ? $this->id : 0))) {
|
||||||
$langs->loadLangs(array("errors", 'compta'));
|
$langs->loadLangs(array("errors", 'compta'));
|
||||||
$error++;
|
$error++;
|
||||||
$this->errors[] = $langs->trans('SupplierAccountancyCodeShort') . " " . $langs->trans("ErrorProdIdAlreadyExist", $vallabel) . ' (' . $langs->trans("ForbiddenBySetupRules") . ')';
|
$this->errors[] = $langs->trans('SupplierAccountancyCodeShort') . " " . $langs->trans("ErrorProdIdAlreadyExist", $vallabel) . ' (' . $langs->trans("ForbiddenBySetupRules") . ')';
|
||||||
|
|||||||
Reference in New Issue
Block a user