Merge branch '16.0' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur
2022-10-29 12:51:51 +02:00
20 changed files with 117 additions and 87 deletions

View File

@@ -127,7 +127,8 @@ print '<td>'.$langs->trans("Example").'</td>';
print "</tr>\n";
print '<tr class="oddeven"><td>';
print $langs->trans("MailingEMailFrom").'</td><td>';
$help = img_help(1, $langs->trans("EMailHelpMsgSPFDKIM"));
print $langs->trans("MailingEMailFrom").' '.$help.'</td><td>';
print '<input size="32" type="text" name="MAILING_EMAIL_FROM" value="'.$conf->global->MAILING_EMAIL_FROM.'">';
if (!empty($conf->global->MAILING_EMAIL_FROM) && !isValidEmail($conf->global->MAILING_EMAIL_FROM)) {
print ' '.img_warning($langs->trans("BadEMail"));

View File

@@ -599,7 +599,8 @@ if ($action == 'edit') {
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("OtherOptions").'</td><td></td></tr>';
// From
print '<tr class="oddeven"><td class="fieldrequired">'.$langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from') ?ini_get('sendmail_from') : $langs->transnoentities("Undefined")).'</td>';
$help = img_help(1, $langs->trans("EMailHelpMsgSPFDKIM"));
print '<tr class="oddeven"><td class="fieldrequired">'.$langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from') ?ini_get('sendmail_from') : $langs->transnoentities("Undefined")).' '.$help.'</td>';
print '<td><input class="flat minwidth200" name="MAIN_MAIL_EMAIL_FROM" value="'.(!empty($conf->global->MAIN_MAIL_EMAIL_FROM) ? $conf->global->MAIN_MAIL_EMAIL_FROM : '');
print '"></td></tr>';
@@ -820,7 +821,8 @@ if ($action == 'edit') {
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("OtherOptions").'</td><td></td></tr>';
// From
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from') ?ini_get('sendmail_from') : $langs->transnoentities("Undefined")).'</td>';
$help = img_help(1, $langs->trans("EMailHelpMsgSPFDKIM"));
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from') ?ini_get('sendmail_from') : $langs->transnoentities("Undefined")).' '.$help.'</td>';
print '<td>'.$conf->global->MAIN_MAIL_EMAIL_FROM;
if (empty($conf->global->MAIN_MAIL_EMAIL_FROM)) {
print img_warning($langs->trans("Mandatory"));

View File

@@ -75,17 +75,6 @@ $hookmanager->initHooks(array('taxvatcard', 'globalcard'));
// Fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label($object->table_element);
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
// Initialize array of search criterias
$search_all = GETPOST("search_all", 'alpha');
$search = array();
foreach ($object->fields as $key => $val) {
if (GETPOST('search_'.$key, 'alpha')) {
$search[$key] = GETPOST('search_'.$key, 'alpha');
}
}
if (empty($action) && empty($id) && empty($ref)) {
$action = 'view';
}

View File

@@ -2074,14 +2074,21 @@ class ExtraFields
$visibility = 1;
if (isset($this->attributes[$object->table_element]['list'][$key])) { // 'list' is option for visibility
$visibility = dol_eval($this->attributes[$object->table_element]['list'][$key], 1, 1, '1');
$visibility = intval(dol_eval($this->attributes[$object->table_element]['list'][$key], 1, 1, '1'));
}
$perms = 1;
if (isset($this->attributes[$object->table_element]['perms'][$key])) {
$perms = dol_eval($this->attributes[$object->table_element]['perms'][$key], 1, 1, '1');
}
if (empty($enabled)) {
if (empty($enabled)
|| (
$onlykey === '@GETPOSTISSET'
&& in_array($this->attributes[$object->table_element]['type'][$key], array('boolean', 'chkbxlst'))
&& in_array(abs($enabled), array(2, 5))
&& ! GETPOSTISSET('options_' . $key) // Update hidden checkboxes and multiselect only if they are provided
)
) {
continue;
}
if (empty($visibility)) {

View File

@@ -2453,9 +2453,10 @@ class Form
* @param string $morecss Add more css on select
* @param string $nooutput No print, return the output into a string
* @param int $forcecombo Force to use combo box
* @param array $TProducts Add filter on a defined product
* @return void|string
*/
public function select_bom($selected = '', $htmlname = 'bom_id', $limit = 0, $status = 1, $type = 1, $showempty = '1', $morecss = '', $nooutput = '', $forcecombo = 0)
public function select_bom($selected = '', $htmlname = 'bom_id', $limit = 0, $status = 1, $type = 0, $showempty = '1', $morecss = '', $nooutput = '', $forcecombo = 0, $TProducts = [])
{
// phpcs:enable
global $conf, $user, $langs, $db;
@@ -2477,7 +2478,8 @@ class Form
$sql.= ' FROM '.MAIN_DB_PREFIX.'bom_bom as b';
$sql.= ' WHERE b.entity IN ('.getEntity('bom').')';
if (!empty($status)) $sql.= ' AND status = '. (int) $status;
if (!empty($type)) $sql.= ' AND status = '. (int) $type;
if (!empty($type)) $sql.= ' AND bomtype = '. (int) $type;
if (!empty($TProducts)) $sql .= ' AND fk_product IN ('.$this->db->sanitize(implode(',', $TProducts)).')';
if (!empty($limit)) $sql.= ' LIMIT '. (int) $limit;
$resql = $db->query($sql);
if ($resql) {
@@ -2489,8 +2491,9 @@ class Form
while ($obj = $db->fetch_object($resql)) {
$product = new Product($db);
$res = $product->fetch($obj->fk_product);
if ($obj->rowid == $selected) $out .= '<option value="'.$obj->rowid.'" selected>'.$obj->ref.' - '. $product->label .' - '.$obj->label.'</option>';
$out .= '<option value="'.$obj->rowid.'">'.$obj->ref.' - '.$product->label .' - '. $obj->label.'</option>';
$out .= '<option value="'.$obj->rowid.'"';
if ($obj->rowid == $selected) $out .= 'selected';
$out .= '>'.$obj->ref.' - '.$product->label .' - '. $obj->label.'</option>';
}
} else {
$error++;

View File

@@ -1724,15 +1724,13 @@ function form_constantes($tableau, $strictw3c = 0, $helptext = '', $text = 'Valu
print '<div id="example1" class="hidden">';
print 'http://lists.example.com/cgi-bin/mailman/admin/%LISTE%/members/add?subscribees_upload=%EMAIL%&amp;adminpw=%MAILMAN_ADMINPW%&amp;subscribe_or_invite=0&amp;send_welcome_msg_to_this_batch=0&amp;notification_to_list_owner=0';
print '</div>';
}
if ($const == 'ADHERENT_MAILMAN_UNSUB_URL') {
} elseif ($const == 'ADHERENT_MAILMAN_UNSUB_URL') {
print '. '.$langs->trans("Example").': <a href="#" id="exampleclick2">'.img_down().'</a><br>';
print '<div id="example2" class="hidden">';
print 'http://lists.example.com/cgi-bin/mailman/admin/%LISTE%/members/remove?unsubscribees_upload=%EMAIL%&amp;adminpw=%MAILMAN_ADMINPW%&amp;send_unsub_ack_to_this_batch=0&amp;send_unsub_notifications_to_list_owner=0';
print '</div>';
//print 'http://lists.example.com/cgi-bin/mailman/admin/%LISTE%/members/remove?adminpw=%MAILMAN_ADMINPW%&unsubscribees=%EMAIL%';
}
if ($const == 'ADHERENT_MAILMAN_LISTS') {
} elseif ($const == 'ADHERENT_MAILMAN_LISTS') {
print '. '.$langs->trans("Example").': <a href="#" id="exampleclick3">'.img_down().'</a><br>';
print '<div id="example3" class="hidden">';
print 'mymailmanlist<br>';
@@ -1743,6 +1741,8 @@ function form_constantes($tableau, $strictw3c = 0, $helptext = '', $text = 'Valu
}
print '</div>';
//print 'http://lists.example.com/cgi-bin/mailman/admin/%LISTE%/members/remove?adminpw=%MAILMAN_ADMINPW%&unsubscribees=%EMAIL%';
} elseif ($const == 'ADHERENT_MAIL_FROM') {
print ' '.img_help(1, $langs->trans("EMailHelpMsgSPFDKIM"));
}
print "</td>\n";

View File

@@ -1241,13 +1241,14 @@ function projectLinesPerAction(&$inc, $parent, $fuser, $lines, &$level, &$projec
print convertSecondToTime($lines[$i]->timespent_duration, 'allhourmin');
$modeinput = 'hours';
// Comment for avoid unnecessary multiple calculation
/*$modeinput = 'hours';
print '<script type="text/javascript">';
print "jQuery(document).ready(function () {\n";
print " jQuery('.inputhour, .inputminute').bind('keyup', function(e) { updateTotal(0, '".$modeinput."') });";
print "})\n";
print '</script>';
print '</script>';*/
print '</td>';
@@ -1628,13 +1629,14 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
//$tableCell.='&nbsp;<input type="submit" class="button"'.($disabledtask?' disabled':'').' value="'.$langs->trans("Add").'">';
print $tableCell;
$modeinput = 'hours';
// Comment for avoid unnecessary multiple calculation
/*$modeinput = 'hours';
print '<script type="text/javascript">';
print "jQuery(document).ready(function () {\n";
print " jQuery('.inputhour, .inputminute').bind('keyup', function(e) { updateTotal(0, '".$modeinput."') });";
print "})\n";
print '</script>';
print '</script>';*/
print '</td>';

View File

@@ -391,6 +391,11 @@ function restrictedArea(User $user, $features, $objectid = 0, $tableandshare = '
return 1;
}
// To avoid access forbidden with numeric ref
if ($dbt_select != 'rowid' && $dbt_select != 'id') {
$objectid = "'".$objectid."'";
}
// Features/modules to check
$featuresarray = array($features);
if (preg_match('/&/', $features)) {

View File

@@ -658,16 +658,7 @@ class modProduct extends DolibarrModules
}
// End add extra fields
$this->import_fieldshidden_array[$r] = array('extra.fk_object'=>'lastrowid-'.MAIN_DB_PREFIX.'product'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent)
$this->import_regex_array[$r] = array(
'p.ref'=>'[^ ]',
'p.price_base_type' => 'HT|TTC',
'p.tosell'=>'^[0|1]$',
'p.tobuy'=>'^[0|1]$',
'p.fk_product_type'=>'^[0|1]$',
'p.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$',
'p.recuperableonly' => '^[0|1]$',
'p.finished' => '^[0|1]$'
);
// field order as per structure of table llx_product
$import_sample = array(
'p.ref' => "ref:PREF123456",

View File

@@ -29,6 +29,9 @@ $module = $object->element;
$note_public = 'note_public';
$note_private = 'note_private';
if ($module == "product") {
$module = ($object->type == Product::TYPE_SERVICE ? 'service' : 'product');
}
$colwidth = (isset($colwidth) ? $colwidth : (empty($cssclass) ? '25' : ''));
// Set $permission from the $permissionnote var defined on calling page
$permission = (isset($permissionnote) ? $permissionnote : (isset($permission) ? $permission : (isset($user->rights->$module->create) ? $user->rights->$module->create : (isset($user->rights->$module->creer) ? $user->rights->$module->creer : 0))));
@@ -60,37 +63,39 @@ if (!empty($conf->global->MAIN_AUTO_TIMESTAMP_IN_PRIVATE_NOTES)) {
// Special cases
if ($module == 'propal') {
$permission = $user->rights->propal->creer;
$permission = $user->hasRight("propal", "creer");
} elseif ($module == 'supplier_proposal') {
$permission = $user->rights->supplier_proposal->creer;
$permission = $user->hasRight("supplier_proposal", "creer");
} elseif ($module == 'fichinter') {
$permission = $user->rights->ficheinter->creer;
$permission = $user->hasRight("ficheinter", "creer");
} elseif ($module == 'project') {
$permission = $user->rights->projet->creer;
$permission = $user->hasRight("projet", "creer");
} elseif ($module == 'project_task') {
$permission = $user->rights->projet->creer;
$permission = $user->hasRight("projet", "creer");
} elseif ($module == 'invoice_supplier') {
if (empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) {
$permission = $user->rights->fournisseur->facture->creer;
$permission = $user->hasRight("fournisseur", "facture", "creer");
} else {
$permission = $user->rights->supplier_invoice->creer;
$permission = $user->hasRight("supplier_invoice", "creer");
}
} elseif ($module == 'order_supplier') {
if (empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) {
$permission = $user->rights->fournisseur->commande->creer;
$permission = $user->hasRight("fournisseur", "commande", "creer");
} else {
$permission = $user->rights->supplier_order->creer;
$permission = $user->hasRight("supplier_order", "creer");
}
} elseif ($module == 'societe') {
$permission = $user->rights->societe->creer;
$permission = $user->hasRight("societe", "creer");
} elseif ($module == 'contact') {
$permission = $user->rights->societe->creer;
$permission = $user->hasRight("societe", "creer");
} elseif ($module == 'shipping') {
$permission = $user->rights->expedition->creer;
$permission = $user->hasRight("expedition", "creer");
} elseif ($module == 'product') {
$permission = $user->rights->produit->creer;
$permission = $user->hasRight("produit", "creer");
} elseif ($module == 'service') {
$permission = $user->hasRight("service", "creer");
} elseif ($module == 'ecmfiles') {
$permission = $user->rights->ecm->setup;
$permission = $user->hasRight("ecm", "setup");
} elseif ($module == 'user') {
$permission = $user->hasRight("user", "self", "write");
}

View File

@@ -418,7 +418,7 @@ if (empty($reshook)) {
// FROM
$expediteur = new User($db);
$expediteur->fetch($object->fk_user_author);
$emailFrom = $expediteur->email;
$emailFrom = $conf->global->MAIN_MAIL_EMAIL_FROM;
if ($emailTo && $emailFrom) {
$filename = array(); $filedir = array(); $mimetype = array();
@@ -525,7 +525,7 @@ if (empty($reshook)) {
// FROM
$expediteur = new User($db);
$expediteur->fetch($object->fk_user_author);
$emailFrom = $expediteur->email;
$emailFrom = $conf->global->MAIN_MAIL_EMAIL_FROM;
if ($emailFrom && $emailTo) {
$filename = array(); $filedir = array(); $mimetype = array();
@@ -641,7 +641,7 @@ if (empty($reshook)) {
// FROM
$expediteur = new User($db);
$expediteur->fetch($object->fk_user_approve > 0 ? $object->fk_user_approve : $object->fk_user_validator);
$emailFrom = $expediteur->email;
$emailFrom = $conf->global->MAIN_MAIL_EMAIL_FROM;
if ($emailFrom && $emailTo) {
$filename = array(); $filedir = array(); $mimetype = array();
@@ -749,7 +749,7 @@ if (empty($reshook)) {
// FROM
$expediteur = new User($db);
$expediteur->fetch($object->fk_user_refuse);
$emailFrom = $expediteur->email;
$emailFrom = $conf->global->MAIN_MAIL_EMAIL_FROM;
if ($emailFrom && $emailTo) {
$filename = array(); $filedir = array(); $mimetype = array();
@@ -863,7 +863,7 @@ if (empty($reshook)) {
// FROM
$expediteur = new User($db);
$expediteur->fetch($object->fk_user_cancel);
$emailFrom = $expediteur->email;
$emailFrom = $conf->global->MAIN_MAIL_EMAIL_FROM;
if ($emailFrom && $emailTo) {
$filename = array(); $filedir = array(); $mimetype = array();
@@ -1043,7 +1043,7 @@ if (empty($reshook)) {
// FROM
$expediteur = new User($db);
$expediteur->fetch($user->id);
$emailFrom = $expediteur->email;
$emailFrom = $conf->global->MAIN_MAIL_EMAIL_FROM;
if ($emailFrom && $emailTo) {
$filename = array(); $filedir = array(); $mimetype = array();

View File

@@ -292,6 +292,7 @@ MAIN_MAIL_SMTP_SERVER=SMTP/SMTPS Host (default value in php.ini: <b>%s</b>)
MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike=SMTP/SMTPS Port (Not defined into PHP on Unix-like systems)
MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike=SMTP/SMTPS Host (Not defined into PHP on Unix-like systems)
MAIN_MAIL_EMAIL_FROM=Sender email for automatic emails (default value in php.ini: <b>%s</b>)
EMailHelpMsgSPFDKIM=To prevent Dolibarr emails to be classified as spam, make sure that the server is authorized to send e-mails from this address by SPF and DKIM configuration
MAIN_MAIL_ERRORS_TO=Email used for error returns emails (fields 'Errors-To' in emails sent)
MAIN_MAIL_AUTOCOPY_TO= Copy (Bcc) all sent emails to
MAIN_DISABLE_ALL_MAILS=Disable all email sending (for test purposes or demos)

View File

@@ -250,7 +250,9 @@ CountryMF=Saint Martin
##### Civilities #####
CivilityMME=Mrs.
CivilityMMEShort=Mrs.
CivilityMR=Mr.
CivilityMRShort=Mr.
CivilityMLE=Ms.
CivilityMTRE=Master
CivilityDR=Doctor

View File

@@ -1014,7 +1014,7 @@ class Products extends DolibarrApi
throw new RestException(401);
}
$sql = "SELECT t.rowid, t.ref, t.ref_ext, t.label, t.rang, t.entity";
$sql = "SELECT t.rowid, t.ref, t.ref_ext, t.label, t.position, t.entity";
$sql .= " FROM ".$this->db->prefix()."product_attribute as t";
$sql .= ' WHERE t.entity IN ('.getEntity('product').')';
@@ -1051,7 +1051,7 @@ class Products extends DolibarrApi
$tmp->ref = $result->ref;
$tmp->ref_ext = $result->ref_ext;
$tmp->label = $result->label;
$tmp->rang = $result->rang;
$tmp->position = $result->position;
$tmp->entity = $result->entity;
$return[] = $this->_cleanObjectDatas($tmp);
@@ -1088,7 +1088,7 @@ class Products extends DolibarrApi
throw new RestException(404, "Product attribute not found");
}
$fields = ["id", "ref", "ref_ext", "label", "rang", "entity"];
$fields = ["id", "ref", "ref_ext", "label", "position", "entity"];
foreach ($prodattr as $field => $value) {
if (!in_array($field, $fields)) {

View File

@@ -795,12 +795,12 @@ print '</div>';
print '</form>';
if (!empty($conf->use_javascript_ajax)) {
$modeinput = 'hours';
if ($conf->use_javascript_ajax) {
print "\n<!-- JS CODE TO ENABLE Tooltips on all object with class classfortooltip -->\n";
print '<script type="text/javascript">'."\n";
print "jQuery(document).ready(function () {\n";
print " updateTotal(0,\''.$modeinput.'\');\n";
print ' jQuery(".timesheetalreadyrecorded").tooltip({
show: { collision: "flipfit", effect:\'toggle\', delay:50 },
hide: { effect:\'toggle\', delay: 50 },
@@ -809,8 +809,7 @@ if ($conf->use_javascript_ajax) {
return \''.dol_escape_js($langs->trans("TimeAlreadyRecorded", $usertoprocess->getFullName($langs))).'\';
}
});'."\n";
print ' updateTotal(0,\''.$modeinput.'\');';
print " jQuery('.inputhour, .inputminute').bind('keyup', function(e) { updateTotal(0, '".$modeinput."') });";
print "\n});\n";
print '</script>';
}

View File

@@ -926,7 +926,7 @@ class Project extends CommonObject
}
// Fetch tasks
$this->getLinesArray($user);
$this->getLinesArray($user, 0);
// Delete tasks
$ret = $this->deleteTasks($user);
@@ -2301,13 +2301,14 @@ class Project extends CommonObject
* Create an array of tasks of current project
*
* @param User $user Object user we want project allowed to
* @param int $loadRoleMode 1= will test Roles on task; 0 used in delete project action
* @return int >0 if OK, <0 if KO
*/
public function getLinesArray($user)
public function getLinesArray($user, $loadRoleMode = 1)
{
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
$taskstatic = new Task($this->db);
$this->lines = $taskstatic->getTasksArray(0, $user, $this->id, 0, 0);
$this->lines = $taskstatic->getTasksArray(0, $user, $this->id, 0, 0, '', '-1', '', 0, 0, array(), 0, array(), 0, $loadRoleMode);
}
}

View File

@@ -811,9 +811,10 @@ class Task extends CommonObjectLine
* @param int $includebilltime Calculate also the time to bill and billed
* @param array $search_array_options Array of search
* @param int $loadextras Fetch all Extrafields on each task
* @param int $loadRoleMode 1= will test Roles on task; 0 used in delete project action
* @return array Array of tasks
*/
public function getTasksArray($usert = null, $userp = null, $projectid = 0, $socid = 0, $mode = 0, $filteronproj = '', $filteronprojstatus = '-1', $morewherefilter = '', $filteronprojuser = 0, $filterontaskuser = 0, $extrafields = array(), $includebilltime = 0, $search_array_options = array(), $loadextras = 0)
public function getTasksArray($usert = null, $userp = null, $projectid = 0, $socid = 0, $mode = 0, $filteronproj = '', $filteronprojstatus = '-1', $morewherefilter = '', $filteronprojuser = 0, $filterontaskuser = 0, $extrafields = array(), $includebilltime = 0, $search_array_options = array(), $loadextras = 0, $loadRoleMode = 1)
{
global $conf, $hookmanager;
@@ -968,6 +969,7 @@ class Task extends CommonObjectLine
$obj = $this->db->fetch_object($resql);
if ($loadRoleMode) {
if ((!$obj->public) && (is_object($userp))) { // If not public project and we ask a filter on project owned by a user
if (!$this->getUserRolesForProjectsOrTasks($userp, 0, $obj->projectid, 0)) {
$error++;
@@ -978,6 +980,7 @@ class Task extends CommonObjectLine
$error++;
}
}
}
if (!$error) {
$tasks[$i] = new Task($this->db);

View File

@@ -2358,7 +2358,17 @@ if (preg_match('/^dopayment/', $action)) { // If we choosed/click on the payme
// Code for payment with option STRIPE_USE_NEW_CHECKOUT set
// Create a Stripe client.
<?php
if (empty($stripeacc)) {
?>
var stripe = Stripe('<?php echo $stripearrayofkeys['publishable_key']; // Defined into config.php ?>');
<?php
} else {
?>
var stripe = Stripe('<?php echo $stripearrayofkeys['publishable_key']; // Defined into config.php ?>', { stripeAccount: '<?php echo $stripeacc; ?>' });
<?php
}
?>
// Create an instance of Elements
var elements = stripe.elements();
@@ -2403,7 +2413,17 @@ if (preg_match('/^dopayment/', $action)) { // If we choosed/click on the payme
// Code for payment with option STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION set to 1 or 2
// Create a Stripe client.
<?php
if (empty($stripeacc)) {
?>
var stripe = Stripe('<?php echo $stripearrayofkeys['publishable_key']; // Defined into config.php ?>');
<?php
} else {
?>
var stripe = Stripe('<?php echo $stripearrayofkeys['publishable_key']; // Defined into config.php ?>', { stripeAccount: '<?php echo $stripeacc; ?>' });
<?php
}
?>
<?php
if (getDolGlobalInt('STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION') == 2) {

View File

@@ -1094,7 +1094,7 @@ class Thirdparties extends DolibarrApi
$invoice = new Facture($this->db);
$result = $invoice->list_replacable_invoices($id);
if ($result < 0) {
throw new RestException(405, $this->thirdparty->error);
throw new RestException(405, $invoice->error);
}
return $result;
@@ -1137,7 +1137,7 @@ class Thirdparties extends DolibarrApi
$invoice = new Facture($this->db);
$result = $invoice->list_qualified_avoir_invoices($id);
if ($result < 0) {
throw new RestException(405, $this->thirdparty->error);
throw new RestException(405, $invoice->error);
}
return $result;
@@ -1176,10 +1176,9 @@ class Thirdparties extends DolibarrApi
$sql .= " WHERE fk_soc = ".((int) $id);
}
$result = $this->db->query($sql);
if ($result->num_rows == 0) {
if ($this->db->num_rows($result) == 0) {
throw new RestException(404, 'Account not found');
}
@@ -1421,7 +1420,7 @@ class Thirdparties extends DolibarrApi
if ($result > 0) {
return array("success" => $result);
} else {
throw new RestException(500, 'Error generating the document '.$this->error);
throw new RestException(500, 'Error generating the document '.$this->company->error);
}
}

View File

@@ -1474,7 +1474,7 @@ class Societe extends CommonObject
$sql .= ",fk_effectif = ".($this->effectif_id > 0 ? ((int) $this->effectif_id) : "null");
if (isset($this->stcomm_id)) {
$sql .= ",fk_stcomm=".($this->stcomm_id > 0 ? ((int) $this->stcomm_id) : "0");
$sql .= ",fk_stcomm=".(int) $this->stcomm_id;
}
if (isset($this->typent_id)) {
$sql .= ",fk_typent = ".($this->typent_id > 0 ? ((int) $this->typent_id) : "0");