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

This commit is contained in:
Laurent Destailleur 2021-11-15 11:10:39 +01:00
commit ec7eebcf4a
8 changed files with 56 additions and 14 deletions

View File

@ -1058,7 +1058,7 @@ class Facture extends CommonInvoice
{
global $conf;
// Charge facture source
// Source invoice load
$facture = new Facture($this->db);
// Retrieve all extrafield
@ -2405,7 +2405,7 @@ class Facture extends CommonInvoice
/**
* Tag the invoice as paid completely (if close_code is filled) => this->fk_statut=2, this->paye=1
* or partialy (if close_code filled) + appel trigger BILL_PAYED => this->fk_statut=2, this->paye stay 0
* or partially (if close_code filled) + appel trigger BILL_PAYED => this->fk_statut=2, this->paye stay 0
*
* @param User $user Object user that modify
* @param string $close_code Code renseigne si on classe a payee completement alors que paiement incomplet (cas escompte par exemple)
@ -2421,7 +2421,7 @@ class Facture extends CommonInvoice
$now = dol_now();
dol_syslog(get_class($this)."::set_paid rowid=".((int) $this->id), LOG_DEBUG);
dol_syslog(get_class($this)."::setPaid rowid=".((int) $this->id), LOG_DEBUG);
$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture SET';
$sql .= ' fk_statut='.self::STATUS_CLOSED;
@ -2502,7 +2502,7 @@ class Facture extends CommonInvoice
$sql .= ' fk_user_closing=null';
$sql .= " WHERE rowid = ".((int) $this->id);
dol_syslog(get_class($this)."::set_unpaid", LOG_DEBUG);
dol_syslog(get_class($this)."::setUnpaid", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
// Call trigger
@ -2728,7 +2728,7 @@ class Facture extends CommonInvoice
$error++;
}
// On verifie si la facture etait une provisoire
// We check if the invoice was provisional
if (!$error && (preg_match('/^[\(]?PROV/i', $this->ref))) {
// La verif qu'une remise n'est pas utilisee 2 fois est faite au moment de l'insertion de ligne
}
@ -2737,7 +2737,7 @@ class Facture extends CommonInvoice
// Define third party as a customer
$result = $this->thirdparty->set_as_client();
// Si active on decremente le produit principal et ses composants a la validation de facture
// If active we decrement the main product and its components at invoice validation
if ($this->type != self::TYPE_DEPOSIT && $result >= 0 && !empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_BILL) && $idwarehouse > 0) {
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
$langs->load("agenda");
@ -4783,7 +4783,7 @@ class Facture extends CommonInvoice
// TODO : add a flag on invoices to store this conf : INVOICE_RETAINED_WARRANTY_LIMITED_TO_FINAL_SITUATION
// note : we dont need to test INVOICE_USE_RETAINED_WARRANTY because if $this->retained_warranty is not empty it's because it was set when this conf was active
// note : we don't need to test INVOICE_USE_RETAINED_WARRANTY because if $this->retained_warranty is not empty it's because it was set when this conf was active
$displayWarranty = false;
if (!empty($this->retained_warranty)) {
@ -4982,7 +4982,7 @@ class Facture extends CommonInvoice
$this->db->begin();
//Select all action comm reminder
// Select all action comm reminder
$sql = "SELECT rowid as id FROM ".MAIN_DB_PREFIX."facture as f";
if (!empty($paymentmode) && $paymentmode != 'all') {
$sql .= ", ".MAIN_DB_PREFIX."c_paiement as cp";
@ -5382,7 +5382,7 @@ class FactureLigne extends CommonInvoiceLine
$this->db->begin();
// Insertion dans base de la ligne
// Update line in database
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facturedet';
$sql .= ' (fk_facture, fk_parent_line, label, description, qty,';
$sql .= ' vat_src_code, tva_tx, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type,';
@ -5450,8 +5450,8 @@ class FactureLigne extends CommonInvoiceLine
}
}
// Si fk_remise_except defini, on lie la remise a la facture
// ce qui la flague comme "consommee".
// If fk_remise_except is defined, the discount is linked to the invoice
// which flags it as "consumed".
if ($this->fk_remise_except) {
$discount = new DiscountAbsolute($this->db);
$result = $discount->fetch($this->fk_remise_except);
@ -5740,7 +5740,7 @@ class FactureLigne extends CommonInvoiceLine
$this->total_localtax2 = 0;
}
// Mise a jour ligne en base
// Update line in database
$sql = "UPDATE ".MAIN_DB_PREFIX."facturedet SET";
$sql .= " total_ht=".price2num($this->total_ht)."";
$sql .= ",total_tva=".price2num($this->total_tva)."";

View File

@ -2131,30 +2131,38 @@ function dolGetElementUrl($objectid, $objecttype, $withpicto = 0, $option = '')
// Special cases, to work with non standard path
if ($objecttype == 'facture' || $objecttype == 'invoice') {
$langs->load('bills');
$classpath = 'compta/facture/class';
$module = 'facture';
$myobject = 'facture';
} elseif ($objecttype == 'commande' || $objecttype == 'order') {
$langs->load('orders');
$classpath = 'commande/class';
$module = 'commande';
$myobject = 'commande';
} elseif ($objecttype == 'propal') {
$langs->load('propal');
$classpath = 'comm/propal/class';
} elseif ($objecttype == 'supplier_proposal') {
$langs->load('supplier_proposal');
$classpath = 'supplier_proposal/class';
} elseif ($objecttype == 'shipping') {
$langs->load('sendings');
$classpath = 'expedition/class';
$myobject = 'expedition';
$module = 'expedition_bon';
} elseif ($objecttype == 'delivery') {
$langs->load('deliveries');
$classpath = 'delivery/class';
$myobject = 'delivery';
$module = 'delivery_note';
} elseif ($objecttype == 'contract') {
$langs->load('contracts');
$classpath = 'contrat/class';
$module = 'contrat';
$myobject = 'contrat';
} elseif ($objecttype == 'member') {
$langs->load('members');
$classpath = 'adherents/class';
$module = 'adherent';
$myobject = 'adherent';
@ -2163,13 +2171,16 @@ function dolGetElementUrl($objectid, $objecttype, $withpicto = 0, $option = '')
$module = 'cabinetmed';
$myobject = 'cabinetmedcons';
} elseif ($objecttype == 'fichinter') {
$langs->load('interventions');
$classpath = 'fichinter/class';
$module = 'ficheinter';
$myobject = 'fichinter';
} elseif ($objecttype == 'project') {
$langs->load('projects');
$classpath = 'projet/class';
$module = 'projet';
} elseif ($objecttype == 'task') {
$langs->load('projects');
$classpath = 'projet/class';
$module = 'projet';
$myobject = 'task';

View File

@ -757,7 +757,7 @@ class modSociete extends DolibarrModules
'sr.bank' => "Bank",
'sr.code_banque' => "BankCode",
'sr.code_guichet' => "DeskCode",
'sr.number' => "BankAccountNumber*",
'sr.number' => "BankAccountNumber",
'sr.cle_rib' => "BankAccountNumberKey",
'sr.bic' => "BIC",
'sr.iban_prefix' => "IBAN",
@ -766,6 +766,7 @@ class modSociete extends DolibarrModules
'sr.owner_address' => "BankAccountOwnerAddress",
'sr.default_rib' => 'Default',
'sr.rum' => 'RUM',
'sr.frstrecur' => "WithdrawMode",
'sr.type' => "Type ban is defaut",
);
@ -797,6 +798,7 @@ class modSociete extends DolibarrModules
'sr.owner_address' => 'address of account holder',
'sr.default_rib' => '1 (default account) / 0 (not default)',
'sr.rum' => 'RUM code',
'sr.frstrecur' => 'FRST',
'sr.type' => 'ban',
);

View File

@ -837,6 +837,10 @@ if ($action == 'create') {
$note_private = (!empty($objectsrc->note) ? $objectsrc->note : (!empty($objectsrc->note_private) ? $objectsrc->note_private : GETPOST('note_private', 'restricthtml')));
$note_public = (!empty($objectsrc->note_public) ? $objectsrc->note_public : GETPOST('note_public', 'restricthtml'));
// Replicate extrafields
$objectsrc->fetch_optionals();
$object->array_options = $objectsrc->array_options;
// Object source contacts list
$srccontactslist = $objectsrc->liste_contact(-1, 'external', 1);
}

View File

@ -404,6 +404,7 @@ NoJournalDefined=No journal defined
Binded=Lines bound
ToBind=Lines to bind
UseMenuToSetBindindManualy=Lines not yet bound, use menu <a href="%s">%s</a> to make the binding manually
SorryThisModuleIsNotCompatibleWithTheExperimentalFeatureOfSituationInvoices=Sorry this module is not compatible with the experimental feature of situation invoices
## Import
ImportAccountingEntries=Accounting entries

View File

@ -390,6 +390,20 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { // TODO Not used by current code
print '</td></tr>';
}
// Activate Klarna
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { // TODO Not used by current code
print '<tr class="oddeven"><td>';
print $langs->trans("STRIPE_KLARNA").'</td><td>';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STRIPE_KLARNA');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STRIPE_KLARNA", $arrval, $conf->global->STRIPE_KLARNA);
}
print ' &nbsp; <span class="opacitymedium">'.$langs->trans("ExampleOnlyForKlarnaCustomers").'</span>';
print '</td></tr>';
}
// Activate Bancontact
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { // TODO Not used by current code
print '<tr class="oddeven"><td>';

View File

@ -409,6 +409,9 @@ class Stripe extends CommonObject
if (!empty($conf->global->STRIPE_SEPA_DIRECT_DEBIT)) {
$paymentmethodtypes[] = "sepa_debit"; //&& ($object->thirdparty->isInEEC())
}
if (!empty($conf->global->STRIPE_KLARNA)) {
$paymentmethodtypes[] = "klarna";
}
if (!empty($conf->global->STRIPE_BANCONTACT)) {
$paymentmethodtypes[] = "bancontact";
}
@ -450,7 +453,9 @@ class Stripe extends CommonObject
if (!empty($conf->global->STRIPE_GIROPAY)) {
unset($dataforintent['setup_future_usage']);
}
if (!empty($conf->global->STRIPE_KLARNA)) {
unset($dataforintent['setup_future_usage']);
}
if (!is_null($payment_method)) {
$dataforintent["payment_method"] = $payment_method;
$description .= ' - '.$payment_method;
@ -602,6 +607,9 @@ class Stripe extends CommonObject
if (!empty($conf->global->STRIPE_BANCONTACT)) {
$paymentmethodtypes[] = "bancontact";
}
if (!empty($conf->global->STRIPE_KLARNA)) {
$paymentmethodtypes[] = "klarna";
}
if (!empty($conf->global->STRIPE_IDEAL)) {
$paymentmethodtypes[] = "ideal";
}

View File

@ -330,6 +330,8 @@ if ($action == 'creditnote' && $user->rights->facture->creer) {
$creditnote = new Facture($db);
$creditnote->socid = $invoice->socid;
$creditnote->date = dol_now();
$creditnote->module_source = 'takepos';
$creditnote->pos_source = isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : '' ;
$creditnote->type = Facture::TYPE_CREDIT_NOTE;
$creditnote->fk_facture_source = $placeid;
$creditnote->remise_absolue = $invoice->remise_absolue;