Merge branch 'Dolibarr:14.0' into 14.0

This commit is contained in:
gdsoftdev 2022-02-25 11:28:46 +01:00 committed by GitHub
commit c4ed8cf25f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
35 changed files with 234 additions and 131 deletions

View File

@ -55,8 +55,8 @@ class AccountancyImport
$fieldname = $fieldArr[1];
}
$debit = trim($arrayrecord[11]['val']);
$credit = trim($arrayrecord[12]['val']);
$debit = floatval(trim($arrayrecord[11]['val']));
$credit = floatval(trim($arrayrecord[12]['val']));
if (!empty($debit)) {
$amount = $debit;
} else {
@ -86,7 +86,7 @@ class AccountancyImport
$fieldname = $fieldArr[1];
}
$debit = trim($arrayrecord[11]['val']);
$debit = floatval(trim($arrayrecord[11]['val']));
if (!empty($debit)) {
$sens = 'D';
} else {

View File

@ -331,7 +331,7 @@ class BookKeeping extends CommonObject
if (empty($this->piece_num)) {
$sqlnum = "SELECT MAX(piece_num)+1 as maxpiecenum";
$sqlnum .= " FROM ".MAIN_DB_PREFIX.$this->table_element;
$sqlnum .= " WHERE entity = ".$conf->entity; // Do not use getEntity for accounting features
$sqlnum .= " WHERE entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
$resqlnum = $this->db->query($sqlnum);
if ($resqlnum) {
@ -736,7 +736,7 @@ class BookKeeping extends CommonObject
$sql .= " t.date_validated as date_validation";
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.$mode.' as t';
$sql .= ' WHERE 1 = 1';
$sql .= " AND entity IN (".getEntity('accountancy').")";
$sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
if (null !== $ref) {
$sql .= " AND t.ref = '".$this->db->escape($ref)."'";
} else {
@ -881,7 +881,7 @@ class BookKeeping extends CommonObject
}
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
$sql .= ' WHERE 1 = 1';
$sql .= " AND entity IN (".getEntity('accountancy').")";
$sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
if (count($sqlwhere) > 0) {
$sql .= ' AND '.implode(' '.$filtermode.' ', $sqlwhere);
}
@ -1037,7 +1037,7 @@ class BookKeeping extends CommonObject
}
}
}
$sql .= ' WHERE t.entity IN ('.getEntity('accountancy').')';
$sql .= ' WHERE t.entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features
if ($showAlreadyExportMovements == 0) {
$sql .= " AND t.date_export IS NULL";
}
@ -1157,7 +1157,7 @@ class BookKeeping extends CommonObject
}
}
}
$sql .= ' WHERE entity IN ('.getEntity('accountancy').')';
$sql .= ' WHERE entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features
if (count($sqlwhere) > 0) {
$sql .= ' AND '.implode(' '.$filtermode.' ', $sqlwhere);
}
@ -1454,7 +1454,7 @@ class BookKeeping extends CommonObject
*/
public function deleteByYearAndJournal($delyear = 0, $journal = '', $mode = '', $delmonth = 0)
{
global $langs;
global $conf, $langs;
if (empty($delyear) && empty($journal)) {
$this->error = 'ErrorOneFieldRequired';
@ -1475,7 +1475,7 @@ class BookKeeping extends CommonObject
if (!empty($journal)) {
$sql .= " AND code_journal = '".$this->db->escape($journal)."'";
}
$sql .= " AND entity IN (".getEntity('accountancy').")";
$sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
// Exclusion of validated entries at the time of deletion
$sql .= " AND date_validated IS NULL";
@ -1514,7 +1514,7 @@ class BookKeeping extends CommonObject
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element;
$sql .= " WHERE piece_num = ".(int) $piecenum;
$sql .= " AND date_validated IS NULL"; // For security, exclusion of validated entries at the time of deletion
$sql .= " AND entity IN (".getEntity('accountancy').")";
$sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
$resql = $this->db->query($sql);
@ -1636,7 +1636,7 @@ class BookKeeping extends CommonObject
}
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element.$mode;
$sql .= " WHERE piece_num = ".$piecenum;
$sql .= " AND entity IN (".getEntity('accountancy').")";
$sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
dol_syslog(__METHOD__, LOG_DEBUG);
$result = $this->db->query($sql);
@ -1674,9 +1674,9 @@ class BookKeeping extends CommonObject
global $conf;
$sql = "SELECT MAX(piece_num)+1 as max FROM ".MAIN_DB_PREFIX.$this->table_element.$mode;
$sql .= " WHERE entity IN (".getEntity('accountancy').")";
$sql .= " WHERE entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
dol_syslog(get_class($this)."getNextNumMvt sql=".$sql, LOG_DEBUG);
dol_syslog(get_class($this)."::getNextNumMvt sql=".$sql, LOG_DEBUG);
$result = $this->db->query($sql);
if ($result) {
@ -1717,7 +1717,7 @@ class BookKeeping extends CommonObject
}
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element.$mode;
$sql .= " WHERE piece_num = ".$piecenum;
$sql .= " AND entity IN (".getEntity('accountancy').")";
$sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
dol_syslog(__METHOD__, LOG_DEBUG);
$result = $this->db->query($sql);
@ -1780,7 +1780,7 @@ class BookKeeping extends CommonObject
$sql .= " montant as amount, sens, fk_user_author, import_key, code_journal, piece_num,";
$sql .= " date_validated as date_validation";
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element;
$sql .= " WHERE entity IN (".getEntity('accountancy').")";
$sql .= " WHERE entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
dol_syslog(get_class($this)."::export_bookkeeping", LOG_DEBUG);
@ -1836,6 +1836,8 @@ class BookKeeping extends CommonObject
*/
public function transformTransaction($direction = 0, $piece_num = '')
{
global $conf;
$error = 0;
$this->db->begin();
@ -1855,14 +1857,14 @@ class BookKeeping extends CommonObject
$sql .= ' doc_ref, fk_doc, fk_docdet, entity, thirdparty_code, subledger_account, subledger_label,';
$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, '.$next_piecenum.", '".$this->db->idate($now)."'";
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num);
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
$resql = $this->db->query($sql);
if (!$resql) {
$error++;
$this->errors[] = 'Error '.$this->db->lasterror();
dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
}
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num);
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
$resql = $this->db->query($sql);
if (!$resql) {
$error++;
@ -1870,7 +1872,7 @@ class BookKeeping extends CommonObject
dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
}
} elseif ($direction == 1) {
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num);
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
$resql = $this->db->query($sql);
if (!$resql) {
$error++;
@ -1885,14 +1887,14 @@ class BookKeeping extends CommonObject
$sql .= ' doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,';
$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num';
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE piece_num = '.((int) $piece_num);
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
$resql = $this->db->query($sql);
if (!$resql) {
$error++;
$this->errors[] = 'Error '.$this->db->lasterror();
dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
}
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num);
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
$resql = $this->db->query($sql);
if (!$resql) {
$error++;
@ -1947,7 +1949,7 @@ class BookKeeping extends CommonObject
$sql .= " AND aa.active = 1";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
$sql .= " AND asy.rowid = ".((int) $pcgver);
$sql .= " AND ab.entity IN (".getEntity('accountancy').")";
$sql .= " AND ab.entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
$sql .= " ORDER BY account_number ASC";
dol_syslog(get_class($this)."::select_account", LOG_DEBUG);
@ -2011,7 +2013,7 @@ class BookKeeping extends CommonObject
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as parent ON aa.account_parent = parent.rowid AND parent.active = 1";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as root ON parent.account_parent = root.rowid AND root.active = 1";
$sql .= " WHERE aa.account_number = '".$this->db->escape($account)."'";
$sql .= " AND aa.entity IN (".getEntity('accountancy').")";
$sql .= " AND aa.entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
dol_syslog(get_class($this)."::select_account sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql);
@ -2051,7 +2053,7 @@ class BookKeeping extends CommonObject
$sql .= " AND asy.rowid = ".((int) $pcgver);
$sql .= " AND aa.active = 1";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_accounting_category as cat ON aa.fk_accounting_category = cat.rowid";
$sql .= " WHERE aa.entity IN (".getEntity('accountancy').")";
$sql .= " WHERE aa.entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
dol_syslog(get_class($this)."::select_account sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql);

View File

@ -403,6 +403,7 @@ if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
}
$sql .= " AND aa.account_number IS NOT NULL";
$sql .= " GROUP BY fd.fk_code_ventilation,aa.account_number,aa.label";
$sql .= ' ORDER BY aa.account_number';
dol_syslog('htdocs/accountancy/customer/index.php');
$resql = $db->query($sql);

View File

@ -188,6 +188,7 @@ $sql .= " AND er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseRepo
$sql .= " AND er.entity IN (".getEntity('expensereport', 0).")"; // We don't share object for accountancy
$sql .= " AND aa.account_number IS NULL";
$sql .= " GROUP BY erd.fk_code_ventilation,aa.account_number,aa.label";
$sql .= ' ORDER BY aa.account_number';
dol_syslog('/accountancy/expensereport/index.php:: sql='.$sql);
$resql = $db->query($sql);

View File

@ -300,6 +300,7 @@ $sql .= " AND ffd.product_type <= 2";
$sql .= " AND ff.entity IN (".getEntity('facture_fourn', 0).")"; // We don't share object for accountancy
$sql .= " AND aa.account_number IS NULL";
$sql .= " GROUP BY ffd.fk_code_ventilation,aa.account_number,aa.label";
$sql .= ' ORDER BY aa.account_number';
dol_syslog('htdocs/accountancy/supplier/index.php');
$resql = $db->query($sql);

View File

@ -267,9 +267,9 @@ class Dolistore
// add image or default ?
if ($product->id_default_image != '') {
$image_url = DOL_URL_ROOT.'/admin/dolistore/ajax/image.php?id_product='.((int) $product->id).'&id_image='.((int) $product->id_default_image);
$images = '<a href="'.urlencode($image_url).'" class="documentpreview" target="_blank" mime="image/png" title="'.dol_escape_htmltag($product->name->language[$this->lang - 1].', '.$langs->trans('Version').' '.$product->module_version).'">';
$images .= '<img src="'.urlencode($image_url).'&quality=home_default" style="max-height:250px;max-width: 210px;" alt="" /></a>';
$image_url = DOL_URL_ROOT.'/admin/dolistore/ajax/image.php?id_product='.urlencode(((int) $product->id)).'&id_image='.urlencode(((int) $product->id_default_image));
$images = '<a href="'.$image_url.'" class="documentpreview" target="_blank" mime="image/png" title="'.dol_escape_htmltag($product->name->language[$this->lang - 1].', '.$langs->trans('Version').' '.$product->module_version).'">';
$images .= '<img src="'.$image_url.'&quality=home_default" style="max-height:250px;max-width: 210px;" alt="" /></a>';
} else {
$images = '<img src="'.DOL_URL_ROOT.'/admin/dolistore/img/NoImageAvailable.png" />';
}
@ -277,11 +277,11 @@ class Dolistore
// free or pay ?
if ($product->price > 0) {
$price = '<h3>'.price(price2num($product->price, 'MT'), 0, $langs, 1, -1, -1, 'EUR').' '.$langs->trans("HT").'</h3>';
$download_link = '<a target="_blank" href="'.urlencode($this->shop_url.$product->id).'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/follow.png" /></a>';
$download_link = '<a target="_blank" href="'.$this->shop_url.urlencode($product->id).'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/follow.png" /></a>';
} else {
$price = '<h3>'.$langs->trans('Free').'</h3>';
$download_link = '<a target="_blank" href="'.urlencode($this->shop_url.$product->id).'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/Download-128.png" /></a>';
$download_link .= '<br><br><a target="_blank" href="'.urlencode($this->shop_url.$product->id).'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/follow.png" /></a>';
$download_link = '<a target="_blank" href="'.$this->shop_url.urlencode($product->id).'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/Download-128.png" /></a>';
$download_link .= '<br><br><a target="_blank" href="'.$this->shop_url.urlencode($product->id).'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/follow.png" /></a>';
}
// Set and check version

View File

@ -546,6 +546,7 @@ print '</form>';
print '</fieldset>';
$title = $langs->trans("BackupZipWizard");
print "<br>\n";
print "<!-- Dump of a server -->\n";
@ -564,7 +565,7 @@ print '</span>';
print '<div id="backupfilesleft" class="fichehalfleft">';
print load_fiche_titre($title ? $title : $langs->trans("BackupZipWizard"));
print load_fiche_titre($title);
print '<label for="zipfilename_template">'.$langs->trans("FileNameToGenerate").'</label><br>';
$prefix = 'documents';

View File

@ -1041,7 +1041,7 @@ class Setup extends DolibarrApi
* @param int $page Page number (starting from zero)
* @param string $zipcode To filter on zipcode
* @param string $town To filter on city name
* @param int $active Payment term is active or not {@min 0} {@max 1}
* @param int $active Town is active or not {@min 0} {@max 1}
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)"
* @return array List of towns
*
@ -1055,7 +1055,7 @@ class Setup extends DolibarrApi
$sql = "SELECT rowid AS id, zip, town, fk_county, fk_pays AS fk_country";
$sql .= " FROM ".MAIN_DB_PREFIX."c_ziptown as t";
$sql .= " AND t.active = ".((int) $active);
$sql .= " WHERE t.active = ".((int) $active);
if ($zipcode) {
$sql .= " AND t.zip LIKE '%".$this->db->escape($zipcode)."%'";
}

View File

@ -55,12 +55,27 @@ if (!empty($_SERVER['HTTP_DOLAPIENTITY'])) {
define("DOLENTITY", (int) $_SERVER['HTTP_DOLAPIENTITY']);
}
// Response for preflight requests (used by browser when into a CORS context)
if (!empty($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'OPTIONS' && !empty($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS'])) {
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE');
header('Access-Control-Allow-Headers: Content-Type, Authorization, api_key, DOLAPIKEY');
http_response_code(204);
exit;
}
// When we request url to get the json file, we accept Cross site so we can include the descriptor into an external tool.
if (preg_match('/\/explorer\/swagger\.json/', $_SERVER["PHP_SELF"])) {
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE');
header('Access-Control-Allow-Headers: Content-Type, Authorization, api_key, DOLAPIKEY');
}
// When we request url to get an API, we accept Cross site so we can make js API call inside another website
if (preg_match('/\/api\/index\.php/', $_SERVER["PHP_SELF"])) {
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE');
header('Access-Control-Allow-Headers: Content-Type, Authorization, api_key, DOLAPIKEY');
}
$res = 0;
if (!$res && file_exists("../main.inc.php")) {
@ -304,7 +319,7 @@ if (!empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/swagger.json' &&
foreach ($listofendpoints as $endpointrule) {
$tmparray = explode(':', $endpointrule);
if ($classfile == $tmparray[0] && $tmparray[1] == 1) {
if (($classfile == $tmparray[0] || $classfile.'api' == $tmparray[0]) && $tmparray[1] == 1) {
$endpointisallowed = true;
break;
}

View File

@ -1944,7 +1944,7 @@ if ($action == 'create') {
// We verify whether the object is provisionally numbering
$ref = substr($object->ref, 1, 4);
if ($ref == 'PROV') {
if ($ref == 'PROV' || $ref == '') {
$numref = $object->getNextNumRef($soc);
if (empty($numref)) {
$error++;

View File

@ -1877,8 +1877,12 @@ if ($action == 'create' && $usercancreate) {
if ($action == 'validate') {
// We check that object has a temporary ref
$ref = substr($object->ref, 1, 4);
if ($ref == 'PROV') {
if ($ref == 'PROV' || $ref == '') {
$numref = $object->getNextNumRef($soc);
if (empty($numref)) {
$error++;
setEventMessages($object->error, $object->errors, 'errors');
}
} else {
$numref = $object->ref;
}
@ -1915,7 +1919,9 @@ if ($action == 'create' && $usercancreate) {
);
}
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateOrder'), $text, 'confirm_validate', $formquestion, 0, 1, 220);
if (!$error) {
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateOrder'), $text, 'confirm_validate', $formquestion, 0, 1, 220);
}
}
// Confirm back to draft status

View File

@ -326,7 +326,7 @@ if ($action == 'create') {
if ($conf->use_javascript_ajax) {
print "\n".'<script type="text/javascript" language="javascript">';
print 'jQuery(document).ready(function () {
jQuery("#selecttype").change(function() {
jQuery("#type").change(function() {
document.formsoc.action.value="create";
document.formsoc.submit();
});
@ -349,16 +349,16 @@ if ($action == 'create') {
// Ref
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("Ref").'</td>';
print '<td><input size="8" type="text" class="flat" name="ref" value="'.dol_escape_htmltag(GETPOST("ref") ?GETPOST("ref", 'alpha') : $object->ref).'" maxlength="12" autofocus></td></tr>';
print '<td><input size="8" type="text" class="flat" name="ref" value="'.dol_escape_htmltag(GETPOSTISSET('ref') ? GETPOST("ref", 'alpha') : $object->ref).'" maxlength="12" autofocus></td></tr>';
// Label
print '<tr><td class="fieldrequired">'.$langs->trans("LabelBankCashAccount").'</td>';
print '<td><input type="text" class="flat maxwidth150onsmartphone" name="label" value="'.dol_escape_htmltag(GETPOST("label", 'alpha')).'"></td></tr>';
print '<td><input type="text" class="flat maxwidth150onsmartphone" name="label" value="'.dol_escape_htmltag(GETPOST('label', 'alpha')).'"></td></tr>';
// Type
print '<tr><td class="fieldrequired">'.$langs->trans("AccountType").'</td>';
print '<td>';
$formbank->selectTypeOfBankAccount(GETPOSTISSET("type") ? GETPOST("type") : Account::TYPE_CURRENT, "type");
$formbank->selectTypeOfBankAccount(GETPOSTISSET("type") ? GETPOST('type', 'int') : Account::TYPE_CURRENT, 'type');
print '</td></tr>';
// Currency
@ -376,7 +376,7 @@ if ($action == 'create') {
// Status
print '<tr><td class="fieldrequired">'.$langs->trans("Status").'</td>';
print '<td>';
print $form->selectarray("clos", $object->status, (GETPOST("clos", 'int') != '' ?GETPOST("clos", 'int') : $object->clos), 0, 0, 0, '', 0, 0, 0, '', 'maxwidth150onsmartphone');
print $form->selectarray("clos", $object->status, (GETPOST('clos', 'int') != '' ? GETPOST('clos', 'int') : $object->clos), 0, 0, 0, '', 0, 0, 0, '', 'maxwidth150onsmartphone');
print '</td></tr>';
// Country
@ -471,7 +471,7 @@ if ($action == 'create') {
print '</table>';
print '<br>';
$type = GETPOST('type');
$type = (GETPOSTISSET("type") ? GETPOST('type', 'int') : Account::TYPE_CURRENT); // add default value
if ($type == Account::TYPE_SAVINGS || $type == Account::TYPE_CURRENT) {
print '<table class="border centpercent">';
@ -820,7 +820,7 @@ if ($action == 'create') {
if ($conf->use_javascript_ajax) {
print "\n".'<script type="text/javascript" language="javascript">';
print 'jQuery(document).ready(function () {
jQuery("#selecttype").change(function() {
jQuery("#type").change(function() {
document.formsoc.action.value="edit";
document.formsoc.submit();
});
@ -848,16 +848,16 @@ if ($action == 'create') {
// Ref
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("Ref").'</td>';
print '<td><input type="text" class="flat maxwidth200" name="ref" value="'.dol_escape_htmltag(GETPOSTISSET("ref") ? GETPOST("ref") : $object->ref).'"></td></tr>';
print '<td><input type="text" class="flat maxwidth200" name="ref" value="'.dol_escape_htmltag(GETPOSTISSET('ref') ? GETPOST('ref', 'alpha') : $object->ref).'"></td></tr>';
// Label
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td>';
print '<td><input type="text" class="flat minwidth300" name="label" value="'.dol_escape_htmltag(GETPOSTISSET("label") ? GETPOST("label") : $object->label).'"></td></tr>';
print '<td><input type="text" class="flat minwidth300" name="label" value="'.dol_escape_htmltag(GETPOSTISSET('label') ? GETPOST('label', 'alpha') : $object->label).'"></td></tr>';
// Type
print '<tr><td class="fieldrequired">'.$langs->trans("AccountType").'</td>';
print '<td class="maxwidth200onsmartphone">';
$formbank->selectTypeOfBankAccount((GETPOSTISSET("type") ? GETPOST("type") : $object->type), "type");
$formbank->selectTypeOfBankAccount((GETPOSTISSET('type') ? GETPOST('type', 'int') : $object->type), 'type');
print '</td></tr>';
// Currency
@ -878,7 +878,7 @@ if ($action == 'create') {
// Status
print '<tr><td class="fieldrequired">'.$langs->trans("Status").'</td>';
print '<td class="maxwidth200onsmartphone">';
print $form->selectarray("clos", $object->status, (GETPOSTISSET("clos") ? GETPOST("clos") : $object->clos));
print $form->selectarray("clos", $object->status, (GETPOSTISSET("clos") ? GETPOST("clos", "int") : $object->clos));
print '</td></tr>';
// Country
@ -1002,7 +1002,8 @@ if ($action == 'create') {
print '</table>';
if (GETPOST("type") == Account::TYPE_SAVINGS || GETPOST("type") == Account::TYPE_CURRENT) {
$type = (GETPOSTISSET('type') ? GETPOST('type', 'int') : $object->type); // add default current value
if ($type == Account::TYPE_SAVINGS || $type == Account::TYPE_CURRENT) {
print '<br>';
//print '<div class="underbanner clearboth"></div>';

View File

@ -185,6 +185,7 @@ $limit = 5;
$sql = "SELECT p.rowid, p.ref, p.amount, p.datec, p.statut";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
$sql .= " WHERE p.type = 'bank-transfer'";
$sql .= " AND p.entity IN (".getEntity('invoice').")";
$sql .= " ORDER BY datec DESC";
$sql .= $db->plimit($limit);

View File

@ -260,12 +260,20 @@ if ($id) {
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
$sql .= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl";
$sql .= " , ".MAIN_DB_PREFIX."prelevement_facture as pf";
$sql .= " , ".MAIN_DB_PREFIX."facture as f";
if ($type == 'bank-transfer') {
$sql .= " , ".MAIN_DB_PREFIX."facture_fourn as f";
} else {
$sql .= " , ".MAIN_DB_PREFIX."facture as f";
}
$sql .= " , ".MAIN_DB_PREFIX."societe as s";
$sql .= " WHERE pf.fk_prelevement_lignes = pl.rowid";
$sql .= " AND pl.fk_prelevement_bons = p.rowid";
$sql .= " AND f.fk_soc = s.rowid";
$sql .= " AND pf.fk_facture = f.rowid";
if ($type == 'bank-transfer') {
$sql .= " AND pf.fk_facture_fourn = f.rowid";
} else {
$sql .= " AND pf.fk_facture = f.rowid";
}
$sql .= " AND f.entity IN (".getEntity('invoice').")";
$sql .= " AND pl.rowid = ".((int) $id);
if ($socid) {

View File

@ -455,7 +455,7 @@ if ($modecompta == 'CREANCES-DETTES') {
$_SERVER["PHP_SELF"],
"amount",
"",
$classslink,
$paramslink,
'class="right"',
$sortfield,
$sortorder

View File

@ -1679,7 +1679,7 @@ class ExtraFields
} elseif ($type == 'price') {
//$value = price($value, 0, $langs, 0, 0, -1, $conf->currency);
if ($value || $value == '0') {
$value = price($value, 0, $langs, 0, 0, -1);
$value = price($value, 0, $langs, 0, $conf->global->MAIN_MAX_DECIMALS_TOT, -1).' '.$langs->getCurrencySymbol($conf->currency);
}
} elseif ($type == 'select') {
$valstr = (!empty($param['options'][$value]) ? $param['options'][$value] : '');

View File

@ -1060,11 +1060,11 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_
}
// Capital
if ($fromcompany->capital) {
$tmpamounttoshow = price2num($fromcompany->capital); // This field is a free string
$tmpamounttoshow = price2num($fromcompany->capital); // This field is a free string or a float
if (is_numeric($tmpamounttoshow) && $tmpamounttoshow > 0) {
$line3 .= ($line3 ? " - " : "").$outputlangs->transnoentities("CapitalOf", price($tmpamounttoshow, 0, $outputlangs, 0, 0, 0, $conf->currency));
} else {
$line3 .= ($line3 ? " - " : "").$outputlangs->transnoentities("CapitalOf", $tmpamounttoshow, $outputlangs);
} elseif (!empty($fromcompany->capital)) {
$line3 .= ($line3 ? " - " : "").$outputlangs->transnoentities("CapitalOf", $fromcompany->capital, $outputlangs);
}
}
// Prof Id 1

View File

@ -736,6 +736,29 @@ class ImportCsv extends ModeleImports
$tmp = explode('-', $val, 2);
$listfields[] = preg_replace('/^'.preg_quote($alias, '/').'\./', '', $key);
$listvalues[] = "'".$tmp[1]."'";
} elseif (preg_match('/^rule-/', $val)) {
$fieldname = $key;
if (!empty($objimport->array_import_convertvalue[0][$fieldname])) {
if ($objimport->array_import_convertvalue[0][$fieldname]['rule'] == 'compute') {
$file = (empty($objimport->array_import_convertvalue[0][$fieldname]['classfile']) ? $objimport->array_import_convertvalue[0][$fieldname]['file'] : $objimport->array_import_convertvalue[0][$fieldname]['classfile']);
$class = $objimport->array_import_convertvalue[0][$fieldname]['class'];
$method = $objimport->array_import_convertvalue[0][$fieldname]['method'];
$resultload = dol_include_once($file);
if (empty($resultload)) {
dol_print_error('', 'Error trying to call file=' . $file . ', class=' . $class . ', method=' . $method);
break;
}
$classinstance = new $class($this->db);
$res = call_user_func_array(array($classinstance, $method), array(&$arrayrecord, $fieldname, &$listfields, &$listvalues));
if ($res < 0) {
if (!empty($objimport->array_import_convertvalue[0][$fieldname]['dict'])) $this->errors[$error]['lib'] = $langs->trans('ErrorFieldValueNotIn', $key, end($listvalues), 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$fieldname]['dict']));
else $this->errors[$error]['lib'] = 'ErrorFieldValueNotIn';
$this->errors[$error]['type'] = 'FOREIGNKEY';
$errorforthistable++;
$error++;
}
}
}
} else {
$this->errors[$error]['lib'] = 'Bad value of profile setup '.$val.' for array_import_fieldshidden';
$this->errors[$error]['type'] = 'Import profile setup';

View File

@ -777,6 +777,29 @@ class ImportXlsx extends ModeleImports
$tmp = explode('-', $val, 2);
$listfields[] = preg_replace('/^' . preg_quote($alias, '/') . '\./', '', $key);
$listvalues[] = "'" . $tmp[1] . "'";
} elseif (preg_match('/^rule-/', $val)) {
$fieldname = $key;
if (!empty($objimport->array_import_convertvalue[0][$fieldname])) {
if ($objimport->array_import_convertvalue[0][$fieldname]['rule'] == 'compute') {
$file = (empty($objimport->array_import_convertvalue[0][$fieldname]['classfile']) ? $objimport->array_import_convertvalue[0][$fieldname]['file'] : $objimport->array_import_convertvalue[0][$fieldname]['classfile']);
$class = $objimport->array_import_convertvalue[0][$fieldname]['class'];
$method = $objimport->array_import_convertvalue[0][$fieldname]['method'];
$resultload = dol_include_once($file);
if (empty($resultload)) {
dol_print_error('', 'Error trying to call file=' . $file . ', class=' . $class . ', method=' . $method);
break;
}
$classinstance = new $class($this->db);
$res = call_user_func_array(array($classinstance, $method), array(&$arrayrecord, $fieldname, &$listfields, &$listvalues));
if ($res < 0) {
if (!empty($objimport->array_import_convertvalue[0][$fieldname]['dict'])) $this->errors[$error]['lib'] = $langs->trans('ErrorFieldValueNotIn', $key, end($listvalues), 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$fieldname]['dict']));
else $this->errors[$error]['lib'] = 'ErrorFieldValueNotIn';
$this->errors[$error]['type'] = 'FOREIGNKEY';
$errorforthistable++;
$error++;
}
}
}
} else {
$this->errors[$error]['lib'] = 'Bad value of profile setup ' . $val . ' for array_import_fieldshidden';
$this->errors[$error]['type'] = 'Import profile setup';

View File

@ -465,17 +465,21 @@ class CommandeFournisseur extends CommonOrder
$sql .= " l.date_start, l.date_end,";
$sql .= ' l.fk_multicurrency, l.multicurrency_code, l.multicurrency_subprice, l.multicurrency_total_ht, l.multicurrency_total_tva, l.multicurrency_total_ttc';
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) {
$sql .= ", pfp.rowid as fk_pfp, pfp.packaging";
$sql .= ", pfp.rowid as fk_pfp, pfp.packaging, MAX(pfp.quantity) as max_qty";
}
$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as l";
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid';
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON l.fk_product = pfp.fk_product and l.ref = pfp.ref_fourn AND pfp.fk_soc = ".((int) $this->socid);
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON pfp.entity IN (".getEntity('product_fournisseur_price').") AND l.fk_product = pfp.fk_product and l.ref = pfp.ref_fourn AND pfp.fk_soc = ".((int) $this->socid);
}
$sql .= " WHERE l.fk_commande = ".$this->id;
if ($only_product) {
$sql .= ' AND p.fk_product_type = 0';
}
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) {
$sql.= " AND l.qty >= pfp.quantity ";
$sql.= " GROUP BY l.rowid HAVING max_qty = MAX(pfp.quantity) ";
}
$sql .= " ORDER BY l.rang, l.rowid";
//print $sql;
@ -3519,14 +3523,17 @@ class CommandeFournisseurLigne extends CommonOrderLine
$sql .= ' cd.date_start, cd.date_end, cd.fk_unit,';
$sql .= ' cd.multicurrency_subprice, cd.multicurrency_total_ht, cd.multicurrency_total_tva, cd.multicurrency_total_ttc';
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) {
$sql .= ", pfp.rowid as fk_pfp, pfp.packaging";
$sql .= ", pfp.rowid as fk_pfp, pfp.packaging, MAX(pfp.quantity) as max_qty";
}
$sql .= ' FROM '.MAIN_DB_PREFIX.'commande_fournisseurdet as cd';
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON cd.fk_product = p.rowid';
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON cd.fk_product = pfp.fk_product and cd.ref = pfp.ref_fourn";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON pfp.entity IN (".getEntity('product_fournisseur_price').") AND cd.fk_product = pfp.fk_product and cd.ref = pfp.ref_fourn";
}
$sql .= ' WHERE cd.rowid = '.((int) $rowid);
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) {
$sql .= " AND cd.qty >= pfp.quantity GROUP BY cd.rowid HAVING max_qty = MAX(pfp.quantity)";
}
$result = $this->db->query($sql);
if ($result) {
$objp = $this->db->fetch_object($result);

View File

@ -1274,9 +1274,7 @@ if ($resql) {
$projectstatic = new Project($db);
$i = 0;
$totalarray = array();
$totalarray['nbfield'] = 0;
$totalarray['val'] = array();
$totalarray = array('nbfield' => 0, 'val' => array(), 'pos' => array());
$totalarray['val']['cf.total_ht'] = 0;
$totalarray['val']['cf.total_ttc'] = 0;
while ($i < min($num, $limit)) {

View File

@ -529,9 +529,9 @@ if (empty($reshook)) {
if ($line->product_type < 9 && $line->total_ht != 0) { // Remove lines with product_type greater than or equal to 9 and no need to create discount if amount is null
$keyforvatrate = $line->tva_tx.($line->vat_src_code ? ' ('.$line->vat_src_code.')' : '');
$amount_ht[$line->tva_tx] += $line->total_ht;
$amount_tva[$line->tva_tx] += $line->total_tva;
$amount_ttc[$line->tva_tx] += $line->total_ttc;
$amount_ht[$keyforvatrate] += $line->total_ht;
$amount_tva[$keyforvatrate] += $line->total_tva;
$amount_ttc[$keyforvatrate] += $line->total_ttc;
$multicurrency_amount_ht[$keyforvatrate] += $line->multicurrency_total_ht;
$multicurrency_amount_tva[$keyforvatrate] += $line->multicurrency_total_tva;
$multicurrency_amount_ttc[$keyforvatrate] += $line->multicurrency_total_ttc;

View File

@ -141,6 +141,7 @@ $endatlinenb = (GETPOST('endatlinenb') ? GETPOST('endatlinenb') : '');
$updatekeys = (GETPOST('updatekeys', 'array') ? GETPOST('updatekeys', 'array') : array());
$separator = (GETPOST('separator', 'nohtml') ? GETPOST('separator', 'nohtml') : (!empty($conf->global->IMPORT_CSV_SEPARATOR_TO_USE) ? $conf->global->IMPORT_CSV_SEPARATOR_TO_USE : ','));
$enclosure = (GETPOST('enclosure', 'nohtml') ? GETPOST('enclosure', 'nohtml') : '"');
$separator_used = str_replace('\t', "\t", $separator);
$objimport = new Import($db);
$objimport->load_arrays($user, ($step == 1 ? '' : $datatoimport));
@ -773,7 +774,7 @@ if ($step == 4 && $datatoimport) {
require_once $dir.$file;
$obj = new $classname($db, $datatoimport);
if ($model == 'csv') {
$obj->separator = $separator;
$obj->separator = $separator_used;
$obj->enclosure = $enclosure;
}
if ($model == 'xlsx') {
@ -1334,7 +1335,7 @@ if ($step == 5 && $datatoimport) {
require_once $dir.$file;
$obj = new $classname($db, $datatoimport);
if ($model == 'csv') {
$obj->separator = $separator;
$obj->separator = $separator_used;
$obj->enclosure = $enclosure;
}
@ -1783,7 +1784,7 @@ if ($step == 6 && $datatoimport) {
require_once $dir.$file;
$obj = new $classname($db, $datatoimport);
if ($model == 'csv') {
$obj->separator = $separator;
$obj->separator = $separator_used;
$obj->enclosure = $enclosure;
}

View File

@ -649,3 +649,5 @@ ALTER TABLE llx_facture_fourn CHANGE COLUMN fk_mode_transport fk_transport_mode
ALTER TABLE llx_c_socialnetworks DROP INDEX idx_c_socialnetworks_code;
ALTER TABLE llx_c_socialnetworks ADD UNIQUE INDEX idx_c_socialnetworks_code_entity (code, entity);
ALTER TABLE llx_propaldet ADD COLUMN import_key varchar(14);

View File

@ -1,8 +1,9 @@
-- ===================================================================
-- Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
-- Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
-- Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
-- Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
-- Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
-- Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
-- Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
-- Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
-- Copyright (C) 2022 OpenDSI <support@open-dsi.fr>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
@ -21,53 +22,55 @@
create table llx_propaldet
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
fk_propal integer NOT NULL,
fk_parent_line integer NULL,
fk_product integer NULL,
label varchar(255) DEFAULT NULL,
description text,
fk_remise_except integer NULL, -- Lien vers table des remises fixes
vat_src_code varchar(10) DEFAULT '', -- Vat code used as source of vat fields. Not strict foreign key here.
tva_tx double(6,3) DEFAULT 0, -- Vat rate
localtax1_tx double(6,3) DEFAULT 0, -- localtax1 rate
localtax1_type varchar(10) NULL, -- localtax1 type
localtax2_tx double(6,3) DEFAULT 0, -- localtax2 rate
localtax2_type varchar(10) NULL, -- localtax2 type
qty real, -- quantity
remise_percent real DEFAULT 0, -- pourcentage de remise
remise real DEFAULT 0, -- montant de la remise (obsolete)
price real, -- prix final (obsolete)
subprice double(24,8) DEFAULT 0, -- prix unitaire article
total_ht double(24,8) DEFAULT 0, -- Total HT de la ligne toute quantite et incluant remise ligne et globale
total_tva double(24,8) DEFAULT 0, -- Total TVA de la ligne toute quantite et incluant remise ligne et globale
total_localtax1 double(24,8) DEFAULT 0, -- Total localtax1
total_localtax2 double(24,8) DEFAULT 0, -- Total localtax2
total_ttc double(24,8) DEFAULT 0, -- Total TTC de la ligne toute quantite et incluant remise ligne et globale
product_type integer DEFAULT 0, -- 0 or 1. Value 9 may be used by some modules (amount of line may not be included into generated discount if value is 9).
date_start datetime DEFAULT NULL, -- date debut si service
date_end datetime DEFAULT NULL, -- date fin si service
info_bits integer DEFAULT 0, -- TVA NPR ou non
buy_price_ht double(24,8) DEFAULT 0, -- buying price
fk_product_fournisseur_price integer DEFAULT NULL, -- reference of supplier price when line was added (may be used to update buy_price_ht current price when future invoice will be created)
special_code integer DEFAULT 0, -- code for special lines (may be 1=transport, 2=ecotax, 3=option, moduleid=...)
rang integer DEFAULT 0, -- ordre affichage sur la propal
fk_unit integer DEFAULT NULL, -- lien vers table des unités
fk_multicurrency integer,
multicurrency_code varchar(255),
multicurrency_subprice double(24,8) DEFAULT 0,
multicurrency_total_ht double(24,8) DEFAULT 0,
multicurrency_total_tva double(24,8) DEFAULT 0,
multicurrency_total_ttc double(24,8) DEFAULT 0
rowid integer AUTO_INCREMENT PRIMARY KEY,
fk_propal integer NOT NULL,
fk_parent_line integer NULL,
fk_product integer NULL,
label varchar(255) DEFAULT NULL,
description text,
fk_remise_except integer NULL, -- Link to table of fixed discounts
vat_src_code varchar(10) DEFAULT '', -- Vat code used as source of vat fields. Not strict foreign key here.
tva_tx double(6,3) DEFAULT 0, -- Vat rate
localtax1_tx double(6,3) DEFAULT 0, -- localtax1 rate
localtax1_type varchar(10) NULL, -- localtax1 type
localtax2_tx double(6,3) DEFAULT 0, -- localtax2 rate
localtax2_type varchar(10) NULL, -- localtax2 type
qty real, -- quantity
remise_percent real DEFAULT 0, -- discount percentage
remise real DEFAULT 0, -- discount amount (obsolete)
price real, -- final price (obsolete)
subprice double(24,8) DEFAULT 0, -- unit price article
total_ht double(24,8) DEFAULT 0, -- Total excluding VAT of the line all quantities and including line and global discount
total_tva double(24,8) DEFAULT 0, -- Total VAT of the line any quantity and including discount line and global
total_localtax1 double(24,8) DEFAULT 0, -- Total localtax1
total_localtax2 double(24,8) DEFAULT 0, -- Total localtax2
total_ttc double(24,8) DEFAULT 0, -- Total TTC of the line all quantity and including line and global discount
product_type integer DEFAULT 0, -- 0 or 1. Value 9 may be used by some modules (amount of line may not be included into generated discount if value is 9).
date_start datetime DEFAULT NULL, -- start date if service
date_end datetime DEFAULT NULL, -- end date if service
info_bits integer DEFAULT 0, -- VAT NPR or not
buy_price_ht double(24,8) DEFAULT 0, -- buying price
fk_product_fournisseur_price integer DEFAULT NULL, -- reference of supplier price when line was added (may be used to update buy_price_ht current price when future invoice will be created)
special_code integer DEFAULT 0, -- code for special lines (may be 1=transport, 2=ecotax, 3=option, moduleid=...)
rang integer DEFAULT 0, -- order display on the propal
fk_unit integer DEFAULT NULL, -- link to table of units
fk_multicurrency integer,
multicurrency_code varchar(255),
multicurrency_subprice double(24,8) DEFAULT 0,
multicurrency_total_ht double(24,8) DEFAULT 0,
multicurrency_total_tva double(24,8) DEFAULT 0,
multicurrency_total_ttc double(24,8) DEFAULT 0,
import_key varchar(14)
)ENGINE=innodb;
--
-- Liste des codes pour special_code
-- List of codes for special_code
--
-- 1 : frais de port
-- 2 : ecotaxe
-- 3 : produit/service propose en option
-- 1 : shipping costs
-- 2 : ecotax
-- 3 : optional product/service
--

View File

@ -41,3 +41,5 @@ QCFrequency=Quality control frequency (in days)
#Traceability - qc status
OutOfOrder=Out of order
InWorkingOrder=In working order
CantMoveNonExistantSerial=Error. You ask a move on a record for a serial that does not exists anymore. May be you take the same serial on same warehouse several times in same shipment or it was used by another shipment. Remove this shipment and prepare another one.

View File

@ -42,3 +42,4 @@ HideLots=Masquer les lots
#Traceability - qc status
OutOfOrder=Hors d'usage
InWorkingOrder=En état de marche
CantMoveNonExistantSerial=Erreur : Vous avez demandé un mouvement sur un numéro de série qui nexiste plus. Peut-être avez-vous requis le même numéro de série plusieurs fois dans une même expédition, ou il a déjà servi dans une autre expédition. Supprimez cette expédition et préparez-en une autre.

View File

@ -5288,11 +5288,12 @@ class Product extends CommonObject
$filterStatus = '0,'.$filterStatus;
}
$result = $this->load_stats_reception(0, $filterStatus, 1);
if ($result < 0) dol_print_error($this->db, $this->error);
if ($result < 0) {
dol_print_error($this->db, $this->error);
}
$stock_reception_fournisseur = $this->stats_reception['qty'];
}
if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && !empty($conf->reception->enabled))
{
if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && !empty($conf->reception->enabled)) {
// Case module reception is used
$filterStatus = '4';
if (isset($includedraftpoforvirtual)) {

View File

@ -944,7 +944,7 @@ if ($action != 'create' && $action != 'edit' && $action != 'delete') {
$delallowed = $usercancreate;
$modulepart = 'stock';
print $formfile->showdocuments($modulepart, $object->ref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 0, 0, 0, 28, 0, '', 0, '', $object->default_lang, '', $object);
print $formfile->showdocuments($modulepart, $objectref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 0, 0, 0, 28, 0, '', 0, '', $object->default_lang, '', $object);
$somethingshown = $formfile->numoffiles;
print '</div><div class="fichehalfright"><div class="ficheaddleft">';

View File

@ -842,7 +842,9 @@ class MouvementStock extends CommonObject
*/
private function createBatch($dluo, $qty)
{
global $user;
global $user, $langs;
$langs->load('productbatch');
$pdluo = new Productbatch($this->db);
@ -853,7 +855,7 @@ class MouvementStock extends CommonObject
$result = $pdluo->fetch($dluo);
if (empty($pdluo->id)) {
// We didn't find the line. May be it was deleted before by a previous move in same transaction.
$this->error = 'Error. You ask a move on a record for a serial that does not exists anymore. May be you take the same serial on same warehouse several times in same shipment or it was used by another shipment. Remove this shipment and prepare another one.';
$this->error = $langs->trans('CantMoveNonExistantSerial');
$this->errors[] = $this->error;
$result = -2;
}

View File

@ -249,7 +249,7 @@ if (empty($reshook) && $action == 'create_ticket' && GETPOST('add', 'alpha')) {
$message = ($conf->global->TICKET_MESSAGE_MAIL_NEW ? $conf->global->TICKET_MESSAGE_MAIL_NEW : $langs->transnoentities('TicketNewEmailBody')).'<br><br>';
$message .= $langs->transnoentities('TicketNewEmailBodyInfosTicket').'<br>';
$url_public_ticket = ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE.'/' : dol_buildpath('/public/ticket/view.php', 2)).'?track_id='.$object->track_id;
$url_public_ticket = ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE.'/view.php' : dol_buildpath('/public/ticket/view.php', 2)).'?track_id='.$object->track_id;
$infos_new_ticket = $langs->transnoentities('TicketNewEmailBodyInfosTrackId', '<a href="'.$url_public_ticket.'" rel="nofollow noopener">'.$object->track_id.'</a>').'<br>';
$infos_new_ticket .= $langs->transnoentities('TicketNewEmailBodyInfosTrackUrl').'<br><br>';

View File

@ -875,8 +875,8 @@ class Societe extends CommonObject
$sql .= ", name_alias";
$sql .= ", entity";
$sql .= ", datec";
$sql .= ", fk_typent";
$sql .= ", fk_user_creat";
$sql .= ", fk_typent";
$sql .= ", canvas";
$sql .= ", status";
$sql .= ", ref_ext";

View File

@ -391,7 +391,7 @@ foreach ($search as $key => $val) {
continue;
}
$mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
if ($search[$key] != '') {
if ($search[$key] != '' && !is_array($val)) {
$sql .= natural_search($key, $search[$key], $mode_search);
}
}
@ -609,9 +609,9 @@ if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
}
foreach ($search as $key => $val) {
if (is_array($search[$key]) && count($search[$key])) {
foreach ($search[$key] as $skey) {
$param .= '&search_'.$key.'[]='.urlencode($skey);
if (is_array($val) && count($val)) {
foreach ($val as $skey) {
$param .= (!empty($val)) ? '&search_'.$key.'[]='.urlencode($skey) : "";
}
} else {
$param .= '&search_'.$key.'='.urlencode($search[$key]);

View File

@ -207,6 +207,9 @@ if (!empty($conf->adherent->enabled)) {
if (!empty($conf->agenda->enabled)) {
$tmparray['comm/action/index.php?mainmenu=agenda&leftmenu='] = 'Agenda';
}
if (!empty($conf->ticket->enabled)) {
$tmparray['ticket/list.php?mainmenu=ticket&leftmenu='] = 'Tickets';
}
$head = user_prepare_head($object);

View File

@ -248,7 +248,7 @@ if (($action == 'add' || $action == 'create') && empty($massaction) && !GETPOST(
exit();
}
$prodcomb->variation_weight = $weight_impact;
$prodcomb->variation_weight = price2num($weight_impact);
// for conf PRODUIT_MULTIPRICES
if ($conf->global->PRODUIT_MULTIPRICES) {