Merge branch '17.0' of git@github.com:Dolibarr/dolibarr.git into 18.0

This commit is contained in:
Laurent Destailleur 2023-07-06 22:22:26 +02:00
commit 86864b4d53
17 changed files with 71 additions and 29 deletions

View File

@ -1323,7 +1323,7 @@ class BOM extends CommonObject
$outputlangs->load("products");
if (!dol_strlen($modele)) {
$modele = 'standard';
$modele = '';
if ($this->model_pdf) {
$modele = $this->model_pdf;
@ -1333,8 +1333,11 @@ class BOM extends CommonObject
}
$modelpath = "core/modules/bom/doc/";
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
if (!empty($modele)) {
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
} else {
return 0;
}
}
/**

View File

@ -490,8 +490,8 @@ $typeid = $type;
// List of products or services (type is type of category)
if ($type == Categorie::TYPE_PRODUCT) {
if ($user->hasRight("product", "read")) {
$permission = ($user->rights->produit->creer || $user->hasRight('service', 'creer'));
if ($user->hasRight("product", "read") || $user->hasRight("service", "read")) {
$permission = ($user->hasRight('produit', 'creer') || $user->hasRight('service', 'creer'));
$prods = $object->getObjectsInCateg($type, 0, $limit, $offset);
if ($prods < 0) {

View File

@ -1396,10 +1396,10 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
$ids1 = '';
$ids2 = '';
if (!empty($cases1[$h]) && is_array($cases1[$h]) && count($cases1[$h]) && array_keys($cases1[$h])) {
$ids1 = join(',', array_keys($cases1[$h]));
$ids1 = join(', ', array_keys($cases1[$h]));
}
if (!empty($cases2[$h]) && is_array($cases2[$h]) && count($cases2[$h]) && array_keys($cases2[$h])) {
$ids2 = join(',', array_keys($cases2[$h]));
$ids2 = join(', ', array_keys($cases2[$h]));
}
if ($h == $begin_h) {

View File

@ -2070,6 +2070,8 @@ if ($action == 'create' && $usercancreate) {
}
}
print "\n";
print '</table>';
print dol_get_fiche_end();

View File

@ -540,11 +540,13 @@ class BonPrelevement extends CommonObject
} else {
if ($this->type == 'bank-transfer') {
$modeforaddpayment = 'payment_supplier';
$labelforaddpayment = '(BankTransferPayment)';
} else {
$modeforaddpayment = 'payment';
$labelforaddpayment = '(WithdrawalPayment)';
}
$result = $paiement->addPaymentToBank($user, $modeforaddpayment, '(WithdrawalPayment)', $fk_bank_account, '', '');
$result = $paiement->addPaymentToBank($user, $modeforaddpayment, $labelforaddpayment, $fk_bank_account, '', '');
if ($result < 0) {
$error++;
$this->error = $paiement->error;

View File

@ -470,12 +470,13 @@ class Contact extends CommonObject
/**
* Add a contact into database
*
* @param User $user Object user that create
* @return int <0 if KO, >0 if OK
* @param User $user Object user that create
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if KO, >0 if OK
*/
public function create($user)
public function create($user, $notrigger = 0)
{
global $conf, $langs;
global $conf;
$error = 0;
$now = dol_now();
@ -551,7 +552,7 @@ class Contact extends CommonObject
}
}
if (!$error) {
if (!$error && !$notrigger) {
// Call trigger
$result = $this->call_trigger('CONTACT_CREATE', $user);
if ($result < 0) {

View File

@ -3640,7 +3640,8 @@ abstract class CommonObject
$diff = price2num($total_tva_by_vats[$obj->vatrate] - $tmpvat, 'MT', 1);
//print 'Line '.$i.' rowid='.$obj->rowid.' vat_rate='.$obj->vatrate.' total_ht='.$obj->total_ht.' total_tva='.$obj->total_tva.' total_ttc='.$obj->total_ttc.' total_ht_by_vats='.$total_ht_by_vats[$obj->vatrate].' total_tva_by_vats='.$total_tva_by_vats[$obj->vatrate].' (new calculation = '.$tmpvat.') total_ttc_by_vats='.$total_ttc_by_vats[$obj->vatrate].($diff?" => DIFF":"")."<br>\n";
if ($diff) {
if (abs($diff) > 0.1) {
if (abs($diff) > (10 * pow(10, -1 * getDolGlobalInt('MAIN_MAX_DECIMALS_TOT', 0)))) {
// If error is more than 10 times the accurancy of rounding. This should not happen.
$errmsg = 'A rounding difference was detected into TOTAL but is too high to be corrected. Some data in your lines may be corrupted. Try to edit each line manually to fix this before restarting.';
dol_syslog($errmsg, LOG_WARNING);
$this->error = $errmsg;

View File

@ -69,6 +69,7 @@ ALTER TABLE llx_bom_bom ADD COLUMN bomtype integer DEFAULT 0;
UPDATE llx_emailcollector_emailcollector SET ref = 'Collect_Ticket_Requests' WHERE ref = 'Collect_Ticket_Requets';
UPDATE llx_emailcollector_emailcollector SET ref = 'Collect_Responses_In' WHERE ref = 'Collect_Responses';
-- VMYSQL4.3 ALTER TABLE llx_emailcollector_emailcollector MODIFY COLUMN tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
UPDATE llx_document_model set nom = 'standard' where nom = 'Standard' and type ='stock';

View File

@ -42,6 +42,8 @@
-- VPGSQL8.2 CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_ecm_directories FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
-- VPGSQL8.2 CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_ecm_files FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
-- VMYSQL4.3 ALTER TABLE llx_emailcollector_emailcollector MODIFY COLUMN tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_ecm_files ADD COLUMN note_private text AFTER fk_user_m;
ALTER TABLE llx_ecm_files ADD COLUMN note_public text AFTER note_private;

View File

@ -35,6 +35,8 @@
-- VMYSQL4.3 ALTER TABLE llx_partnership MODIFY COLUMN date_partnership_end date NULL;
-- VPGSQL8.2 ALTER TABLE llx_partnership ALTER COLUMN date_partnership_end DROP NOT NULL;
-- VMYSQL4.3 ALTER TABLE llx_emailcollector_emailcollector MODIFY COLUMN tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_product_fournisseur_price ADD COLUMN packaging real DEFAULT NULL;
-- VMYSQL4.3 ALTER TABLE llx_product_fournisseur_price MODIFY COLUMN packaging real DEFAULT NULL;
-- VPGSQL8.2 ALTER TABLE llx_product_fournisseur_price MODIFY COLUMN packaging real DEFAULT NULL USING packaging::real;

View File

@ -51,6 +51,8 @@
-- VPGSQL8.2 ALTER TABLE llx_c_payment_term ALTER COLUMN rowid SET DEFAULT nextval('llx_c_payment_term_rowid_seq');
-- VPGSQL8.2 SELECT setval('llx_c_payment_term_rowid_seq', MAX(rowid)) FROM llx_c_payment_term;
-- VMYSQL4.3 ALTER TABLE llx_emailcollector_emailcollector MODIFY COLUMN tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_entrepot ADD COLUMN barcode varchar(180) DEFAULT NULL;
ALTER TABLE llx_entrepot ADD COLUMN fk_barcode_type integer DEFAULT NULL;

View File

@ -33,6 +33,9 @@
-- Missing in v16 or lower
-- VMYSQL4.3 ALTER TABLE llx_emailcollector_emailcollector MODIFY COLUMN tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_accounting_account DROP FOREIGN KEY fk_accounting_account_fk_pcg_version;
ALTER TABLE llx_accounting_system MODIFY COLUMN pcg_version varchar(32) NOT NULL;
ALTER TABLE llx_accounting_account ADD CONSTRAINT fk_accounting_account_fk_pcg_version FOREIGN KEY (fk_pcg_version) REFERENCES llx_accounting_system (pcg_version);

View File

@ -636,7 +636,7 @@ $listofreferent = array(
'lang'=>'banks',
'buttonnew'=>'AddVariousPayment',
'testnew'=>$user->hasRight('banque', 'modifier'),
'test'=>isModEnabled("banque") && $user->hasRight('banque', 'lire') && !empty($conf->global->BANK_USE_OLD_VARIOUS_PAYMENT)
'test'=>isModEnabled("banque") && $user->hasRight('banque', 'lire') && empty($conf->global->BANK_USE_OLD_VARIOUS_PAYMENT)
),
/* No need for this, available on dedicated tab "Agenda/Events"
'agenda'=>array(

View File

@ -114,7 +114,6 @@ if (empty($conf->global->MEMBER_PUBLIC_ENABLED)) {
httponly_accessforbidden('Public access of list of members is not enabled');
}
$form = new Form($db);
$morehead = '';

View File

@ -875,10 +875,11 @@ class Societe extends CommonObject
* Create third party in database.
* $this->code_client = -1 and $this->code_fournisseur = -1 means automatic assignement.
*
* @param User $user Object of user that ask creation
* @return int >=0 if OK, <0 if KO
* @param User $user Object of user that ask creation
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int >=0 if OK, <0 if KO
*/
public function create(User $user)
public function create(User $user, $notrigger = 0)
{
global $langs, $conf, $mysoc;
@ -1016,7 +1017,7 @@ class Societe extends CommonObject
$this->add_commercial($user, $user->id);
}
if ($ret >= 0) {
if ($ret >= 0 && !$notrigger) {
// Call trigger
$result = $this->call_trigger('COMPANY_CREATE', $user);
if ($result < 0) {
@ -1059,12 +1060,13 @@ class Societe extends CommonObject
/**
* Create a contact/address from thirdparty
*
* @param User $user Object user
* @param int $no_email 1=Do not send mailing, 0=Ok to recieve mailling
* @param array $tags Array of tag to affect to contact
* @return int <0 if KO, >0 if OK
* @param User $user Object user
* @param int $no_email 1=Do not send mailing, 0=Ok to recieve mailling
* @param array $tags Array of tag to affect to contact
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if KO, >0 if OK
*/
public function create_individual(User $user, $no_email = 0, $tags = array())
public function create_individual(User $user, $no_email = 0, $tags = array(), $notrigger = 0)
{
global $conf;
@ -1092,7 +1094,7 @@ class Societe extends CommonObject
$this->setUpperOrLowerCase();
$contact->phone_pro = $this->phone;
$contactId = $contact->create($user);
$contactId = $contact->create($user, $notrigger);
if ($contactId < 0) {
$error++;
$this->error = $contact->error;

View File

@ -1733,10 +1733,12 @@ while ($i < $imaxinloop) {
// Staff
if (!empty($arrayfields['staff.code']['checked'])) {
print '<td class="center">';
if (!is_array($staffArray) || count($staffArray) == 0) {
$staffArray = $formcompany->effectif_array(1);
if (!empty($obj->staff_code)) {
if (empty($conf->cache['staffArray'])) {
$conf->cache['staffArray'] = $formcompany->effectif_array(1);
}
print $conf->cache['staffArray'][$obj->staff_code];
}
print $staffArray[$obj->staff_code];
print '</td>';
if (!$i) {
$totalarray['nbfield']++;

20
test/other/test_uncrypt.php Executable file
View File

@ -0,0 +1,20 @@
#!/usr/bin/env php
<?php
$path = __DIR__ . '/';
$res=@include_once $path.'/../htdocs/master.inc.php';
$res=@include_once $path.'/../../htdocs/master.inc.php';
if (! $res) @include_once '../../master.inc.php';
if (! $res) @include_once '../master.inc.php';
if (! $res) @include_once './master.inc.php';
print "Decode a value crypted with crypted:.... in conf.php file\n";
print dol_decode('123456789');
print "\n";
//print print_r(unserialize(serialize($object)));