Merge remote-tracking branch 'Dolibarr/13.0' into 13

This commit is contained in:
Francis Appels 2021-03-01 21:24:00 +01:00
commit 132322259f
50 changed files with 519 additions and 504 deletions

View File

@ -73,7 +73,8 @@ $tables=array(
'commande_fournisseur'=>array(0=>'date_commande', 1=>'date_valid', 3=>'date_creation', 4=>'date_approve', 5=>'date_approve2', 6=>'date_livraison'),
'supplier_proposal'=>array(0=>'datec', 1=>'date_valid', 2=>'date_cloture'),
'expensereport'=>array(0=>'date_debut', 1=>'date_fin', 2=>'date_create', 3=>'date_valid', 4=>'date_approve', 5=>'date_refuse', 6=>'date_cancel'),
'holiday'=>array(0=>'date_debut', 1=>'date_fin', 2=>'date_create', 3=>'date_valid', 5=>'date_refuse', 6=>'date_cancel')
'holiday'=>array(0=>'date_debut', 1=>'date_fin', 2=>'date_create', 3=>'date_valid', 5=>'date_refuse', 6=>'date_cancel'),
'ticket'=>array(0=>'datec', 1=>'date_read', 2=>'date_close')
);
$year=2010;

View File

@ -1,136 +0,0 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
/**
* \file htdocs/accountancy/bookkeeping/balancebymonth.php
* \ingroup Accountancy (Double entries)
* \brief Balance by month
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("bills", "compta", "accountancy", "other"));
// Filter
$year = GETPOST("year", 'int');
if ($year == 0) {
$year_current = strftime("%Y", time());
$year_start = $year_current;
} else {
$year_current = $year;
$year_start = $year;
}
/*
* View
*/
llxHeader('', $langs->trans("Bookkeeping"));
$textprevyear = '<a href="'.$_SERVER["PHP_SELF"].'?year='.($year_current - 1).'">'.img_previous().'</a>';
$textnextyear = '&nbsp;<a href="'.$_SERVER["PHP_SELF"].'?year='.($year_current + 1).'">'.img_next().'</a>';
print load_fiche_titre($langs->trans("AccountBalanceByMonth").' '.$textprevyear.' '.$langs->trans("Year").' '.$year_start.' '.$textnextyear);
$sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."facturedet as fd";
$sql .= " , ".MAIN_DB_PREFIX."facture as f";
$sql .= " WHERE fd.fk_code_ventilation = 0";
$sql .= " AND f.rowid = fd.fk_facture AND f.fk_statut = 1;";
dol_syslog('accountancy/bookkeeping/balancebymonth.php:: $sql='.$sql);
$result = $db->query($sql);
if ($result) {
$row = $db->fetch_row($result);
$nbfac = $row[0];
$db->free($result);
}
$y = $year_current;
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td width=150>'.$langs->trans("Label").'</td>';
for ($i = 1; $i <= 12; $i++)
{
print '<td class="right">'.$langs->trans("MonthShort".sprintf("%02s", $i)).'</td>';
}
print '<td class="center"><strong>'.$langs->trans("Total").'</strong></td>';
print '</tr>';
$sql = "SELECT bk.numero_compte AS 'compte',";
$sql .= " ROUND(SUM(IF(MONTH(bk.doc_date)=1,bk.montant,0)),2) AS 'Janvier',";
$sql .= " ROUND(SUM(IF(MONTH(bk.doc_date)=2,bk.montant,0)),2) AS 'Fevrier',";
$sql .= " ROUND(SUM(IF(MONTH(bk.doc_date)=3,bk.montant,0)),2) AS 'Mars',";
$sql .= " ROUND(SUM(IF(MONTH(bk.doc_date)=4,bk.montant,0)),2) AS 'Avril',";
$sql .= " ROUND(SUM(IF(MONTH(bk.doc_date)=5,bk.montant,0)),2) AS 'Mai',";
$sql .= " ROUND(SUM(IF(MONTH(bk.doc_date)=6,bk.montant,0)),2) AS 'Juin',";
$sql .= " ROUND(SUM(IF(MONTH(bk.doc_date)=7,bk.montant,0)),2) AS 'Juillet',";
$sql .= " ROUND(SUM(IF(MONTH(bk.doc_date)=8,bk.montant,0)),2) AS 'Aout',";
$sql .= " ROUND(SUM(IF(MONTH(bk.doc_date)=9,bk.montant,0)),2) AS 'Septembre',";
$sql .= " ROUND(SUM(IF(MONTH(bk.doc_date)=10,bk.montant,0)),2) AS 'Octobre',";
$sql .= " ROUND(SUM(IF(MONTH(bk.doc_date)=11,bk.montant,0)),2) AS 'Novembre',";
$sql .= " ROUND(SUM(IF(MONTH(bk.doc_date)=12,bk.montant,0)),2) AS 'Decembre',";
$sql .= " ROUND(SUM(bk.montant),2) as 'Total'";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as bk";
$sql .= " WHERE bk.doc_date >= '".$db->idate(dol_get_first_day($y, 1, false))."'";
$sql .= " AND bk.doc_date <= '".$db->idate(dol_get_last_day($y, 12, false))."'";
$sql .= " GROUP BY bk.numero_compte";
$resql = $db->query($sql);
if ($resql) {
$i = 0;
$num = $db->num_rows($resql);
while ($i < $num) {
$row = $db->fetch_row($resql);
print '<tr class="oddeven"><td width="14%">'.length_accountg($row[0]).'</td>';
print '<td class="right" width="6.5%">'.price($row[1]).'</td>';
print '<td class="right" width="6.5%">'.price($row[2]).'</td>';
print '<td class="right" width="6.5%">'.price($row[3]).'</td>';
print '<td class="right" width="6.5%">'.price($row[4]).'</td>';
print '<td class="right" width="6.5%">'.price($row[5]).'</td>';
print '<td class="right" width="6.5%">'.price($row[6]).'</td>';
print '<td class="right" width="6.5%">'.price($row[7]).'</td>';
print '<td class="right" width="6.5%">'.price($row[8]).'</td>';
print '<td class="right" width="6.5%">'.price($row[9]).'</td>';
print '<td class="right" width="6.5%">'.price($row[10]).'</td>';
print '<td class="right" width="6.5%">'.price($row[11]).'</td>';
print '<td class="right" width="6.5%">'.price($row[12]).'</td>';
print '<td class="right" width="8%"><strong>'.price($row[13]).'</strong></td>';
print '</tr>';
$i++;
}
$db->free($resql);
} else {
print $db->lasterror();
}
print "</table>\n";
// End of page
llxFooter();
$db->close();

View File

@ -145,7 +145,7 @@ print dol_get_fiche_end();
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, ";
$sql .= " bk.subledger_account, bk.numero_compte , bk.label_compte, bk.debit, ";
$sql .= " bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.lettering_code ";
$sql .= " bk.credit, bk.montant, bk.sens, bk.code_journal, bk.piece_num, bk.lettering_code";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as bk";
$sql .= " WHERE (bk.subledger_account = '".$db->escape($object->code_compta)."' AND bk.numero_compte = '".$db->escape($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER)."' )";

View File

@ -144,7 +144,7 @@ print dol_get_fiche_end();
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, ";
$sql .= " bk.subledger_account, bk.numero_compte , bk.label_compte, bk.debit, ";
$sql .= " bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.lettering_code, bk.date_validated ";
$sql .= " bk.credit, bk.montant, bk.sens, bk.code_journal, bk.piece_num, bk.lettering_code, bk.date_validated ";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as bk";
$sql .= " WHERE (bk.subledger_account = '".$db->escape($object->code_compta_fournisseur)."' AND bk.numero_compte = '".$db->escape($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER)."' )";
if (dol_strlen($search_date_start) || dol_strlen($search_date_end)) {

View File

@ -359,7 +359,7 @@ class AccountancyExport
print length_accountg($line->numero_compte).$separator;
print length_accounta($line->subledger_account).$separator;
print $line->sens.$separator;
print price2fec(abs($line->montant)).$separator;
print price2fec(abs($line->debit - $line->credit)).$separator;
print dol_string_unaccent($line->label_operation).$separator;
print dol_string_unaccent($line->doc_ref);
print $end_line;
@ -387,11 +387,11 @@ class AccountancyExport
print $line->label_operation.$separator;
print $date.$separator;
if ($line->sens == 'D') {
print price($line->montant).$separator;
print price($line->debit).$separator;
print ''.$separator;
} elseif ($line->sens == 'C') {
print ''.$separator;
print price($line->montant).$separator;
print price($line->credit).$separator;
}
print $line->doc_ref.$separator;
print $line->label_operation.$separator;
@ -492,7 +492,7 @@ class AccountancyExport
$Tab['num_piece'] = str_pad(self::trunc($data->piece_num, 12), 12);
$Tab['num_compte'] = str_pad(self::trunc($code_compta, 11), 11);
$Tab['libelle_ecriture'] = str_pad(self::trunc(dol_string_unaccent($data->doc_ref).dol_string_unaccent($data->label_operation), 25), 25);
$Tab['montant'] = str_pad(abs($data->montant), 13, ' ', STR_PAD_LEFT);
$Tab['montant'] = str_pad(abs($data->debit - $data->credit), 13, ' ', STR_PAD_LEFT);
$Tab['type_montant'] = str_pad($data->sens, 1);
$Tab['vide'] = str_repeat(' ', 18);
$Tab['intitule_compte'] = str_pad(self::trunc(dol_string_unaccent($data->label_operation), 34), 34);
@ -539,6 +539,7 @@ class AccountancyExport
$Tab['libelle_ecriture'] = str_pad(self::trunc(dol_string_unaccent($data->doc_ref).' '.dol_string_unaccent($data->label_operation), 20), 20);
// Credit invoice - invert sens
/*
if ($data->montant < 0) {
if ($data->sens == 'C') {
$Tab['sens'] = 'D';
@ -549,10 +550,12 @@ class AccountancyExport
} else {
$Tab['sens'] = $data->sens; // C or D
$Tab['signe_montant'] = '+';
}
}*/
$Tab['sens'] = $data->sens; // C or D
$Tab['signe_montant'] = '+';
// The amount must be in centimes without decimal points.
$Tab['montant'] = str_pad(abs($data->montant * 100), 12, '0', STR_PAD_LEFT);
$Tab['montant'] = str_pad(abs(($data->debit - $abs->credit) * 100), 12, '0', STR_PAD_LEFT);
$Tab['contrepartie'] = str_repeat(' ', 8);
// Force date format : %d%m%y
@ -637,13 +640,13 @@ class AccountancyExport
$Tab['num_compte'] = str_pad(self::trunc($code_compta, 6), 6, '0');
if ($data->sens == 'D') {
$Tab['montant_debit'] = str_pad(number_format(abs($data->montant), 2, ',', ''), 13, ' ', STR_PAD_LEFT);
$Tab['montant_debit'] = str_pad(number_format($data->debit, 2, ',', ''), 13, ' ', STR_PAD_LEFT);
$Tab['montant_crebit'] = str_pad(number_format(0, 2, ',', ''), 13, ' ', STR_PAD_LEFT);
} else {
$Tab['montant_debit'] = str_pad(number_format(0, 2, ',', ''), 13, ' ', STR_PAD_LEFT);
$Tab['montant_crebit'] = str_pad(number_format(abs($data->montant), 2, ',', ''), 13, ' ', STR_PAD_LEFT);
$Tab['montant_crebit'] = str_pad(number_format($data->credit, 2, ',', ''), 13, ' ', STR_PAD_LEFT);
}
$Tab['libelle_ecriture'] = str_pad(self::trunc(dol_string_unaccent($data->doc_ref).' '.dol_string_unaccent($data->label_operation), 30), 30);
@ -704,7 +707,7 @@ class AccountancyExport
//print substr(length_accountg($line->numero_compte), 0, 2) . $separator;
print '"'.dol_trunc($line->label_operation, 40, 'right', 'UTF-8', 1).'"'.$separator;
print '"'.dol_trunc($line->piece_num, 15, 'right', 'UTF-8', 1).'"'.$separator;
print price2num(abs($line->montant)).$separator;
print price2num(abs($line->debit - $line->credit)).$separator;
print $line->sens.$separator;
print $date.$separator;
//print 'EUR';
@ -744,7 +747,7 @@ class AccountancyExport
print self::toAnsi($line->doc_ref).$separator;
print price($line->debit).$separator;
print price($line->credit).$separator;
print price($line->montant).$separator;
print price(abs($line->debit - $line->credit)).$separator;
print $line->sens.$separator;
print $line->lettering_code.$separator;
print $line->code_journal;
@ -807,7 +810,7 @@ class AccountancyExport
$tab[] = length_accounta($line->subledger_account);
$tab[] = price2num($line->debit);
$tab[] = price2num($line->credit);
$tab[] = price2num($line->montant);
$tab[] = price2num($line->debit - $line->credit);
$tab[] = $line->code_journal;
print implode($separator, $tab).$this->end_line;
@ -849,7 +852,7 @@ class AccountancyExport
foreach ($objectLines as $line) {
if ($line->debit == 0 && $line->credit == 0) {
unset($array[$line]);
//unset($array[$line]);
} else {
$date_creation = dol_print_date($line->date_creation, '%Y%m%d');
$date_document = dol_print_date($line->doc_date, '%Y%m%d');
@ -950,7 +953,7 @@ class AccountancyExport
foreach ($objectLines as $line) {
if ($line->debit == 0 && $line->credit == 0) {
unset($array[$line]);
//unset($array[$line]);
} else {
$date_creation = dol_print_date($line->date_creation, '%Y%m%d');
$date_document = dol_print_date($line->doc_date, '%Y%m%d');
@ -1105,12 +1108,7 @@ class AccountancyExport
// Code
print '""'.$this->separator;
// Netto
if ($line->montant >= 0)
{
print $line->montant.$this->separator;
} else {
print ($line->montant * -1).$this->separator;
}
print abs($line->debit - $line->credit).$this->separator;
// Steuer
print "0.00".$this->separator;
// FW-Betrag
@ -1190,13 +1188,13 @@ class AccountancyExport
print $date_lim_reglement.$separator;
// CNPI
if ($line->doc_type == 'supplier_invoice') {
if ($line->montant < 0) {
if (($line->debit - $line->credit) > 0) {
$nature_piece = 'AF';
} else {
$nature_piece = 'FF';
}
} elseif ($line->doc_type == 'customer_invoice') {
if ($line->montant < 0) {
if (($line->debit - $line->credit) < 0) {
$nature_piece = 'AC';
} else {
$nature_piece = 'FC';
@ -1220,7 +1218,7 @@ class AccountancyExport
print $racine_subledger_account.$separator; // deprecated CPTG & CPTA use instead
// MONT
print price(abs($line->montant), 0, '', 1, 2, 2).$separator;
print price(abs($line->debit - $line->credit), 0, '', 1, 2, 2).$separator;
// CODC
print $line->sens.$separator;
// CPTG
@ -1452,13 +1450,13 @@ class AccountancyExport
print $date_lim_reglement.$separator;
// CNPI
if ($line->doc_type == 'supplier_invoice') {
if ($line->montant < 0) {
if (($line->debit - $line->credit) > 0) {
$nature_piece = 'AF';
} else {
$nature_piece = 'FF';
}
} elseif ($line->doc_type == 'customer_invoice') {
if ($line->montant < 0) {
if (($line->debit - $line->credit) < 0) {
$nature_piece = 'AC';
} else {
$nature_piece = 'FC';
@ -1482,7 +1480,7 @@ class AccountancyExport
print $racine_subledger_account.$separator; // deprecated CPTG & CPTA use instead
// MONT
print price(abs($line->montant), 0, '', 1, 2).$separator;
print price(abs($line->debit - $line->credit), 0, '', 1, 2).$separator;
// CODC
print $line->sens.$separator;
// CPTG
@ -1602,7 +1600,7 @@ class AccountancyExport
print self::trunc($line->label_compte, 60).$separator; //Account label
print self::trunc($line->doc_ref, 20).$separator; //Piece
print self::trunc($line->label_operation, 60).$separator; //Operation label
print price(abs($line->montant)).$separator; //Amount
print price(abs($line->debit - $line->credit)).$separator; //Amount
print $line->sens.$separator; //Direction
print $separator; //Analytic
print $separator; //Analytic
@ -1631,7 +1629,7 @@ class AccountancyExport
$supplier_invoices_infos = array();
foreach ($objectLines as $line) {
if ($line->debit == 0 && $line->credit == 0) {
unset($array[$line]);
//unset($array[$line]);
} else {
$date = dol_print_date($line->doc_date, '%d/%m/%Y');
@ -1699,8 +1697,8 @@ class AccountancyExport
print dol_trunc(str_replace('"', '', $line->piece_num), 10, 'right', 'UTF-8', 1) . $this->separator;
//Devise
print 'EUR' . $this->separator;
//Montant
print price2num(abs($line->montant)) . $this->separator;
//Amount
print price2num(abs($line->debit - $line->credit)) . $this->separator;
//Sens
print $line->sens . $this->separator;
//Code lettrage
@ -1726,14 +1724,14 @@ class AccountancyExport
foreach ($objectLines as $line) {
if ($line->debit == 0 && $line->credit == 0) {
unset($array[$line]);
//unset($array[$line]);
} else {
$date = dol_print_date($line->doc_date, '%d%m%Y');
print $line->id . $this->separator;
print $date . $this->separator;
print substr($line->code_journal, 0, 4) . $this->separator;
if ((substr($line->numero_compte, 0, 3) == '411') || (substr($line->numero_compte, 0, 3) == '401')) {
if ((substr($line->numero_compte, 0, 3) == '411') || (substr($line->numero_compte, 0, 3) == '401')) { // TODO No hard code value
print length_accountg($line->subledger_account) . $this->separator;
} else {
print substr(length_accountg($line->numero_compte), 0, 15) . $this->separator;
@ -1742,7 +1740,7 @@ class AccountancyExport
//print '"'.dol_trunc(str_replace('"', '', $line->label_operation),40,'right','UTF-8',1).'"' . $this->separator;
print '"' . dol_trunc(str_replace('"', '', $line->doc_ref), 40, 'right', 'UTF-8', 1) . '"' . $this->separator;
print '"' . dol_trunc(str_replace('"', '', $line->piece_num), 10, 'right', 'UTF-8', 1) . '"' . $this->separator;
print price2num($line->montant) . $this->separator;
print price2num(abs($line->debit - $line->credit)) . $this->separator;
print $line->sens . $this->separator;
print $date . $this->separator;
print $this->separator;

View File

@ -135,6 +135,7 @@ class BookKeeping extends CommonObject
/**
* @var float FEC:Amount (Not necessary)
* @deprecated No more used
*/
public $amount;
@ -239,6 +240,9 @@ class BookKeeping extends CommonObject
if (isset($this->montant)) {
$this->montant = (float) $this->montant;
}
if (isset($this->amount)) {
$this->amount = (float) $this->amount;
}
if (isset($this->sens)) {
$this->sens = trim($this->sens);
}
@ -554,6 +558,9 @@ class BookKeeping extends CommonObject
if (isset($this->montant)) {
$this->montant = trim($this->montant);
}
if (isset($this->amount)) {
$this->amount = trim($this->amount);
}
if (isset($this->sens)) {
$this->sens = trim($this->sens);
}
@ -695,7 +702,7 @@ class BookKeeping extends CommonObject
$sql .= " t.label_operation,";
$sql .= " t.debit,";
$sql .= " t.credit,";
$sql .= " t.montant,";
$sql .= " t.montant as amount,";
$sql .= " t.sens,";
$sql .= " t.fk_user_author,";
$sql .= " t.import_key,";
@ -734,7 +741,8 @@ class BookKeeping extends CommonObject
$this->label_operation = $obj->label_operation;
$this->debit = $obj->debit;
$this->credit = $obj->credit;
$this->montant = $obj->montant;
$this->montant = $obj->amount;
$this->amount = $obj->amount;
$this->sens = $obj->sens;
$this->fk_user_author = $obj->fk_user_author;
$this->import_key = $obj->import_key;
@ -1197,8 +1205,8 @@ class BookKeeping extends CommonObject
if (isset($this->credit)) {
$this->credit = trim($this->credit);
}
if (isset($this->montant)) {
$this->montant = trim($this->montant);
if (isset($this->amount)) {
$this->amount = trim($this->amount);
}
if (isset($this->sens)) {
$this->sens = trim($this->sens);
@ -1641,7 +1649,7 @@ class BookKeeping extends CommonObject
$sql = "SELECT rowid, doc_date, doc_type,";
$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, date_creation";
$sql .= " montant as amount, sens, fk_user_author, import_key, code_journal, journal_label, piece_num, date_creation";
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element.$mode;
$sql .= " WHERE piece_num = ".$piecenum;
$sql .= " AND entity IN (".getEntity('accountancy').")";
@ -1667,7 +1675,8 @@ class BookKeeping extends CommonObject
$line->label_operation = $obj->label_operation;
$line->debit = $obj->debit;
$line->credit = $obj->credit;
$line->montant = $obj->montant;
$line->montant = $obj->amount;
$line->amount = $obj->amount;
$line->sens = $obj->sens;
$line->code_journal = $obj->code_journal;
$line->journal_label = $obj->journal_label;
@ -1700,7 +1709,7 @@ class BookKeeping extends CommonObject
$sql = "SELECT rowid, doc_date, doc_type,";
$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, piece_num";
$sql .= " montant as amount, sens, fk_user_author, import_key, code_journal, piece_num";
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element;
$sql .= " WHERE entity IN (".getEntity('accountancy').")";
@ -1730,7 +1739,8 @@ class BookKeeping extends CommonObject
$line->label_operation = $obj->label_operation;
$line->debit = $obj->debit;
$line->credit = $obj->credit;
$line->montant = $obj->montant;
$line->montant = $obj->amount;
$line->amount = $obj->amount;
$line->sens = $obj->sens;
$line->code_journal = $obj->code_journal;
$line->piece_num = $obj->piece_num;

View File

@ -1490,10 +1490,14 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Password
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
print '<tr><td>'.$langs->trans("Password").'</td><td>'.preg_replace('/./i', '*', $object->pass);
if ($object->pass) print preg_replace('/./i', '*', $object->pass);
else {
if ($user->admin) print $langs->trans("Crypted").': '.$object->pass_indatabase_crypted;
else print $langs->trans("Hidden");
if ($object->pass) {
print preg_replace('/./i', '*', $object->pass);
} else {
if ($user->admin) {
print $langs->trans("Crypted").': '.$object->pass_indatabase_crypted;
} else {
print $langs->trans("Hidden");
}
}
if ((!empty($object->pass) || !empty($object->pass_crypted)) && empty($object->user_id)) {
$langs->load("errors");
@ -1523,6 +1527,32 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
}
print '</td></tr>';
print '</table>';
print '</div>';
print '<div class="fichehalfright"><div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield tableforfield" width="100%">';
// Birth Date
print '<tr><td class="titlefield">'.$langs->trans("DateOfBirth").'</td><td class="valeur">'.dol_print_date($object->birth, 'day').'</td></tr>';
// Public
print '<tr><td>'.$langs->trans("Public").'</td><td class="valeur">'.yn($object->public).'</td></tr>';
// Categories
if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) {
print '<tr><td>'.$langs->trans("Categories").'</td>';
print '<td colspan="2">';
print $form->showCategories($object->id, Categorie::TYPE_MEMBER, 1);
print '</td></tr>';
}
// Other attributes
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
// Third party Dolibarr
if (!empty($conf->societe->enabled)) {
print '<tr><td>';
@ -1571,29 +1601,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
}
print '</td></tr>';
print '</table>';
print '</div>';
print '<div class="fichehalfright"><div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield tableforfield" width="100%">';
// Birth Date
print '<tr><td class="titlefield">'.$langs->trans("DateOfBirth").'</td><td class="valeur">'.dol_print_date($object->birth, 'day').'</td></tr>';
// Public
print '<tr><td>'.$langs->trans("Public").'</td><td class="valeur">'.yn($object->public).'</td></tr>';
// Categories
if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) {
print '<tr><td>'.$langs->trans("Categories").'</td>';
print '<td colspan="2">';
print $form->showCategories($object->id, Categorie::TYPE_MEMBER, 1);
print '</td></tr>';
}
//VCard
print '<tr><td>';
print $langs->trans("VCard").'</td><td colspan="3">';
@ -1603,9 +1610,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '</a>';
print '</td></tr>';
// Other attributes
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
print "</table>\n";
print "</div></div></div>\n";

View File

@ -450,6 +450,12 @@ if ($rowid > 0) {
print '<tr><td>'.$langs->trans("MemberNature").'</td><td class="valeur" >'.$object->getmorphylib().'</td>';
print '</tr>';
// Gender
print '<tr><td>'.$langs->trans("Gender").'</td>';
print '<td>';
if ($object->gender) print $langs->trans("Gender".$object->gender);
print '</td></tr>';
// Company
print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.$object->company.'</td></tr>';
@ -460,6 +466,15 @@ if ($rowid > 0) {
// Password
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
print '<tr><td>'.$langs->trans("Password").'</td><td>'.preg_replace('/./i', '*', $object->pass);
if ($object->pass) {
print preg_replace('/./i', '*', $object->pass);
} else {
if ($user->admin) {
print $langs->trans("Crypted").': '.$object->pass_indatabase_crypted;
} else {
print $langs->trans("Hidden");
}
}
if ((!empty($object->pass) || !empty($object->pass_crypted)) && empty($object->user_id)) {
$langs->load("errors");
$htmltext = $langs->trans("WarningPasswordSetWithNoAccount");
@ -468,32 +483,6 @@ if ($rowid > 0) {
print '</td></tr>';
}
print '</table>';
print '</div>';
print '<div class="fichehalfright"><div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield" width="100%">';
// Birthday
print '<tr><td class="titlefield">'.$langs->trans("Birthday").'</td><td class="valeur">'.dol_print_date($object->birth, 'day').'</td></tr>';
// Public
print '<tr><td>'.$langs->trans("Public").'</td><td class="valeur">'.yn($object->public).'</td></tr>';
// Categories
if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) {
print '<tr><td>'.$langs->trans("Categories").'</td>';
print '<td colspan="2">';
print $form->showCategories($object->id, Categorie::TYPE_MEMBER, 1);
print '</td></tr>';
}
// Other attributes
$cols = 2;
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
// Date end subscription
print '<tr><td>'.$langs->trans("SubscriptionEndDate").'</td><td class="valeur">';
if ($object->datefin) {
@ -512,6 +501,32 @@ if ($rowid > 0) {
}
print '</td></tr>';
print '</table>';
print '</div>';
print '<div class="fichehalfright"><div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield" width="100%">';
// Birthday
print '<tr><td class="titlefield">'.$langs->trans("DateOfBirth").'</td><td class="valeur">'.dol_print_date($object->birth, 'day').'</td></tr>';
// Public
print '<tr><td>'.$langs->trans("Public").'</td><td class="valeur">'.yn($object->public).'</td></tr>';
// Categories
if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) {
print '<tr><td>'.$langs->trans("Categories").'</td>';
print '<td colspan="2">';
print $form->showCategories($object->id, Categorie::TYPE_MEMBER, 1);
print '</td></tr>';
}
// Other attributes
$cols = 2;
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
// Third party Dolibarr
if (!empty($conf->societe->enabled)) {
print '<tr><td>';

View File

@ -418,7 +418,7 @@ while ($i < min($num, $limit)) {
// Ref
if (!empty($arrayfields['d.ref']['checked'])) {
print '<td>'.$subscription->getNomUrl(1).'</td>';
print '<td class="nowraponall">'.$subscription->getNomUrl(1).'</td>';
if (!$i) $totalarray['nbfield']++;
}
// Type

View File

@ -840,6 +840,7 @@ if ($resql)
print "</tr>\n";
} else {
// If template is for a module, check module is enabled.
if ($obj->module) {
$tempmodulekey = $obj->module;
if (empty($conf->$tempmodulekey) || empty($conf->$tempmodulekey->enabled)) {
@ -847,6 +848,7 @@ if ($resql)
continue;
}
}
$keyforobj = 'type_template';
if (!in_array($obj->$keyforobj, array_keys($elementList)))
{

View File

@ -784,7 +784,7 @@ if (empty($reshook))
}
}
}
} elseif ($action == 'addline' && GETPOST('submitforalllines', 'aZ09') && GETPOST('vatforalllines', 'alpha')) {
} elseif ($action == 'addline' && GETPOST('submitforalllines', 'alpha') && GETPOST('vatforalllines', 'alpha') !== '') {
// Define vat_rate
$vat_rate = (GETPOST('vatforalllines') ? GETPOST('vatforalllines') : 0);
$vat_rate = str_replace('*', '', $vat_rate);

View File

@ -615,7 +615,7 @@ if (empty($reshook))
$result = $object->set_remise($user, GETPOST('remise_percent'));
} elseif ($action == 'setremiseabsolue' && $usercancreate) {
$result = $object->set_remise_absolue($user, GETPOST('remise_absolue'));
} elseif ($action == 'addline' && GETPOST('submitforalllines', 'alpha') && GETPOST('vatforalllines', 'alpha')) {
} elseif ($action == 'addline' && GETPOST('submitforalllines', 'alpha') && GETPOST('vatforalllines', 'alpha') !== '') {
// Define vat_rate
$vat_rate = (GETPOST('vatforalllines') ? GETPOST('vatforalllines') : 0);
$vat_rate = str_replace('*', '', $vat_rate);

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2017-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
/* Copyright (C) 2017-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -70,6 +70,8 @@ class PaymentVarious extends CommonObject
public $amount;
public $type_payment;
public $num_payment;
public $chqemetteur;
public $chqbank;
public $category_transaction;
/**
@ -424,7 +426,7 @@ class PaymentVarious extends CommonObject
$this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("BankAccount"));
return -6;
}
if (!empty($conf->banque->enabled) && (empty($this->type_payment) || $this->type_payment <= 0))
if (!empty($conf->banque->enabled) && (empty($this->type_payment)))
{
$this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("PaymentMode"));
return -7;
@ -499,8 +501,8 @@ class PaymentVarious extends CommonObject
$this->num_payment,
($this->category_transaction > 0 ? $this->category_transaction : 0),
$user,
'',
'',
$this->chqemetteur,
$this->chqbank,
'',
$this->datev
);

View File

@ -49,7 +49,7 @@ $accountid = GETPOST("accountid") > 0 ? GETPOST("accountid", "int") : 0;
$label = GETPOST("label", "alpha");
$sens = GETPOST("sens", "int");
$amount = price2num(GETPOST("amount", "alpha"));
$paymenttype = GETPOST("paymenttype", "int");
$paymenttype = GETPOST("paymenttype", "aZ09");
$accountancy_code = GETPOST("accountancy_code", "alpha");
$projectid = (GETPOST('projectid', 'int') ? GETPOST('projectid', 'int') : GETPOST('fk_project', 'int'));
if (!empty($conf->accounting->enabled) && !empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) {
@ -113,8 +113,10 @@ if (empty($reshook))
$object->amount = price2num(GETPOST("amount", 'alpha'));
$object->label = GETPOST("label", 'restricthtml');
$object->note = GETPOST("note", 'restricthtml');
$object->type_payment = GETPOST("paymenttype", 'int') > 0 ? GETPOST("paymenttype", "int") : 0;
$object->type_payment = dol_getIdFromCode($db, GETPOST('paymenttype'), 'c_paiement', 'code', 'id', 1);
$object->num_payment = GETPOST("num_payment", 'alpha');
$object->chqemetteur = GETPOST("chqemetteur", 'alpha');
$object->chqbank = GETPOST("chqbank", 'alpha');
$object->fk_user_author = $user->id;
$object->category_transaction = GETPOST("category_transaction", 'alpha');
@ -345,6 +347,43 @@ foreach ($bankcateg->fetchAll() as $bankcategory) {
/* ************************************************************************** */
if ($action == 'create')
{
// Update fields properties in realtime
if (!empty($conf->use_javascript_ajax))
{
print "\n".'<script type="text/javascript" language="javascript">';
print '$(document).ready(function () {
setPaymentType();
$("#selectpaymenttype").change(function() {
setPaymentType();
});
function setPaymentType()
{
var code = $("#selectpaymenttype option:selected").val();
if (code == \'CHQ\' || code == \'VIR\')
{
if (code == \'CHQ\')
{
$(\'.fieldrequireddyn\').addClass(\'fieldrequired\');
}
if ($(\'#fieldchqemetteur\').val() == \'\')
{
var emetteur = jQuery(\'#thirdpartylabel\').val();
$(\'#fieldchqemetteur\').val(emetteur);
}
}
else
{
$(\'.fieldrequireddyn\').removeClass(\'fieldrequired\');
$(\'#fieldchqemetteur\').val(\'\');
}
}
';
print ' });'."\n";
print ' </script>'."\n";
}
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
@ -390,20 +429,28 @@ if ($action == 'create')
}
// Type payment
print '<tr><td>';
print $form->editfieldkey('PaymentMode', 'selectpaymenttype', '', $object, 0, 'string', '', 1).'</td><td>';
$form->select_types_paiements($paymenttype, "paymenttype");
print '</td></tr>';
print '<tr><td><span class="fieldrequired">'.$langs->trans('PaymentMode').'</span></td><td>';
$form->select_types_paiements($paymenttype, 'paymenttype', '', 2);
print "</td>\n";
print '</tr>';
// Number
if (!empty($conf->banque->enabled))
{
// Number
print '<tr><td><label for="num_payment">'.$langs->trans('Numero');
print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
print '</label></td>';
print '<td><input name="num_payment" class="maxwidth150onsmartphone" id="num_payment" type="text" value="'.GETPOST("num_payment").'"></td></tr>'."\n";
}
print '<tr><td><label for="num_payment">'.$langs->trans('Numero');
print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
print '</label></td>';
print '<td><input name="num_payment" class="maxwidth150onsmartphone" id="num_payment" type="text" value="'.GETPOST("num_payment").'"></td></tr>'."\n";
// Check transmitter
print '<tr><td class="'.(GETPOST('paymenttype') == 'CHQ' ? 'fieldrequired ' : '').'fieldrequireddyn"><label for="fieldchqemetteur">'.$langs->trans('CheckTransmitter');
print ' <em>('.$langs->trans("ChequeMaker").')</em>';
print '</label></td>';
print '<td><input id="fieldchqemetteur" name="chqemetteur" size="30" type="text" value="'.GETPOST('chqemetteur', 'alphanohtml').'"></td></tr>';
// Bank name
print '<tr><td><label for="chqbank">'.$langs->trans('Bank');
print ' <em>('.$langs->trans("ChequeBank").')</em>';
print '</label></td>';
print '<td><input id="chqbank" name="chqbank" size="30" type="text" value="'.GETPOST('chqbank', 'alphanohtml').'"></td></tr>';
// Accountancy account
if (!empty($conf->accounting->enabled)) {

View File

@ -1878,7 +1878,7 @@ if (empty($reshook))
$_GET["originid"] = $_POST["originid"];
setEventMessages($object->error, $object->errors, 'errors');
}
} elseif ($action == 'addline' && GETPOST('submitforalllines', 'aZ09') && GETPOST('vatforalllines', 'alpha')) {
} elseif ($action == 'addline' && GETPOST('submitforalllines', 'alpha') && GETPOST('vatforalllines', 'alpha') !== '') {
// Define vat_rate
$vat_rate = (GETPOST('vatforalllines') ? GETPOST('vatforalllines') : 0);
$vat_rate = str_replace('*', '', $vat_rate);

View File

@ -93,7 +93,7 @@ class box_factures extends ModeleBoxes
$sql .= ", f.tva as total_tva";
$sql .= ", f.total_ttc";
$sql .= ", f.datef as df";
$sql .= ", f.paye, f.fk_statut, f.datec, f.tms";
$sql .= ", f.paye, f.fk_statut as status, f.datec, f.tms";
$sql .= ", f.date_lim_reglement as datelimite";
$sql .= ", s.rowid as socid, s.nom as name, s.name_alias";
$sql .= ", s.code_client, s.code_compta, s.client";
@ -131,8 +131,10 @@ class box_factures extends ModeleBoxes
$facturestatic->total_ht = $objp->total_ht;
$facturestatic->total_tva = $objp->total_tva;
$facturestatic->total_ttc = $objp->total_ttc;
$facturestatic->statut = $objp->fk_statut;
$facturestatic->statut = $objp->status;
$facturestatic->status = $objp->status;
$facturestatic->date_lim_reglement = $this->db->jdate($objp->datelimite);
$facturestatic->alreadypaid = $objp->paye;
$societestatic->id = $objp->socid;
$societestatic->name = $objp->name;
@ -181,7 +183,7 @@ class box_factures extends ModeleBoxes
$this->info_box_contents[$line][] = array(
'td' => 'class="right" width="18"',
'text' => $facturestatic->LibStatut($objp->paye, $objp->fk_statut, 3),
'text' => $facturestatic->LibStatut($objp->paye, $objp->status, 3, $objp->paye),
);
$line++;

View File

@ -86,6 +86,8 @@ class box_factures_fourn extends ModeleBoxes
if ($user->rights->fournisseur->facture->lire)
{
$langs->load("bills");
$sql = "SELECT s.rowid as socid, s.nom as name, s.name_alias";
$sql .= ", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur";
$sql .= ", s.logo, s.email, s.entity";
@ -93,7 +95,7 @@ class box_factures_fourn extends ModeleBoxes
$sql .= ", f.total_ht";
$sql .= ", f.total_tva";
$sql .= ", f.total_ttc";
$sql .= ", f.paye, f.fk_statut";
$sql .= ", f.paye, f.fk_statut as status";
$sql .= ', f.datef as df';
$sql .= ', f.datec as datec';
$sql .= ', f.date_lim_reglement as datelimite, f.tms, f.type';
@ -118,6 +120,7 @@ class box_factures_fourn extends ModeleBoxes
while ($line < $num) {
$objp = $this->db->fetch_object($result);
$datelimite = $this->db->jdate($objp->datelimite);
$date = $this->db->jdate($objp->df);
$datem = $this->db->jdate($objp->tms);
@ -128,7 +131,8 @@ class box_factures_fourn extends ModeleBoxes
$facturestatic->total_tva = $objp->total_tva;
$facturestatic->total_ttc = $objp->total_ttc;
$facturestatic->date_echeance = $datelimite;
$facturestatic->statut = $objp->fk_statut;
$facturestatic->statut = $objp->status;
$facturestatic->status = $objp->status;
$facturestatic->ref_supplier = $objp->ref_supplier;
$thirdpartystatic->id = $objp->socid;
@ -182,7 +186,7 @@ class box_factures_fourn extends ModeleBoxes
$alreadypaid = $fac->getSommePaiement();
$this->info_box_contents[$line][] = array(
'td' => 'class="right" width="18"',
'text' => $facturestatic->LibStatut($objp->paye, $objp->fk_statut, 3, $alreadypaid, $objp->type),
'text' => $facturestatic->LibStatut($objp->paye, $objp->status, 3, $alreadypaid, $objp->type),
);
$line++;

View File

@ -82,6 +82,8 @@ class box_factures_fourn_imp extends ModeleBoxes
if ($user->rights->fournisseur->facture->lire)
{
$langs->load("bills");
$sql = "SELECT s.rowid as socid, s.nom as name, s.name_alias";
$sql .= ", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur";
$sql .= ", s.logo, s.email, s.entity";
@ -90,13 +92,13 @@ class box_factures_fourn_imp extends ModeleBoxes
$sql .= ", f.total_ht as total_ht";
$sql .= ", f.tva as total_tva";
$sql .= ", f.total_ttc";
$sql .= ", f.paye, f.fk_statut, f.type";
$sql .= ", f.paye, f.fk_statut as status, f.type";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= ",".MAIN_DB_PREFIX."facture_fourn as f";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " WHERE f.fk_soc = s.rowid";
$sql .= " AND f.entity = ".$conf->entity;
$sql .= " AND f.paye=0";
$sql .= " AND f.paye = 0";
$sql .= " AND fk_statut = 1";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
if ($user->socid) $sql .= " AND s.rowid = ".$user->socid;
@ -126,7 +128,8 @@ class box_factures_fourn_imp extends ModeleBoxes
$facturestatic->total_tva = $objp->total_tva;
$facturestatic->total_ttc = $objp->total_ttc;
$facturestatic->date_echeance = $datelimite;
$facturestatic->statut = $objp->fk_statut;
$facturestatic->statut = $objp->status;
$facturestatic->status = $objp->status;
$thirdpartystatic->id = $objp->socid;
$thirdpartystatic->name = $objp->name;
@ -173,7 +176,7 @@ class box_factures_fourn_imp extends ModeleBoxes
$alreadypaid = $fac->getSommePaiement();
$this->info_box_contents[$line][] = array(
'td' => 'class="right" width="18"',
'text' => $facturestatic->LibStatut($objp->paye, $objp->fk_statut, 3, $alreadypaid, $objp->type),
'text' => $facturestatic->LibStatut($objp->paye, $objp->status, 3, $alreadypaid, $objp->type),
);
$line++;

View File

@ -98,7 +98,7 @@ class box_factures_imp extends ModeleBoxes
$sql .= ", f.total as total_ht";
$sql .= ", f.tva as total_tva";
$sql .= ", f.total_ttc";
$sql .= ", f.paye, f.fk_statut, f.rowid as facid";
$sql .= ", f.paye, f.fk_statut as status, f.rowid as facid";
$sql .= ", sum(pf.amount) as am";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -136,8 +136,10 @@ class box_factures_imp extends ModeleBoxes
$facturestatic->total_ht = $objp->total_ht;
$facturestatic->total_tva = $objp->total_tva;
$facturestatic->total_ttc = $objp->total_ttc;
$facturestatic->statut = $objp->fk_statut;
$facturestatic->statut = $objp->status;
$facturestatic->status = $objp->status;
$facturestatic->date_lim_reglement = $this->db->jdate($objp->datelimite);
$facturestatic->alreadypaid = $objp->paye;
$societestatic->id = $objp->socid;
$societestatic->name = $objp->name;
@ -186,7 +188,7 @@ class box_factures_imp extends ModeleBoxes
$this->info_box_contents[$line][] = array(
'td' => 'class="right" width="18"',
'text' => $facturestatic->LibStatut($objp->paye, $objp->fk_statut, 3, $objp->am),
'text' => $facturestatic->LibStatut($objp->paye, $objp->status, 3, $objp->am),
);
$line++;

View File

@ -82,7 +82,7 @@ class box_ficheinter extends ModeleBoxes
if (!empty($user->rights->ficheinter->lire))
{
$sql = "SELECT f.rowid, f.ref, f.fk_soc, f.fk_statut";
$sql = "SELECT f.rowid, f.ref, f.fk_soc, f.fk_statut as status";
$sql .= ", f.datec";
$sql .= ", f.date_valid as datev";
$sql .= ", f.tms as datem";
@ -113,7 +113,8 @@ class box_ficheinter extends ModeleBoxes
$objp = $this->db->fetch_object($resql);
$datec = $this->db->jdate($objp->datec);
$ficheinterstatic->statut = $objp->fk_statut;
$ficheinterstatic->statut = $objp->status;
$ficheinterstatic->status = $objp->status;
$ficheinterstatic->id = $objp->rowid;
$ficheinterstatic->ref = $objp->ref;

View File

@ -117,6 +117,10 @@ class box_members extends ModeleBoxes
$memberstatic->morphy = $objp->morphy;
$memberstatic->company = $objp->company;
$memberstatic->statut = $objp->status;
$memberstatic->date_creation = $datec;
$memberstatic->date_modification = $datem;
$memberstatic->need_subscription = $objp->subscription;
$memberstatic->datefin = $this->db->jdate($objp->date_end_subscription);
if (!empty($objp->fk_soc)) {
$memberstatic->socid = $objp->fk_soc;

View File

@ -88,7 +88,7 @@ class box_propales extends ModeleBoxes
$sql = "SELECT s.rowid as socid, s.nom as name, s.name_alias";
$sql .= ", s.code_client, s.code_compta, s.client";
$sql .= ", s.logo, s.email, s.entity";
$sql .= ", p.rowid, p.ref, p.fk_statut, p.datep as dp, p.datec, p.fin_validite, p.date_cloture, p.total_ht, p.tva as total_tva, p.total as total_ttc, p.tms";
$sql .= ", p.rowid, p.ref, p.fk_statut as status, p.datep as dp, p.datec, p.fin_validite, p.date_cloture, p.total_ht, p.tva as total_tva, p.total as total_ttc, p.tms";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= ", ".MAIN_DB_PREFIX."propal as p";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -121,6 +121,8 @@ class box_propales extends ModeleBoxes
$propalstatic->total_ht = $objp->total_ht;
$propalstatic->total_tva = $objp->total_tva;
$propalstatic->total_ttc = $objp->total_ttc;
$propalstatic->statut = $objp->status;
$propalstatic->status = $objp->status;
$societestatic->id = $objp->socid;
$societestatic->name = $objp->name;
@ -133,7 +135,7 @@ class box_propales extends ModeleBoxes
$societestatic->entity = $objp->entity;
$late = '';
if ($objp->fk_statut == 1 && $dateterm < ($now - $conf->propal->cloture->warning_delay)) {
if ($objp->status == 1 && $dateterm < ($now - $conf->propal->cloture->warning_delay)) {
$late = img_warning($langs->trans("Late"));
}
@ -162,7 +164,7 @@ class box_propales extends ModeleBoxes
$this->info_box_contents[$line][] = array(
'td' => 'class="right" width="18"',
'text' => $propalstatic->LibStatut($objp->fk_statut, 3),
'text' => $propalstatic->LibStatut($objp->status, 3),
);
$line++;

View File

@ -90,7 +90,7 @@ class box_supplier_orders extends ModeleBoxes
$sql .= ", c.total_ht";
$sql .= ", c.tva as total_tva";
$sql .= ", c.total_ttc";
$sql .= ", c.fk_statut";
$sql .= ", c.fk_statut as status";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= ", ".MAIN_DB_PREFIX."commande_fournisseur as c";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -115,6 +115,7 @@ class box_supplier_orders extends ModeleBoxes
$supplierorderstatic->id = $objp->rowid;
$supplierorderstatic->ref = $objp->ref;
$supplierorderstatic->statut = $objp->status;
$thirdpartystatic->id = $objp->socid;
$thirdpartystatic->name = $objp->name;
@ -150,7 +151,7 @@ class box_supplier_orders extends ModeleBoxes
$this->info_box_contents[$line][] = array(
'td' => 'class="right" width="18"',
'text' => $supplierorderstatic->LibStatut($objp->fk_statut, 3),
'text' => $supplierorderstatic->LibStatut($objp->status, 3),
);
$line++;

View File

@ -90,7 +90,7 @@ class box_supplier_orders_awaiting_reception extends ModeleBoxes
$sql .= ", c.total_ht";
$sql .= ", c.tva as total_tva";
$sql .= ", c.total_ttc";
$sql .= ", c.fk_statut";
$sql .= ", c.fk_statut as status";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= ", ".MAIN_DB_PREFIX."commande_fournisseur as c";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -115,11 +115,10 @@ class box_supplier_orders_awaiting_reception extends ModeleBoxes
$delivery_date = $this->db->jdate($objp->delivery_date);
$datem = $this->db->jdate($objp->tms);
$supplierorderstatic->delivery_date = $delivery_date;
$supplierorderstatic->statut = $objp->fk_statut;
$supplierorderstatic->id = $objp->rowid;
$supplierorderstatic->ref = $objp->ref;
$supplierorderstatic->delivery_date = $delivery_date;
$supplierorderstatic->statut = $objp->status;
$thirdpartystatic->id = $objp->socid;
$thirdpartystatic->name = $objp->name;

View File

@ -485,6 +485,10 @@ abstract class CommonObject
*/
public $sendtoid;
/**
* @var float Amount already paid (used to show correct status)
*/
public $alreadypaid;
/**
* @var array List of child tables. To test if we can delete object.
@ -2210,14 +2214,16 @@ abstract class CommonObject
$this->updateline(
$line->id, ($line->description ? $line->description : $line->desc), $line->subprice, $line->qty, $line->remise_percent,
$line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, false,
$line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice
$line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice,
$line->ref_supplier
);
break;
case 'invoice_supplier':
$this->updateline(
$line->id, ($line->description ? $line->description : $line->desc), $line->subprice, $line->tva_tx, $line->localtax1_tx,
$line->localtax2_tx, $line->qty, 0, 'HT', $line->info_bits, $line->product_type, $line->remise_percent, false,
$line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice
$line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice,
$line->ref_supplier
);
break;
default:

View File

@ -7133,7 +7133,7 @@ class Form
'invoice'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('invoice').')'),
'invoice_template'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToTemplateInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.titre as ref, t.total as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_rec as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('invoice').')'),
'contrat'=>array('enabled'=>$conf->contrat->enabled, 'perms'=>1, 'label'=>'LinkToContract',
'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_customer as ref_client, t.ref_supplier, '' as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('contract').')'),
'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_customer as ref_client, t.ref_supplier, SUM(td.total_ht) as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as t, ".MAIN_DB_PREFIX."contratdet as td WHERE t.fk_soc = s.rowid AND td.fk_contrat = t.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('contract').')'),
'fichinter'=>array('enabled'=>$conf->ficheinter->enabled, 'perms'=>1, 'label'=>'LinkToIntervention', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('intervention').')'),
'supplier_proposal'=>array('enabled'=>$conf->supplier_proposal->enabled, 'perms'=>1, 'label'=>'LinkToSupplierProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('supplier_proposal').')'),
'order_supplier'=>array('enabled'=>$conf->supplier_order->enabled, 'perms'=>1, 'label'=>'LinkToSupplierOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('commande_fournisseur').')'),
@ -7206,7 +7206,12 @@ class Form
print '</td>';
print '<td class="center">'.$objp->ref.'</td>';
print '<td>'.$objp->ref_client.'</td>';
print '<td class="right">'.price($objp->total_ht).'</td>';
print '<td class="right">';
if ($possiblelink[label] == 'LinkToContract') {
$form = new Form($db);
print $form->textwithpicto('', $langs->trans("InformationOnLinkToContract")).' ';
}
print price($objp->total_ht).'</td>';
print '<td>'.$objp->name.'</td>';
print '</tr>';
$i++;

View File

@ -329,9 +329,8 @@ class FormMail extends Form
// Load translation files required by the page
$langs->loadLangs(array('other', 'mails'));
// Clear temp files. Must be done at beginning, before call of triggers
if (GETPOST('mode', 'alpha') == 'init' || (GETPOST('modelmailselected', 'alpha') && GETPOST('modelmailselected', 'alpha') != '-1'))
{
// Clear temp files. Must be done before call of triggers, at beginning (mode = init), or when we select a new template
if (GETPOST('mode', 'alpha') == 'init' || (GETPOST('modelselected') && GETPOST('modelmailselected', 'alpha') && GETPOST('modelmailselected', 'alpha') != '-1')) {
$this->clear_attached_files();
}
@ -1201,6 +1200,8 @@ class FormMail extends Form
*/
public function getEMailTemplate($db, $type_template, $user, $outputlangs, $id = 0, $active = 1, $label = '')
{
global $conf;
$ret = new ModelMail();
if ($id == -2 && empty($label)) {
@ -1214,7 +1215,7 @@ class FormMail extends Form
$languagetosearchmain = $tmparray[0].'_'.strtoupper($tmparray[0]);
if ($languagetosearchmain == $languagetosearch) $languagetosearchmain = '';
$sql = "SELECT rowid, label, topic, joinfiles, content, content_lines, lang";
$sql = "SELECT rowid, module, label, type_template, topic, joinfiles, content, content_lines, lang";
$sql .= " FROM ".MAIN_DB_PREFIX.'c_email_templates';
$sql .= " WHERE (type_template='".$db->escape($type_template)."' OR type_template='all')";
$sql .= " AND entity IN (".getEntity('c_email_templates').")";
@ -1226,72 +1227,92 @@ class FormMail extends Form
if ($id == -1) $sql .= " AND position=0";
if ($languagetosearch) $sql .= $db->order("position,lang,label", "ASC,DESC,ASC"); // We want line with lang set first, then with lang null or ''
else $sql .= $db->order("position,lang,label", "ASC,ASC,ASC"); // If no language provided, we give priority to lang not defined
$sql .= $db->plimit(1);
//$sql .= $db->plimit(1);
//print $sql;
$resql = $db->query($sql);
if ($resql)
if (!$resql)
{
// Get first found
dol_print_error($db);
return -1;
}
// Get first found
while (1) {
$obj = $db->fetch_object($resql);
if ($obj) {
// If template is for a module, check module is enabled; if not, take next template
if ($obj->module) {
$tempmodulekey = $obj->module;
if (empty($conf->$tempmodulekey) || empty($conf->$tempmodulekey->enabled)) {
continue;
}
}
// If a record was found
$ret->id = $obj->rowid;
$ret->module = $obj->module;
$ret->label = $obj->label;
$ret->lang = $obj->lang;
$ret->topic = $obj->topic;
$ret->content = $obj->content;
$ret->content_lines = $obj->content_lines;
$ret->joinfiles = $obj->joinfiles;
} elseif ($id == -2) {
// Not found with the provided label
return -1;
} else { // If there is no template at all
$defaultmessage = '';
if ($type_template == 'body') {
// Special case to use this->withbody as content
$defaultmessage = $this->withbody;
} elseif ($type_template == 'facture_send') {
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendInvoice");
} elseif ($type_template == 'facture_relance') {
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendInvoiceReminder");
} elseif ($type_template == 'propal_send') {
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendProposal");
} elseif ($type_template == 'supplier_proposal_send') {
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendSupplierProposal");
} elseif ($type_template == 'order_send') {
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendOrder");
} elseif ($type_template == 'order_supplier_send') {
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendSupplierOrder");
} elseif ($type_template == 'invoice_supplier_send') {
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendSupplierInvoice");
} elseif ($type_template == 'shipping_send') {
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendShipping");
} elseif ($type_template == 'fichinter_send') {
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendFichInter");
} elseif ($type_template == 'actioncomm_send') {
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendActionComm");
} elseif ($type_template == 'thirdparty') {
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentThirdparty");
} elseif (!empty($type_template)) {
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentGeneric");
break;
} else {
// If no record found
if ($id == -2) {
// Not found with the provided label
return -1;
} else {
// If there is no template at all
$defaultmessage = '';
if ($type_template == 'body') {
// Special case to use this->withbody as content
$defaultmessage = $this->withbody;
} elseif ($type_template == 'facture_send') {
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendInvoice");
} elseif ($type_template == 'facture_relance') {
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendInvoiceReminder");
} elseif ($type_template == 'propal_send') {
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendProposal");
} elseif ($type_template == 'supplier_proposal_send') {
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendSupplierProposal");
} elseif ($type_template == 'order_send') {
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendOrder");
} elseif ($type_template == 'order_supplier_send') {
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendSupplierOrder");
} elseif ($type_template == 'invoice_supplier_send') {
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendSupplierInvoice");
} elseif ($type_template == 'shipping_send') {
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendShipping");
} elseif ($type_template == 'fichinter_send') {
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendFichInter");
} elseif ($type_template == 'actioncomm_send') {
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendActionComm");
} elseif ($type_template == 'thirdparty') {
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentThirdparty");
} elseif (!empty($type_template)) {
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentGeneric");
}
$ret->label = 'default';
$ret->lang = $outputlangs->defaultlang;
$ret->topic = '';
$ret->joinfiles = 1;
$ret->content = $defaultmessage;
$ret->content_lines = '';
break;
}
$ret->label = 'default';
$ret->lang = $outputlangs->defaultlang;
$ret->topic = '';
$ret->joinfiles = 1;
$ret->content = $defaultmessage;
$ret->content_lines = '';
}
$db->free($resql);
return $ret;
} else {
dol_print_error($db);
return -1;
}
$db->free($resql);
return $ret;
}
/**
@ -1338,7 +1359,9 @@ class FormMail extends Form
*/
public function fetchAllEMailTemplate($type_template, $user, $outputlangs, $active = 1)
{
$sql = "SELECT rowid, label, topic, content, content_lines, lang, fk_user, private, position";
global $conf;
$sql = "SELECT rowid, module, label, topic, content, content_lines, lang, fk_user, private, position";
$sql .= " FROM ".MAIN_DB_PREFIX.'c_email_templates';
$sql .= " WHERE type_template IN ('".$this->db->escape($type_template)."', 'all')";
$sql .= " AND entity IN (".getEntity('c_email_templates').")";
@ -1355,6 +1378,14 @@ class FormMail extends Form
$this->lines_model = array();
while ($obj = $this->db->fetch_object($resql))
{
// If template is for a module, check module is enabled.
if ($obj->module) {
$tempmodulekey = $obj->module;
if (empty($conf->$tempmodulekey) || empty($conf->$tempmodulekey->enabled)) {
continue;
}
}
$line = new ModelMail();
$line->id = $obj->rowid;
$line->label = $obj->label;

View File

@ -530,6 +530,7 @@ function hideMessage(fieldId,message) {
* @param string token Token
*/
function setConstant(url, code, input, entity, strict, forcereload, userid, token) {
var saved_url = url; /* avoid undefined url */
$.post( url, {
action: "set",
name: code,
@ -574,7 +575,7 @@ function setConstant(url, code, input, entity, strict, forcereload, userid, toke
$.each(data, function(key, value) {
$("#set_" + key).hide();
$("#del_" + key).show();
$.post( url, {
$.post( saved_url, {
action: "set",
name: key,
value: value,
@ -604,6 +605,7 @@ function setConstant(url, code, input, entity, strict, forcereload, userid, toke
* @param string token Token
*/
function delConstant(url, code, input, entity, strict, forcereload, userid, token) {
var saved_url = url; /* avoid undefined url */
$.post( url, {
action: "del",
name: code,
@ -645,7 +647,7 @@ function delConstant(url, code, input, entity, strict, forcereload, userid, toke
$.each(data, function(key, value) {
$("#del_" + value).hide();
$("#set_" + value).show();
$.post( url, {
$.post( saved_url, {
action: "del",
name: value,
entity: entity,

View File

@ -620,7 +620,7 @@ function dol_get_first_day_week($day, $month, $year, $gm = false)
*/
function getGMTEasterDatetime($year)
{
$base = new DateTime("$year-03-21");
$base = new DateTime("$year-03-21", new DateTimeZone("UTC"));
$days = easter_days($year); // Return number of days between 21 march and easter day.
$tmp = $base->add(new DateInterval("P{$days}D"));
return $tmp->getTimestamp();
@ -628,11 +628,11 @@ function getGMTEasterDatetime($year)
/**
* Return the number of non working days including saturday and sunday (or not) between 2 dates in timestamp.
* Dates must be UTC with hour, day, min to 0.
* Dates must be UTC with hour, min, sec to 0.
* Called by function num_open_day()
*
* @param int $timestampStart Timestamp de debut
* @param int $timestampEnd Timestamp de fin
* @param int $timestampStart Timestamp start (UTC with hour, min, sec = 0)
* @param int $timestampEnd Timestamp end (UTC with hour, min, sec = 0)
* @param string $country_code Country code
* @param int $lastday Last day is included, 0: no, 1:yes
* @param int $includesaturday Include saturday as non working day (-1=use setup, 0=no, 1=yes)
@ -721,32 +721,20 @@ function num_public_holiday($timestampStart, $timestampEnd, $country_code = '',
{
// Calculation for the monday of easter date
$date_paques = getGMTEasterDatetime($annee);
$date_lundi_paques = mktime(
gmdate("H", $date_paques),
gmdate("i", $date_paques),
gmdate("s", $date_paques),
gmdate("m", $date_paques),
gmdate("d", $date_paques) + 1,
gmdate("Y", $date_paques)
);
//print 'PPP'.$date_paques.' '.dol_print_date($date_paques, 'dayhour', 'gmt')." ";
$date_lundi_paques = $date_paques + (3600 * 24);
$jour_lundi_paques = gmdate("d", $date_lundi_paques);
$mois_lundi_paques = gmdate("m", $date_lundi_paques);
if ($jour_lundi_paques == $jour && $mois_lundi_paques == $mois) $ferie = true;
// Easter (monday)
//print 'annee='.$annee.' $jour='.$jour.' $mois='.$mois.' $jour_lundi_paques='.$jour_lundi_paques.' $mois_lundi_paques='.$mois_lundi_paques."\n";
}
if (in_array('ascension', $specialdayrule))
{
// Calcul du jour de l'ascension (39 days after easter day)
$date_paques = getGMTEasterDatetime($annee);
$date_ascension = mktime(
gmdate("H", $date_paques),
gmdate("i", $date_paques),
gmdate("s", $date_paques),
gmdate("m", $date_paques),
gmdate("d", $date_paques) + 39,
gmdate("Y", $date_paques)
);
$date_ascension = $date_paques + (3600 * 24 * 39);
$jour_ascension = gmdate("d", $date_ascension);
$mois_ascension = gmdate("m", $date_ascension);
if ($jour_ascension == $jour && $mois_ascension == $mois) $ferie = true;
@ -757,14 +745,7 @@ function num_public_holiday($timestampStart, $timestampEnd, $country_code = '',
{
// Calculation of "Pentecote" (49 days after easter day)
$date_paques = getGMTEasterDatetime($annee);
$date_pentecote = mktime(
gmdate("H", $date_paques),
gmdate("i", $date_paques),
gmdate("s", $date_paques),
gmdate("m", $date_paques),
gmdate("d", $date_paques) + 49,
gmdate("Y", $date_paques)
);
$date_pentecote = $date_paques + (3600 * 24 * 49);
$jour_pentecote = gmdate("d", $date_pentecote);
$mois_pentecote = gmdate("m", $date_pentecote);
if ($jour_pentecote == $jour && $mois_pentecote == $mois) $ferie = true;
@ -774,14 +755,7 @@ function num_public_holiday($timestampStart, $timestampEnd, $country_code = '',
{
// Calculation of "Pentecote" (49 days after easter day)
$date_paques = getGMTEasterDatetime($annee);
$date_pentecote = mktime(
gmdate("H", $date_paques),
gmdate("i", $date_paques),
gmdate("s", $date_paques),
gmdate("m", $date_paques),
gmdate("d", $date_paques) + 50,
gmdate("Y", $date_paques)
);
$date_pentecote = $date_paques + (3600 * 24 * 50);
$jour_pentecote = gmdate("d", $date_pentecote);
$mois_pentecote = gmdate("m", $date_pentecote);
if ($jour_pentecote == $jour && $mois_pentecote == $mois) $ferie = true;
@ -792,14 +766,7 @@ function num_public_holiday($timestampStart, $timestampEnd, $country_code = '',
{
// Viernes Santo
$date_paques = getGMTEasterDatetime($annee);
$date_viernes = mktime(
gmdate("H", $date_paques),
gmdate("i", $date_paques),
gmdate("s", $date_paques),
gmdate("m", $date_paques),
gmdate("d", $date_paques) - 2,
gmdate("Y", $date_paques)
);
$date_viernes = $date_paques - (3600 * 24 * 2);
$jour_viernes = gmdate("d", $date_viernes);
$mois_viernes = gmdate("m", $date_viernes);
if ($jour_viernes == $jour && $mois_viernes == $mois) $ferie = true;
@ -810,14 +777,7 @@ function num_public_holiday($timestampStart, $timestampEnd, $country_code = '',
{
// Fronleichnam (60 days after easter sunday)
$date_paques = getGMTEasterDatetime($annee);
$date_fronleichnam = mktime(
gmdate("H", $date_paques),
gmdate("i", $date_paques),
gmdate("s", $date_paques),
gmdate("m", $date_paques),
gmdate("d", $date_paques) + 60,
gmdate("Y", $date_paques)
);
$date_fronleichnam = $date_paques + (3600 * 24 * 60);
$jour_fronleichnam = gmdate("d", $date_fronleichnam);
$mois_fronleichnam = gmdate("m", $date_fronleichnam);
if ($jour_fronleichnam == $jour && $mois_fronleichnam == $mois) $ferie = true;

View File

@ -3272,7 +3272,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'help', 'holiday',
'intervention', 'label', 'language', 'link', 'list', 'listlight', 'lot',
'map-marker-alt', 'member', 'money-bill-alt', 'mrp', 'note', 'next',
'object_accounting', 'object_account', 'object_accountline', 'object_action', 'object_barcode', 'object_bill', 'object_billa', 'object_billd', 'object_bom',
'object_accounting', 'object_account', 'object_accountline', 'object_action', 'object_barcode', 'object_bill', 'object_billa', 'object_billr', 'object_billd', 'object_bom',
'object_category', 'object_conversation', 'object_bookmark', 'object_bug', 'object_clock', 'object_dolly', 'object_dollyrevert', 'object_generic', 'object_folder',
'object_list-alt', 'object_calendar', 'object_calendarweek', 'object_calendarmonth', 'object_calendarday', 'object_calendarperuser',
'object_cash-register', 'object_company', 'object_contact', 'object_contract', 'object_donation', 'object_dynamicprice',
@ -3312,7 +3312,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
$arrayconvpictotofa = array(
'account'=>'university', 'accountline'=>'receipt', 'accountancy'=>'money-check-alt', 'action'=>'calendar-alt', 'add'=>'plus-circle', 'address'=> 'address-book',
'bank_account'=>'university', 'bill'=>'file-invoice-dollar', 'billa'=>'file-excel', 'supplier_invoicea'=>'file-excel', 'billd'=>'file-medical', 'supplier_invoiced'=>'file-medical', 'bom'=>'cubes',
'bank_account'=>'university', 'bill'=>'file-invoice-dollar', 'billa'=>'file-excel', 'billr'=>'file-invoice-dollar', 'supplier_invoicea'=>'file-excel', 'billd'=>'file-medical', 'supplier_invoiced'=>'file-medical', 'bom'=>'cubes',
'company'=>'building', 'contact'=>'address-book', 'contract'=>'suitcase', 'conversation'=>'comments', 'donation'=>'file-alt', 'dynamicprice'=>'hand-holding-usd',
'setup'=>'cog', 'companies'=>'building', 'products'=>'cube', 'commercial'=>'suitcase', 'invoicing'=>'coins',
'accounting'=>'chart-line', 'category'=>'tag', 'dollyrevert'=>'dolly',
@ -3381,7 +3381,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
$arrayconvpictotomorcess = array(
'action'=>'infobox-action', 'account'=>'infobox-bank_account', 'accountline'=>'infobox-bank_account', 'accountancy'=>'infobox-bank_account',
'bank_account'=>'bg-infobox-bank_account',
'bill'=>'infobox-commande', 'billa'=>'infobox-commande', 'billd'=>'infobox-commande',
'bill'=>'infobox-commande', 'billa'=>'infobox-commande', 'billr'=>'infobox-commande', 'billd'=>'infobox-commande',
'cash-register'=>'infobox-bank_account', 'contract'=>'infobox-contrat', 'check'=>'font-status4', 'conversation'=>'infobox-contrat',
'donation'=>'infobox-commande', 'dollyrevert'=>'flip', 'ecm'=>'infobox-action',
'hrm'=>'infobox-adherent', 'group'=>'infobox-adherent', 'intervention'=>'infobox-contrat',

View File

@ -292,7 +292,8 @@ class modAccounting extends DolibarrModules
'b.subledger_label'=>'SubledgerAccountLabel',
'b.label_operation'=>'LabelOperation',
'b.debit'=>"Debit",
'b.credit'=>"Credit"
'b.credit'=>"Credit",
'b.sens'=>'Direction' // This field is still used by accounting export. We can remove it once it has been replace into accountancyexport.class.php by a detection using ->debit and ->credit
);
$this->import_fieldshidden_array[$r] = array('b.doc_type'=>'const-import_from_external', 'b.fk_doc'=>'const-0', 'b.fk_docdet'=>'const-0', 'b.fk_user_author'=>'user->id', 'b.date_creation'=>'const-'.dol_print_date(dol_now(), 'standard')); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent)
$this->import_regex_array[$r] = array('b.doc_date'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$');
@ -309,7 +310,8 @@ class modAccounting extends DolibarrModules
'b.subledger_label'=>'',
'b.label_operation'=>"Sale of ABC",
'b.debit'=>"0",
'b.credit'=>"100"
'b.credit'=>"100",
'b.sens'=>'C' // This field is still used by accounting export. We can remove it once it has been replace into accountancyexport.class.php by a detection using ->debit and ->credit
);
// Chart of accounts

View File

@ -69,13 +69,15 @@ if (!empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) || !empty($conf->global->FA
if (in_array($object->element, array('propal', 'commande', 'facture')) && $object->status == $object::STATUS_DRAFT)
{
global $mysoc;
print img_edit($langs->trans("UpdateForAllLines"), 0, 'class="clickvatforalllines opacitymedium paddingleft cursorpointer"');
print '<script>$(document).ready(function() { $(".clickvatforalllines").click(function() { jQuery(".classvatforalllines").toggle(); }); });</script>';
print '<div class="classvatforalllines hidden inline-block nowraponall">';
//print '<input class="inline-block maxwidth50" type="text" name="vatforalllines" id="vatforalllines" value="">';
print $form->load_tva('vatforalllines', '', $mysoc, $object->thirdparty, 0, 0, '', false, 1);
print '<input class="inline-block button smallpaddingimp" type="submit" name="submitforalllines" value="'.$langs->trans("Update").'">';
print '</div>';
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?mode=vatforalllines&id='.$object->id.'">'.img_edit($langs->trans("UpdateForAllLines"), 0, 'class="clickvatforalllines opacitymedium paddingleft cursorpointer"').'</a>';
//print '<script>$(document).ready(function() { $(".clickvatforalllines").click(function() { jQuery(".classvatforalllines").toggle(); }); });</script>';
if (GETPOST('mode', 'aZ09') == 'vatforalllines') {
print '<div class="classvatforalllines inline-block nowraponall">';
print $form->load_tva('vatforalllines', '', $mysoc, $object->thirdparty, 0, 0, '', false, 1);
print '<input class="inline-block button smallpaddingimp" type="submit" name="submitforalllines" value="'.$langs->trans("Update").'">';
print '</div>';
}
}
print '</td>';

View File

@ -322,24 +322,26 @@ print '<td width="60" class="center">'.$langs->trans("Value")."</td>\n";
print '<td></td>';
print "</tr>\n";
if (!empty($conf->societe->enabled)) {
print '<tr class="oddeven">';
print '<td colspan="2">';
print $langs->trans("DonationUseThirdparties");
print '</td>';
print '<td class="center">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('DONATION_USE_THIRDPARTIES');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("DONATION_USE_THIRDPARTIES", $arrval, $conf->global->DONATION_USE_THIRDPARTIES);
}
print "</td>\n";
print "</tr>\n";
}
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'" />';
print '<input type="hidden" name="action" value="set_DONATION_ACCOUNTINGACCOUNT" />';
print '<tr class="oddeven">';
print '<td colspan="2">';
print $form->textwithpicto($langs->trans("DonationUserThirdparties"), $langs->trans("DonationUserThirdpartiesDesc"));
print '</td>';
print '<td class="center">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('DONATION_USE_THIRDPARTIES');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("DONATION_USE_THIRDPARTIES", $arrval, $conf->global->DONATION_USE_THIRDPARTIES);
}
print "</td>\n";
print "</tr>\n";
print '<tr class="oddeven">';
print '<td>';
$label = $langs->trans("AccountAccounting");

View File

@ -44,7 +44,7 @@ if (!empty($conf->projet->enabled)) {
}
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$langs->loadLangs(array("bills", "companies", "donations"));
$langs->loadLangs(array("bills", "companies", "donations", "users"));
$id = GETPOST('rowid') ?GETPOST('rowid', 'int') : GETPOST('id', 'int');
$action = GETPOST('action', 'aZ09');
@ -179,15 +179,18 @@ if ($action == 'add')
$error = 0;
if (empty($donation_date))
{
if (!empty($conf->societe->enabled) && !empty($conf->global->DONATION_USE_THIRDPARTIES) && !(GETPOST("socid", 'int') > 0)) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ThirdParty")), null, 'errors');
$action = "create";
$error++;
}
if (empty($donation_date)) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
$action = "create";
$error++;
}
if (empty($amount))
{
if (empty($amount)) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Amount")), null, 'errors');
$action = "create";
$error++;
@ -347,16 +350,16 @@ if ($action == 'create')
print '<tbody>';
// Ref
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans('Ref').'</td><td colspan="2">'.$langs->trans('Draft').'</td></tr>';
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans('Ref').'</td><td>'.$langs->trans('Draft').'</td></tr>';
// Company
if (!empty($conf->societe->enabled) && !empty($conf->global->DONATION_USE_THIRDPARTIES))
{
// Thirdparty
print '<td>'.$langs->trans('Customer').'</td>';
if ($soc->id > 0 && !GETPOST('fac_rec', 'alpha'))
if ($soc->id > 0)
{
print '<td colspan="2">';
print '<td class="fieldrequired">'.$langs->trans('ThirdParty').'</td>';
print '<td>';
print $soc->getNomUrl(1);
print '<input type="hidden" name="socid" value="'.$soc->id.'">';
// Outstanding Bill
@ -372,7 +375,8 @@ if ($action == 'create')
print ')';
print '</td>';
} else {
print '<td colspan="2">';
print '<td class="fieldrequired">'.$langs->trans('ThirdParty').'</td>';
print '<td>';
print $form->select_company($soc->id, 'socid', '(s.client = 1 OR s.client = 3) AND status=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300');
// Option to reload page to retrieve customer informations. Note, this clear other input
if (!empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED))
@ -389,7 +393,7 @@ if ($action == 'create')
});
</script>';
}
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&client=3&fournisseur=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddThirdParty").'</span><span class="fa fa-plus-circle valignmiddle paddingleft"></span></a>';
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&client=3&fournisseur=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddThirdParty").'"></span></a>';
print '</td>';
}
print '</tr>'."\n";
@ -545,11 +549,15 @@ if (!empty($id) && $action == 'edit')
print "</td>";
print "</tr>\n";
if ($object->socid && !empty($conf->societe->enabled) && !empty($conf->global->DONATION_USE_THIRDPARTIES)) {
if (!empty($conf->societe->enabled) && !empty($conf->global->DONATION_USE_THIRDPARTIES)) {
$company = new Societe($db);
$result = $company->fetch($object->socid);
print '<tr><td>'.$langs->trans("LinkedToDolibarrThirdParty").'</td><td colspan="2">'.$company->getNomUrl(1).'</td></tr>';
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td colspan="2">';
if ($object->socid > 0) {
$result = $company->fetch($object->socid);
print $company->getNomUrl(1);
}
print '</td></tr>';
} else {
$langs->load("companies");
print '<tr><td>'.$langs->trans("Company").'</td><td><input type="text" name="societe" class="maxwidth200" value="'.dol_escape_htmltag($object->societe).'"></td></tr>';
@ -707,11 +715,15 @@ if (!empty($id) && $action != 'edit')
print yn($object->public);
print '</td></tr>';
if ($object->socid) {
if (!empty($conf->societe->enabled) && !empty($conf->global->DONATION_USE_THIRDPARTIES)) {
$company = new Societe($db);
$result = $company->fetch($object->socid);
print '<tr><td>'.$langs->trans("LinkedToDolibarrThirdParty").'</td><td colspan="2">'.$company->getNomUrl(1).'</td></tr>';
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td colspan="2">';
if ($object->socid > 0) {
$result = $company->fetch($object->socid);
print $company->getNomUrl(1);
}
print '</td></tr>';
} else {
print '<tr><td>'.$langs->trans("Company").'</td><td colspan="2">'.$object->societe.'</td></tr>';
print '<tr><td>'.$langs->trans("Lastname").'</td><td colspan="2">'.$object->lastname.'</td></tr>';

View File

@ -2299,6 +2299,10 @@ class FactureFournisseur extends CommonInvoice
if ($this->type == self::TYPE_REPLACEMENT) $label = '<u class="paddingrightonly">'.$langs->transnoentitiesnoconv("InvoiceReplace").'</u>';
elseif ($this->type == self::TYPE_CREDIT_NOTE) $label = '<u class="paddingrightonly">'.$langs->transnoentitiesnoconv("CreditNote").'</u>';
elseif ($this->type == self::TYPE_DEPOSIT) $label = '<u class="paddingrightonly">'.$langs->transnoentitiesnoconv("Deposit").'</u>';
if (isset($this->status)) {
$alreadypaid = -1;
$label .= ' '.$this->getLibStatut(5, $alreadypaid);
}
if (!empty($this->ref))
$label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
if (!empty($this->ref_supplier))

View File

@ -579,3 +579,8 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value
insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 6,'AC_EMAIL_IN','system','reception Email',NULL, 1, 4);
-- VMYSQL4.3 ALTER TABLE llx_accounting_bookkeeping MODIFY COLUMN montant double(24,8) NULL;
-- VPGSQL8.2 ALTER TABLE llx_accounting_bookkeeping ALTER COLUMN montant DROP NOT NULL;

View File

@ -35,7 +35,7 @@ CREATE TABLE llx_accounting_bookkeeping
label_operation varchar(255), -- FEC:EcritureLib | label of the operation
debit double(24,8) NOT NULL, -- FEC:Debit
credit double(24,8) NOT NULL, -- FEC:Credit
montant double(24,8) NOT NULL, -- FEC:Montant (Not necessary)
montant double(24,8) NULL, -- FEC:Montant (Not necessary)
sens varchar(1) DEFAULT NULL, -- FEC:Sens (Not necessary)
multicurrency_amount double(24,8), -- FEC:Montantdevise
multicurrency_code varchar(255), -- FEC:Idevise

View File

@ -21,7 +21,7 @@ CountryNL=Netherlands
CountryHU=Hungary
CountryRU=Russia
CountrySE=Sweden
CountryCI=Ivoiry Coast
CountryCI=Ivory Coast
CountrySN=Senegal
CountryAR=Argentina
CountryCM=Cameroon

View File

@ -32,3 +32,4 @@ DONATION_ART238=Show article 238 from CGI if you are concerned
DONATION_ART885=Show article 885 from CGI if you are concerned
DonationPayment=Donation payment
DonationValidated=Donation %s validated
DonationUseThirdparties=Use an existing thirdparty as coordinates of donators

View File

@ -1115,3 +1115,4 @@ EventReminder=Event Reminder
UpdateForAllLines=Update for all lines
OnHold=On hold
Civility=Civility
InformationOnLinkToContract=This amount is only the total of all the lines of the contract. No notion of time is taken into consideration.

View File

@ -869,7 +869,7 @@ if (!$source)
print '</td><td class="CTableRow'.($var ? '1' : '2').'">';
if (empty($amount) || !is_numeric($amount))
{
print '<input type="hidden" name="amount" value="'.GETPOST("amount", 'int').'">';
print '<input type="hidden" name="amount" value="'.price2num(GETPOST("amount", 'alpha'), 'MT').'">';
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price2num(GETPOST("newamount", "alpha"), 'MT').'">';
} else {
print '<b>'.price($amount).'</b>';
@ -915,7 +915,7 @@ if ($source == 'order')
if ($action != 'dopayment') // Do not change amount if we just click on first dopayment
{
$amount = $order->total_ttc;
if (GETPOST("amount", 'int')) $amount = GETPOST("amount", 'int');
if (GETPOST("amount", 'alpha')) $amount = GETPOST("amount", 'alpha');
$amount = price2num($amount);
}
@ -961,7 +961,7 @@ if ($source == 'order')
print '</td><td class="CTableRow'.($var ? '1' : '2').'">';
if (empty($amount) || !is_numeric($amount))
{
print '<input type="hidden" name="amount" value="'.GETPOST("amount", 'int').'">';
print '<input type="hidden" name="amount" value="'.price2num(GETPOST("amount", 'alpha'), 'MT').'">';
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price2num(GETPOST("newamount", "alpha"), 'MT').'">';
} else {
print '<b>'.price($amount).'</b>';
@ -1033,7 +1033,7 @@ if ($source == 'invoice')
if ($action != 'dopayment') // Do not change amount if we just click on first dopayment
{
$amount = price2num($invoice->total_ttc - ($invoice->getSommePaiement() + $invoice->getSumCreditNotesUsed() + $invoice->getSumDepositsUsed()));
if (GETPOST("amount", 'int')) $amount = GETPOST("amount", 'int');
if (GETPOST("amount", 'int')) $amount = GETPOST("amount", 'alpha');
$amount = price2num($amount);
}
@ -1082,7 +1082,7 @@ if ($source == 'invoice')
} elseif (empty($object->paye)) {
if (empty($amount) || !is_numeric($amount))
{
print '<input type="hidden" name="amount" value="'.GETPOST("amount", 'int').'">';
print '<input type="hidden" name="amount" value="'.price2num(GETPOST("amount", 'alpha'), 'MT').'">';
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price2num(GETPOST("newamount", "alpha"), 'MT').'">';
} else {
print '<b>'.price($amount).'</b>';
@ -1198,7 +1198,7 @@ if ($source == 'contractline')
}
}
if (GETPOST("amount", 'int')) $amount = GETPOST("amount", 'int');
if (GETPOST("amount", 'alpha')) $amount = GETPOST("amount", 'alpha');
$amount = price2num($amount);
}
@ -1286,7 +1286,7 @@ if ($source == 'contractline')
print '</td><td class="CTableRow'.($var ? '1' : '2').'">';
if (empty($amount) || !is_numeric($amount))
{
print '<input type="hidden" name="amount" value="'.GETPOST("amount", 'int').'">';
print '<input type="hidden" name="amount" value="'.price2num(GETPOST("amount", 'alpha'), 'MT').'">';
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price2num(GETPOST("newamount", "alpha"), 'MT').'">';
} else {
print '<b>'.price($amount).'</b>';
@ -1359,8 +1359,8 @@ if ($source == 'membersubscription')
if ($action != 'dopayment') // Do not change amount if we just click on first dopayment
{
$amount = $subscription->total_ttc;
if (GETPOST("amount", 'int')) $amount = GETPOST("amount", 'int');
$amount = price2num($amount);
if (GETPOST("amount", 'alpha')) $amount = GETPOST("amount", 'alpha');
$amount = price2num($amount, 'MT');
}
if (GETPOST('fulltag', 'alpha')) {
@ -1448,11 +1448,19 @@ if ($source == 'membersubscription')
{
//$valtoshow=price2num(GETPOST("newamount",'alpha'),'MT');
if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow);
print '<input type="hidden" name="amount" value="'.GETPOST("amount", 'int').'">';
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.$valtoshow.'">';
print '<input type="hidden" name="amount" value="'.price2num(GETPOST("amount", 'alpha'), 'MT').'">';
if (empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)) {
print '<input class="flat maxwidth75" type="text" name="newamountbis" value="'.$valtoshow.'" disabled>';
print '<input type="hidden" name="newamount" value="'.$valtoshow.'">';
} else {
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.$valtoshow.'">';
}
} else {
$valtoshow = $amount;
if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow);
if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) {
$valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow);
$amount = $valtoshow;
}
print '<b>'.price($valtoshow).'</b>';
print '<input type="hidden" name="amount" value="'.$valtoshow.'">';
print '<input type="hidden" name="newamount" value="'.$valtoshow.'">';
@ -1521,7 +1529,7 @@ if ($source == 'donation')
if ($action != 'dopayment') // Do not change amount if we just click on first dopayment
{
$amount = $subscription->total_ttc;
if (GETPOST("amount", 'int')) $amount = GETPOST("amount", 'int');
if (GETPOST("amount", 'alpha')) $amount = GETPOST("amount", 'alpha');
$amount = price2num($amount);
}
@ -1587,11 +1595,14 @@ if ($source == 'donation')
{
//$valtoshow=price2num(GETPOST("newamount",'alpha'),'MT');
if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow);
print '<input type="hidden" name="amount" value="'.GETPOST("amount", 'int').'">';
print '<input type="hidden" name="amount" value="'.price2num(GETPOST("amount", 'alpha'), 'MT').'">';
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.$valtoshow.'">';
} else {
$valtoshow = $amount;
if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow);
if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) {
$valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow);
$amount = $valtoshow;
}
print '<b>'.price($valtoshow).'</b>';
print '<input type="hidden" name="amount" value="'.$valtoshow.'">';
print '<input type="hidden" name="newamount" value="'.$valtoshow.'">';
@ -2089,6 +2100,10 @@ if (preg_match('/^dopayment/', $action)) // If we choosed/click on the payment
}
else
{
/* Disable button to pay and show hourglass cursor */
jQuery('#hourglasstopay').show();
jQuery('#buttontopay').hide();
stripe.handleCardPayment(
clientSecret, cardElement, {
payment_method_data: {

View File

@ -74,7 +74,7 @@ if (empty($conf) || !is_object($conf))
<td width="25%">
<table class="nobordernopadding">
<tr>
<td><input type="text" name="code_client" size="16" value="<?php echo $this->control->tpl['customercode']; ?>" maxlength="15"></td>
<td><input type="text" name="code_client" size="16" value="<?php echo $this->control->tpl['customercode']; ?>" maxlength="24"></td>
<td><?php echo $this->control->tpl['help_customercode']; ?></td>
</tr>
</table>
@ -89,7 +89,7 @@ if (empty($conf) || !is_object($conf))
<td>
<table class="nobordernopadding">
<tr>
<td><input type="text" name="code_fournisseur" size="16" value="<?php echo $this->control->tpl['suppliercode']; ?>" maxlength="15"></td>
<td><input type="text" name="code_fournisseur" size="16" value="<?php echo $this->control->tpl['suppliercode']; ?>" maxlength="24"></td>
<td><?php echo $this->control->tpl['help_suppliercode']; ?></td>
</tr>
</table>

View File

@ -75,7 +75,7 @@ $contact = $GLOBALS['objcanvas']->control->object;
<tr>
<td>
<?php if ($this->control->tpl['ismodifiable_customercode']) { ?>
<input type="text" name="code_client" size="16" value="<?php echo $this->control->tpl['customercode']; ?>" maxlength="15">
<input type="text" name="code_client" size="16" value="<?php echo $this->control->tpl['customercode']; ?>" maxlength="24">
<?php } else { ?>
<?php echo $this->control->tpl['customercode']; ?>
<input type="hidden" name="code_client" value="<?php echo $this->control->tpl['customercode']; ?>">
@ -96,7 +96,7 @@ $contact = $GLOBALS['objcanvas']->control->object;
<tr>
<td>
<?php if ($this->control->tpl['ismodifiable_suppliercode']) { ?>
<input type="text" name="code_fournisseur" size="16" value="<?php echo $this->control->tpl['suppliercode']; ?>" maxlength="15">
<input type="text" name="code_fournisseur" size="16" value="<?php echo $this->control->tpl['suppliercode']; ?>" maxlength="24">
<?php } else { ?>
<?php echo $this->control->tpl['suppliercode']; ?>
<input type="hidden" name="code_fournisseur" value="<?php echo $this->control->tpl['suppliercode']; ?>">

View File

@ -84,7 +84,7 @@ if (empty($conf) || !is_object($conf))
<td width="25%">
<table class="nobordernopadding">
<tr>
<td><input type="text" name="code_client" size="16" value="<?php echo $this->control->tpl['customercode']; ?>" maxlength="15"></td>
<td><input type="text" name="code_client" size="16" value="<?php echo $this->control->tpl['customercode']; ?>" maxlength="24"></td>
<td><?php echo $this->control->tpl['help_customercode']; ?></td>
</tr>
</table>
@ -99,7 +99,7 @@ if (empty($conf) || !is_object($conf))
<td>
<table class="nobordernopadding">
<tr>
<td><input type="text" name="code_fournisseur" size="16" value="<?php echo $this->control->tpl['suppliercode']; ?>" maxlength="15"></td>
<td><input type="text" name="code_fournisseur" size="16" value="<?php echo $this->control->tpl['suppliercode']; ?>" maxlength="24"></td>
<td><?php echo $this->control->tpl['help_suppliercode']; ?></td>
</tr>
</table>

View File

@ -73,7 +73,7 @@ if (empty($conf) || !is_object($conf))
<tr>
<td>
<?php if ($this->control->tpl['ismodifiable_customercode']) { ?>
<input type="text" name="code_client" size="16" value="<?php echo $this->control->tpl['customercode']; ?>" maxlength="15">
<input type="text" name="code_client" size="16" value="<?php echo $this->control->tpl['customercode']; ?>" maxlength="24">
<?php } else { ?>
<?php echo $this->control->tpl['customercode']; ?>
<input type="hidden" name="code_client" value="<?php echo $this->control->tpl['customercode']; ?>">
@ -94,7 +94,7 @@ if (empty($conf) || !is_object($conf))
<tr>
<td>
<?php if ($this->control->tpl['ismodifiable_suppliercode']) { ?>
<input type="text" name="code_fournisseur" size="16" value="<?php echo $this->control->tpl['suppliercode']; ?>" maxlength="15">
<input type="text" name="code_fournisseur" size="16" value="<?php echo $this->control->tpl['suppliercode']; ?>" maxlength="24">
<?php } else { ?>
<?php echo $this->control->tpl['suppliercode']; ?>
<input type="hidden" name="code_fournisseur" value="<?php echo $this->control->tpl['suppliercode']; ?>">

View File

@ -1253,7 +1253,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
print '<table class="nobordernopadding"><tr><td>';
$tmpcode = $object->code_client;
if (empty($tmpcode) && !empty($modCodeClient->code_auto)) $tmpcode = $modCodeClient->getNextValue($object, 0);
print '<input type="text" name="customer_code" id="customer_code" class="maxwidthonsmartphone" value="'.dol_escape_htmltag($tmpcode).'" maxlength="15">';
print '<input type="text" name="customer_code" id="customer_code" class="maxwidthonsmartphone" value="'.dol_escape_htmltag($tmpcode).'" maxlength="24">';
print '</td><td>';
$s = $modCodeClient->getToolTip($langs, $object, 0);
print $form->textwithpicto('', $s, 1);
@ -1285,7 +1285,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
print '<table class="nobordernopadding"><tr><td>';
$tmpcode = $object->code_fournisseur;
if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) $tmpcode = $modCodeFournisseur->getNextValue($object, 1);
print '<input type="text" name="supplier_code" id="supplier_code" class="maxwidthonsmartphone" value="'.dol_escape_htmltag($tmpcode).'" maxlength="15">';
print '<input type="text" name="supplier_code" id="supplier_code" class="maxwidthonsmartphone" value="'.dol_escape_htmltag($tmpcode).'" maxlength="24">';
print '</td><td>';
$s = $modCodeFournisseur->getToolTip($langs, $object, 1);
print $form->textwithpicto('', $s, 1);
@ -1840,10 +1840,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
$tmpcode = $object->code_client;
if (empty($tmpcode) && !empty($object->oldcopy->code_client)) $tmpcode = $object->oldcopy->code_client; // When there is an error to update a thirdparty, the number for supplier and customer code is kept to old value.
if (empty($tmpcode) && !empty($modCodeClient->code_auto)) $tmpcode = $modCodeClient->getNextValue($object, 0);
print '<input type="text" name="customer_code" id="customer_code" size="16" value="'.dol_escape_htmltag($tmpcode).'" maxlength="15">';
print '<input type="text" name="customer_code" id="customer_code" size="16" value="'.dol_escape_htmltag($tmpcode).'" maxlength="24">';
} elseif ($object->codeclient_modifiable())
{
print '<input type="text" name="customer_code" id="customer_code" size="16" value="'.dol_escape_htmltag($object->code_client).'" maxlength="15">';
print '<input type="text" name="customer_code" id="customer_code" size="16" value="'.dol_escape_htmltag($object->code_client).'" maxlength="24">';
} else {
print $object->code_client;
print '<input type="hidden" name="customer_code" value="'.dol_escape_htmltag($object->code_client).'">';
@ -1878,10 +1878,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
$tmpcode = $object->code_fournisseur;
if (empty($tmpcode) && !empty($object->oldcopy->code_fournisseur)) $tmpcode = $object->oldcopy->code_fournisseur; // When there is an error to update a thirdparty, the number for supplier and customer code is kept to old value.
if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) $tmpcode = $modCodeFournisseur->getNextValue($object, 1);
print '<input type="text" name="supplier_code" id="supplier_code" size="16" value="'.dol_escape_htmltag($tmpcode).'" maxlength="15">';
print '<input type="text" name="supplier_code" id="supplier_code" size="16" value="'.dol_escape_htmltag($tmpcode).'" maxlength="24">';
} elseif ($object->codefournisseur_modifiable())
{
print '<input type="text" name="supplier_code" id="supplier_code" size="16" value="'.dol_escape_htmltag($object->code_fournisseur).'" maxlength="15">';
print '<input type="text" name="supplier_code" id="supplier_code" size="16" value="'.dol_escape_htmltag($object->code_fournisseur).'" maxlength="24">';
} else {
print $object->code_fournisseur;
print '<input type="hidden" name="supplier_code" value="'.$object->code_fournisseur.'">';

View File

@ -254,7 +254,7 @@ class Ticket extends CommonObject
'entity' => array('type'=>'integer', 'label'=>'Entity', 'visible'=>0, 'enabled'=>1, 'position'=>5, 'notnull'=>1, 'index'=>1),
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'visible'=>1, 'enabled'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", 'css'=>''),
'track_id' => array('type'=>'varchar(255)', 'label'=>'TicketTrackId', 'visible'=>-2, 'enabled'=>1, 'position'=>11, 'notnull'=>-1, 'searchall'=>1, 'help'=>"Help text"),
'fk_user_create' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Author', 'visible'=>1, 'enabled'=>1, 'position'=>15, 'notnull'=>1, 'css'=>'tdoverflowmax150 maxwidth150onsmartphone'),
'fk_user_create' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Author', 'visible'=>1, 'enabled'=>1, 'position'=>15, 'notnull'=>1, 'css'=>'tdoverflowmax125 maxwidth150onsmartphone'),
'origin_email' => array('type'=>'mail', 'label'=>'OriginEmail', 'visible'=>-2, 'enabled'=>1, 'position'=>16, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", 'css'=>'tdoverflowmax150'),
'subject' => array('type'=>'varchar(255)', 'label'=>'Subject', 'visible'=>1, 'enabled'=>1, 'position'=>18, 'notnull'=>-1, 'searchall'=>1, 'help'=>"", 'css'=>'maxwidth200 tdoverflowmax200', 'autofocusoncreate'=>1),
'type_code' => array('type'=>'varchar(32)', 'label'=>'Type', 'visible'=>1, 'enabled'=>1, 'position'=>20, 'notnull'=>-1, 'help'=>"", 'css'=>'maxwidth125 tdoverflowmax50'),
@ -266,7 +266,7 @@ class Ticket extends CommonObject
'timing' => array('type'=>'varchar(20)', 'label'=>'Timing', 'visible'=>-1, 'enabled'=>1, 'position'=>42, 'notnull'=>-1, 'help'=>""),
'datec' => array('type'=>'datetime', 'label'=>'DateCreation', 'visible'=>1, 'enabled'=>1, 'position'=>500, 'notnull'=>1),
'date_read' => array('type'=>'datetime', 'label'=>'TicketReadOn', 'visible'=>-1, 'enabled'=>1, 'position'=>501, 'notnull'=>1),
'fk_user_assign' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'AssignedTo', 'visible'=>1, 'enabled'=>1, 'position'=>505, 'notnull'=>1, 'css'=>'tdoverflowmax150'),
'fk_user_assign' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'AssignedTo', 'visible'=>1, 'enabled'=>1, 'position'=>505, 'notnull'=>1, 'css'=>'tdoverflowmax125'),
'date_close' => array('type'=>'datetime', 'label'=>'TicketCloseOn', 'visible'=>-1, 'enabled'=>1, 'position'=>510, 'notnull'=>1),
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'visible'=>-1, 'enabled'=>1, 'position'=>520, 'notnull'=>1),
'message' => array('type'=>'text', 'label'=>'Message', 'visible'=>-2, 'enabled'=>1, 'position'=>540, 'notnull'=>-1,),

View File

@ -362,7 +362,7 @@ foreach ($search as $key => $val)
}
if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
if ($search_societe) $sql .= natural_search('s.nom', $search_societe);
//if ($search_fk_project) $sql .= natural_search('fk_project', $search_fk_project, 2);
if ($search_fk_project) $sql .= natural_search('fk_project', $search_fk_project, 2);
if ($search_date_start) $sql .= " AND t.datec >= '".$db->idate($search_date_start)."'";
if ($search_date_end) $sql .= " AND t.datec <= '".$db->idate($search_date_end)."'";
if ($search_dateread_start) $sql .= " AND t.date_read >= '".$db->idate($search_dateread_start)."'";
@ -667,7 +667,7 @@ foreach ($object->fields as $key => $val)
print '</td>';
} elseif ($key == 'fk_user_assign' || $key == 'fk_user_create') {
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
print $form->select_dolusers($search[$key], 'search_'.$key, 1, null, 0, '', '', '0', 0, 0, '', 0, '', ($val['css'] ? $val['css'] : 'maxwidth150'));
print $form->select_dolusers($search[$key], 'search_'.$key, 1, null, 0, '', '', '0', 0, 0, '', 0, '', ($val['css'] ? $val['css'] : 'maxwidth125'));
print '</td>';
} elseif ($key == 'fk_statut') {
$arrayofstatus = array();
@ -681,7 +681,7 @@ foreach ($object->fields as $key => $val)
//var_dump($arrayofstatus);var_dump($search['fk_statut']);var_dump(array_values($search[$key]));
$selectedarray = null;
if ($search[$key]) $selectedarray = array_values($search[$key]);
print Form::multiselectarray('search_fk_statut', $arrayofstatus, $selectedarray, 0, 0, 'minwidth150', 1, 0, '', '', '');
print Form::multiselectarray('search_fk_statut', $arrayofstatus, $selectedarray, 0, 0, 'minwidth100 maxwidth150', 1, 0, '', '', '');
print '</td>';
} elseif ($key == "fk_soc") {
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'"><input type="text" class="flat maxwidth75" name="search_societe" value="'.dol_escape_htmltag($search_societe).'"></td>';

View File

@ -69,7 +69,13 @@ class DateLibTest extends PHPUnit\Framework\TestCase
$this->savlangs=$langs;
$this->savdb=$db;
$langs->load("admin");
print __METHOD__." db->type=".$db->type." user->id=".$user->id;
print "\n".$langs->trans("CurrentTimeZone").' : '.getServerTimeZoneString();
print "\n".$langs->trans("CurrentHour").' : '.dol_print_date(dol_now('gmt'), 'dayhour', 'tzserver');
//print " - db ".$db->db;
print "\n";
}
@ -139,8 +145,8 @@ class DateLibTest extends PHPUnit\Framework\TestCase
$db=$this->savdb;
// With same hours
$date1=dol_mktime(0, 0, 0, 1, 1, 2012);
$date2=dol_mktime(0, 0, 0, 1, 2, 2012);
$date1=dol_mktime(0, 0, 0, 1, 1, 2012, 'gmt');
$date2=dol_mktime(0, 0, 0, 1, 2, 2012, 'gmt');
$result=num_between_day($date1, $date2, 1);
print __METHOD__." result=".$result."\n";
@ -151,8 +157,8 @@ class DateLibTest extends PHPUnit\Framework\TestCase
$this->assertEquals(1, $result);
// With different hours
$date1=dol_mktime(0, 0, 0, 1, 1, 2012);
$date2=dol_mktime(12, 0, 0, 1, 2, 2012);
$date1=dol_mktime(0, 0, 0, 1, 1, 2012, 'gmt');
$date2=dol_mktime(12, 0, 0, 1, 2, 2012, 'gmt');
$result=num_between_day($date1, $date2, 1);
print __METHOD__." result=".$result."\n";
@ -190,26 +196,27 @@ class DateLibTest extends PHPUnit\Framework\TestCase
$langs=$this->savlangs;
$db=$this->savdb;
// With same hours - Tuesday/Wednesday jan 2013
$date1=dol_mktime(0, 0, 0, 1, 1, 2013);
$date2=dol_mktime(0, 0, 0, 1, 2, 2013);
$date3=dol_mktime(0, 0, 0, 1, 3, 2013);
// With same hours - Tuesday/Wednesday jan 2013
$date1=dol_mktime(0, 0, 0, 1, 1, 2013, 'gmt');
$date2=dol_mktime(0, 0, 0, 1, 2, 2013, 'gmt');
$date3=dol_mktime(0, 0, 0, 1, 3, 2013, 'gmt');
$result=num_public_holiday($date1, $date2, 'FR', 1);
print __METHOD__." result=".$result."\n";
$this->assertEquals(1, $result, 'NumPublicHoliday for Tuesday 1 - Wednesday 2 jan 2013 for FR'); // 1 closed days (country france)
$result=num_public_holiday($date1, $date2, 'FR', 1);
print __METHOD__." for Tuesday 1 - Wednesday 2 jan 2013 for FR result=".$result."\n";
$this->assertEquals(1, $result, 'NumPublicHoliday for Tuesday 1 - Wednesday 2 jan 2013 for FR'); // 1 closed days (country france)
$result=num_public_holiday($date1, $date2, 'XX', 1);
print __METHOD__." result=".$result."\n";
$this->assertEquals(1, $result, 'NumPublicHoliday for Tuesday 1 - Wednesday 2 jan 2013 for XX'); // 1 closed days (country unknown)
$result=num_public_holiday($date1, $date2, 'XX', 1);
print __METHOD__." for Tuesday 1 - Wednesday 2 jan 2013 for XX result=".$result."\n";
$this->assertEquals(1, $result, 'NumPublicHoliday for Tuesday 1 - Wednesday 2 jan 2013 for XX'); // 1 closed days (country unknown)
$result=num_public_holiday($date2, $date3, 'FR', 1);
print __METHOD__." result=".$result."\n";
$this->assertEquals(0, $result, 'NumPublicHoliday for Wednesday 2 - Thursday 3 jan 2013 for FR'); // no closed days
print '----'."\n";
$result=num_public_holiday($date2, $date3, 'FR', 1);
print __METHOD__." for Wednesday 2 - Thursday 3 jan 2013 for FR result=".$result."\n";
$this->assertEquals(0, $result, 'NumPublicHoliday for Wednesday 2 - Thursday 3 jan 2013 for FR'); // no closed days
// Check with easter monday
$date1=dol_mktime(0, 0, 0, 4, 21, 2019);
$date2=dol_mktime(0, 0, 0, 4, 23, 2019);
// Check with easter monday
$date1=dol_mktime(0, 0, 0, 4, 21, 2019, 'gmt');
$date2=dol_mktime(0, 0, 0, 4, 23, 2019, 'gmt');
$result=num_public_holiday($date1, $date2, 'XX', 1);
print __METHOD__." result=".$result."\n";
@ -219,9 +226,9 @@ class DateLibTest extends PHPUnit\Framework\TestCase
print __METHOD__." result=".$result."\n";
$this->assertEquals(2, $result, 'NumPublicHoliday including eastermonday for FR'); // 1 opened day, 2 closed days (sunday + easter monday)
// Check for sunday/saturday - Friday 4 - Sunday 6 jan 2013
$date1=dol_mktime(0, 0, 0, 1, 4, 2013);
$date2=dol_mktime(0, 0, 0, 1, 6, 2013);
// Check for sunday/saturday - Friday 4 - Sunday 6 jan 2013
$date1=dol_mktime(0, 0, 0, 1, 4, 2013, 'gmt');
$date2=dol_mktime(0, 0, 0, 1, 6, 2013, 'gmt');
$result=num_public_holiday($date1, $date2, 'FR', 1);
print __METHOD__." result=".$result."\n";
@ -257,10 +264,10 @@ class DateLibTest extends PHPUnit\Framework\TestCase
$langs=$this->savlangs;
$db=$this->savdb;
// With same hours - Tuesday/Wednesday jan 2013
$date1=dol_mktime(0, 0, 0, 1, 1, 2013);
$date2=dol_mktime(0, 0, 0, 1, 2, 2013);
$date3=dol_mktime(0, 0, 0, 1, 3, 2013);
// With same hours - Tuesday/Wednesday jan 2013
$date1=dol_mktime(0, 0, 0, 1, 1, 2013, 'gmt');
$date2=dol_mktime(0, 0, 0, 1, 2, 2013, 'gmt');
$date3=dol_mktime(0, 0, 0, 1, 3, 2013, 'gmt');
$result=num_open_day($date1, $date2, 0, 1, 0, 'FR');
print __METHOD__." result=".$result."\n";
@ -274,9 +281,9 @@ class DateLibTest extends PHPUnit\Framework\TestCase
print __METHOD__." result=".$result."\n";
$this->assertEquals(2, $result, 'NumOpenDay Wednesday 2 - Thursday 3 jan 2013 for FR'); // 2 opened days
// With same hours - Friday/Sunday jan 2013
$date1=dol_mktime(0, 0, 0, 1, 4, 2013);
$date2=dol_mktime(0, 0, 0, 1, 6, 2013);
// With same hours - Friday/Sunday jan 2013
$date1=dol_mktime(0, 0, 0, 1, 4, 2013, 'gmt');
$date2=dol_mktime(0, 0, 0, 1, 6, 2013, 'gmt');
$result=num_open_day($date1, $date2, 0, 1, 0, 'FR');
print __METHOD__." result=".$result."\n";
@ -328,7 +335,6 @@ class DateLibTest extends PHPUnit\Framework\TestCase
print __METHOD__." result=".$result."\n";
$this->assertSame('1 '.$langs->trans("Day"), $result);
return $result;
}

View File

@ -83,8 +83,8 @@ class DateLibTzFranceTest extends PHPUnit\Framework\TestCase
{
global $conf,$user,$langs,$db;
if (getServerTimeZoneString() != 'Europe/Paris') {
print "\n".__METHOD__." This PHPUnit test can be launched manually only onto a server with PHP timezone set to TZ+1 Europe/Paris, not a TZ=".getServerTimeZoneString().".\n"; die();
if (getServerTimeZoneString() != 'Europe/Paris' && getServerTimeZoneString() != 'Europe/Berlin') {
print "\n".__METHOD__." This PHPUnit test can be launched manually only onto a server with PHP timezone set to TZ=Europe/Paris, not a TZ=".getServerTimeZoneString().".\n"; die();
}
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.