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

This commit is contained in:
Laurent Destailleur
2020-10-15 20:51:46 +02:00
21 changed files with 114 additions and 71 deletions

View File

@@ -2,6 +2,8 @@
![Downloads per day](https://img.shields.io/sourceforge/dw/dolibarr.svg)
![Build status](https://img.shields.io/travis/Dolibarr/dolibarr/develop.svg)
[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%205.6-8892BF.svg?style=flat-square)](https://php.net/)
[![GitHub release](https://img.shields.io/github/v/release/Dolibarr/dolibarr)](https://github.com/Dolibarr/dolibarr)
Dolibarr ERP & CRM is a modern software package that helps manage your organization's activity (contacts, suppliers, invoices, orders, stocks, agenda…).

View File

@@ -639,10 +639,11 @@ if ($object->id > 0)
if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
{
// Box factures
$tmp = $object->getOutstandingBills();
$tmp = $object->getOutstandingBills('customer', 0);
$outstandingOpened = $tmp['opened'];
$outstandingTotal = $tmp['total_ht'];
$outstandingTotalIncTax = $tmp['total_ttc'];
$text = $langs->trans("OverAllInvoices");
$link = DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->id;
$icon = 'bill';
@@ -668,6 +669,24 @@ if ($object->id > 0)
$boxstat .= '<span class="boxstatsindicator'.($outstandingOpened > 0 ? ' amountremaintopay' : '').'">'.price($outstandingOpened, 1, $langs, 1, -1, -1, $conf->currency).$warn.'</span>';
$boxstat .= '</div>';
if ($link) $boxstat .= '</a>';
$tmp = $object->getOutstandingBills('customer', 1);
$outstandingOpenedLate = $tmp['opened'];
if ($outstandingOpened != $outstandingOpenedLate && !empty($outstandingOpenedLate)) {
$warn = '';
if ($object->outstanding_limit != '' && $object->outstanding_limit < $outstandingOpenedLate) {
$warn = ' ' . img_warning($langs->trans("OutstandingBillReached"));
}
$text = $langs->trans("CurrentOutstandingBillLate");
$link = DOL_URL_ROOT . '/compta/recap-compta.php?socid=' . $object->id;
$icon = 'bill';
if ($link) $boxstat .= '<a href="' . $link . '" class="boxstatsindicator thumbstat nobold nounderline">';
$boxstat .= '<div class="boxstats" title="' . dol_escape_htmltag($text) . '">';
$boxstat .= '<span class="boxstatstext">' . img_object("", $icon) . ' <span>' . $text . '</span></span><br>';
$boxstat .= '<span class="boxstatsindicator' . ($outstandingOpenedLate > 0 ? ' amountremaintopay' : '') . '">'.price($outstandingOpenedLate, 1, $langs, 1, -1, -1, $conf->currency) . $warn . '</span>';
$boxstat .= '</div>';
if ($link) $boxstat .= '</a>';
}
}
$parameters = array();

View File

@@ -135,7 +135,7 @@ if (empty($reshook))
$from = $object->email_from;
$replyto = $object->email_replyto;
$errorsto = $object->email_errorsto;
// Le message est-il en html
// Is the message in html
$msgishtml = -1; // Unknown by default
if (preg_match('/[\s\t]*<html>/i', $message)) $msgishtml = 1;
@@ -144,8 +144,8 @@ if (empty($reshook))
$nbok = 0; $nbko = 0;
// On choisit les mails non deja envoyes pour ce mailing (statut=0)
// ou envoyes en erreur (statut=-1)
// We choose mails not already sent for this mailing (statut=0)
// or sent in error (statut=-1)
$sql = "SELECT mc.rowid, mc.fk_mailing, mc.lastname, mc.firstname, mc.email, mc.other, mc.source_url, mc.source_id, mc.source_type, mc.tag";
$sql .= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc";
$sql .= " WHERE mc.statut < 1 AND mc.fk_mailing = ".$object->id;
@@ -155,7 +155,7 @@ if (empty($reshook))
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql); // nb of possible recipients
$num = $db->num_rows($resql); // Number of possible recipients
if ($num)
{
@@ -163,7 +163,7 @@ if (empty($reshook))
$now = dol_now();
// Positionne date debut envoi
// Positioning date of start sending
$sql = "UPDATE ".MAIN_DB_PREFIX."mailing SET date_envoi='".$db->idate($now)."' WHERE rowid=".$object->id;
$resql2 = $db->query($sql);
if (!$resql2)
@@ -273,7 +273,7 @@ if (empty($reshook))
}
}
// Fabrication du mail
// Mail making
$trackid = 'emailing-'.$obj->fk_mailing.'-'.$obj->rowid;
$mail = new CMailFile($newsubject, $sendto, $from, $newmessage, $arr_file, $arr_mime, $arr_name, '', '', 0, $msgishtml, $errorsto, $arr_css, $trackid, '', 'emailing');
@@ -408,15 +408,15 @@ if (empty($reshook))
if (!$error)
{
// Le message est-il en html
$msgishtml = -1; // Inconnu par defaut
// Is the message in html
$msgishtml = -1; // Unknow by default
if (preg_match('/[\s\t]*<html>/i', $object->body)) $msgishtml = 1;
// other are set at begin of page
$object->substitutionarrayfortest['__EMAIL__'] = $object->sendto;
$object->substitutionarrayfortest['__MAILTOEMAIL__'] = '<a href="mailto:'.$object->sendto.'">'.$object->sendto.'</a>';
// Pratique les substitutions sur le sujet et message
// Subject and message substitutions
complete_substitutions_array($object->substitutionarrayfortest, $langs);
$tmpsujet = make_substitutions($object->sujet, $object->substitutionarrayfortest);
$tmpbody = make_substitutions($object->body, $object->substitutionarrayfortest);
@@ -426,7 +426,7 @@ if (empty($reshook))
$arr_name = array();
$arr_css = array();
// Ajout CSS
// Add CSS
if (!empty($object->bgcolor)) $arr_css['bgcolor'] = (preg_match('/^#/', $object->bgcolor) ? '' : '#').$object->bgcolor;
if (!empty($object->bgimage)) $arr_css['bgimage'] = $object->bgimage;
@@ -540,7 +540,7 @@ if (empty($reshook))
$action = "edit";
}
// Action remove file
// Action of file remove
if (!empty($_POST["removedfile"]))
{
$upload_dir = $conf->mailing->dir_output."/".get_exdir($object->id, 2, 0, 1, $object, 'mailing');
@@ -552,7 +552,7 @@ if (empty($reshook))
$action = "edit";
}
// Action update emailing
// Action of emailing update
if ($action == 'update' && empty($_POST["removedfile"]) && empty($_POST["cancel"]))
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@@ -592,7 +592,7 @@ if (empty($reshook))
}
}
// Action confirmation validation
// Action of validation confirmation
if ($action == 'confirm_valid' && $confirm == 'yes')
{
if ($object->id > 0)
@@ -606,7 +606,7 @@ if (empty($reshook))
}
}
// Action confirmation validation
// Action of validation confirmation
if ($action == 'confirm_settodraft' && $confirm == 'yes')
{
if ($object->id > 0)
@@ -652,7 +652,7 @@ if (empty($reshook))
}
}
// Action confirmation suppression
// Action of delete confirmation
if ($action == 'confirm_delete' && $confirm == 'yes')
{
if ($object->delete($object->id))
@@ -736,7 +736,7 @@ if ($action == 'create')
print '</table>';
print '<div style="padding-top: 10px">';
// Editeur wysiwyg
// wysiwyg editor
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor('bodyemail', GETPOST('bodyemail', 'restricthtml'), '', 600, 'dolibarr_mailings', '', true, true, $conf->global->FCKEDITOR_ENABLE_MAILING, 20, '90%');
$doleditor->Create();
@@ -759,7 +759,7 @@ if ($action == 'create')
{
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("SetToDraft"), $langs->trans("ConfirmUnvalidateEmailing"), "confirm_settodraft", '', '', 1);
}
// Confirmation validation of mailing
// Confirmation of mailing validation
if ($action == 'valid')
{
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("ValidMailing"), $langs->trans("ConfirmValidMailing"), "confirm_valid", '', '', 1);
@@ -779,7 +779,7 @@ if ($action == 'create')
dol_fiche_head($head, 'card', $langs->trans("Mailing"), -1, 'email');
/*
* Mailing en mode visu
* View mode mailing
*/
if ($action == 'sendall')
{
@@ -883,7 +883,7 @@ if ($action == 'create')
}
print '</td></tr>';
// Nb of distinct emails
// Number of distinct emails
print '<tr><td>';
print $langs->trans("TotalNbOfDistinctRecipients");
print '</td><td colspan="3">';
@@ -929,12 +929,12 @@ if ($action == 'create')
array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneContent"), 'value' => 1),
array('type' => 'checkbox', 'name' => 'clone_receivers', 'label' => $langs->trans("CloneReceivers"), 'value' => 0)
);
// Paiement incomplet. On demande si motif = escompte ou autre
// Incomplete payment. On demande si motif = escompte ou autre
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneEMailing', $object->ref), 'confirm_clone', $formquestion, 'yes', 2, 240);
}
/*
* Boutons d'action
* Actions Buttons
*/
if (GETPOST('cancel', 'alpha') || $confirm == 'no' || $action == '' || in_array($action, array('settodraft', 'valid', 'delete', 'sendall', 'clone', 'test')))
@@ -1021,7 +1021,7 @@ if ($action == 'create')
print '</div>';
}
// Affichage formulaire de TEST
// Display of the TEST form
if ($action == 'test')
{
print '<div id="formmailbeforetitle" name="formmailbeforetitle"></div>';
@@ -1029,7 +1029,7 @@ if ($action == 'create')
dol_fiche_head(null, '', '', -1);
// Create l'objet formulaire mail
// Create mail form object
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail = new FormMail($db);
$formmail->fromname = $object->email_from;
@@ -1046,9 +1046,9 @@ if ($action == 'create')
$formmail->withbodyreadonly = 1;
$formmail->withcancel = 1;
$formmail->withdeliveryreceipt = 0;
// Tableau des substitutions
// Table of substitutions
$formmail->substit = $object->substitutionarrayfortest;
// Tableau des parametres complementaires du post
// Table of post's complementary params
$formmail->param["action"] = "send";
$formmail->param["models"] = 'none';
$formmail->param["mailid"] = $object->id;
@@ -1109,7 +1109,7 @@ if ($action == 'create')
if (empty($object->bgcolor) || strtolower($object->bgcolor) == 'ffffff') // CKEditor does not apply the color of the div into its content area
{
$readonly = 1;
// Editeur wysiwyg
// wysiwyg editor
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor('bodyemail', $object->body, '', 600, 'dolibarr_mailings', '', false, true, empty($conf->global->FCKEDITOR_ENABLE_MAILING) ? 0 : 1, 20, '90%', $readonly);
$doleditor->Create();
@@ -1119,7 +1119,7 @@ if ($action == 'create')
dol_fiche_end();
} else {
/*
* Mailing en mode edition (CKeditor or HTML source)
* Edition mode mailing (CKeditor or HTML source)
*/
dol_fiche_head($head, 'card', $langs->trans("Mailing"), -1, 'email');
@@ -1150,7 +1150,7 @@ if ($action == 'create')
// To
print '<tr><td>'.$langs->trans("MailErrorsTo").'</td><td colspan="3">'.dol_print_email($object->email_errorsto, 0, 0, 0, 0, 1).'</td></tr>';
// Nb of distinct emails
// Number of distinct emails
print '<tr><td>';
print $langs->trans("TotalNbOfDistinctRecipients");
print '</td><td colspan="3">';
@@ -1267,14 +1267,14 @@ if ($action == 'create')
if ($action == 'edit')
{
// Editeur wysiwyg
// wysiwyg editor
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor('bodyemail', $object->body, '', 600, 'dolibarr_mailings', '', true, true, $conf->global->FCKEDITOR_ENABLE_MAILING, 20, '90%');
$doleditor->Create();
}
if ($action == 'edithtml')
{
// Editor HTML source
// HTML source editor
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor('bodyemail', $object->body, '', 600, 'dolibarr_mailings', '', true, true, 'ace', 20, '90%');
$doleditor->Create(0, '', false, 'HTML Source', 'php');

View File

@@ -207,7 +207,7 @@ if (empty($reshook))
{
$action = 'create';
}
// Le reste propre a cette action s'affiche en bas de page.
// The next of this action is displayed at the page's bottom.
}
/*
@@ -249,7 +249,7 @@ if (empty($reshook))
if (!empty($conf->banque->enabled))
{
// Si module bank actif, un compte est obligatoire lors de la saisie d'un paiement
// If the bank module is active, an account is required to input a payment
if (GETPOST('accountid', 'int') <= 0)
{
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('AccountToCredit')), null, 'errors');
@@ -503,7 +503,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
}
print "</tr>\n";
// Cheque number
// Bank check number
print '<tr><td>'.$langs->trans('Numero');
print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
print '</td>';
@@ -793,7 +793,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
}
// Bouton Enregistrer
// Save button
if ($action != 'add_paiement')
{
$checkboxlabel = $langs->trans("ClosePaidInvoicesAutomatically");

View File

@@ -179,13 +179,13 @@ $head = payment_prepare_head($object);
dol_fiche_head($head, 'payment', $langs->trans("PaymentCustomerInvoice"), -1, 'payment');
// Confirmation de la suppression du paiement
// Confirmation of payment delete
if ($action == 'delete')
{
print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans("DeletePayment"), $langs->trans("ConfirmDeletePayment"), 'confirm_delete', '', 0, 2);
}
// Confirmation de la validation du paiement
// Confirmation of payment validation
if ($action == 'valide')
{
$facid = $_GET['facid'];
@@ -408,7 +408,7 @@ if ($resql)
/*
* Boutons Actions
* Actions Buttons
*/
print '<div class="tabsAction">';

View File

@@ -312,7 +312,7 @@ if ($action == 'new')
dol_fiche_head($head, $hselected, $langs->trans("Cheques"), -1, 'payment');
/*
* Confirmation de la suppression du bordereau
* Confirmation of slip's delete
*/
if ($action == 'delete')
{
@@ -320,7 +320,7 @@ if ($action == 'new')
}
/*
* Confirmation de la validation du bordereau
* Confirmation of slip's validation
*/
if ($action == 'valide')
{
@@ -595,7 +595,7 @@ if ($action == 'new')
print $accountstatic->getNomUrl(1);
print '</td></tr>';
// Nb of cheques
// Number of bank checks
print '<tr><td>'.$langs->trans('NbOfCheques').'</td><td colspan="2">';
print $object->nbcheque;
print '</td></tr>';
@@ -613,7 +613,7 @@ if ($action == 'new')
print '</div>';
// List of cheques
// List of bank checks
$sql = "SELECT b.rowid, b.amount, b.num_chq, b.emetteur,";
$sql .= " b.dateo as date, b.datec as datec, b.banque,";
$sql .= " p.rowid as pid, ba.rowid as bid, p.statut";
@@ -654,7 +654,7 @@ if ($action == 'new')
{
print '<tr class="oddeven">';
print '<td class="center">'.$i.'</td>';
print '<td class="center">'.dol_print_date($db->jdate($objp->date), 'day').'</td>'; // Date operation
print '<td class="center">'.dol_print_date($db->jdate($objp->date), 'day').'</td>'; // Operation date
print '<td class="center">'.($objp->num_chq ? $objp->num_chq : '&nbsp;').'</td>';
print '<td>'.dol_trunc($objp->emetteur, 24).'</td>';
print '<td>'.dol_trunc($objp->banque, 24).'</td>';
@@ -707,7 +707,7 @@ if ($action == 'new')
print "</table>";
// Cheque denormalized data nbcheque is similar to real number of cheque
// Cheque denormalized data nbcheque is similar to real number of bank check
if ($num > 0 && $i < ($object->nbcheque + 1)) {
// Show warning that some records were removed.
$langs->load("errors");
@@ -727,7 +727,7 @@ if ($action == 'new')
/*
* Boutons Actions
* Actions Buttons
*/
print '<div class="tabsAction">';

View File

@@ -109,7 +109,7 @@ if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm == 'y
$paiement = new PaymentSocialContribution($db);
$paiement->chid = $chid;
$paiement->datepaye = $datepaye;
$paiement->amounts = $amounts; // Tableau de montant
$paiement->amounts = $amounts; // Amount list
$paiement->paiementtype = GETPOST("paiementtype", 'alphanohtml');
$paiement->num_payment = GETPOST("num_payment", 'alphanohtml');
$paiement->note = GETPOST("note", 'restricthtml');
@@ -160,7 +160,7 @@ llxHeader();
$form = new Form($db);
// Formulaire de creation d'un paiement de charge
// Form of charge payment creation
if ($action == 'create')
{
$charge->fetch($chid);
@@ -255,7 +255,7 @@ if ($action == 'create')
dol_fiche_end();
/*
* Autres charges impayees
* Other unpaid charges
*/
$num = 1;
$i = 0;
@@ -327,7 +327,7 @@ if ($action == 'create')
print "</table>";
// Bouton Save payment
// Save payment button
print '<br><div class="center"><input type="checkbox" checked name="closepaidcontrib"> '.$langs->trans("ClosePaidContributionsAutomatically");
print '<br><input type="submit" class="button" name="save" value="'.$langs->trans('ToMakePayment').'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';

View File

@@ -131,7 +131,7 @@ print '<tr><td>'.$langs->trans('Mode').'</td><td colspan="3">'.$langs->trans("Pa
// Numero
print '<tr><td>'.$langs->trans('Numero').'</td><td colspan="3">'.$object->num_payment.'</td></tr>';
// Montant
// Amount
print '<tr><td>'.$langs->trans('Amount').'</td><td colspan="3">'.price($object->amount, 0, $outputlangs, 1, -1, -1, $conf->currency).'</td></tr>';
// Note
@@ -235,7 +235,7 @@ if ($resql)
/*
* Boutons Actions
* Actions Buttons
*/
print '<div class="tabsAction">';

View File

@@ -1748,7 +1748,7 @@ function addFileIntoDatabaseIndex($dir, $file, $fullpathorig = '', $mode = 'uplo
if (is_object($object) && $object->id > 0) {
$ecmfile->src_object_id = $object->id;
$ecmfile->src_object_type = $object->element;
$ecmfile->src_object_type = $object->table_element;
}
if ($setsharekey)

View File

@@ -54,9 +54,11 @@ function intracommReportAdminPrepareHead()
/**
* Prepare array with list of tabs
*
* @param Object $object Object related to tabs
*
* @return array Array of tabs to show
*/
function intracommReportPrepareHead()
function intracommReportPrepareHead($object)
{
global $langs, $conf;

View File

@@ -417,6 +417,20 @@ if ($object->id > 0)
$boxstat .= '<span class="boxstatsindicator'.($outstandingOpened > 0 ? ' amountremaintopay' : '').'">'.price($outstandingOpened, 1, $langs, 1, -1, -1, $conf->currency).$warn.'</span>';
$boxstat .= '</div>';
if ($link) $boxstat .= '</a>';
$tmp = $object->getOutstandingBills('supplier', 1);
$outstandingOpenedLate = $tmp['opened'];
if ($outstandingOpened != $outstandingOpenedLate && !empty($outstandingOpenedLate)) {
$text = $langs->trans("CurrentOutstandingBillLate");
$link = DOL_URL_ROOT.'/fourn/recap-fourn.php?socid='.$object->id;
$icon = 'bill';
if ($link) $boxstat .= '<a href="'.$link.'" class="boxstatsindicator thumbstat nobold nounderline">';
$boxstat .= '<div class="boxstats" title="' . dol_escape_htmltag($text) . '">';
$boxstat .= '<span class="boxstatstext">' . img_object("", $icon) . ' <span>' . $text . '</span></span><br>';
$boxstat .= '<span class="boxstatsindicator' . ($outstandingOpenedLate > 0 ? ' amountremaintopay' : '') . '">'.price($outstandingOpenedLate, 1, $langs, 1, -1, -1, $conf->currency) . $warn . '</span>';
$boxstat .= '</div>';
if ($link) $boxstat .= '</a>';
}
}
$boxstat .= '</td></tr>';

View File

@@ -134,12 +134,12 @@ CREATE TABLE llx_intracommreport
ref varchar(30) NOT NULL, -- report reference number
entity integer DEFAULT 1 NOT NULL, -- multi company id
type_declaration varchar(32),
period varchar(32),
periods varchar(32),
mode varchar(32),
content_xml text,
type_export varchar(10),
datec datetime,
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
)ENGINE=innodb;
ALTER TABLE llx_c_incoterms ADD COLUMN label varchar(100) NULL;

View File

@@ -24,7 +24,7 @@ create table llx_intracommreport
ref varchar(30) NOT NULL, -- report reference number
entity integer DEFAULT 1 NOT NULL, -- multi company id
type_declaration varchar(32),
period varchar(32),
periods varchar(32),
mode varchar(32),
content_xml text,
type_export varchar(10),

View File

@@ -102,7 +102,7 @@ print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="update">';
print_fiche_titre($langs->trans("Parameters").' (DEB)');
print load_fiche_titre($langs->trans("Parameters").' (DEB)');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
@@ -168,7 +168,7 @@ print "</tr>\n";
print '</table>';
print_fiche_titre($langs->trans("Parameters").' (DES)');
print load_fiche_titre($langs->trans("Parameters").' (DES)');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';

View File

@@ -459,4 +459,5 @@ MulticurrencyUsed=Use Multicurrency
MulticurrencyCurrency=Currency
InEEC=Europe (EEC)
RestOfEurope=Rest of Europe (EEC)
OutOfEurope=Out of Europe (EEC)
OutOfEurope=Out of Europe (EEC)
CurrentOutstandingBillLate=Current outstanding bill late

View File

@@ -4092,9 +4092,10 @@ class Societe extends CommonObject
* Return amount of bill not paid and total
*
* @param string $mode 'customer' or 'supplier'
* @param int $late 0 => all invoice, 1=> only late
* @return array array('opened'=>Amount, 'total'=>Total amount)
*/
public function getOutstandingBills($mode = 'customer')
public function getOutstandingBills($mode = 'customer', $late = 0)
{
$table = 'facture';
if ($mode == 'supplier') $table = 'facture_fourn';
@@ -4109,6 +4110,9 @@ class Societe extends CommonObject
if ($mode == 'supplier') $sql = "SELECT rowid, total_ht as total_ht, total_ttc, paye, type, fk_statut as status, close_code FROM ".MAIN_DB_PREFIX.$table." as f";
else $sql = "SELECT rowid, total as total_ht, total_ttc, paye, fk_statut as status, close_code FROM ".MAIN_DB_PREFIX.$table." as f";
$sql .= " WHERE fk_soc = ".$this->id;
if (!empty($late)) {
$sql .= " AND date_lim_reglement < '".$this->db->idate(dol_now())."'";
}
if ($mode == 'supplier') {
$sql .= " AND entity IN (".getEntity('facture_fourn').")";
} else {

View File

@@ -18,7 +18,7 @@ module.exports = {
browserName : 'chrome',
javascriptEnabled : true,
chromeOptions : {
args : ['disable-gpu'],
args : ['disable-gpu', 'window-size=1280,1024'],
w3c : false
}
}

View File

@@ -26,7 +26,8 @@ module.exports = {
},
userIsLoggedIn: async function (login) {
await this.useXpath()
await this.waitForElementNotPresent('@loginTable')
.useXpath()
.waitForElementVisible('@userLogin')
.expect.element('@userLogin')
.text.to.equal(login);

View File

@@ -30,7 +30,7 @@ Before(async function getDolApiKey() {
const params = new URLSearchParams()
params.set('login', adminUsername)
params.set('password', adminPassword)
const apiKey = `http://localhost/dolibarr/htdocs/api/index.php/login?${params.toString()}`;
const apiKey = client.globals.backend_url + `api/index.php/login?${params.toString()}`;
header['Accept'] = 'application/json'
await fetch(apiKey, {
method: 'GET',
@@ -74,4 +74,4 @@ After(async () => {
});
}
}
});
});

View File

@@ -5,12 +5,6 @@ const assert = require('assert');
let response;
let Login = {};
Given('the administrator has logged in using the webUI', async function () {
await client.page.loginPage().navigate().waitForLoginPage();
await client.page.loginPage().userLogsInWithUsernameAndPassword(client.globals.adminUsername, client.globals.adminPassword);
return client.page.loginPage().userIsLoggedIn(client.globals.adminUsername);
});
Given('the administrator has browsed to the new users page', function () {
return client.page.homePage().browsedToNewUserPage();
});
@@ -153,4 +147,4 @@ const getResponseMessage = async function (expectedResponseMessage) {
const actualResponseMessage = json_response['error']['0'];
return assert.strictEqual(actualResponseMessage, expectedResponseMessage,
`the expected response message was ${expectedResponseMessage} but got ${actualResponseMessage}`);
};
};

View File

@@ -1,6 +1,12 @@
const { Given, When, Then } = require('cucumber')
const { client } = require('nightwatch-api')
Given('the administrator has logged in using the webUI', async function () {
await client.page.loginPage().navigate().waitForLoginPage();
await client.page.loginPage().userLogsInWithUsernameAndPassword(client.globals.adminUsername, client.globals.adminPassword);
return client.page.loginPage().userIsLoggedIn(client.globals.adminUsername);
});
Given('the user has browsed to the login page', function () {
return client.page.loginPage().navigate();
});