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

This commit is contained in:
John Botella 2019-08-02 14:52:01 +02:00
commit b4c4e5a662
117 changed files with 2359 additions and 789 deletions

View File

@ -1,6 +1,12 @@
# .scrutinizer.yml
#build:
# - php-scrutinizer-run
build:
nodes:
analysis:
tests:
override:
- php-scrutinizer-run
imports:
- javascript

View File

@ -32,7 +32,7 @@ PSR/simple-cache ? Library for cache (used by PHPSp
Restler 3.0.0RC6 LGPL-3+ Yes Library to develop REST Web services (+ swagger-ui js lib into dir explorer)
Sabre 3.2.2 BSD Yes DAV support
Swift Mailer 5.4.2-DEV MIT license Yes Comprehensive mailing tools for PHP
Stripe 6.35 MIT licence Yes Library for Stripe module
Stripe 6.41 MIT licence Yes Library for Stripe module
TCPDF 6.2.25 LGPL-3+ Yes PDF generation
TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes FPDI replacement

View File

@ -38,6 +38,7 @@ require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php
$langs->loadLangs(array("accountancy", "bills", "compta"));
$action = GETPOST('action', 'aZ09');
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
$id = GETPOST('id', 'int'); // id of record
$mode = GETPOST('mode', 'aZ09'); // '' or 'tmp'
@ -346,6 +347,8 @@ if ($action == 'create')
}
print '<form action="' . $_SERVER["PHP_SELF"] . '" name="create_mvt" method="POST">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="confirm_create">' . "\n";
print '<input type="hidden" name="next_num_mvt" value="' . $next_num_mvt . '">' . "\n";
print '<input type="hidden" name="mode" value="_tmp">' . "\n";
@ -441,7 +444,8 @@ if ($action == 'create')
print '</td><td colspan="3">';
if ($action == 'editdate') {
print '<form name="setdate" action="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $object->piece_num . '" method="post">';
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="setdate">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
print $form->selectDate($object->doc_date ? $object->doc_date : - 1, 'doc_date', '', '', '', "setdate");
@ -464,7 +468,8 @@ if ($action == 'create')
print '</td><td>';
if ($action == 'editjournal') {
print '<form name="setjournal" action="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $object->piece_num . '" method="post">';
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="setjournal">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
print $formaccounting->select_journal($object->code_journal, 'code_journal', 0, 0, array(), 1, 1);
@ -487,7 +492,8 @@ if ($action == 'create')
print '</td><td>';
if ($action == 'editdocref') {
print '<form name="setdocref" action="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $object->piece_num . '" method="post">';
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="setdocref">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
print '<input type="text" size="20" name="doc_ref" value="'.dol_escape_htmltag($object->doc_ref).'">';
@ -583,6 +589,8 @@ if ($action == 'create')
print load_fiche_titre($langs->trans("ListeMvts"), '', '');
print '<form action="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $object->piece_num . '" method="post">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="doc_date" value="' . $object->doc_date . '">' . "\n";
print '<input type="hidden" name="doc_type" value="' . $object->doc_type . '">' . "\n";
print '<input type="hidden" name="doc_ref" value="' . $object->doc_ref . '">' . "\n";
@ -641,8 +649,8 @@ if ($action == 'create')
print '<td>' . $accountingaccount->getNomUrl(0, 1, 1, '', 0) . '</td>';
print '<td>' . length_accounta($line->subledger_account) . '</td>';
print '<td>' . $line->label_operation. '</td>';
print '<td class="right">' . price($line->debit) . '</td>';
print '<td class="right">' . price($line->credit) . '</td>';
print '<td class="nowrap right">' . price($line->debit) . '</td>';
print '<td class="nowrap right">' . price($line->credit) . '</td>';
print '<td class="center">';
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=update&id=' . $line->id . '&piece_num=' . $line->piece_num . '&mode='.$mode.'">';
@ -675,7 +683,7 @@ if ($action == 'create')
print $formaccounting->select_account('', 'accountingaccount_number', 1, array (), 1, 1, '');
print '</td>';
print '<td>';
// TODO For the moment we keep a fre input text instead of a combo. The select_auxaccount has problem because it does not
// TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because it does not
// use setup of keypress to select thirdparty and this hang browser on large database.
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
{

View File

@ -789,7 +789,7 @@ if ($num > 0)
// Amount debit
if (! empty($arrayfields['t.debit']['checked']))
{
print '<td class="right">' . ($line->debit ? price($line->debit) : ''). '</td>';
print '<td class="nowrap right">' . ($line->debit ? price($line->debit) : ''). '</td>';
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totaldebitfield']=$totalarray['nbfield'];
$totalarray['totaldebit'] += $line->debit;
@ -798,7 +798,7 @@ if ($num > 0)
// Amount credit
if (! empty($arrayfields['t.credit']['checked']))
{
print '<td class="right">' . ($line->credit ? price($line->credit) : '') . '</td>';
print '<td class="nowrap right">' . ($line->credit ? price($line->credit) : '') . '</td>';
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totalcreditfield']=$totalarray['nbfield'];
$totalarray['totalcredit'] += $line->credit;
@ -879,8 +879,8 @@ if ($num > 0)
if ($num < $limit && empty($offset)) print '<td class="left">'.$langs->trans("Total").'</td>';
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
}
elseif ($totalarray['totaldebitfield'] == $i) print '<td class="right">'.price($totalarray['totaldebit']).'</td>';
elseif ($totalarray['totalcreditfield'] == $i) print '<td class="right">'.price($totalarray['totalcredit']).'</td>';
elseif ($totalarray['totaldebitfield'] == $i) print '<td class="nowrap right">'.price($totalarray['totaldebit']).'</td>';
elseif ($totalarray['totalcreditfield'] == $i) print '<td class="nowrap right">'.price($totalarray['totalcredit']).'</td>';
else print '<td></td>';
}
$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql);

View File

@ -5,7 +5,7 @@
* Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2016 Pierre-Henry Favre <phf@atm-consulting.fr>
* Copyright (C) 2016-2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2016-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2017 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2017 Elarifr. Ari Elbaz <github@accedinfo.com>
* Copyright (C) 2017-2019 Frédéric France <frederic.france@netlogic.fr>
@ -48,8 +48,10 @@ class AccountancyExport
public static $EXPORT_TYPE_BOB50 = 35;
public static $EXPORT_TYPE_CIEL = 40;
public static $EXPORT_TYPE_SAGE50_SWISS = 45;
public static $EXPORT_TYPE_CHARLEMAGNE = 50;
public static $EXPORT_TYPE_QUADRATUS = 60;
public static $EXPORT_TYPE_OPENCONCERTO = 100;
public static $EXPORT_TYPE_LDCOMPTA = 110;
public static $EXPORT_TYPE_FEC = 1000;
@ -105,7 +107,9 @@ class AccountancyExport
self::$EXPORT_TYPE_AGIRIS => $langs->trans('Modelcsv_agiris'),
self::$EXPORT_TYPE_OPENCONCERTO => $langs->trans('Modelcsv_openconcerto'),
self::$EXPORT_TYPE_SAGE50_SWISS => $langs->trans('Modelcsv_Sage50_Swiss'),
self::$EXPORT_TYPE_LDCOMPTA => $langs->trans('Modelcsv_LDCompta'),
self::$EXPORT_TYPE_FEC => $langs->trans('Modelcsv_FEC'),
self::$EXPORT_TYPE_CHARLEMAGNE => $langs->trans('Modelcsv_charlemagne'),
);
ksort($listofexporttypes, SORT_NUMERIC);
@ -133,6 +137,7 @@ class AccountancyExport
self::$EXPORT_TYPE_AGIRIS => 'agiris',
self::$EXPORT_TYPE_OPENCONCERTO => 'openconcerto',
self::$EXPORT_TYPE_SAGE50_SWISS => 'sage50ch',
self::$EXPORT_TYPE_LDCOMPTA => 'ldcompta',
self::$EXPORT_TYPE_FEC => 'fec',
);
@ -191,10 +196,18 @@ class AccountancyExport
'label' => $langs->trans('Modelcsv_Sage50_Swiss'),
'ACCOUNTING_EXPORT_FORMAT' => 'csv',
),
self::$EXPORT_TYPE_LDCOMPTA => array(
'label' => $langs->trans('Modelcsv_LDCompta'),
'ACCOUNTING_EXPORT_FORMAT' => 'csv',
),
self::$EXPORT_TYPE_FEC => array(
'label' => $langs->trans('Modelcsv_FEC'),
'ACCOUNTING_EXPORT_FORMAT' => 'txt',
),
self::$EXPORT_TYPE_CHARLEMAGNE => array(
'label' => $langs->trans('Modelcsv_charlemagne'),
'ACCOUNTING_EXPORT_FORMAT' => 'txt',
),
),
'cr'=> array (
'1' => $langs->trans("Unix"),
@ -257,12 +270,18 @@ class AccountancyExport
case self::$EXPORT_TYPE_OPENCONCERTO :
$this->exportOpenConcerto($TData);
break;
case self::$EXPORT_TYPE_FEC :
$this->exportFEC($TData);
break;
case self::$EXPORT_TYPE_SAGE50_SWISS :
$this->exportSAGE50SWISS($TData);
break;
case self::$EXPORT_TYPE_LDCOMPTA :
$this->exportLDCompta($TData);
break;
case self::$EXPORT_TYPE_FEC :
$this->exportFEC($TData);
break;
case self::$EXPORT_TYPE_CHARLEMAGNE :
$this->exportCharlemagne($TData);
break;
default:
$this->errors[] = $langs->trans('accountancy_error_modelnotfound');
break;
@ -274,7 +293,6 @@ class AccountancyExport
* Export format : CEGID
*
* @param array $objectLines data
*
* @return void
*/
public function exportCegid($objectLines)
@ -300,7 +318,6 @@ class AccountancyExport
* Export format : COGILOG
*
* @param array $objectLines data
*
* @return void
*/
public function exportCogilog($objectLines)
@ -334,7 +351,6 @@ class AccountancyExport
* Export format : COALA
*
* @param array $objectLines data
*
* @return void
*/
public function exportCoala($objectLines)
@ -362,7 +378,6 @@ class AccountancyExport
* Export format : BOB50
*
* @param array $objectLines data
*
* @return void
*/
public function exportBob50($objectLines)
@ -401,7 +416,6 @@ class AccountancyExport
* Export format : CIEL
*
* @param array $TData data
*
* @return void
*/
public function exportCiel(&$TData)
@ -442,7 +456,6 @@ class AccountancyExport
* Export format : Quadratus
*
* @param array $TData data
*
* @return void
*/
public function exportQuadratus(&$TData)
@ -526,7 +539,6 @@ class AccountancyExport
* Export format : EBP
*
* @param array $objectLines data
*
* @return void
*/
public function exportEbp($objectLines)
@ -563,7 +575,6 @@ class AccountancyExport
* Export format : Agiris Isacompta
*
* @param array $objectLines data
*
* @return void
*/
public function exportAgiris($objectLines)
@ -604,7 +615,6 @@ class AccountancyExport
* Export format : OpenConcerto
*
* @param array $objectLines data
*
* @return void
*/
public function exportOpenConcerto($objectLines)
@ -634,16 +644,17 @@ class AccountancyExport
}
/**
* Export format : Configurable
* Export format : Configurable CSV
*
* @param array $objectLines data
*
* @return void
*/
public function exportConfigurable($objectLines)
{
global $conf;
$separator = $this->separator;
foreach ($objectLines as $line) {
$tab = array();
// export configurable
@ -651,15 +662,14 @@ class AccountancyExport
$tab[] = $line->piece_num;
$tab[] = $date;
$tab[] = $line->doc_ref;
$tab[] = $line->label_operation;
$tab[] = preg_match('/'.$separator.'/', $line->label_operation) ? "'".$line->label_operation."'" : $line->label_operation;
$tab[] = length_accountg($line->numero_compte);
$tab[] = length_accounta($line->subledger_account);
$tab[] = price($line->debit);
$tab[] = price($line->credit);
$tab[] = price($line->montant);
$tab[] = price2num($line->debit);
$tab[] = price2num($line->credit);
$tab[] = price2num($line->montant);
$tab[] = $line->code_journal;
$separator = $this->separator;
print implode($separator, $tab) . $this->end_line;
}
}
@ -668,7 +678,6 @@ class AccountancyExport
* Export format : FEC
*
* @param array $objectLines data
*
* @return void
*/
public function exportFEC($objectLines)
@ -909,6 +918,162 @@ class AccountancyExport
}
}
/**
* Export format : LD Compta version 9 & higher
* http://www.ldsysteme.fr/fileadmin/telechargement/np/ldcompta/Documentation/IntCptW10.pdf
*
* @param array $objectLines data
*
* @return void
*/
public function exportLDCompta($objectLines)
{
$separator = ';';
$end_line = "\n";
foreach ($objectLines as $line) {
$date_document = dol_print_date($line->doc_date, '%Y%m%d');
$date_creation = dol_print_date($line->date_creation, '%Y%m%d');
// TYPE
$type_enregistrement = 'E'; // For write movement
print $type_enregistrement . $separator;
// JNAL
print substr($line->code_journal, 0, 2) . $separator;
// NECR
print $line->id . $separator;
// NPIE
print $line->piece_num . $separator;
// DATP
print $date_document . $separator;
// LIBE
print $line->label_operation . $separator;
// DATH
print $line->date_lim_reglement . $separator;
// CNPI
if ($line->doc_type == 'supplier_invoice') {
if ($line->montant < 0) {
$nature_piece = 'AF';
} else {
$nature_piece = 'FF';
}
} elseif ($line->doc_type == 'customer_invoice') {
if ($line->montant < 0) {
$nature_piece = 'AC';
} else {
$nature_piece = 'FC';
}
} else {
$nature_piece = '';
}
print $nature_piece . $separator;
// RACI
/*
if (! empty($line->subledger_account)) {
if ($line->doc_type == 'supplier_invoice') {
$racine_subledger_account = '40';
} elseif ($line->doc_type == 'customer_invoice') {
$racine_subledger_account = '41';
} else {
$nature_piece = '';
}
print $racine_subledger_account . $separator;
} else {
print $separator;
}
*/
// MONT
print price(abs($line->montant)) . $separator;
// CODC
print $line->sens . $separator;
// CPTG
print length_accountg($line->numero_compte) . $separator;
// DATE
print $date_creation . $separator;
// CLET
print $line->lettering_code . $separator;
// DATL
print $line->date_lettering . $separator;
// CPTA
if (! empty($line->subledger_account)) {
print length_accounta($line->subledger_account) . $separator;
}
// CNAT
if ($line->doc_type == 'supplier_invoice' && ! empty($line->subledger_account)) {
print 'F';
} elseif ($line->doc_type == 'customer_invoice' && ! empty($line->subledger_account)) {
print 'C';
} else {
print '';
}
print $end_line;
}
}
/**
* Export format : Charlemagne
*
* @param array $objectLines data
*
* @return void
*/
public function exportCharlemagne($objectLines)
{
global $langs;
$langs->load('compta');
$separator = "\t";
$end_line = "\n";
/*
* Charlemagne export need header
*/
print $langs->transnoentitiesnoconv('Date') . $separator;
print self::trunc($langs->transnoentitiesnoconv('Journal'), 6) . $separator;
print self::trunc($langs->transnoentitiesnoconv('Account'), 15) . $separator;
print self::trunc($langs->transnoentitiesnoconv('LabelAccount'), 60) . $separator;
print self::trunc($langs->transnoentitiesnoconv('Piece'), 20) . $separator;
print self::trunc($langs->transnoentitiesnoconv('LabelOperation'), 60) . $separator;
print $langs->transnoentitiesnoconv('Amount') . $separator;
print 'S' . $separator;
print self::trunc($langs->transnoentitiesnoconv('Analytic') . ' 1', 15) . $separator;
print self::trunc($langs->transnoentitiesnoconv('AnalyticLabel') . ' 1', 60) . $separator;
print self::trunc($langs->transnoentitiesnoconv('Analytic') . ' 2', 15) . $separator;
print self::trunc($langs->transnoentitiesnoconv('AnalyticLabel') . ' 2', 60) . $separator;
print self::trunc($langs->transnoentitiesnoconv('Analytic') . ' 3', 15) . $separator;
print self::trunc($langs->transnoentitiesnoconv('AnalyticLabel') . ' 3', 60) . $separator;
print $end_line;
foreach($objectLines as $line) {
$date = dol_print_date($line->doc_date, '%Y%m%d');
print $date . $separator; //Date
print self::trunc($line->code_journal, 6) . $separator; //Journal code
if(!empty($line->subledger_account)) $account = $line->subledger_account;
else $account = $line->numero_compte;
print self::trunc($account, 15) . $separator;//Account number
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 $line->sens . $separator;//Direction
print $separator;//Analytic
print $separator;//Analytic
print $separator;//Analytic
print $separator;//Analytic
print $separator;//Analytic
print $separator;//Analytic
print $end_line;
}
}
/**
* trunc
*

View File

@ -469,14 +469,15 @@ class BookKeeping extends CommonObject
*/
public function createStd(User $user, $notrigger = false, $mode = '')
{
global $conf;
global $conf, $langs;
$langs->loadLangs(array("accountancy", "bills", "compta"));
dol_syslog(__METHOD__, LOG_DEBUG);
$error = 0;
// Clean parameters
if (isset($this->doc_type)) {
$this->doc_type = trim($this->doc_type);
}
@ -540,7 +541,7 @@ class BookKeeping extends CommonObject
$now = dol_now();
// Check parameters
// Put here code to add control on parameters values
$this->journal_label = $langs->trans($this->journal_label);
// Insert request
$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . $mode.' (';

View File

@ -1187,7 +1187,7 @@ else
}
// Morphy
$morphys["phy"] = $langs->trans("Physical");
$morphys["mor"] = $langs->trans("Morale");
$morphys["mor"] = $langs->trans("Moral");
print '<tr><td><span class="fieldrequired">'.$langs->trans("MemberNature").'</span></td><td>';
print $form->selectarray("morphy", $morphys, (GETPOSTISSET("morphy")?GETPOST("morphy", 'alpha'):$object->morphy));
print "</td></tr>";

View File

@ -53,21 +53,21 @@ class Subscription extends CommonObject
* @var integer
*/
public $datec;
/**
* Date modification record (tms)
*
* @var integer
*/
public $datem;
/**
* Subscription start date (date subscription)
*
* @var integer
*/
public $dateh;
/**
* Subscription end date
*
@ -128,10 +128,11 @@ class Subscription extends CommonObject
$sql = "INSERT INTO ".MAIN_DB_PREFIX."subscription (fk_adherent, fk_type, datec, dateadh, datef, subscription, note)";
if ($this->fk_type == null) {
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
$member=new Adherent($this->db);
$result=$member->fetch($this->fk_adherent);
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
$member=new Adherent($this->db);
$result=$member->fetch($this->fk_adherent);
if ($this->fk_type == null) { // If type not defined, we use the type of member
$type=$member->typeid;
} else {
$type=$this->fk_type;
@ -151,11 +152,13 @@ class Subscription extends CommonObject
if (! $error)
{
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element);
$this->fk_type = $type;
}
if (! $error && ! $notrigger)
{
// Call triggers
$this->context = array('member'=>$member);
// Call triggers
$result=$this->call_trigger('MEMBER_SUBSCRIPTION_CREATE', $user);
if ($result < 0) { $error++; }
// End call triggers
@ -257,7 +260,8 @@ class Subscription extends CommonObject
$result=$member->update_end_date($user);
if (! $error && ! $notrigger) {
// Call triggers
$this->context = array('member'=>$member);
// Call triggers
$result=$this->call_trigger('MEMBER_SUBSCRIPTION_MODIFY', $user);
if ($result < 0) { $error++; } //Do also here what you must do to rollback action if trigger fail
// End call triggers

View File

@ -182,7 +182,7 @@ if ($result > 0)
if (empty($dn))
{
$langs->load("errors");
print '<tr '.$bc[false].'><td colspan="2"><font class="error">'.$langs->trans("ErrorModuleSetupNotComplete").'</font></td></tr>';
print '<tr '.$bc[false].'><td colspan="2"><font class="error">'.$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Member")).'</font></td></tr>';
}
else
{

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2007-2019 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -205,18 +205,18 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit')
print $form->showrefnav($object, 'rowid', $linkback, 1);
print '</td></tr>';
// Type
// Member
$adh->ref=$adh->getFullName($langs);
print '<tr>';
print '<td>'.$langs->trans("Member").'</td><td class="valeur" colspan="3">'.$adh->getNomUrl(1, 0, 'subscription').'</td>';
print '</tr>';
// Type
print '<tr>';
print '<td>'.$langs->trans("Type").'</td><td class="valeur" colspan="3">';
print $form->selectarray("typeid", $adht->liste_array(), (isset($_POST["typeid"])?$_POST["typeid"]:$object->fk_type));
print'</td></tr>';
// Member
$adh->ref=$adh->getFullName($langs);
print '<tr>';
print '<td>'.$langs->trans("Member").'</td><td class="valeur" colspan="3">'.$adh->getNomUrl(1, 0, 'subscription').'</td>';
print '</tr>';
// Date start subscription
print '<tr><td>'.$langs->trans("DateSubscription").'</td><td class="valeur" colspan="2">';
print $form->selectDate($object->dateh, 'datesub', 1, 1, 0, 'update', 1);
@ -309,6 +309,12 @@ if ($rowid && $action != 'edit')
print '<table class="border" width="100%">';
// Member
$adh->ref=$adh->getFullName($langs);
print '<tr>';
print '<td class="titlefield">'.$langs->trans("Member").'</td><td class="valeur">'.$adh->getNomUrl(1, 0, 'subscription').'</td>';
print '</tr>';
// Type
print '<tr>';
print '<td class="titlefield">'.$langs->trans("Type").'</td>';
@ -322,17 +328,6 @@ if ($rowid && $action != 'edit')
}
print '</td></tr>';
// Member
$adh->ref=$adh->getFullName($langs);
print '<tr>';
print '<td class="titlefield">'.$langs->trans("Member").'</td><td class="valeur">'.$adh->getNomUrl(1, 0, 'subscription').'</td>';
print '</tr>';
// Date record
/*print '<tr>';
print '<td>'.$langs->trans("DateSubscription").'</td><td class="valeur">'.dol_print_date($object->datec,'dayhour').'</td>';
print '</tr>';*/
// Date subscription
print '<tr>';
print '<td>'.$langs->trans("DateSubscription").'</td><td class="valeur">'.dol_print_date($object->dateh, 'day').'</td>';

View File

@ -342,7 +342,7 @@ if ($action == 'create')
// Morphy
$morphys[""] = $langs->trans("MorPhy");
$morphys["phy"] = $langs->trans("Physical");
$morphys["mor"] = $langs->trans("Morale");
$morphys["mor"] = $langs->trans("Moral");
print '<tr><td><span>'.$langs->trans("MemberNature").'</span></td><td>';
print $form->selectarray("morphy", $morphys, isset($_POST["morphy"])?$_POST["morphy"]:$object->morphy);
print "</td></tr>";
@ -775,7 +775,7 @@ if ($rowid > 0)
// Morphy
$morphys[""] = $langs->trans("MorPhy");
$morphys["phy"] = $langs->trans("Physical");
$morphys["mor"] = $langs->trans("Morale");
$morphys["mor"] = $langs->trans("Moral");
print '<tr><td><span>'.$langs->trans("MemberNature").'</span></td><td>';
print $form->selectarray("morphy", $morphys, isset($_POST["morphy"])?$_POST["morphy"]:$object->morphy);
print "</td></tr>";

View File

@ -37,12 +37,12 @@ $action = GETPOST('action', 'aZ09');
/*
* Actions
*/
if ($action == 'setvalue' && $user->admin)
{
$result=dolibarr_set_const($db, "CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS", GETPOST("CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS"), 'chaine', 0, '', $conf->entity);
$result=dolibarr_set_const($db, "CLICKTODIAL_URL", GETPOST("CLICKTODIAL_URL"), 'chaine', 0, '', $conf->entity);
$result1=dolibarr_set_const($db, "CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS", GETPOST("CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS"), 'chaine', 0, '', $conf->entity);
$result2=dolibarr_set_const($db, "CLICKTODIAL_URL", GETPOST("CLICKTODIAL_URL"), 'chaine', 0, '', $conf->entity);
if ($result1 >= 0 && $result2 >= 0)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');

View File

@ -0,0 +1,228 @@
<?php
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2012-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/admin/facture.php
* \ingroup facture
* \brief Page to setup invoice module
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
// Load translation files required by the page
$langs->loadLangs(array('admin', 'errors', 'other', 'bills'));
if (! $user->admin) accessforbidden();
$action = GETPOST('action', 'alpha');
$value = GETPOST('value', 'alpha');
$label = GETPOST('label', 'alpha');
$scandir = GETPOST('scan_dir', 'alpha');
$type='invoice';
/*
* Actions
*/
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
/*
* View
*/
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
llxHeader(
"", $langs->trans("BillsSetup"),
'EN:Invoice_Configuration|FR:Configuration_module_facture|ES:ConfiguracionFactura'
);
$form=new Form($db);
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("BillsSetup"), $linkback, 'title_setup');
$head = invoice_admin_prepare_head();
dol_fiche_head($head, 'situation', $langs->trans("InvoiceSituation"), -1, 'invoice');
/*
* Numbering module
*/
print load_fiche_titre($langs->trans("InvoiceSituation"), '', '');
$var=0;
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
_updateBtn();
print '<table class="noborder" width="100%">';
_printOnOff('INVOICE_USE_SITUATION', $langs->trans('UseSituationInvoices'));
_printOnOff('INVOICE_USE_SITUATION_CREDIT_NOTE', $langs->trans('UseSituationInvoicesCreditNote'));
_printOnOff('INVOICE_USE_SITUATION_RETAINED_WARRANTY', $langs->trans('Retainedwarranty'));
$metas = array(
'type' => 'number',
'step' => '0.01',
'min' => 0,
'max' => 100
);
_printInputFormPart('INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT', $langs->trans('RetainedwarrantyDefaultPercent'), '', $metas);
// Conditions paiements
$inputCount = empty($inputCount)?1:($inputCount+1);
print '<tr class="impair">';
print '<td>'.$langs->trans('PaymentConditionsShortRetainedWarranty').'</td>';
print '<td class="center" width="20">&nbsp;</td>';
print '<td class="right" width="300">';
print '<input type="hidden" name="param'.$inputCount.'" value="INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID">';
$form->select_conditions_paiements($conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID, 'value'.$inputCount, -1, 1);
print '</td></tr>';
print '</table>';
_updateBtn();
print '</form>';
dol_fiche_end();
// End of page
llxFooter();
$db->close();
/**
* Print an update button
*
* @return void
*/
function _updateBtn()
{
global $langs;
print '<div style="text-align: right;" >';
print '<input type="submit" class="butAction" value="'.$langs->trans("Save").'">';
print '</div>';
}
/**
* Print a On/Off button
*
* @param string $confkey the conf key
* @param bool $title Title of conf
* @param string $desc Description
*
* @return void
*/
function _printOnOff($confkey, $title = false, $desc = '')
{
global $var, $bc, $langs;
$var=!$var;
print '<tr '.$bc[$var].'>';
print '<td>'.($title?$title:$langs->trans($confkey));
if (!empty($desc)) {
print '<br><small>'.$langs->trans($desc).'</small>';
}
print '</td>';
print '<td class="center" width="20">&nbsp;</td>';
print '<td class="right" width="300">';
print ajax_constantonoff($confkey);
print '</td></tr>';
}
/**
* Print a form part
*
* @param string $confkey the conf key
* @param bool $title Title of conf
* @param string $desc Description of
* @param array $metas html meta
* @param string $type type of input textarea or input
* @param bool $help help description
*
* @return void
*/
function _printInputFormPart($confkey, $title = false, $desc = '', $metas = array(), $type = 'input', $help = false)
{
global $var, $bc, $langs, $conf, $db, $inputCount;
$var=!$var;
$inputCount = empty($inputCount)?1:($inputCount+1);
$form=new Form($db);
$defaultMetas = array(
'name' => 'value'.$inputCount
);
if ($type!='textarea') {
$defaultMetas['type'] = 'text';
$defaultMetas['value'] = $conf->global->{$confkey};
}
$metas = array_merge($defaultMetas, $metas);
$metascompil = '';
foreach ($metas as $key => $values) {
$metascompil .= ' '.$key.'="'.$values.'" ';
}
print '<tr '.$bc[$var].'>';
print '<td>';
if (!empty($help)) {
print $form->textwithtooltip(($title?$title:$langs->trans($confkey)), $langs->trans($help), 2, 1, img_help(1, ''));
} else {
print $title?$title:$langs->trans($confkey);
}
if (!empty($desc)) {
print '<br><small>'.$langs->trans($desc).'</small>';
}
print '</td>';
print '<td class="center" width="20">&nbsp;</td>';
print '<td class="right" width="300">';
print '<input type="hidden" name="param'.$inputCount.'" value="'.$confkey.'">';
print '<input type="hidden" name="action" value="setModuleOptions">';
if ($type=='textarea') {
print '<textarea '.$metascompil.' >'.dol_htmlentities($conf->global->{$confkey}).'</textarea>';
} else {
print '<input '.$metascompil.' />';
}
print '</td></tr>';
}

View File

@ -446,8 +446,10 @@ print "\n";
<br>
<div class="center"><input type="submit" class="button"
value="<?php echo $langs->trans("GenerateBackup") ?>" id="buttonGo" /><br>
<div class="center">
<input type="submit" class="button reposition" value="<?php echo $langs->trans("GenerateBackup") ?>" id="buttonGo">
<input type="hidden" name="page_y" value="<?php echo GETPOST('page_y', 'int'); ?>">
<br>
<br>
<?php
@ -459,7 +461,7 @@ if (! empty($_SESSION["commandbackuplastdone"]))
//print $paramclear;
// Now run command and show result
// Now show result
print '<b>'.$langs->trans("BackupResult").':</b> ';
print $_SESSION["commandbackupresult"];
@ -598,9 +600,6 @@ print '<br>';
</fieldset>
</form>
<?php
// End of page

View File

@ -50,7 +50,7 @@ if (! $user->admin) accessforbidden();
if ($file && ! $what)
{
//print DOL_URL_ROOT.'/dolibarr_export.php';
header("Location: ".DOL_URL_ROOT.'/admin/tools/dolibarr_export.php?msg='.urlencode($langs->trans("ErrorFieldRequired", $langs->transnoentities("ExportMethod"))));
header("Location: ".DOL_URL_ROOT.'/admin/tools/dolibarr_export.php?msg='.urlencode($langs->trans("ErrorFieldRequired", $langs->transnoentities("ExportMethod"))).(GETPOST('page_y', 'int')?'&page_y='.GETPOST('page_y', 'int'):''));
exit;
}
@ -122,25 +122,15 @@ $utils = new Utils($db);
// MYSQL
if ($what == 'mysql')
{
$cmddump=GETPOST("mysqldump"); // Do not sanitize here with 'alpha', will be sanitize later by dol_sanitizePathName and escapeshellarg
$cmddump=dol_sanitizePathName($cmddump);
if (! empty($dolibarr_main_restrict_os_commands))
{
$arrayofallowedcommand=explode(',', $dolibarr_main_restrict_os_commands);
$ok=0;
dol_syslog("Command are restricted to ".$dolibarr_main_restrict_os_commands.". We check that one of this command is inside ".$cmddump);
foreach($arrayofallowedcommand as $allowedcommand)
{
$basenamecmddump=basename($cmddump);
if (preg_match('/^'.preg_quote($allowedcommand, '/').'$/', $basenamecmddump)) // the provided command $cmddump must be an allowed command
{
$ok=1;
break;
}
}
if (! $ok)
$basenamecmddump=basename($cmddump);
if (! in_array($basenamecmddump, $arrayofallowedcommand)) // the provided command $cmddump must be an allowed command
{
$errormsg=$langs->trans('CommandIsNotInsideAllowedCommands');
}
@ -176,6 +166,18 @@ if ($what == 'postgresql')
$cmddump=GETPOST("postgresqldump"); // Do not sanitize here with 'alpha', will be sanitize later by dol_sanitizePathName and escapeshellarg
$cmddump=dol_sanitizePathName($cmddump);
/* Not required, the command is output on screen but not ran for pgsql
if (! empty($dolibarr_main_restrict_os_commands))
{
$arrayofallowedcommand=explode(',', $dolibarr_main_restrict_os_commands);
dol_syslog("Command are restricted to ".$dolibarr_main_restrict_os_commands.". We check that one of this command is inside ".$cmddump);
$basenamecmddump=basename($cmddump);
if (! in_array($basenamecmddump, $arrayofallowedcommand)) // the provided command $cmddump must be an allowed command
{
$errormsg=$langs->trans('CommandIsNotInsideAllowedCommands');
}
} */
if (! $errormsg && $cmddump)
{
dolibarr_set_const($db, 'SYSTEMTOOLS_POSTGRESQLDUMP', $cmddump, 'chaine', 0, '', $conf->entity);
@ -193,7 +195,6 @@ if ($what == 'postgresql')
}
if ($errormsg)
{
setEventMessages($langs->trans("Error")." : ".$errormsg, null, 'errors');
@ -230,8 +231,8 @@ $result=$formfile->list_of_documents($filearray,null,'systemtools','',1,'backup/
print '<br>';
*/
// Redirect t backup page
header("Location: dolibarr_export.php");
// Redirect to backup page
header("Location: dolibarr_export.php".(GETPOST('page_y', 'int')?'?page_y='.GETPOST('page_y', 'int'):''));
$time_end = time();

View File

@ -79,16 +79,6 @@ if (! empty($conf->stock->enabled) && empty($conf->global->CASHDESK_NO_DECREASE_
}
/*
if (! empty($_POST['txtUsername']) && ! empty($conf->banque->enabled) && (empty($conf_fkaccount_cash) && empty($conf_fkaccount_cheque) && empty($conf_fkaccount_cb)))
{
$langs->load("errors");
$retour=$langs->trans("ErrorModuleSetupNotComplete");
header('Location: '.DOL_URL_ROOT.'/cashdesk/index.php?err='.urlencode($retour).'&user='.$username.'&socid='.$thirdpartyid.'&warehouseid='.$warehouseid);
exit;
}
*/
// Check password
$auth = new Auth($db);
$retour = $auth->verif($username, $password);

View File

@ -165,7 +165,7 @@ $langs->loadLangs(array("main","bills","cashdesk"));
if (empty($_SESSION['CASHDESK_ID_BANKACCOUNT_CASH']) || $_SESSION['CASHDESK_ID_BANKACCOUNT_CASH'] < 0)
{
$langs->load("errors");
print '<input class="bouton_mode_reglement_disabled" type="button" name="btnModeReglement" value="'.$langs->trans("Cash").'" title="'.dol_escape_htmltag($langs->trans("ErrorModuleSetupNotComplete")).'" />';
print '<input class="bouton_mode_reglement_disabled" type="button" name="btnModeReglement" value="'.$langs->trans("Cash").'" title="'.dol_escape_htmltag($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("CashDesk"))).'" />';
}
else print '<input class="button bouton_mode_reglement" type="submit" name="btnModeReglement" value="'.$langs->trans("Cash").'" onclick="javascript: verifClic(\'ESP\');" />';
print '</div>';
@ -173,7 +173,7 @@ $langs->loadLangs(array("main","bills","cashdesk"));
if (empty($_SESSION['CASHDESK_ID_BANKACCOUNT_CB']) || $_SESSION['CASHDESK_ID_BANKACCOUNT_CB'] < 0)
{
$langs->load("errors");
print '<input class="bouton_mode_reglement_disabled" type="button" name="btnModeReglement" value="'.$langs->trans("CreditCard").'" title="'.dol_escape_htmltag($langs->trans("ErrorModuleSetupNotComplete")).'" />';
print '<input class="bouton_mode_reglement_disabled" type="button" name="btnModeReglement" value="'.$langs->trans("CreditCard").'" title="'.dol_escape_htmltag($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("CashDesk"))).'" />';
}
else print '<input class="button bouton_mode_reglement" type="submit" name="btnModeReglement" value="'.$langs->trans("CreditCard").'" onclick="javascript: verifClic(\'CB\');" />';
print '</div>';
@ -181,7 +181,7 @@ $langs->loadLangs(array("main","bills","cashdesk"));
if (empty($_SESSION['CASHDESK_ID_BANKACCOUNT_CHEQUE']) || $_SESSION['CASHDESK_ID_BANKACCOUNT_CHEQUE'] < 0)
{
$langs->load("errors");
print '<input class="bouton_mode_reglement_disabled" type="button" name="btnModeReglement" value="'.$langs->trans("CheckBank").'" title="'.dol_escape_htmltag($langs->trans("ErrorModuleSetupNotComplete")).'" />';
print '<input class="bouton_mode_reglement_disabled" type="button" name="btnModeReglement" value="'.$langs->trans("CheckBank").'" title="'.dol_escape_htmltag($langs->trans("ErrorModuleSetupNotComplete"), $langs->transnoentitiesnoconv("CashDesk")).'" />';
}
else print '<input class="button bouton_mode_reglement" type="submit" name="btnModeReglement" value="'.$langs->trans("CheckBank").'" onclick="javascript: verifClic(\'CHQ\');" />';
print '</div>';

View File

@ -168,287 +168,8 @@ if ($action != 'preview' && $action != 'editcontent') $style=' margin-bottom: 5p
//var_dump($objectpage);exit;
print '<div class="centpercent websitebar">';
if (count($object->records) > 0)
{
// ***** Part for web sites
print '<div class="websiteselection hideonsmartphoneimp">';
print $langs->trans("WebSite").': ';
print '</div>';
// List of websites
print '<div class="websiteselection">';
$out='';
$out.='<select name="website" class="minwidth100" id="website">';
if (empty($object->records)) $out.='<option value="-1">&nbsp;</option>';
// Loop on each sites
$i=0;
foreach($object->records as $key => $valwebsite)
{
if (empty($website)) $website=$valwebsite->ref;
$out.='<option value="'.$valwebsite->ref.'"';
if ($website == $valwebsite->ref) $out.=' selected'; // To preselect a value
$out.='>';
$out.=$valwebsite->ref;
$out.='</option>';
$i++;
}
$out.='</select>';
$out.=ajax_combobox('website');
print $out;
print '<input type="submit" class="button" name="refreshsite" value="'.$langs->trans("Load").'">';
if ($website)
{
$virtualurl='';
$dataroot=DOL_DATA_ROOT.'/collab/'.$website;
if (! empty($object->virtualhost)) $virtualurl=$object->virtualhost;
}
if ($website && $action == 'preview')
{
$disabled='';
if (empty($user->rights->websites->write)) $disabled=' disabled="disabled"';
print ' &nbsp; ';
//print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("MediaFiles")).'" name="editmedia">';
print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditCss")).'" name="editcss">';
print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditMenu")).'" name="editmenu">';
print '<input type="submit"'.$disabled.' class="button" value="'.dol_escape_htmltag($langs->trans("AddPage")).'" name="create">';
}
print '</div>';
// Button for websites
print '<div class="websitetools">';
if ($action == 'preview')
{
print '<div class="websiteinputurl">';
print '<input type="text" id="previewsiteurl" class="minwidth200imp" name="previewsite" placeholder="'.$langs->trans("http://myvirtualhost").'" value="'.$virtualurl.'">';
//print '<input type="submit" class="button" name="previewwebsite" target="tab'.$website.'" value="'.$langs->trans("ViewSiteInNewTab").'">';
$htmltext=$langs->trans("SetHereVirtualHost", $dataroot);
print $form->textwithpicto('', $htmltext);
print '</div>';
$urlext=$virtualurl;
$urlint=$urlwithroot.'/public/collab/index.php?website='.$website;
//if (! empty($object->virtualhost))
//{
print '<a class="websitebuttonsitepreview" id="previewsiteext" href="'.$urlext.'" target="tab'.$website.'" alt="'.dol_escape_htmltag($langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $dataroot, $urlext)).'">';
print $form->textwithpicto('', $langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $dataroot, $urlext?$urlext:$langs->trans("VirtualHostUrlNotDefined")), 1, 'preview_ext');
print '</a>';
//}
print '<a class="websitebuttonsitepreview" id="previewsite" href="'.$urlwithroot.'/public/collab/index.php?website='.$website.'" target="tab'.$website.'" alt="'.dol_escape_htmltag($langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $urlint)).'">';
print $form->textwithpicto('', $langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $urlint, $dataroot), 1, 'preview');
print '</a>';
}
if (in_array($action, array('editcss','editmenu','create')))
{
if ($action != 'preview') print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Cancel")).'" name="preview">';
if (preg_match('/^create/', $action)) print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
if (preg_match('/^edit/', $action)) print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
}
print '</div>';
// ***** Part for pages
if ($website)
{
print '</div>';
$array=$objectpage->fetchAll($object->id);
if (! is_array($array) && $array < 0) dol_print_error('', $objectpage->error, $objectpage->errors);
$atleastonepage=(is_array($array) && count($array) > 0);
print '<div class="centpercent websitebar"'.($style?' style="'.$style.'"':'').'">';
print '<div class="websiteselection hideonsmartphoneimp">';
print $langs->trans("Page").': ';
print '</div>';
print '<div class="websiteselection">';
if ($action != 'add')
{
$out='';
$out.='<select name="pageid" id="pageid" class="minwidth200">';
if ($atleastonepage)
{
if (empty($pageid) && $action != 'create') // Page id is not defined, we try to take one
{
$firstpageid=0;$homepageid=0;
foreach($array as $key => $valpage)
{
if (empty($firstpageid)) $firstpageid=$valpage->id;
if ($object->fk_default_home && $key == $object->fk_default_home) $homepageid=$valpage->id;
}
$pageid=$homepageid?$homepageid:$firstpageid; // We choose home page and if not defined yet, we take first page
}
foreach($array as $key => $valpage)
{
$out.='<option value="'.$key.'"';
if ($pageid > 0 && $pageid == $key) $out.=' selected'; // To preselect a value
$out.='>';
$out.=$valpage->title;
if ($object->fk_default_home && $key == $object->fk_default_home) $out.=' ('.$langs->trans("HomePage").')';
$out.='</option>';
}
}
else $out.='<option value="-1">&nbsp;</option>';
$out.='</select>';
$out.=ajax_combobox('pageid');
print $out;
}
else
{
print $langs->trans("New");
}
print '<input type="submit" class="button" name="refreshpage" value="'.$langs->trans("Load").'"'.($atleastonepage?'':' disabled="disabled"').'>';
//print $form->selectarray('page', $array);
if ($action == 'preview')
{
$disabled='';
if (empty($user->rights->websites->write)) $disabled=' disabled="disabled"';
if ($pageid > 0)
{
print ' &nbsp; ';
if ($object->fk_default_home > 0 && $pageid == $object->fk_default_home) print '<input type="submit" class="button" disabled="disabled" value="'.dol_escape_htmltag($langs->trans("SetAsHomePage")).'" name="setashome">';
else print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("SetAsHomePage")).'" name="setashome">';
print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditPageMeta")).'" name="editmeta">';
print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditPageContent")).'" name="editcontent">';
//print '<a href="'.$_SERVER["PHP_SELF"].'?action=editmeta&website='.urlencode($website).'&pageid='.urlencode($pageid).'" class="button">'.dol_escape_htmltag($langs->trans("EditPageMeta")).'</a>';
//print '<a href="'.$_SERVER["PHP_SELF"].'?action=editcontent&website='.urlencode($website).'&pageid='.urlencode($pageid).'" class="button">'.dol_escape_htmltag($langs->trans("EditPageContent")).'</a>';
print '<input type="submit" class="buttonDelete" name="delete" value="'.$langs->trans("Delete").'"'.($atleastonepage?'':' disabled="disabled"').'>';
}
}
print '</div>';
print '<div class="websiteselection">';
print '</div>';
print '<div class="websitetools">';
if ($website && $pageid > 0 && $action == 'preview')
{
$websitepage = new WebSitePage($db);
$websitepage->fetch($pageid);
$realpage=$urlwithroot.'/public/collab/index.php?website='.$website.'&page='.$pageid;
$pagealias = $websitepage->pageurl;
print '<div class="websiteinputurl">';
print '<input type="text" id="previewpageurl" class="minwidth200imp" name="previewsite" value="'.$pagealias.'" disabled="disabled">';
//print '<input type="submit" class="button" name="previewwebsite" target="tab'.$website.'" value="'.$langs->trans("ViewSiteInNewTab").'">';
$htmltext=$langs->trans("WEBSITE_PAGENAME", $pagealias);
print $form->textwithpicto('', $htmltext);
print '</div>';
if (! empty($object->virtualhost))
{
$urlext=$virtualurl.'/'.$pagealias.'.php';
print '<a class="websitebuttonsitepreview" id="previewpageext" href="'.$urlext.'" target="tab'.$website.'" alt="'.dol_escape_htmltag($langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $dataroot, $urlext)).'">';
print $form->textwithpicto('', $langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $dataroot, $urlext?$urlext:$langs->trans("VirtualHostUrlNotDefined")), 1, 'preview_ext');
print '</a>';
}
else
{
print '<a class="websitebuttonsitepreview" id="previewpageextnoclick" href="#">';
print $form->textwithpicto('', $langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $dataroot, $urlext?$urlext:$langs->trans("VirtualHostUrlNotDefined")), 1, 'preview_ext');
print '</a>';
}
print '<a class="websitebuttonsitepreview" id="previewpage" href="'.$realpage.'&nocache='.dol_now().'" class="button" target="tab'.$website.'" alt="'.dol_escape_htmltag($langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $realpage)).'">';
print $form->textwithpicto('', $langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $realpage, $dataroot), 1, 'preview');
print '</a>'; // View page in new Tab
//print '<input type="submit" class="button" name="previewpage" target="tab'.$website.'"value="'.$langs->trans("ViewPageInNewTab").'">';
// TODO Add js to save alias like we save virtual host name and use dynamic virtual host for url of id=previewpageext
}
if (! in_array($action, array('editcss','editmenu','create')))
{
if ($action != 'preview') print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Cancel")).'" name="preview">';
if (preg_match('/^create/', $action)) print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
if (preg_match('/^edit/', $action)) print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
}
print '</div>';
if ($action == 'preview')
{
// Adding jquery code to change on the fly url of preview ext
if (! empty($conf->use_javascript_ajax))
{
print '<script type="text/javascript" language="javascript">
jQuery(document).ready(function() {
jQuery("#previewsiteext,#previewpageext").click(function() {
newurl=jQuery("#previewsiteurl").val();
newpage=jQuery("#previewsiteurl").val() + "/" + jQuery("#previewpageurl").val() + ".php";
console.log("Open url "+newurl);
/* Save url */
jQuery.ajax({
method: "POST",
url: "'.DOL_URL_ROOT.'/core/ajax/saveinplace.php",
data: {
field: \'editval_virtualhost\',
element: \'websites\',
table_element: \'website\',
fk_element: '.$object->id.',
value: newurl,
},
context: document.body
});
jQuery("#previewsiteext").attr("href",newurl);
jQuery("#previewpageext").attr("href",newpage);
});
});
</script>';
}
}
}
}
else
{
print '<div class="websiteselection">';
$langs->load("errors");
print $langs->trans("ErrorModuleSetupNotComplete");
print '<div>';
$action='';
}
print '</div>';
$head = array();
if ($action == 'editcontent')
{
/*
* Editing global variables not related to a specific theme
*/
$csscontent = @file_get_contents($filecss);
$contentforedit = '';
/*$contentforedit.='<style scoped>'."\n"; // "scoped" means "apply to parent element only". Not yet supported by browsers
$contentforedit.=$csscontent;
$contentforedit.='</style>'."\n";*/
$contentforedit .= $objectpage->content;
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor('PAGE_CONTENT', $contentforedit, '', 500, 'Full', '', true, true, true, ROWS_5, '90%');
$doleditor->Create(0, '', false);
}
print "</div>\n</form>\n";

View File

@ -3519,7 +3519,7 @@ class Propal extends CommonObject
else
{
$langs->load("errors");
print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete");
print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Proposal"));
return "";
}
}

View File

@ -272,7 +272,7 @@ $sql.= ' p.rowid, p.entity, p.note_private, p.total_ht, p.tva as total_vat, p.to
$sql.= ' p.datec as date_creation, p.tms as date_update,';
$sql.= " pr.rowid as project_id, pr.ref as project_ref, pr.title as project_label,";
$sql.= ' u.login';
if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user,";
if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user";
if ($search_categ_cus) $sql .= ", cc.fk_categorie, cc.fk_soc";
// Add fields from extrafields
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');

View File

@ -2591,7 +2591,7 @@ if ($action == 'create' && $user->rights->commande->creer)
}
} else {
$langs->load("errors");
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="' . dol_escape_htmltag($langs->trans("ErrorModuleSetupNotComplete")) . '">' . $langs->trans('CreateShipment') . '</a></div>';
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="' . dol_escape_htmltag($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Shipment"))) . '">' . $langs->trans('CreateShipment') . '</a></div>';
}
}
}

View File

@ -247,7 +247,7 @@ if ($action=="create" || $action=="start")
}
// Get the bank account dedicated to this point of sale module/terminal
$vartouse=CASHDESK_ID_BANKACCOUNT_CASH.$terminaltouse;
$vartouse='CASHDESK_ID_BANKACCOUNT_CASH'.$terminaltouse;
$bankid = $conf->global->$vartouse; // This value is ok for 'Terminal 0' for module 'CashDesk' and 'TakePos' (they manage only 1 terminal)
// Hook to get the good bank id according to posmodule and posnumber.
// @TODO add hook here

View File

@ -190,7 +190,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
print $socialcontrib->getNomUrl(1, '20');
print '</td>';
// Type
print '<td><a href="../sociales/index.php?filtre=cs.fk_type:'.$obj->type.'">'.$obj->lib.'</a></td>';
print '<td><a href="../sociales/list.php?filtre=cs.fk_type:'.$obj->type.'">'.$obj->lib.'</a></td>';
// Expected to pay
print '<td class="right">'.price($obj->total).'</td>';
// Ref payment

View File

@ -309,6 +309,38 @@ if (empty($reshook))
dol_print_error($db, $object->error);
}
elseif ($action == 'setretainedwarrantyconditions' && $user->rights->facture->creer)
{
$object->fetch($id);
$object->retained_warranty_fk_cond_reglement = 0; // To clean property
$result = $object->setRetainedWarrantyPaymentTerms(GETPOST('retained_warranty_fk_cond_reglement', 'int'));
if ($result < 0) dol_print_error($db, $object->error);
$old_rw_date_lim_reglement = $object->retained_warranty_date_limit;
$new_rw_date_lim_reglement = $object->calculate_date_lim_reglement($object->retained_warranty_fk_cond_reglement);
if ($new_rw_date_lim_reglement > $old_rw_date_lim_reglement) $object->retained_warranty_date_limit = $new_rw_date_lim_reglement;
if ($object->retained_warranty_date_limit < $object->date) $object->retained_warranty_date_limit = $object->date;
$result = $object->update($user);
if ($result < 0) dol_print_error($db, $object->error);
}
elseif ($action == 'setretainedwarranty' && $user->rights->facture->creer)
{
$object->fetch($id);
$result = $object->setRetainedWarranty(GETPOST('retained_warranty', 'float'));
if ($result < 0)
dol_print_error($db, $object->error);
}
elseif ($action == 'setretainedwarrantydatelimit' && $user->rights->facture->creer)
{
$object->fetch($id);
$result = $object->setRetainedWarrantyDateLimit(GETPOST('retained_warranty_date_limit', 'float'));
if ($result < 0)
dol_print_error($db, $object->error);
}
// Multicurrency Code
elseif ($action == 'setmulticurrencycode' && $usercancreate) {
$result = $object->setMulticurrencyCode(GETPOST('multicurrency_code', 'alpha'));
@ -1209,6 +1241,16 @@ if (empty($reshook))
$object->situation_counter = 1;
$object->situation_final = 0;
$object->situation_cycle_ref = $object->newCycle();
$object->retained_warranty = GETPOST('retained_warranty', 'int');
$object->retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int');
$retained_warranty_date_limit = GETPOST('retained_warranty_date_limit');
if(!empty($retained_warranty_date_limit) && $db->jdate($retained_warranty_date_limit)){
$object->retained_warranty_date_limit = $db->jdate($retained_warranty_date_limit);
}
$object->retained_warranty_date_limit = !empty($object->retained_warranty_date_limit) ? $object->retained_warranty_date_limit : $object->calculate_date_lim_reglement($object->retained_warranty_fk_cond_reglement);
}
$object->fetch_thirdparty();
@ -3147,6 +3189,44 @@ if ($action == 'create')
$form->select_conditions_paiements(isset($_POST['cond_reglement_id']) ? $_POST['cond_reglement_id'] : $cond_reglement_id, 'cond_reglement_id');
print '</td></tr>';
if (! empty($conf->global->INVOICE_USE_SITUATION))
{
if($conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY){
$rwStyle = 'display:none;';
if(GETPOST('type', 'int') == Facture::TYPE_SITUATION){
$rwStyle = '';
}
$retained_warranty = GETPOST('retained_warranty', 'int');
$retained_warranty = !empty($retained_warranty)?$retained_warranty:$conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT;
print '<tr class="retained-warranty-line" style="'.$rwStyle.'" ><td class="nowrap">' . $langs->trans('RetainedWarranty') . '</td><td colspan="2">';
print '<input id="new-situation-invoice-retained-warranty" name="retained_warranty" type="number" value="'.$retained_warranty.'" step="0.01" min="0" max="100" />%';
// Retained warranty payment term
print '<tr class="retained-warranty-line" style="'.$rwStyle.'" ><td class="nowrap">' . $langs->trans('PaymentConditionsShortRetainedWarranty') . '</td><td colspan="2">';
$retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int');
$retained_warranty_fk_cond_reglement = !empty($retained_warranty_fk_cond_reglement)? $retained_warranty_fk_cond_reglement : $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID;
$form->select_conditions_paiements($retained_warranty_fk_cond_reglement, 'retained_warranty_fk_cond_reglement', -1, 1);
print '</td></tr>';
print '<script type="text/javascript" language="javascript">
$(document).ready(function() {
$("[name=\'type\'").change(function() {
if($( this ).prop("checked") && $( this ).val() == '.Facture::TYPE_SITUATION.')
{
$(".retained-warranty-line").show();
}
else{
$(".retained-warranty-line").hide();
}
});
});
</script>';
}
}
// Payment mode
print '<tr><td>' . $langs->trans('PaymentMode') . '</td><td colspan="2">';
$form->select_types_paiements(isset($_POST['mode_reglement_id']) ? $_POST['mode_reglement_id'] : $mode_reglement_id, 'mode_reglement_id', 'CRDT');
@ -4020,6 +4100,126 @@ elseif ($id > 0 || ! empty($ref))
print '</td></tr>';
}
$displayWarranty = false;
if( ( $object->type == Facture::TYPE_SITUATION && (!empty($object->retained_warranty) || !empty($conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY)) ) )
{
// Check if this situation invoice is 100% for real
if(!empty($object->situation_final) && !empty($object->lines)){
$displayWarranty = true;
foreach($object->lines as $i => $line){
if($line->product_type < 2 && $line->situation_percent < 100){
$displayWarranty = false;
break;
}
}
}
// Retained Warranty
print '<tr class="retained-warranty-lines" ><td>';
print '<table id="retained-warranty-table" class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('RetainedWarranty');
print '</td>';
if ($action != 'editretainedwarranty' && $user->rights->facture->creer){
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editretainedwarranty&amp;facid=' . $object->id . '">' . img_edit($langs->trans('setretainedwarranty'), 1) . '</a></td>';
}
print '</tr></table>';
print '</td><td>';
if ($action == 'editretainedwarranty')
{
print '<form id="retained-warranty-form" method="POST" action="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'">';
print '<input type="hidden" name="action" value="setretainedwarranty">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input name="retained_warranty" type="number" step="0.01" min="0" max="100" value="'.$object->retained_warranty.'" >';
print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
print '</form>';
}
else
{
print price($object->retained_warranty).'%';
}
print '</td></tr>';
// Retained warranty payment term
print '<tr class="retained-warranty-lines" ><td>';
print '<table id="retained-warranty-cond-reglement-table" class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('PaymentConditionsShortRetainedWarranty');
print '</td>';
if ($action != 'editretainedwarrantypaymentterms' && $user->rights->facture->creer){
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editretainedwarrantypaymentterms&amp;facid=' . $object->id . '">' . img_edit($langs->trans('setPaymentConditionsShortRetainedWarranty'), 1) . '</a></td>';
}
print '</tr></table>';
print '</td><td>';
$defaultDate = !empty($object->retained_warranty_date_limit)?$object->retained_warranty_date_limit:strtotime('-1 years', $object->date_lim_reglement);
if($object->date > $defaultDate){
$defaultDate = $object->date;
}
if ($action == 'editretainedwarrantypaymentterms')
{
//date('Y-m-d',$object->date_lim_reglement)
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'">';
print '<input type="hidden" name="action" value="setretainedwarrantyconditions">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int');
$retained_warranty_fk_cond_reglement = !empty($retained_warranty_fk_cond_reglement)? $retained_warranty_fk_cond_reglement : $object->retained_warranty_fk_cond_reglement;
$retained_warranty_fk_cond_reglement = !empty($retained_warranty_fk_cond_reglement)? $retained_warranty_fk_cond_reglement : $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID;
$form->select_conditions_paiements($retained_warranty_fk_cond_reglement, 'retained_warranty_fk_cond_reglement', -1, 1);
print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
print '</form>';
}
else
{
print $form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->retained_warranty_fk_cond_reglement, 'none');
if(!$displayWarranty){
print img_picto($langs->trans('RetainedWarrantyNeed100Percent'), 'warning.png', 'class="pictowarning valignmiddle" ');
}
}
print '</td></tr>';
if($displayWarranty)
{
// Retained Warranty payment date limit
print '<tr class="retained-warranty-lines" ><td>';
print '<table id="retained-warranty-date-limit-table" class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('RetainedWarrantyDateLimit');
print '</td>';
if ($action != 'editretainedwarrantydatelimit' && $user->rights->facture->creer){
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editretainedwarrantydatelimit&amp;facid=' . $object->id . '">' . img_edit($langs->trans('setretainedwarrantyDateLimit'), 1) . '</a></td>';
}
print '</tr></table>';
print '</td><td>';
$defaultDate = !empty($object->retained_warranty_date_limit)?$object->retained_warranty_date_limit:strtotime('-1 years', $object->date_lim_reglement);
if($object->date > $defaultDate){
$defaultDate = $object->date;
}
if ($action == 'editretainedwarrantydatelimit')
{
//date('Y-m-d',$object->date_lim_reglement)
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'">';
print '<input type="hidden" name="action" value="setretainedwarrantydatelimit">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input name="retained_warranty_date_limit" type="date" step="1" min="'.dol_print_date($object->date, '%Y-%m-%d').'" value="'.dol_print_date($defaultDate, '%Y-%m-%d').'" >';
print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
print '</form>';
}
else
{
print dol_print_date($object->retained_warranty_date_limit, 'day');
}
print '</td></tr>';
}
}
// Other attributes
$cols = 2;
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
@ -4464,6 +4664,31 @@ elseif ($id > 0 || ! empty($ref))
print ' :</td>';
print '<td class="right'.($resteapayeraffiche?' amountremaintopay':(' '.$cssforamountpaymentcomplete)).'">' . price($resteapayeraffiche) . '</td>';
print '<td class="nowrap">&nbsp;</td></tr>';
// Retained warranty : usualy use on construction industry
if(!empty($object->situation_final) && !empty($object->retained_warranty) && $displayWarranty){
// Billed - retained warranty
if($object->type == Facture::TYPE_SITUATION)
{
$retainedWarranty = $total_global_ttc * $object->retained_warranty / 100;
}
else
{
// Because one day retained warranty could be used on standard invoices
$retainedWarranty = $object->total_ttc * $object->retained_warranty / 100;
}
$billedWithRetainedWarranty = $object->total_ttc - $retainedWarranty ;
print '<tr><td colspan="' . $nbcols . '" align="right">' . $langs->trans("ToPayOn", dol_print_date($object->date_lim_reglement, 'day')) . ' :</td><td align="right">' . price($billedWithRetainedWarranty) . '</td><td>&nbsp;</td></tr>';
// retained warranty
print '<tr><td colspan="' . $nbcols . '" align="right">';
print $langs->trans("RetainedWarranty") . ' ('.$object->retained_warranty.'%)';
print !empty($object->retained_warranty_date_limit)?' '.$langs->trans("ToPayOn", dol_print_date($object->retained_warranty_date_limit, 'day')):'';
print ' :</td><td align="right">' . price($retainedWarranty) . '</td><td>&nbsp;</td></tr>';
}
}
else // Credit note
{

View File

@ -206,6 +206,21 @@ class Facture extends CommonInvoice
public $oldcopy;
/**
* @var double percentage of retainage
*/
public $retained_warranty;
/**
* @var int timestamp of date limit of retainage
*/
public $retained_warranty_date_limit;
/**
* @var int Code in llx_c_paiement
*/
public $retained_warranty_fk_cond_reglement;
/**
* Standard invoice
*/
@ -472,6 +487,9 @@ class Facture extends CommonInvoice
$sql.= ", fk_multicurrency";
$sql.= ", multicurrency_code";
$sql.= ", multicurrency_tx";
$sql.= ", retained_warranty";
$sql.= ", retained_warranty_date_limit";
$sql.= ", retained_warranty_fk_cond_reglement";
$sql.= ")";
$sql.= " VALUES (";
$sql.= "'(PROV)'";
@ -506,6 +524,10 @@ class Facture extends CommonInvoice
$sql.= ", ".(int) $this->fk_multicurrency;
$sql.= ", '".$this->db->escape($this->multicurrency_code)."'";
$sql.= ", ".(double) $this->multicurrency_tx;
$sql.= ", ".(empty($this->retained_warranty)?"0":$this->db->escape($this->retained_warranty));
$sql.= ", ".(!empty($this->retained_warranty_date_limit)?"'".$this->db->idate($this->retained_warranty_date_limit)."'":'NULL');
$sql.= ", ".(int) $this->retained_warranty_fk_cond_reglement;
$sql.=")";
$resql=$this->db->query($sql);
@ -1336,6 +1358,7 @@ class Facture extends CommonInvoice
$sql.= ', f.fk_incoterms, f.location_incoterms';
$sql.= ', f.module_source, f.pos_source';
$sql.= ", i.libelle as label_incoterms";
$sql.= ", f.retained_warranty as retained_warranty, f.retained_warranty_date_limit as retained_warranty_date_limit, f.retained_warranty_fk_cond_reglement as retained_warranty_fk_cond_reglement";
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture as f';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as c ON f.fk_cond_reglement = c.rowid';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON f.fk_mode_reglement = p.id';
@ -1405,6 +1428,10 @@ class Facture extends CommonInvoice
$this->situation_cycle_ref = $obj->situation_cycle_ref;
$this->situation_counter = $obj->situation_counter;
$this->situation_final = $obj->situation_final;
$this->retained_warranty = $obj->retained_warranty;
$this->retained_warranty_date_limit = $this->db->jdate($obj->retained_warranty_date_limit);
$this->retained_warranty_fk_cond_reglement = $obj->retained_warranty_fk_cond_reglement;
$this->extraparams = (array) json_decode($obj->extraparams, true);
//Incoterms
@ -1648,6 +1675,8 @@ class Facture extends CommonInvoice
if (isset($this->note_public)) $this->note_public=trim($this->note_public);
if (isset($this->modelpdf)) $this->modelpdf=trim($this->modelpdf);
if (isset($this->import_key)) $this->import_key=trim($this->import_key);
if (isset($this->retained_warranty)) $this->retained_warranty = floatval($this->retained_warranty);
// Check parameters
// Put here code to add control on parameters values
@ -1688,7 +1717,10 @@ class Facture extends CommonInvoice
$sql.= " import_key=".(isset($this->import_key)?"'".$this->db->escape($this->import_key)."'":"null").",";
$sql.= " situation_cycle_ref=".(empty($this->situation_cycle_ref)?"null":$this->db->escape($this->situation_cycle_ref)).",";
$sql.= " situation_counter=".(empty($this->situation_counter)?"null":$this->db->escape($this->situation_counter)).",";
$sql.= " situation_final=".(empty($this->situation_final)?"0":$this->db->escape($this->situation_final));
$sql.= " situation_final=".(empty($this->situation_final)?"0":$this->db->escape($this->situation_final)).",";
$sql.= " retained_warranty=".(empty($this->retained_warranty)?"0":$this->db->escape($this->retained_warranty)).",";
$sql.= " retained_warranty_date_limit=".(strval($this->retained_warranty_date_limit)!='' ? "'".$this->db->idate($this->retained_warranty_date_limit)."'" : 'null').",";
$sql.= " retained_warranty_fk_cond_reglement=".(isset($this->retained_warranty_fk_cond_reglement)?intval($this->retained_warranty_fk_cond_reglement):"null");
$sql.= " WHERE rowid=".$this->id;
$this->db->begin();
@ -3463,7 +3495,7 @@ class Facture extends CommonInvoice
else
{
$langs->load("errors");
print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete");
print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Invoice"));
return "";
}
}
@ -4375,6 +4407,137 @@ class Facture extends CommonInvoice
return $this->date_lim_reglement < ($now - $conf->facture->client->warning_delay);
}
/**
* @return number or -1 if not available
*/
public function getRetainedWarrantyAmount()
{
if(empty($this->retained_warranty) ){
return -1;
}
$retainedWarrantyAmount = 0;
// Billed - retained warranty
if($this->type == Facture::TYPE_SITUATION)
{
$displayWarranty = true;
// Check if this situation invoice is 100% for real
if(!empty($this->lines)){
foreach($this->lines as $i => $line){
if($line->product_type < 2 && $line->situation_percent < 100){
$displayWarranty = false;
break;
}
}
}
if($displayWarranty && !empty($this->situation_final))
{
$this->fetchPreviousNextSituationInvoice();
$TPreviousIncoice = $this->tab_previous_situation_invoice;
$total2BillWT = 0;
foreach ($TPreviousIncoice as &$fac){
$total2BillWT += $fac->total_ttc;
}
$total2BillWT += $this->total_ttc;
$retainedWarrantyAmount = $total2BillWT * $this->retained_warranty / 100;
}
else{
return -1;
}
}
else
{
// Because one day retained warranty could be used on standard invoices
$retainedWarrantyAmount = $this->total_ttc * $this->retained_warranty / 100;
}
return $retainedWarrantyAmount;
}
/**
* Change the retained warranty
*
* @param float $value value of retained warranty
* @return int >0 if OK, <0 if KO
*/
public function setRetainedWarranty($value)
{
dol_syslog(get_class($this).'::setRetainedWarranty('.$value.')');
if ($this->statut >= 0)
{
$fieldname = 'retained_warranty';
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
$sql .= ' SET '.$fieldname.' = '.floatval($value);
$sql .= ' WHERE rowid='.$this->id;
if ($this->db->query($sql))
{
$this->retained_warranty = floatval($value);
return 1;
}
else
{
dol_syslog(get_class($this).'::setRetainedWarranty Erreur '.$sql.' - '.$this->db->error());
$this->error=$this->db->error();
return -1;
}
}
else
{
dol_syslog(get_class($this).'::setRetainedWarranty, status of the object is incompatible');
$this->error='Status of the object is incompatible '.$this->statut;
return -2;
}
}
/**
* Change the retained_warranty_date_limit
*
* @param int $timestamp date limit of retained warranty in timestamp format
* @param string $dateYmd date limit of retained warranty in Y m d format
* @return int >0 if OK, <0 if KO
*/
public function setRetainedWarrantyDateLimit($timestamp, $dateYmd = false)
{
if(!$timestamp && $dateYmd){
$timestamp = $this->db->jdate($dateYmd);
}
dol_syslog(get_class($this).'::setRetainedWarrantyDateLimit('.$timestamp.')');
if ($this->statut >= 0)
{
$fieldname = 'retained_warranty_date_limit';
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
$sql .= ' SET '.$fieldname.' = '.(strval($timestamp)!='' ? '\'' .$this->db->idate($timestamp).'\'' : 'null' );
$sql .= ' WHERE rowid='.$this->id;
if ($this->db->query($sql))
{
$this->retained_warranty_date_limit = $timestamp;
return 1;
}
else
{
dol_syslog(get_class($this).'::setRetainedWarrantyDateLimit Erreur '.$sql.' - '.$this->db->error());
$this->error=$this->db->error();
return -1;
}
}
else
{
dol_syslog(get_class($this).'::setRetainedWarrantyDateLimit, status of the object is incompatible');
$this->error='Status of the object is incompatible '.$this->statut;
return -2;
}
}
}
/**

View File

@ -182,6 +182,12 @@ $arrayfields=array(
'f.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500),
'f.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
);
if($conf->global->INVOICE_USE_SITUATION && $conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY)
{
$arrayfields['f.retained_warranty'] = array('label'=>$langs->trans("RetainedWarranty"), 'checked'=>0);
}
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
@ -373,6 +379,10 @@ $sql.= ' f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,';
$sql.= ' f.datef as df, f.date_lim_reglement as datelimite,';
$sql.= ' f.paye as paye, f.fk_statut,';
$sql.= ' f.datec as date_creation, f.tms as date_update,';
if($conf->global->INVOICE_USE_SITUATION && $conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY)
{
$sql.= ' f.retained_warranty, f.retained_warranty_date_limit, f.situation_final,f.situation_cycle_ref,f.situation_counter,';
}
$sql.= ' s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur,';
$sql.= " typent.code as typent_code,";
$sql.= " state.code_departement as state_code, state.nom as state_name,";
@ -834,6 +844,13 @@ if ($resql)
print '<input class="flat" type="text" size="4" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).'">';
print '</td>';
}
if(! empty($arrayfields['f.retained_warranty']['checked']))
{
print '<td class="liste_titre" align="right">';
print '</td>';
}
if (! empty($arrayfields['dynamount_payed']['checked']))
{
print '<td class="liste_titre right">';
@ -899,6 +916,7 @@ if ($resql)
if (! empty($arrayfields['f.total_localtax1']['checked'])) print_liste_field_titre($arrayfields['f.total_localtax1']['label'], $_SERVER['PHP_SELF'], 'f.localtax1', '', $param, 'class="right"', $sortfield, $sortorder);
if (! empty($arrayfields['f.total_localtax2']['checked'])) print_liste_field_titre($arrayfields['f.total_localtax2']['label'], $_SERVER['PHP_SELF'], 'f.localtax2', '', $param, 'class="right"', $sortfield, $sortorder);
if (! empty($arrayfields['f.total_ttc']['checked'])) print_liste_field_titre($arrayfields['f.total_ttc']['label'], $_SERVER['PHP_SELF'], 'f.total_ttc', '', $param, 'class="right"', $sortfield, $sortorder);
if (! empty($arrayfields['f.retained_warranty']['checked'])) print_liste_field_titre($arrayfields['f.retained_warranty']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'align="right"', $sortfield, $sortorder);
if (! empty($arrayfields['dynamount_payed']['checked'])) print_liste_field_titre($arrayfields['dynamount_payed']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder);
if (! empty($arrayfields['rtp']['checked'])) print_liste_field_titre($arrayfields['rtp']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder);
// Extra fields
@ -939,7 +957,15 @@ if ($resql)
$facturestatic->date_lim_reglement=$db->jdate($obj->datelimite);
$facturestatic->note_public=$obj->note_public;
$facturestatic->note_private=$obj->note_private;
if($conf->global->INVOICE_USE_SITUATION && $conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY)
{
$facturestatic->retained_warranty=$obj->retained_warranty;
$facturestatic->retained_warranty_date_limit=$obj->retained_warranty_date_limit;
$facturestatic->situation_final=$obj->retained_warranty_date_limit;
$facturestatic->situation_final=$obj->retained_warranty_date_limit;
$facturestatic->situation_cycle_ref=$obj->situation_cycle_ref;
$facturestatic->situation_counter=$obj->situation_counter;
}
$thirdpartystatic->id=$obj->socid;
$thirdpartystatic->name=$obj->name;
$thirdpartystatic->client=$obj->client;
@ -1181,6 +1207,11 @@ if ($resql)
$totalarray['totalttc'] += $obj->total_ttc;
}
if(! empty($arrayfields['f.retained_warranty']['checked']))
{
print '<td align="right">'.(! empty($obj->retained_warranty)?price($obj->retained_warranty).'%':'&nbsp;').'</td>';
}
if (! empty($arrayfields['dynamount_payed']['checked']))
{
print '<td class="right nowrap">'.(! empty($totalpay)?price($totalpay, 0, $langs):'&nbsp;').'</td>'; // TODO Use a denormalized field

View File

@ -489,7 +489,7 @@ class RemiseCheque extends CommonObject
else
{
$langs->load("errors");
print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete");
print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Bank"));
return "";
}
}

View File

@ -1141,7 +1141,7 @@ class Paiement extends CommonObject
else
{
$langs->load("errors");
print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete");
print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Invoice"));
return "";
}
}

View File

@ -1417,7 +1417,7 @@ class BonPrelevement extends CommonObject
$sql = "SELECT soc.code_client as code, soc.address, soc.zip, soc.town, c.code as country_code,";
$sql.= " pl.client_nom as nom, pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, pl.amount as somme,";
$sql.= " f.ref as fac, pf.fk_facture as idfac, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum, rib.rum";
$sql.= " f.ref as fac, pf.fk_facture as idfac, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum, rib.rum, rib.date_rum";
$sql.= " FROM";
$sql.= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
$sql.= " ".MAIN_DB_PREFIX."facture as f,";
@ -1443,7 +1443,8 @@ class BonPrelevement extends CommonObject
while ($i < $num)
{
$obj = $this->db->fetch_object($resql);
$fileDebiteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $obj->fac, $obj->idfac, $obj->iban, $obj->bic, $this->db->jdate($obj->datec), $obj->drum, $obj->rum);
$daterum = (!empty($obj->date_rum)) ? $this->db->jdate($obj->date_rum) : $this->db->jdate($obj->datec);
$fileDebiteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $obj->fac, $obj->idfac, $obj->iban, $obj->bic, $daterum, $obj->drum, $obj->rum);
$this->total = $this->total + $obj->somme;
$i++;
}

View File

@ -78,7 +78,7 @@ if (empty($reshook))
// $conf->global->PRELEVEMENT_CODE_BANQUE and $conf->global->PRELEVEMENT_CODE_GUICHET should be empty
$bprev = new BonPrelevement($db);
$executiondate = dol_mktime(0, 0, 0, GETPOST('remonth'), (GETPOST('reday')+$conf->global->PRELEVEMENT_ADDDAYS), GETPOST('reyear'));
$result = $bprev->create($conf->global->PRELEVEMENT_CODE_BANQUE, $conf->global->PRELEVEMENT_CODE_GUICHET, $mode, $format, $executiondate);
if ($result < 0)
{
@ -116,7 +116,7 @@ llxHeader('', $langs->trans("NewStandingOrder"));
if (prelevement_check_config() < 0)
{
$langs->load("errors");
setEventMessages($langs->trans("ErrorModuleSetupNotComplete"), null, 'errors');
setEventMessages($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Withdraw")), null, 'errors');
}
/*$h=0;

View File

@ -58,7 +58,7 @@ llxHeader('', $langs->trans("CustomersStandingOrdersArea"));
if (prelevement_check_config() < 0)
{
$langs->load("errors");
setEventMessages($langs->trans("ErrorModuleSetupNotComplete"), null, 'errors');
setEventMessages($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Withdraw")), null, 'errors');
}
print load_fiche_titre($langs->trans("CustomersStandingOrdersArea"));

View File

@ -187,7 +187,7 @@ if ($resql)
if ($year)
{
$center=($year?"<a href='index.php?year=".($year-1)."'>".img_previous()."</a> ".$langs->trans("Year")." $year <a href='index.php?year=".($year+1)."'>".img_next()."</a>":"");
$center=($year?"<a href='list.php?year=".($year-1)."'>".img_previous()."</a> ".$langs->trans("Year")." $year <a href='list.php?year=".($year+1)."'>".img_next()."</a>":"");
print_barre_liste($langs->trans("SocialContributions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $totalnboflines, 'title_accountancy.png', 0, $newcardbutton, '', $limit);
}
else
@ -281,7 +281,7 @@ if ($resql)
print '<td align="center">';
if ($obj->periode)
{
print '<a href="index.php?year='.strftime("%Y", $db->jdate($obj->periode)).'">'.dol_print_date($db->jdate($obj->periode), 'day').'</a>';
print '<a href="list.php?year='.strftime("%Y", $db->jdate($obj->periode)).'">'.dol_print_date($db->jdate($obj->periode), 'day').'</a>';
}
else
{

View File

@ -90,7 +90,7 @@ print '<input type="hidden" name="mode" value="'.$mode.'">';
if ($mode != 'sconly')
{
$center=($year?'<a href="index.php?year='.($year-1).$param.'">'.img_previous($langs->trans("Previous"), 'class="valignbottom"')."</a> ".$langs->trans("Year").' '.$year.' <a href="index.php?year='.($year+1).$param.'">'.img_next($langs->trans("Next"), 'class="valignbottom"')."</a>":"");
$center=($year?'<a href="list.php?year='.($year-1).$param.'">'.img_previous($langs->trans("Previous"), 'class="valignbottom"')."</a> ".$langs->trans("Year").' '.$year.' <a href="list.php?year='.($year+1).$param.'">'.img_next($langs->trans("Next"), 'class="valignbottom"')."</a>":"");
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $totalnboflines, 'title_accountancy', 0, '', '', $limit, 1);
}
else
@ -181,7 +181,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
print $socialcontrib->getNomUrl(1, '20');
print '</td>';
// Type
print '<td><a href="../sociales/index.php?filtre=cs.fk_type:'.$obj->type.'">'.$obj->lib.'</a></td>';
print '<td><a href="../sociales/list.php?filtre=cs.fk_type:'.$obj->type.'">'.$obj->lib.'</a></td>';
// Date
$date=$obj->periode;
if (empty($date)) $date=$obj->date_ech;

View File

@ -38,7 +38,7 @@ $id = GETPOST('id', 'int');
$result = restrictedArea($user, 'contact', $id, 'socpeople&societe');
$object = new Contact($db);
if ($id > 0) $object->fetch($id);
if(empty($object->thirdparty)) $object->fetch_thirdparty();
if (empty($object->thirdparty)) $object->fetch_thirdparty();
$socid = $object->thirdparty->id;
// Sort & Order fields
@ -69,7 +69,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
}
// Customer or supplier selected in drop box
$thirdTypeSelect = GETPOST("third_select_id");
$type_element = GETPOST('type_element')?GETPOST('type_element'):'';
$type_element = GETPOSTISSET('type_element')?GETPOST('type_element'):'';
// Load translation files required by the page
$langs->loadLangs(array("companies", "bills", "orders", "suppliers", "propal", "interventions", "contracts", "products"));
@ -173,13 +173,13 @@ if ($type_element == 'fichinter')
$sql_select = 'SELECT f.rowid as doc_id, f.ref as doc_number, \'1\' as doc_type, f.datec as dateprint, f.fk_statut as status, tc.libelle, ';
$tables_from = MAIN_DB_PREFIX.'fichinterdet d';
$tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'fichinter as f ON d.fk_fichinter=f.rowid';
$tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=f.rowid';
$tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=f.rowid AND ec.fk_socpeople='.$object->id;
$tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX."c_type_contact tc ON (ec.fk_c_type_contact=tc.rowid and tc.element='fichinter' and tc.source='external' and tc.active=1)";
$where = ' WHERE f.entity IN ('.getEntity('ficheinter').')';
$dateprint = 'f.datec';
$doc_number='f.ref';
}
if ($type_element == 'invoice')
elseif ($type_element == 'invoice')
{ // Customer : show products from invoices
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$documentstatic=new Facture($db);
@ -187,14 +187,14 @@ if ($type_element == 'invoice')
$tables_from = MAIN_DB_PREFIX.'facturedet d';
$tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'facture as f ON d.fk_facture=f.rowid';
$tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product p ON d.fk_product=p.rowid';
$tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=f.rowid';
$tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=f.rowid AND ec.fk_socpeople='.$object->id;
$tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX."c_type_contact tc ON (ec.fk_c_type_contact=tc.rowid and tc.element='facture' and tc.source='external' and tc.active=1)";
$where = " WHERE f.entity IN (".getEntity('invoice').")";
$dateprint = 'f.datef';
$doc_number='f.ref';
$thirdTypeSelect='customer';
}
if ($type_element == 'propal')
elseif ($type_element == 'propal')
{
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
$documentstatic=new Propal($db);
@ -202,14 +202,14 @@ if ($type_element == 'propal')
$tables_from = MAIN_DB_PREFIX.'propaldet d';
$tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'propal as c ON d.fk_propal=c.rowid';
$tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product p ON d.fk_product=p.rowid';
$tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=c.rowid';
$tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=c.rowid AND ec.fk_socpeople='.$object->id;
$tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX."c_type_contact tc ON (ec.fk_c_type_contact=tc.rowid and tc.element='propal' and tc.source='external' and tc.active=1)";
$where = ' WHERE c.entity IN ('.getEntity('propal').')';
$datePrint = 'c.datep';
$doc_number='c.ref';
$thirdTypeSelect='customer';
}
if ($type_element == 'order')
elseif ($type_element == 'order')
{
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
$documentstatic=new Commande($db);
@ -217,14 +217,14 @@ if ($type_element == 'order')
$tables_from = MAIN_DB_PREFIX.'commandedet d';
$tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'commande as c ON d.fk_commande=c.rowid';
$tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product p ON d.fk_product=p.rowid';
$tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=c.rowid';
$tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=c.rowid AND ec.fk_socpeople='.$object->id;
$tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX."c_type_contact tc ON (ec.fk_c_type_contact=tc.rowid and tc.element='commande' and tc.source='external' and tc.active=1)";
$where = ' WHERE c.entity IN ('.getEntity('order').')';
$dateprint = 'c.date_commande';
$doc_number='c.ref';
$thirdTypeSelect='customer';
}
if ($type_element == 'supplier_invoice')
elseif ($type_element == 'supplier_invoice')
{ // Supplier : Show products from invoices.
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
$documentstatic=new FactureFournisseur($db);
@ -232,14 +232,14 @@ if ($type_element == 'supplier_invoice')
$tables_from = MAIN_DB_PREFIX.'facture_fourn_det d';
$tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'facture_fourn as f ON d.fk_facture_fourn=f.rowid';
$tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product p ON d.fk_product=p.rowid';
$tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=f.rowid';
$tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=f.rowid AND ec.fk_socpeople='.$object->id;
$tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX."c_type_contact tc ON (ec.fk_c_type_contact=tc.rowid and tc.element='invoice_supplier' and tc.source='external' and tc.active=1)";
$where = ' WHERE f.entity IN ('.getEntity($documentstatic->element).')';
$dateprint = 'f.datef';
$doc_number='f.ref';
$thirdTypeSelect='supplier';
}
//if ($type_element == 'supplier_proposal')
//elseif ($type_element == 'supplier_proposal')
//{
// require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php';
// $documentstatic=new SupplierProposal($db);
@ -252,7 +252,7 @@ if ($type_element == 'supplier_invoice')
// $doc_number='c.ref';
// $thirdTypeSelect='supplier';
//}
if ($type_element == 'supplier_order')
elseif ($type_element == 'supplier_order')
{ // Supplier : Show products from orders.
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
$documentstatic=new CommandeFournisseur($db);
@ -260,14 +260,14 @@ if ($type_element == 'supplier_order')
$tables_from = MAIN_DB_PREFIX.'commande_fournisseurdet d';
$tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'commande_fournisseur as c ON d.fk_commande=c.rowid';
$tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product p ON d.fk_product=p.rowid';
$tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=c.rowid';
$tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=c.rowid AND ec.fk_socpeople='.$object->id;
$tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX."c_type_contact tc ON (ec.fk_c_type_contact=tc.rowid and tc.element='order_supplier' and tc.source='external' and tc.active=1)";
$where = ' WHERE c.entity IN ('.getEntity($documentstatic->element).')';
$dateprint = 'c.date_valid';
$doc_number='c.ref';
$thirdTypeSelect='supplier';
}
if ($type_element == 'contract')
elseif ($type_element == 'contract')
{ // Order
require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
$documentstatic=new Contrat($db);
@ -276,7 +276,7 @@ if ($type_element == 'contract')
$tables_from = MAIN_DB_PREFIX.'contratdet d';
$tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'contrat as c ON d.fk_contrat=c.rowid';
$tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product p ON d.fk_product=p.rowid';
$tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=c.rowid';
$tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=c.rowid AND ec.fk_socpeople='.$object->id;
$tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX."c_type_contact tc ON (ec.fk_c_type_contact=tc.rowid and tc.element='contrat' and tc.source='external' and tc.active=1)";
$where = ' WHERE c.entity IN ('.getEntity('contrat').')';
$dateprint = 'c.date_valid';

View File

@ -245,7 +245,7 @@ class Contrat extends CommonObject
else
{
$langs->load("errors");
print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete");
print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Contract"));
return "";
}
}

View File

@ -2053,6 +2053,43 @@ abstract class CommonObject
return -2;
}
}
/**
* Change the retained warranty payments terms
*
* @param int $id Id of new payment terms
* @return int >0 if OK, <0 if KO
*/
public function setRetainedWarrantyPaymentTerms($id)
{
dol_syslog(get_class($this).'::setRetainedWarrantyPaymentTerms('.$id.')');
if ($this->statut >= 0 || $this->element == 'societe')
{
$fieldname = 'retained_warranty_fk_cond_reglement';
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
$sql .= ' SET '.$fieldname.' = '.$id;
$sql .= ' WHERE rowid='.$this->id;
if ($this->db->query($sql))
{
$this->retained_warranty_fk_cond_reglement = $id;
return 1;
}
else
{
dol_syslog(get_class($this).'::setRetainedWarrantyPaymentTerms Erreur '.$sql.' - '.$this->db->error());
$this->error=$this->db->error();
return -1;
}
}
else
{
dol_syslog(get_class($this).'::setRetainedWarrantyPaymentTerms, status of the object is incompatible');
$this->error='Status of the object is incompatible '.$this->statut;
return -2;
}
}
/**
* Define delivery address
@ -6047,6 +6084,12 @@ abstract class CommonObject
$type='link';
$param['options']=array($reg[1].':'.$reg[2]=>$reg[1].':'.$reg[2]);
}
elseif(preg_match('/^sellist:(.*):(.*):(.*):(.*)/i', $val['type'], $reg)) {
$param['options'] = array($reg[1] . ':' . $reg[2] . ':' . $reg[3] . ':' . $reg[4] => 'N');
$type = 'sellist';
}
$langfile=$val['langfile'];
$list=$val['list'];
$help=$val['help'];

View File

@ -1411,7 +1411,7 @@ class ExtraFields
// current object id can be use into filter
if (strpos($InfoFieldList[4], '$ID$') !== false && !empty($objectid)) {
$InfoFieldList[4] = str_replace('$ID$', $objectid, $InfoFieldList[4]);
} elseif (preg_match("#^.*list.php$#", $_SERVER["DOCUMENT_URI"])) {
} elseif (preg_match("#^.*list.php$#", $_SERVER["PHP_SELF"])) {
// Pattern for word=$ID$
$word = '\b[a-zA-Z0-9-\.-_]+\b=\$ID\$';
@ -1445,13 +1445,13 @@ class ExtraFields
$InfoFieldList[4] = str_replace('$ID$', '0', $InfoFieldList[4]);
} else {
if (!empty($matchCondition[1])) {
$boolCond = (($matchCondition[1] == "AND") ? ' AND 1 ' : ' OR 0 ');
$boolCond = (($matchCondition[1] == "AND") ? ' AND TRUE ' : ' OR FALSE ');
$InfoFieldList[4] = str_replace($matchCondition[0], $boolCond . $matchCondition[3], $InfoFieldList[4]);
} elseif (!empty($matchCondition[3])) {
$boolCond = (($matchCondition[3] == "AND") ? ' 1 AND ' : ' 0 OR');
$boolCond = (($matchCondition[3] == "AND") ? ' TRUE AND ' : ' FALSE OR');
$InfoFieldList[4] = str_replace($matchCondition[0], $boolCond, $InfoFieldList[4]);
} else {
$InfoFieldList[4] = 1;
$InfoFieldList[4] = " TRUE ";
}
}

View File

@ -199,8 +199,6 @@ class FormMargin
if (! $user->rights->margins->liretous) return;
$rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT, $conf->global->MAIN_MAX_DECIMALS_TOT);
$marginInfo = $this->getMarginInfosArray($object, $force_price);
if (! empty($conf->global->MARGIN_ADD_SHOWHIDE_BUTTON)) // TODO Warning this feature rely on an external js file that may be removed. Using native js function document.cookie should be better
@ -240,13 +238,13 @@ class FormMargin
//if ($marginInfo['margin_on_products'] != 0 && $marginInfo['margin_on_services'] != 0) {
print '<tr class="oddeven">';
print '<td>'.$langs->trans('MarginOnProducts').'</td>';
print '<td class="right">'.price($marginInfo['pv_products'], null, null, null, null, $rounding).'</td>';
print '<td class="right">'.price($marginInfo['pa_products'], null, null, null, null, $rounding).'</td>';
print '<td class="right">'.price($marginInfo['margin_on_products'], null, null, null, null, $rounding).'</td>';
print '<td class="right">'.price($marginInfo['pv_products']).'</td>';
print '<td class="right">'.price($marginInfo['pa_products']).'</td>';
print '<td class="right">'.price($marginInfo['margin_on_products']).'</td>';
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
print '<td class="right">'.(($marginInfo['margin_rate_products'] == '')?'':price($marginInfo['margin_rate_products'], null, null, null, null, $rounding).'%').'</td>';
print '<td class="right">'.(($marginInfo['margin_rate_products'] == '')?'':price($marginInfo['margin_rate_products'], null, null, null, null, 2).'%').'</td>';
if (! empty($conf->global->DISPLAY_MARK_RATES))
print '<td class="right">'.(($marginInfo['mark_rate_products'] == '')?'':price($marginInfo['mark_rate_products'], null, null, null, null, $rounding).'%').'</td>';
print '<td class="right">'.(($marginInfo['mark_rate_products'] == '')?'':price($marginInfo['mark_rate_products'], null, null, null, null, 2).'%').'</td>';
print '</tr>';
}
@ -254,13 +252,13 @@ class FormMargin
{
print '<tr class="oddeven">';
print '<td>'.$langs->trans('MarginOnServices').'</td>';
print '<td class="right">'.price($marginInfo['pv_services'], null, null, null, null, $rounding).'</td>';
print '<td class="right">'.price($marginInfo['pa_services'], null, null, null, null, $rounding).'</td>';
print '<td class="right">'.price($marginInfo['margin_on_services'], null, null, null, null, $rounding).'</td>';
print '<td class="right">'.price($marginInfo['pv_services']).'</td>';
print '<td class="right">'.price($marginInfo['pa_services']).'</td>';
print '<td class="right">'.price($marginInfo['margin_on_services']).'</td>';
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
print '<td class="right">'.(($marginInfo['margin_rate_services'] == '')?'':price($marginInfo['margin_rate_services'], null, null, null, null, $rounding).'%').'</td>';
print '<td class="right">'.(($marginInfo['margin_rate_services'] == '')?'':price($marginInfo['margin_rate_services'], null, null, null, null, 2).'%').'</td>';
if (! empty($conf->global->DISPLAY_MARK_RATES))
print '<td class="right">'.(($marginInfo['mark_rate_services'] == '')?'':price($marginInfo['mark_rate_services'], null, null, null, null, $rounding).'%').'</td>';
print '<td class="right">'.(($marginInfo['mark_rate_services'] == '')?'':price($marginInfo['mark_rate_services'], null, null, null, null, 2).'%').'</td>';
print '</tr>';
}
@ -268,13 +266,13 @@ class FormMargin
{
print '<tr class="liste_total">';
print '<td>'.$langs->trans('TotalMargin').'</td>';
print '<td class="right">'.price($marginInfo['pv_total'], null, null, null, null, $rounding).'</td>';
print '<td class="right">'.price($marginInfo['pa_total'], null, null, null, null, $rounding).'</td>';
print '<td class="right">'.price($marginInfo['total_margin'], null, null, null, null, $rounding).'</td>';
print '<td class="right">'.price($marginInfo['pv_total']).'</td>';
print '<td class="right">'.price($marginInfo['pa_total']).'</td>';
print '<td class="right">'.price($marginInfo['total_margin']).'</td>';
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
print '<td class="right">'.(($marginInfo['total_margin_rate'] == '')?'':price($marginInfo['total_margin_rate'], null, null, null, null, $rounding).'%').'</td>';
print '<td class="right">'.(($marginInfo['total_margin_rate'] == '')?'':price($marginInfo['total_margin_rate'], null, null, null, null, 2).'%').'</td>';
if (! empty($conf->global->DISPLAY_MARK_RATES))
print '<td class="right">'.(($marginInfo['total_mark_rate'] == '')?'':price($marginInfo['total_mark_rate'], null, null, null, null, $rounding).'%').'</td>';
print '<td class="right">'.(($marginInfo['total_mark_rate'] == '')?'':price($marginInfo['total_mark_rate'], null, null, null, null, 2).'%').'</td>';
print '</tr>';
}
print '</table>';

View File

@ -148,6 +148,7 @@ print '
/* Set handler to add page_y param on output (click on href links or submit button) */
jQuery(".reposition").click(function() {
var page_y = $(document).scrollTop();
if (page_y > 0)
{
if (this.href)
@ -157,7 +158,7 @@ print '
}
else
{
console.log("We click on tag with .reposition class but element is not an <a> html tag, so we try to update form field page_y with value "+page_y);
console.log("We click on tag with .reposition class but element is not an <a> html tag, so we try to update input form field page_y with value "+page_y);
jQuery("input[type=hidden][name=page_y]").val(page_y);
}
}

View File

@ -2447,6 +2447,13 @@ function dol_print_phone($phone, $countrycode = '', $cid = 0, $socid = 0, $addli
$newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 1).$separ.substr($newphone, 5, 3).$separ.substr($newphone, 7, 2).$separ.substr($newphone, 9, 2);
}
}
elseif (strtoupper($countrycode) == "JM")
{//Jamaïque
if(dol_strlen($newphone) == 12)
{//ex: +1867_ABC_DEFG
$newphone = substr($newphone, 0, 5).$separ.substr($newphone, 5, 3).$separ.substr($newphone, 8, 4);
}
}
elseif (strtoupper($countrycode) == "MG")
{//Madagascar
if(dol_strlen($phone) == 13)
@ -4400,7 +4407,7 @@ function price($amount, $form = 0, $outlangs = '', $trunc = 1, $rounding = -1, $
{
if ($currency_code == 'auto') $currency_code=$conf->currency;
$listofcurrenciesbefore=array('USD','GBP','AUD','HKD','MXN','PEN','CNY');
$listofcurrenciesbefore=array('USD','GBP','AUD','HKD','MXN','PEN','CNY','CAD');
$listoflanguagesbefore=array('nl_NL');
if (in_array($currency_code, $listofcurrenciesbefore) || in_array($outlangs->defaultlang, $listoflanguagesbefore))
{
@ -6554,10 +6561,17 @@ function dol_htmloutput_mesg($mesgstring = '', $mesgarray = array(), $style = 'o
$newmesgarray=array();
foreach($mesgarray as $val)
{
$tmpmesgstring=preg_replace('/<\/div><div class="(error|warning)">/', '<br>', $val);
$tmpmesgstring=preg_replace('/<div class="(error|warning)">/', '', $tmpmesgstring);
$tmpmesgstring=preg_replace('/<\/div>/', '', $tmpmesgstring);
$newmesgarray[]=$tmpmesgstring;
if (is_string($val))
{
$tmpmesgstring=preg_replace('/<\/div><div class="(error|warning)">/', '<br>', $val);
$tmpmesgstring=preg_replace('/<div class="(error|warning)">/', '', $tmpmesgstring);
$tmpmesgstring=preg_replace('/<\/div>/', '', $tmpmesgstring);
$newmesgarray[]=$tmpmesgstring;
}
else
{
dol_syslog("Error call of dol_htmloutput_mesg with an array with a value that is not a string", LOG_WARNING);
}
}
$mesgarray=$newmesgarray;
}

View File

@ -136,7 +136,14 @@ function invoice_admin_prepare_head()
$head[$h][1] = $langs->trans("Payments");
$head[$h][2] = 'payment';
$h++;
if($conf->global->INVOICE_USE_SITUATION){
$head[$h][0] = DOL_URL_ROOT.'/admin/facture_situation.php';
$head[$h][1] = $langs->trans("InvoiceSituation");
$head[$h][2] = 'situation';
$h++;
}
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab

View File

@ -2212,3 +2212,49 @@ function pdf_getSizeForImage($realpath)
}
return array('width'=>$width,'height'=>$height);
}
/**
* Return line total amount discount
*
* @param Object $object Object
* @param int $i Current line number
* @param Translate $outputlangs Object langs for output
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
* @return string Return total of line excl tax
*/
function pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, $hidedetails = 0)
{
global $conf, $hookmanager;
$sign=1;
if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1;
if ($object->lines[$i]->special_code == 3)
{
return $outputlangs->transnoentities("Option");
}
else
{
if (is_object($hookmanager))
{
$special_code = $object->lines[$i]->special_code;
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
$parameters = array(
'i'=>$i,
'outputlangs'=>$outputlangs,
'hidedetails'=>$hidedetails,
'special_code'=>$special_code
);
$action='';
if( $hookmanager->executeHooks('getlinetotalremise', $parameters, $object, $action)>0)
{
return $hookmanager->resPrint; // Note that $action and $object may have been modified by some hooks
}
}
if (empty($hidedetails) || $hidedetails > 1) return $sign * ( ($object->lines[$i]->subprice * $object->lines[$i]->qty) - $object->lines[$i]->total_ht );
}
return '';
}

View File

@ -38,7 +38,8 @@ function takepos_prepare_head()
$head[$h][2] = 'setup';
$h++;
for ($i = 1; $i <= $conf->global->TAKEPOS_NUM_TERMINALS; $i++)
$numterminals = max(1, $conf->global->TAKEPOS_NUM_TERMINALS);
for ($i = 1; $i <= $numterminals; $i++)
{
$head[$h][0] = DOL_URL_ROOT.'/takepos/admin/terminal.php?terminal='.$i;
$head[$h][1] = $langs->trans("Terminal"). " ".$i;

View File

@ -252,7 +252,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
$pdf->MultiCell(22, 2, $outputlangs->transnoentities("Owner"), 0, 'L');
$pdf->SetFont('', '', $default_font_size);
$pdf->SetXY(32, 26);
$pdf->MultiCell(60, 2, $outputlangs->convToOutputCharset($this->account->proprio), 0, 'L');
$pdf->MultiCell(80, 2, $outputlangs->convToOutputCharset($this->account->proprio), 0, 'L');
$pdf->SetFont('', '', $default_font_size);
$pdf->SetXY(10, 32);

View File

@ -1347,6 +1347,50 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * $total_ttc, 0, $outputlangs), $useborder, 'R', 1);
// Retained warranty
if( !empty($object->situation_final) && ( $object->type == Facture::TYPE_SITUATION && (!empty($object->retained_warranty) ) ) )
{
$displayWarranty = false;
// Check if this situation invoice is 100% for real
if(!empty($object->lines)){
$displayWarranty = true;
foreach($object->lines as $i => $line){
if($line->product_type < 2 && $line->situation_percent < 100){
$displayWarranty = false;
break;
}
}
}
if($displayWarranty){
$pdf->SetTextColor(40, 40, 40);
$pdf->SetFillColor(255, 255, 255);
$retainedWarranty = $object->total_ttc * $object->retained_warranty / 100;
$billedWithRetainedWarranty = $object->total_ttc - $retainedWarranty ;
// Billed - retained warranty
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("ToPayOn", dol_print_date($object->date_lim_reglement, 'day')), $useborder, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($billedWithRetainedWarranty), $useborder, 'R', 1);
// retained warranty
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$retainedWarrantyToPayOn = $outputlangs->transnoentities("RetainedWarranty") . ' ('.$object->retained_warranty.'%)';
$retainedWarrantyToPayOn.= !empty($object->retained_warranty_date_limit)?' '.$outputlangs->transnoentities("toPayOn", dol_print_date($object->retained_warranty_date_limit, 'day')):'';
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $retainedWarrantyToPayOn, $useborder, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($retainedWarranty), $useborder, 'R', 1);
}
}
}
}

View File

@ -1225,13 +1225,172 @@ class pdf_sponge extends ModelePDFFactures
$useborder=0;
$index = 0;
// pourcentage global d'avancement
$percent = 0;
$i=0;
foreach ($object->lines as $line)
{
if(!class_exists('TSubtotal') || !TSubtotal::isModSubtotalLine($line)){
$percent += $line->situation_percent;
$i++;
}
}
if(!empty($i)){
$avancementGlobal = $percent/$i;
}
else{
$avancementGlobal = 0;
}
$object->fetchPreviousNextSituationInvoice();
$TPreviousIncoice = $object->tab_previous_situation_invoice;
$total_a_payer = 0;
$total_a_payer_ttc = 0;
foreach ($TPreviousIncoice as &$fac){
$total_a_payer += $fac->total_ht;
$total_a_payer_ttc += $fac->total_ttc;
}
$total_a_payer += $object->total_ht;
$total_a_payer_ttc += $object->total_ttc;
if(!empty($avancementGlobal)){
$total_a_payer = $total_a_payer * 100 / $avancementGlobal;
$total_a_payer_ttc = $total_a_payer_ttc * 100 / $avancementGlobal;
}
else{
$total_a_payer = 0;
$total_a_payer_ttc = 0;
}
$deja_paye = 0;
$i = 1;
if(!empty($TPreviousIncoice)){
$pdf->setY($tab2_top);
$posy = $pdf->GetY();
foreach ($TPreviousIncoice as &$fac){
if($posy > $this->page_hauteur - 4 ) {
$this->_pagefoot($pdf, $object, $outputlangs, 1);
$pdf->addPage();
$pdf->setY($this->marge_haute);
$posy = $pdf->GetY();
}
// cumul TVA précédent
$index++;
$pdf->SetFillColor(255, 255, 255);
$pdf->SetXY($col1x, $posy);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("PDFSituationTitle", $fac->situation_counter).' '.$outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
$pdf->SetXY($col2x, $posy);
$facSign = '';
if($i>1){
$facSign = $fac->total_ht>=0?'+':'';
}
$displayAmount = ' '.$facSign.' '.price($fac->total_ht, 0, $outputlangs);
$pdf->MultiCell($largcol2, $tab2_hl, $displayAmount, 0, 'R', 1);
$i++;
$deja_paye += $fac->total_ht;
$posy += $tab2_hl;
$pdf->setY($posy);
}
// Display curent total
$pdf->SetFillColor(255, 255, 255);
$pdf->SetXY($col1x, $posy);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("PDFSituationTitle", $object->situation_counter).' '.$outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
$pdf->SetXY($col2x, $posy);
$facSign = '';
if($i>1){
$facSign = $object->total_ht>=0?'+':''; // gestion d'un cas particulier client
}
if($fac->type === facture::TYPE_CREDIT_NOTE){
$facSign = '-'; // les avoirs
}
$displayAmount = ' '.$facSign.' '.price($object->total_ht, 0, $outputlangs);
$pdf->MultiCell($largcol2, $tab2_hl, $displayAmount, 0, 'R', 1);
$posy += $tab2_hl;
// Display all total
$pdf->SetFont('', '', $default_font_size - 1);
$pdf->SetFillColor(255, 255, 255);
$pdf->SetXY($col1x, $posy);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("SituationTotalProgress", $avancementGlobal), 0, 'L', 1);
$pdf->SetXY($col2x, $posy);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_a_payer*$avancementGlobal/100, 0, $outputlangs), 0, 'R', 1);
$pdf->SetFont('', '', $default_font_size - 2);
$posy += $tab2_hl;
if($posy > $this->page_hauteur - 4 ) {
$pdf->addPage();
$pdf->setY($this->marge_haute);
$posy = $pdf->GetY();
}
$tab2_top = $posy;
$index=0;
}
$tab2_top += 3;
// Get Total HT
$total_ht = ($conf->multicurrency->enabled && $object->mylticurrency_tx != 1 ? $object->multicurrency_total_ht : $object->total_ht);
// Total remise
$total_line_remise=0;
foreach($object->lines as $i => $line) {
$total_line_remise+= pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, 2); // TODO: add this methode to core/lib/pdf.lib
// Gestion remise sous forme de ligne négative
if($line->total_ht < 0) $total_line_remise += -$line->total_ht;
}
if($total_line_remise > 0) {
if (! empty($conf->global->MAIN_SHOW_AMOUNT_DISCOUNT)) {
$pdf->SetFillColor(255, 255, 255);
$pdf->SetXY($col1x, $tab2_top + $tab2_hl);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalDiscount"), 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_line_remise, 0, $outputlangs), 0, 'R', 1);
$index++;
}
// Show total NET before discount
if (! empty($conf->global->MAIN_SHOW_AMOUNT_BEFORE_DISCOUNT)) {
$pdf->SetFillColor(255, 255, 255);
$pdf->SetXY($col1x, $tab2_top + 0);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHTBeforeDiscount"), 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + 0);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_line_remise + $total_ht, 0, $outputlangs), 0, 'R', 1);
$index++;
}
}
// Total HT
$pdf->SetFillColor(255, 255, 255);
$pdf->SetXY($col1x, $tab2_top + 0);
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
$total_ht = ($conf->multicurrency->enabled && $object->mylticurrency_tx != 1 ? $object->multicurrency_total_ht : $object->total_ht);
$pdf->SetXY($col2x, $tab2_top + 0);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * ($total_ht + (! empty($object->remise)?$object->remise:0)), 0, $outputlangs), 0, 'R', 1);
// Show VAT by rates and total
@ -1256,7 +1415,7 @@ class pdf_sponge extends ModelePDFFactures
//{
foreach($this->localtax1 as $localtax_type => $localtax_rate)
{
if (in_array((string) $localtax_type, array('1','3','5'))) continue;
if (in_array((string) $localtax_type, array('1', '3', '5'))) continue;
foreach($localtax_rate as $tvakey => $tvaval)
{
@ -1330,7 +1489,14 @@ class pdf_sponge extends ModelePDFFactures
}
if($sum_pdf_tva!=$object->total_tva) { // apply coef to recover the VAT object amount (the good one)
$coef_fix_tva = $object->total_tva / $sum_pdf_tva;
if(!empty($sum_pdf_tva))
{
$coef_fix_tva = $object->total_tva / $sum_pdf_tva;
}
else {
$coef_fix_tva = 1;
}
foreach($this->tva as $tvakey => $tvaval) {
$this->tva[$tvakey]=$tvaval * $coef_fix_tva;
@ -1427,7 +1593,7 @@ class pdf_sponge extends ModelePDFFactures
}
}
}
//}
// Revenue stamp
if (price2num($object->revenuestamp) != 0)
@ -1449,6 +1615,69 @@ class pdf_sponge extends ModelePDFFactures
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * $total_ttc, 0, $outputlangs), $useborder, 'R', 1);
/*if($object->type == Facture::TYPE_SITUATION)
{
// reste à payer total
$index++;
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetFillColor(255,255,255);
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities('SituationTotalRayToRest'), 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_a_payer_ttc-$deja_paye, 0, $outputlangs), 0, 'R', 1);
}*/
// Retained warranty
if( !empty($object->situation_final) && ( $object->type == Facture::TYPE_SITUATION && (!empty($object->retained_warranty) ) ) )
{
$displayWarranty = false;
// Check if this situation invoice is 100% for real
if(!empty($object->situation_final)){
$displayWarranty = true;
}
elseif(!empty($object->lines) && $object->status == Facture::STATUS_DRAFT ){
// $object->situation_final need validation to be done so this test is need for draft
$displayWarranty = true;
foreach($object->lines as $i => $line){
if($line->product_type < 2 && $line->situation_percent < 100){
$displayWarranty = false;
break;
}
}
}
if($displayWarranty){
$pdf->SetTextColor(40, 40, 40);
$pdf->SetFillColor(255, 255, 255);
$retainedWarranty = $total_a_payer_ttc * $object->retained_warranty / 100;
$billedWithRetainedWarranty = $object->total_ttc - $retainedWarranty ;
// Billed - retained warranty
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("PDFEVOLToPayOn", dol_print_date($object->date_lim_reglement, 'day')), $useborder, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($billedWithRetainedWarranty), $useborder, 'R', 1);
// retained warranty
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$retainedWarrantyToPayOn = $outputlangs->transnoentities("PDFEVOLRetainedWarranty") . ' ('.$object->retained_warranty.'%)';
$retainedWarrantyToPayOn.= !empty($object->retained_warranty_date_limit)?' '.$outputlangs->transnoentities("PDFEVOLtoPayOn", dol_print_date($object->retained_warranty_date_limit, 'day')):'';
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $retainedWarrantyToPayOn, $useborder, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($retainedWarranty), $useborder, 'R', 1);
}
}
}
}
@ -1456,7 +1685,7 @@ class pdf_sponge extends ModelePDFFactures
$creditnoteamount=$object->getSumCreditNotesUsed(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0);
$depositsamount=$object->getSumDepositsUsed(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0);
//print "x".$creditnoteamount."-".$depositsamount;exit;
$resteapayer = price2num($total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 'MT');
if ($object->paye) $resteapayer=0;
@ -1509,6 +1738,20 @@ class pdf_sponge extends ModelePDFFactures
return ($tab2_top + ($tab2_hl * $index));
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active generation modules
*
* @param DoliDB $db Database handler
* @param integer $maxfilenamelength Max length of value to show
* @return array List of templates
*/
public static function liste_modeles($db, $maxfilenamelength = 0)
{
// phpcs:enable
return parent::liste_modeles($db, $maxfilenamelength); // TODO: Change the autogenerated stub
}
/**
* Show table for lines
*

View File

@ -136,12 +136,12 @@ class pdf_soleil extends ModelePDFFicheinter
$this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10;
$this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10;
$this->option_logo = 1; // Affiche logo
$this->option_tva = 0; // Gere option tva FACTURE_TVAOPTION
$this->option_modereg = 0; // Affiche mode reglement
$this->option_condreg = 0; // Affiche conditions reglement
$this->option_codeproduitservice = 0; // Affiche code produit-service
$this->option_multilang = 1; // Dispo en plusieurs langues
$this->option_logo = 1; // Display logo
$this->option_tva = 0; // Manage the vat option FACTURE_TVAOPTION
$this->option_modereg = 0; // Display payment mode
$this->option_condreg = 0; // Display payment terms
$this->option_codeproduitservice = 0; // Display product-service code
$this->option_multilang = 1; // Available in several languages
$this->option_draft_watermark = 1; //Support add of a watermark on drafts
// Get source company

View File

@ -594,16 +594,25 @@ class ImportCsv extends ModeleImports
// Test regexp
if (! empty($objimport->array_import_regex[0][$val]) && ($newval != ''))
{
// If test is "Must exist in a field@table"
if (preg_match('/^(.*)@(.*)$/', $objimport->array_import_regex[0][$val], $reg))
// If test is "Must exist in a field@table or field@table:..."
if (preg_match('/^(.+)@([^:]+)(:.+)?$/', $objimport->array_import_regex[0][$val], $reg))
{
$field=$reg[1];
$table=$reg[2];
$filter=!empty($reg[3])?substr($reg[3], 1):'';
$cachekey = $field.'@'.$table;
if(! empty($filter)) $cachekey.= ':'.$filter;
// Load content of field@table into cache array
if (! is_array($this->cachefieldtable[$field.'@'.$table])) // If content of field@table not already loaded into cache
if (! is_array($this->cachefieldtable[$cachekey])) // If content of field@table not already loaded into cache
{
$sql="SELECT ".$field." as aliasfield FROM ".$table;
if(! empty($filter))
{
$sql.= ' WHERE ' . $filter;
}
$resql=$this->db->query($sql);
if ($resql)
{
@ -612,7 +621,7 @@ class ImportCsv extends ModeleImports
while ($i < $num)
{
$obj=$this->db->fetch_object($resql);
if ($obj) $this->cachefieldtable[$field.'@'.$table][]=$obj->aliasfield;
if ($obj) $this->cachefieldtable[$cachekey][]=$obj->aliasfield;
$i++;
}
}
@ -623,9 +632,11 @@ class ImportCsv extends ModeleImports
}
// Now we check cache is not empty (should not) and key is into cache
if (! is_array($this->cachefieldtable[$field.'@'.$table]) || ! in_array($newval, $this->cachefieldtable[$field.'@'.$table]))
if (! is_array($this->cachefieldtable[$cachekey]) || ! in_array($newval, $this->cachefieldtable[$cachekey]))
{
$this->errors[$error]['lib']=$langs->transnoentitiesnoconv('ErrorFieldValueNotIn', $key, $newval, $field, $table);
$tableforerror = $table;
if(! empty($filter)) $tableforerror.= ':'.$filter;
$this->errors[$error]['lib']=$langs->transnoentitiesnoconv('ErrorFieldValueNotIn', $key, $newval, $field, $tableforerror);
$this->errors[$error]['type']='FOREIGNKEY';
$errorforthistable++;
$error++;

View File

@ -621,16 +621,25 @@ class ImportXlsx extends ModeleImports
// Test regexp
if (! empty($objimport->array_import_regex[0][$val]) && ($newval != ''))
{
// If test is "Must exist in a field@table"
if (preg_match('/^(.*)@(.*)$/', $objimport->array_import_regex[0][$val], $reg))
// If test is "Must exist in a field@table or field@table:..."
if (preg_match('/^(.+)@([^:]+)(:.+)?$/', $objimport->array_import_regex[0][$val], $reg))
{
$field=$reg[1];
$table=$reg[2];
$filter=!empty($reg[3])?substr($reg[3], 1):'';
$cachekey = $field.'@'.$table;
if(! empty($filter)) $cachekey.= ':'.$filter;
// Load content of field@table into cache array
if (! is_array($this->cachefieldtable[$field.'@'.$table])) // If content of field@table not already loaded into cache
if (! is_array($this->cachefieldtable[$cachekey])) // If content of field@table not already loaded into cache
{
$sql="SELECT ".$field." as aliasfield FROM ".$table;
if(! empty($filter))
{
$sql.= ' WHERE ' . $filter;
}
$resql=$this->db->query($sql);
if ($resql)
{
@ -639,7 +648,7 @@ class ImportXlsx extends ModeleImports
while ($i < $num)
{
$obj=$this->db->fetch_object($resql);
if ($obj) $this->cachefieldtable[$field.'@'.$table][]=$obj->aliasfield;
if ($obj) $this->cachefieldtable[$cachekey][]=$obj->aliasfield;
$i++;
}
}
@ -650,9 +659,11 @@ class ImportXlsx extends ModeleImports
}
// Now we check cache is not empty (should not) and key is into cache
if (! is_array($this->cachefieldtable[$field.'@'.$table]) || ! in_array($newval, $this->cachefieldtable[$field.'@'.$table]))
if (! is_array($this->cachefieldtable[$cachekey]) || ! in_array($newval, $this->cachefieldtable[$cachekey]))
{
$this->errors[$error]['lib']=$langs->transnoentitiesnoconv('ErrorFieldValueNotIn', $key, $newval, $field, $table);
$tableforerror = $table;
if(! empty($filter)) $tableforerror.= ':'.$filter;
$this->errors[$error]['lib']=$langs->transnoentitiesnoconv('ErrorFieldValueNotIn', $key, $newval, $field, $tableforerror);
$this->errors[$error]['type']='FOREIGNKEY';
$errorforthistable++;
$error++;

View File

@ -139,9 +139,9 @@ class pdf_typhon extends ModelePDFDeliveryOrder
$this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10;
$this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10;
$this->option_logo = 1; // Affiche logo FAC_PDF_LOGO
$this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION
$this->option_codeproduitservice = 1; // Affiche code produit-service
$this->option_logo = 1; // Display logo FAC_PDF_LOGO
$this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION
$this->option_codeproduitservice = 1; // Display product-service code
$this->franchise=!$mysoc->tva_assuj;

View File

@ -425,8 +425,8 @@ class modCategorie extends DolibarrModules
$this->import_icon[$r]=$this->picto;
$this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
$this->import_tables_array[$r]=array('cp'=>MAIN_DB_PREFIX.'categorie_product');
$this->import_fields_array[$r]=array('cp.fk_categorie'=>"Category*",'cp.fk_product'=>"Product*"
);
$this->import_fields_array[$r]=array('cp.fk_categorie'=>"Category*",'cp.fk_product'=>"Product*");
$this->import_regex_array[$r]=array('cp.fk_categorie'=>'rowid@'.MAIN_DB_PREFIX.'categorie:type=0');
$this->import_convertvalue_array[$r]=array(
'cp.fk_categorie'=>array('rule'=>'fetchidfromref','classfile'=>'/categories/class/categorie.class.php','class'=>'Categorie','method'=>'fetch','element'=>'category'),
@ -444,7 +444,10 @@ class modCategorie extends DolibarrModules
$this->import_icon[$r]=$this->picto;
$this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
$this->import_tables_array[$r]=array('cs'=>MAIN_DB_PREFIX.'categorie_societe');
$this->import_fields_array[$r]=array('cs.fk_categorie'=>"Category*",'cs.fk_soc'=>"ThirdParty*"
$this->import_fields_array[$r]=array('cs.fk_categorie'=>"Category*",'cs.fk_soc'=>"ThirdParty*");
$this->import_regex_array[$r]=array(
'cs.fk_categorie'=>'rowid@'.MAIN_DB_PREFIX.'categorie:type=2',
'cs.fk_soc'=>'rowid@'.MAIN_DB_PREFIX.'societe:client>0'
);
$this->import_convertvalue_array[$r]=array(
@ -463,7 +466,10 @@ class modCategorie extends DolibarrModules
$this->import_icon[$r]=$this->picto;
$this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
$this->import_tables_array[$r]=array('cs'=>MAIN_DB_PREFIX.'categorie_fournisseur');
$this->import_fields_array[$r]=array('cs.fk_categorie'=>"Category*",'cs.fk_soc'=>"Supplier*"
$this->import_fields_array[$r]=array('cs.fk_categorie'=>"Category*",'cs.fk_soc'=>"Supplier*");
$this->import_regex_array[$r]=array(
'cs.fk_categorie'=>'rowid@'.MAIN_DB_PREFIX.'categorie:type=1',
'cs.fk_soc'=>'rowid@'.MAIN_DB_PREFIX.'societe:fournisseur>0'
);
$this->import_convertvalue_array[$r]=array(

View File

@ -438,7 +438,7 @@ class pdf_beluga extends ModelePDFProjects
$pdf->MultiCell($this->posxstatut - $this->posxamountht, 3, "", 1, 'R');
}
$pdf->SetXY($this->posxstatut, $curY);
$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxstatut, 3, $outputlangs->transnoentities("Statut"), 1, 'R');
$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxstatut, 3, $outputlangs->transnoentities("Status"), 1, 'R');
if (is_array($elementarray) && count($elementarray) > 0)
{

View File

@ -255,6 +255,25 @@ if ($nolinesbefore) {
{
$form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, 1, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth300', 0, '', GETPOST('combinations', 'array'));
}
if (! empty($conf->global->MAIN_AUTO_OPEN_SELECT2_ON_FOCUS_FOR_CUSTOMER_PRODUCTS))
{
?>
<script type="text/javascript">
$(document).ready(function(){
// On first focus on a select2 combo, auto open the menu (this allow to use the keyboard only)
$(document).on('focus', '.select2-selection.select2-selection--single', function (e) {
console.log('focus on a select2');
if ($(this).attr('aria-labelledby') == 'select2-idprod-container')
{
console.log('open combo');
$('#idprod').select2('open');
}
});
});
</script>
<?php
}
}
else
{
@ -277,21 +296,24 @@ if ($nolinesbefore) {
}
$form->select_produits_fournisseurs($object->socid, GETPOST('idprodfournprice'), 'idprodfournprice', '', '', $ajaxoptions, 1, $alsoproductwithnosupplierprice, 'maxwidth300');
?>
<script type="text/javascript">
$(document).ready(function(){
$(document).on('keypress',function(e) {
if ($('input:focus').length == 0) {
$('#idprodfournprice').select2('open');
}
});
});
</script>
<?php
if (! empty($conf->global->MAIN_AUTO_OPEN_SELECT2_ON_FOCUS_FOR_SUPPLIER_PRODUCTS))
{
?>
<script type="text/javascript">
$(document).ready(function(){
// On first focus on a select2 combo, auto open the menu (this allow to use the keyboard only)
$(document).on('focus', '.select2-selection.select2-selection--single', function (e) {
//console.log('focus on a select2');
if ($(this).attr('aria-labelledby') == 'select2-idprodfournprice-container')
{
$('#idprodfournprice').select2('open');
}
});
});
</script>
<?php
}
}
echo '<input type="hidden" name="pbq" id="pbq" value="">';
echo '</span>';

View File

@ -114,8 +114,8 @@ class InterfaceWorkflowManager extends DolibarrTriggers
if ($element->statut == Propal::STATUS_SIGNED || $element->statut == Propal::STATUS_BILLED) $totalonlinkedelements += $element->total_ht;
}
dol_syslog("Amount of linked proposals = ".$totalonlinkedelements.", of order = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht));
if ( ($totalonlinkedelements == $object->total_ht) || (! empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS)) )
{
if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht))
{
foreach($object->linkedObjects['propal'] as $element)
{
$ret=$element->classifyBilled($user);
@ -143,7 +143,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers
if ($element->statut == Commande::STATUS_VALIDATED || $element->statut == Commande::STATUS_SHIPMENTONPROCESS || $element->statut == Commande::STATUS_CLOSED) $totalonlinkedelements += $element->total_ht;
}
dol_syslog("Amount of linked orders = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht));
if ( ($totalonlinkedelements == $object->total_ht) || (! empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS)) )
if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht))
{
foreach($object->linkedObjects['commande'] as $element)
{
@ -166,7 +166,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers
if ($element->statut == Propal::STATUS_SIGNED || $element->statut == Propal::STATUS_BILLED) $totalonlinkedelements += $element->total_ht;
}
dol_syslog("Amount of linked proposals = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht));
if ( ($totalonlinkedelements == $object->total_ht) || (! empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS)) )
if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht))
{
foreach($object->linkedObjects['propal'] as $element)
{
@ -195,8 +195,8 @@ class InterfaceWorkflowManager extends DolibarrTriggers
if ($element->statut == CommandeFournisseur::STATUS_ACCEPTED || $element->statut == CommandeFournisseur::STATUS_ORDERSENT || $element->statut == CommandeFournisseur::STATUS_RECEIVED_PARTIALLY || $element->statut == CommandeFournisseur::STATUS_RECEIVED_COMPLETELY) $totalonlinkedelements += $element->total_ht;
}
dol_syslog("Amount of linked orders = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht));
if ( ($totalonlinkedelements == $object->total_ht) || (! empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS)) )
{
if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht))
{
foreach($object->linkedObjects['order_supplier'] as $element)
{
$ret=$element->classifyBilled($user);
@ -218,7 +218,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers
if ($element->statut == SupplierProposal::STATUS_SIGNED || $element->statut == SupplierProposal::STATUS_BILLED) $totalonlinkedelements += $element->total_ht;
}
dol_syslog("Amount of linked supplier proposals = ".$totalonlinkedelements.", of supplier invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht));
if ( ($totalonlinkedelements == $object->total_ht) || (! empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS)) )
if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht))
{
foreach($object->linkedObjects['supplier_proposal'] as $element)
{
@ -246,7 +246,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers
if ($element->statut == Commande::STATUS_VALIDATED || $element->statut == Commande::STATUS_SHIPMENTONPROCESS || $element->statut == Commande::STATUS_CLOSED) $totalonlinkedelements += $element->total_ht;
}
dol_syslog("Amount of linked orders = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht));
if ( ($totalonlinkedelements == $object->total_ht) || (! empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS)) )
if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht))
{
foreach($object->linkedObjects['commande'] as $element)
{
@ -345,4 +345,24 @@ class InterfaceWorkflowManager extends DolibarrTriggers
return 0;
}
/**
* @param Object $conf Dolibarr settings object
* @param float $totalonlinkedelements Sum of total amounts (excl VAT) of
* invoices linked to $object
* @param float $object_total_ht The total amount (excl VAT) of the object
* (an order, a proposal, a bill, etc.)
* @return bool True if the amounts are equal (rounded on total amount)
* True if the module is configured to skip the amount equality check
* False otherwise.
*/
private function shouldClassify($conf, $totalonlinkedelements, $object_total_ht)
{
// if the configuration allows unmatching amounts, allow classification anyway
if (!empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS)) {
return true;
}
// if the amount are same, allow classification, else deny
return (price2num($totalonlinkedelements, 'MT') == price2num($object_total_ht, 'MT'));
}
}

View File

@ -649,12 +649,20 @@ class InterfaceActionsAuto extends DolibarrTriggers
// Load translation files required by the page
$langs->loadLangs(array("agenda","other","members"));
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberSubscriptionAddedInDolibarr", $object->ref, $object->getFullName($langs));
$object->actionmsg=$langs->transnoentities("MemberSubscriptionAddedInDolibarr", $object->ref, $object->getFullName($langs));
$object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->getFullName($langs);
$object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type;
$object->actionmsg.="\n".$langs->transnoentities("Amount").': '.$object->last_subscription_amount;
$object->actionmsg.="\n".$langs->transnoentities("Period").': '.dol_print_date($object->last_subscription_date_start, 'day').' - '.dol_print_date($object->last_subscription_date_end, 'day');
$member = $this->context['member'];
if (! is_object($member)) // This should not happen
{
include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
$member = new Adherent($this->db);
$member->fetch($this->fk_adherent);
}
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberSubscriptionAddedInDolibarr", $object->id, $member->getFullName($langs));
$object->actionmsg=$langs->transnoentities("MemberSubscriptionAddedInDolibarr", $object->id, $member->getFullName($langs));
$object->actionmsg.="\n".$langs->transnoentities("Member").': '.$member->getFullName($langs);
$object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->fk_type;
$object->actionmsg.="\n".$langs->transnoentities("Amount").': '.$object->amount;
$object->actionmsg.="\n".$langs->transnoentities("Period").': '.dol_print_date($object->dateh, 'day').' - '.dol_print_date($object->datef, 'day');
$object->sendtoid=0;
if ($object->fk_soc > 0) $object->socid=$object->fk_soc;
@ -664,12 +672,20 @@ class InterfaceActionsAuto extends DolibarrTriggers
// Load translation files required by the page
$langs->loadLangs(array("agenda","other","members"));
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberSubscriptionModifiedInDolibarr", $object->ref, $object->getFullName($langs));
$object->actionmsg=$langs->transnoentities("MemberSubscriptionModifiedInDolibarr", $object->ref, $object->getFullName($langs));
$object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->getFullName($langs);
$object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type;
$object->actionmsg.="\n".$langs->transnoentities("Amount").': '.$object->last_subscription_amount;
$object->actionmsg.="\n".$langs->transnoentities("Period").': '.dol_print_date($object->last_subscription_date_start, 'day').' - '.dol_print_date($object->last_subscription_date_end, 'day');
$member = $this->context['member'];
if (! is_object($member)) // This should not happen
{
include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
$member = new Adherent($this->db);
$member->fetch($this->fk_adherent);
}
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberSubscriptionModifiedInDolibarr", $object->id, $member->getFullName($langs));
$object->actionmsg=$langs->transnoentities("MemberSubscriptionModifiedInDolibarr", $object->id, $member->getFullName($langs));
$object->actionmsg.="\n".$langs->transnoentities("Member").': '.$member->getFullName($langs);
$object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->fk_type;
$object->actionmsg.="\n".$langs->transnoentities("Amount").': '.$object->amount;
$object->actionmsg.="\n".$langs->transnoentities("Period").': '.dol_print_date($object->dateh, 'day').' - '.dol_print_date($object->datef, 'day');
$object->sendtoid=0;
if ($object->fk_soc > 0) $object->socid=$object->fk_soc;

View File

@ -1584,9 +1584,9 @@ if ($action == 'create')
print $line->showOptionals($extrafieldsline, 'edit', array('style'=>$bc[$var], 'colspan'=>$colspan), $indiceAsked);
print '</tr>';
}
$indiceAsked++;
}
$indiceAsked++;
}
print "</table>";

View File

@ -1958,7 +1958,7 @@ else
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0; $total = 0;
$i = 0; $totalpaid = 0;
while ($i < $num)
{
$objp = $db->fetch_object($resql);

View File

@ -701,7 +701,7 @@ class PaiementFourn extends Paiement
else
{
$langs->load("errors");
print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete");
print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Supplier"));
return "";
}
}

View File

@ -3,7 +3,7 @@
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2019 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014 Cedric Gross <c.gross@kreiz-it.fr>
* Copyright (C) 2016 Florian Henry <florian.henry@atm-consulting.fr>
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
@ -239,6 +239,16 @@ if ($action == 'dispatch' && $user->rights->fournisseur->commande->receptionner)
$pu = "pu_" . $reg[1] . '_' . $reg[2]; // This is unit price including discount
$fk_commandefourndet = "fk_commandefourndet_" . $reg[1] . '_' . $reg[2];
if (! empty($conf->global->SUPPLIER_ORDER_CAN_UPDATE_BUYINGPRICE_DURING_RECEIPT)) {
if (empty($conf->multicurrency->enabled) && empty($conf->dynamicprices->enabled)) {
$dto = GETPOST("dto_" . $reg[1] . '_' . $reg[2]);
if (! empty($dto)) {
$unit_price = price2num(GETPOST("pu_" . $reg[1]) * (100 - $dto) / 100, 'MU');
}
$saveprice = "saveprice_" . $reg[1] . '_' . $reg[2];
}
}
// We ask to move a qty
if (GETPOST($qty) != 0) {
if (! (GETPOST($ent, 'int') > 0)) {
@ -254,6 +264,24 @@ if ($action == 'dispatch' && $user->rights->fournisseur->commande->receptionner)
setEventMessages($object->error, $object->errors, 'errors');
$error ++;
}
if (! $error && ! empty($conf->global->SUPPLIER_ORDER_CAN_UPDATE_BUYINGPRICE_DURING_RECEIPT)) {
if (empty($conf->multicurrency->enabled) && empty($conf->dynamicprices->enabled)) {
$dto = GETPOST("dto_" . $reg[1] . '_' . $reg[2]);
//update supplier price
if (isset($_POST[$saveprice])) {
// TODO Use class
$sql = "UPDATE " . MAIN_DB_PREFIX . "product_fournisseur_price";
$sql .= " SET unitprice='" . GETPOST($pu) . "'";
$sql .= ", price=" . GETPOST($pu) . "*quantity";
$sql .= ", remise_percent='" . $dto . "'";
$sql .= " WHERE fk_soc=" . $object->socid;
$sql .= " AND fk_product=" . GETPOST($prod, 'int');
$resql = $db->query($sql);
}
}
}
}
}
}
@ -552,6 +580,15 @@ if ($id > 0 || ! empty($ref)) {
print '<td class="right">' . $langs->trans("QtyDispatchedShort") . '</td>';
print '<td class="right">' . $langs->trans("QtyToDispatchShort") . '</td>';
print '<td width="32"></td>';
if (! empty($conf->global->SUPPLIER_ORDER_CAN_UPDATE_BUYINGPRICE_DURING_RECEIPT)) {
if (empty($conf->multicurrency->enabled) && empty($conf->dynamicprices->enabled)) {
print '<td class="right">' . $langs->trans("Price") . '</td>';
print '<td class="right">' . $langs->trans("ReductionShort") . ' (%)</td>';
print '<td class="right">' . $langs->trans("UpdatePrice") . '</td>';
}
}
print '<td align="right">' . $langs->trans("Warehouse") . '</td>';
// Enable hooks to append additional columns
@ -760,6 +797,25 @@ if ($id > 0 || ! empty($ref)) {
print '</td>';
if (! empty($conf->global->SUPPLIER_ORDER_CAN_UPDATE_BUYINGPRICE_DURING_RECEIPT)) {
if (empty($conf->multicurrency->enabled) && empty($conf->dynamicprices->enabled)) {
// Price
print '<td class="right">';
print '<input id="pu' . $suffix . '" name="pu' . $suffix . '" type="text" size="8" value="' . price((GETPOST('pu' . $suffix) != '' ? GETPOST('pu' . $suffix) : $up_ht_disc)) . '">';
print '</td>';
// Discount
print '<td class="right">';
print '<input id="pu' . $suffix . '" name="dto' . $suffix . '" type="text" size="8" value="' . (GETPOST('dto' . $suffix) != '' ? GETPOST('dto' . $suffix) : '') . '">';
print '</td>';
// Save price
print '<td class="center">';
print '<input class="flat checkformerge" type="checkbox" name="saveprice' . $suffix . '" value="' . (GETPOST('saveprice' . $suffix) != '' ? GETPOST('saveprice' . $suffix) : '') . '">';
print '</td>';
}
}
// Warehouse
print '<td class="right">';
if (count($listwarehouses) > 1) {

View File

@ -1438,45 +1438,30 @@ class Holiday extends CommonObject
$result = $this->db->query($sql);
$typeleaves=$this->getTypes(1, 1);
foreach($typeleaves as $key => $val)
{
// On ajoute x jours à chaque utilisateurs
$nb_holiday = $val['newByMonth'];
if (empty($nb_holiday)) $nb_holiday=0;
if ($nb_holiday > 0)
// Update each user counter
foreach ($users as $userCounter) {
$nbDaysToAdd = $typeleaves[$userCounter['type']]['newByMonth'];
if(empty($nbDaysToAdd)) continue;
dol_syslog("We update leave type id ".$userCounter['type']." for user id ".$userCounter['rowid'], LOG_DEBUG);
$nowHoliday = $userCounter['nb_holiday'];
$newSolde = $nowHoliday + $nbDaysToAdd;
// We add a log for each user
$this->addLogCP($user->id, $userCounter['rowid'], $langs->trans('HolidaysMonthlyUpdate'), $newSolde, $userCounter['type']);
$result = $this->updateSoldeCP($userCounter['rowid'], $newSolde, $userCounter['type'], $langs->trans('HolidaysMonthlyUpdate'));
if ($result < 0)
{
dol_syslog("We update leavefor everybody for type ".$key, LOG_DEBUG);
$i = 0;
while ($i < $nbUser)
{
$now_holiday = $this->getCPforUser($users[$i]['rowid'], $val['rowid']);
$new_solde = $now_holiday + $nb_holiday;
// We add a log for each user
$this->addLogCP($user->id, $users[$i]['rowid'], $langs->trans('HolidaysMonthlyUpdate'), $new_solde, $val['rowid']);
$i++;
}
// Now we update counter for all users at once
$sql2 = "UPDATE ".MAIN_DB_PREFIX."holiday_users SET";
$sql2.= " nb_holiday = nb_holiday + ".$nb_holiday;
$sql2.= " WHERE fk_type = ".$val['rowid'];
$result= $this->db->query($sql2);
if (! $result)
{
dol_print_error($this->db);
break;
}
$error++;
break;
}
else dol_syslog("No change for leave of type ".$key, LOG_DEBUG);
}
if ($result)
if (! $error)
{
$this->db->commit();
return 1;
@ -1635,10 +1620,10 @@ class Holiday extends CommonObject
{
$sql = "SELECT nb_holiday";
$sql.= " FROM ".MAIN_DB_PREFIX."holiday_users";
$sql.= " WHERE fk_user = '".$user_id."'";
if ($fk_type > 0) $sql.=" AND fk_type = ".$fk_type;
$sql.= " WHERE fk_user = ".(int) $user_id;
if ($fk_type > 0) $sql.=" AND fk_type = ".(int) $fk_type;
dol_syslog(get_class($this).'::getCPforUser', LOG_DEBUG);
dol_syslog(get_class($this).'::getCPforUser user_id='.$user_id.' type_id='.$fk_type, LOG_DEBUG);
$result = $this->db->query($sql);
if($result)
{
@ -1799,7 +1784,7 @@ class Holiday extends CommonObject
$obj = $this->db->fetch_object($resql);
$tab_result[$i]['rowid'] = $obj->rowid;
$tab_result[$i]['rowid'] = $obj->rowid; // rowid of user
$tab_result[$i]['name'] = $obj->lastname; // deprecated
$tab_result[$i]['lastname'] = $obj->lastname;
$tab_result[$i]['firstname'] = $obj->firstname;
@ -1807,7 +1792,7 @@ class Holiday extends CommonObject
$tab_result[$i]['status'] = $obj->statut;
$tab_result[$i]['employee'] = $obj->employee;
$tab_result[$i]['photo'] = $obj->photo;
$tab_result[$i]['fk_user'] = $obj->fk_user;
$tab_result[$i]['fk_user'] = $obj->fk_user; // rowid of manager
//$tab_result[$i]['type'] = $obj->type;
//$tab_result[$i]['nb_holiday'] = $obj->nb_holiday;
@ -1826,7 +1811,7 @@ class Holiday extends CommonObject
else
{
// List of vacation balance users
$sql = "SELECT cpu.fk_user, cpu.fk_type, cpu.nb_holiday, u.lastname, u.firstname, u.gender, u.photo, u.employee, u.statut, u.fk_user";
$sql = "SELECT cpu.fk_type, cpu.nb_holiday, u.rowid, u.lastname, u.firstname, u.gender, u.photo, u.employee, u.statut, u.fk_user";
$sql.= " FROM ".MAIN_DB_PREFIX."holiday_users as cpu, ".MAIN_DB_PREFIX."user as u";
$sql.= " WHERE cpu.fk_user = u.rowid";
if ($filters) $sql.=$filters;
@ -1845,7 +1830,7 @@ class Holiday extends CommonObject
{
$obj = $this->db->fetch_object($resql);
$tab_result[$i]['rowid'] = $obj->fk_user;
$tab_result[$i]['rowid'] = $obj->rowid; // rowid of user
$tab_result[$i]['name'] = $obj->lastname; // deprecated
$tab_result[$i]['lastname'] = $obj->lastname;
$tab_result[$i]['firstname'] = $obj->firstname;
@ -1853,9 +1838,9 @@ class Holiday extends CommonObject
$tab_result[$i]['status'] = $obj->statut;
$tab_result[$i]['employee'] = $obj->employee;
$tab_result[$i]['photo'] = $obj->photo;
$tab_result[$i]['fk_user'] = $obj->fk_user;
$tab_result[$i]['fk_user'] = $obj->fk_user; // rowid of manager
$tab_result[$i]['type'] = $obj->type;
$tab_result[$i]['type'] = $obj->fk_type;
$tab_result[$i]['nb_holiday'] = $obj->nb_holiday;
$i++;

View File

@ -1,5 +1,45 @@
# Changelog
## 6.41.0 - 2019-07-31
* [#683](https://github.com/stripe/stripe-php/pull/683) Move the List Balance History API to `/v1/balance_transactions`
## 6.40.0 - 2019-06-27
* [#675](https://github.com/stripe/stripe-php/pull/675) Add support for `SetupIntent` resource and APIs
## 6.39.2 - 2019-06-26
* [#676](https://github.com/stripe/stripe-php/pull/676) Fix exception message in `CustomerBalanceTransaction::update()`
## 6.39.1 - 2019-06-25
* [#674](https://github.com/stripe/stripe-php/pull/674) Add new constants for `collection_method` on `Invoice`
## 6.39.0 - 2019-06-24
* [#673](https://github.com/stripe/stripe-php/pull/673) Enable request latency telemetry by default
## 6.38.0 - 2019-06-17
* [#649](https://github.com/stripe/stripe-php/pull/649) Add support for `CustomerBalanceTransaction` resource and APIs
## 6.37.2 - 2019-06-17
* [#671](https://github.com/stripe/stripe-php/pull/671) Add new PHPDoc
* [#672](https://github.com/stripe/stripe-php/pull/672) Add constants for `submit_type` on Checkout `Session`
## 6.37.1 - 2019-06-14
* [#670](https://github.com/stripe/stripe-php/pull/670) Add new PHPDoc
## 6.37.0 - 2019-05-23
* [#663](https://github.com/stripe/stripe-php/pull/663) Add support for `radar.early_fraud_warning` resource
## 6.36.0 - 2019-05-22
* [#661](https://github.com/stripe/stripe-php/pull/661) Add constants for new TaxId types
* [#662](https://github.com/stripe/stripe-php/pull/662) Add constants for BalanceTransaction types
## 6.35.2 - 2019-05-20
* [#655](https://github.com/stripe/stripe-php/pull/655) Add constants for payment intent statuses
* [#659](https://github.com/stripe/stripe-php/pull/659) Fix PHPDoc for various nested Account actions
* [#660](https://github.com/stripe/stripe-php/pull/660) Fix various PHPDoc
## 6.35.1 - 2019-05-20
* [#658](https://github.com/stripe/stripe-php/pull/658) Use absolute value when checking timestamp tolerance
## 6.35.0 - 2019-05-14
* [#651](https://github.com/stripe/stripe-php/pull/651) Add support for the Capability resource and APIs

View File

@ -6,7 +6,11 @@
[![License](https://poser.pugx.org/stripe/stripe-php/license.svg)](https://packagist.org/packages/stripe/stripe-php)
[![Code Coverage](https://coveralls.io/repos/stripe/stripe-php/badge.svg?branch=master)](https://coveralls.io/r/stripe/stripe-php?branch=master)
You can sign up for a Stripe account at https://stripe.com.
The Stripe PHP library provides convenient access to the Stripe API from
applications written in the PHP language. It includes a pre-defined set of
classes for API resources that initialize themselves dynamically from API
responses which makes it compatible with a wide range of versions of the Stripe
API.
## Requirements
@ -56,7 +60,7 @@ echo $charge;
## Documentation
Please see https://stripe.com/docs/api for up-to-date documentation.
See the [PHP API docs](https://stripe.com/docs/api/php#intro).
## Legacy Version Support
@ -179,6 +183,17 @@ an intermittent network problem:
[Idempotency keys][idempotency-keys] are added to requests to guarantee that
retries are safe.
### Request latency telemetry
By default, the library sends request latency telemetry to Stripe. These
numbers help Stripe improve the overall latency of its API for all users.
You can disable this behavior if you prefer:
```php
\Stripe\Stripe::setEnableTelemetry(false);
```
## Development
Get [Composer][composer]. For example, on Mac OS:

View File

@ -1 +1 @@
6.35.0
6.41.0

View File

@ -76,6 +76,7 @@ require(dirname(__FILE__) . '/lib/CountrySpec.php');
require(dirname(__FILE__) . '/lib/Coupon.php');
require(dirname(__FILE__) . '/lib/CreditNote.php');
require(dirname(__FILE__) . '/lib/Customer.php');
require(dirname(__FILE__) . '/lib/CustomerBalanceTransaction.php');
require(dirname(__FILE__) . '/lib/Discount.php');
require(dirname(__FILE__) . '/lib/Dispute.php');
require(dirname(__FILE__) . '/lib/EphemeralKey.php');
@ -104,6 +105,7 @@ require(dirname(__FILE__) . '/lib/Payout.php');
require(dirname(__FILE__) . '/lib/Person.php');
require(dirname(__FILE__) . '/lib/Plan.php');
require(dirname(__FILE__) . '/lib/Product.php');
require(dirname(__FILE__) . '/lib/Radar/EarlyFraudWarning.php');
require(dirname(__FILE__) . '/lib/Radar/ValueList.php');
require(dirname(__FILE__) . '/lib/Radar/ValueListItem.php');
require(dirname(__FILE__) . '/lib/Recipient.php');
@ -112,6 +114,7 @@ require(dirname(__FILE__) . '/lib/Refund.php');
require(dirname(__FILE__) . '/lib/Reporting/ReportRun.php');
require(dirname(__FILE__) . '/lib/Reporting/ReportType.php');
require(dirname(__FILE__) . '/lib/Review.php');
require(dirname(__FILE__) . '/lib/SetupIntent.php');
require(dirname(__FILE__) . '/lib/SKU.php');
require(dirname(__FILE__) . '/lib/Sigma/ScheduledQueryRun.php');
require(dirname(__FILE__) . '/lib/Source.php');

View File

@ -152,8 +152,8 @@ class Account extends ApiResource
/**
* @param string|null $id The ID of the account to which the capability belongs.
* @param string|null $capabilityId The ID of the capability to retrieve.
* @param string $id The ID of the account to which the capability belongs.
* @param string $capabilityId The ID of the capability to retrieve.
* @param array|null $params
* @param array|string|null $opts
*
@ -165,8 +165,8 @@ class Account extends ApiResource
}
/**
* @param string|null $id The ID of the account to which the capability belongs.
* @param string|null $capabilityId The ID of the capability to update.
* @param string $id The ID of the account to which the capability belongs.
* @param string $capabilityId The ID of the capability to update.
* @param array|null $params
* @param array|string|null $opts
*
@ -178,7 +178,7 @@ class Account extends ApiResource
}
/**
* @param string|null $id The ID of the account on which to retrieve the capabilities.
* @param string $id The ID of the account on which to retrieve the capabilities.
* @param array|null $params
* @param array|string|null $opts
*
@ -190,7 +190,7 @@ class Account extends ApiResource
}
/**
* @param string|null $id The ID of the account on which to create the external account.
* @param string $id The ID of the account on which to create the external account.
* @param array|null $params
* @param array|string|null $opts
*
@ -202,8 +202,8 @@ class Account extends ApiResource
}
/**
* @param string|null $id The ID of the account to which the external account belongs.
* @param array|null $externalAccountId The ID of the external account to retrieve.
* @param string $id The ID of the account to which the external account belongs.
* @param string $externalAccountId The ID of the external account to retrieve.
* @param array|null $params
* @param array|string|null $opts
*
@ -215,8 +215,8 @@ class Account extends ApiResource
}
/**
* @param string|null $id The ID of the account to which the external account belongs.
* @param array|null $externalAccountId The ID of the external account to update.
* @param string $id The ID of the account to which the external account belongs.
* @param string $externalAccountId The ID of the external account to update.
* @param array|null $params
* @param array|string|null $opts
*
@ -228,8 +228,8 @@ class Account extends ApiResource
}
/**
* @param string|null $id The ID of the account to which the external account belongs.
* @param array|null $externalAccountId The ID of the external account to delete.
* @param string $id The ID of the account to which the external account belongs.
* @param string $externalAccountId The ID of the external account to delete.
* @param array|null $params
* @param array|string|null $opts
*
@ -241,7 +241,7 @@ class Account extends ApiResource
}
/**
* @param string|null $id The ID of the account on which to retrieve the external accounts.
* @param string $id The ID of the account on which to retrieve the external accounts.
* @param array|null $params
* @param array|string|null $opts
*
@ -253,7 +253,7 @@ class Account extends ApiResource
}
/**
* @param string|null $id The ID of the account on which to create the login link.
* @param string $id The ID of the account on which to create the login link.
* @param array|null $params
* @param array|string|null $opts
*
@ -280,7 +280,7 @@ class Account extends ApiResource
}
/**
* @param string|null $id The ID of the account on which to create the person.
* @param string $id The ID of the account on which to create the person.
* @param array|null $params
* @param array|string|null $opts
*
@ -292,8 +292,8 @@ class Account extends ApiResource
}
/**
* @param string|null $id The ID of the account to which the person belongs.
* @param string|null $personId The ID of the person to retrieve.
* @param string $id The ID of the account to which the person belongs.
* @param string $personId The ID of the person to retrieve.
* @param array|null $params
* @param array|string|null $opts
*
@ -305,8 +305,8 @@ class Account extends ApiResource
}
/**
* @param string|null $id The ID of the account to which the person belongs.
* @param string|null $personId The ID of the person to update.
* @param string $id The ID of the account to which the person belongs.
* @param string $personId The ID of the person to update.
* @param array|null $params
* @param array|string|null $opts
*
@ -318,8 +318,8 @@ class Account extends ApiResource
}
/**
* @param string|null $id The ID of the account to which the person belongs.
* @param string|null $personId The ID of the person to delete.
* @param string $id The ID of the account to which the person belongs.
* @param string $personId The ID of the person to delete.
* @param array|null $params
* @param array|string|null $opts
*
@ -331,7 +331,7 @@ class Account extends ApiResource
}
/**
* @param string|null $id The ID of the account on which to retrieve the persons.
* @param string $id The ID of the account on which to retrieve the persons.
* @param array|null $params
* @param array|string|null $opts
*

View File

@ -31,11 +31,36 @@ class BalanceTransaction extends ApiResource
use ApiOperations\Retrieve;
/**
* @return string The class URL for this resource. It needs to be special
* cased because it doesn't fit into the standard resource pattern.
* Possible string representations of the type of balance transaction.
* @link https://stripe.com/docs/api/balance/balance_transaction#balance_transaction_object-type
*/
public static function classUrl()
{
return "/v1/balance/history";
}
const TYPE_ADJUSTMENT = 'adjustment';
const TYPE_ADVANCE = 'advance';
const TYPE_ADVANCE_FUNDING = 'advance_funding';
const TYPE_APPLICATION_FEE = 'application_fee';
const TYPE_APPLICATION_FEE_REFUND = 'application_fee_refund';
const TYPE_CHARGE = 'charge';
const TYPE_CONNECT_COLLECTION_TRANSFER = 'connect_collection_transfer';
const TYPE_ISSUING_AUTHORIZATION_HOLD = 'issuing_authorization_hold';
const TYPE_ISSUING_AUTHORIZATION_RELEASE = 'issuing_authorization_release';
const TYPE_ISSUING_TRANSACTION = 'issuing_transaction';
const TYPE_PAYMENT = 'payment';
const TYPE_PAYMENT_FAILURE_REFUND = 'payment_failure_refund';
const TYPE_PAYMENT_REFUND = 'payment_refund';
const TYPE_PAYOUT = 'payout';
const TYPE_PAYOUT_CANCEL = 'payout_cancel';
const TYPE_PAYOUT_FAILURE = 'payout_failure';
const TYPE_REFUND = 'refund';
const TYPE_REFUND_FAILURE = 'refund_failure';
const TYPE_RESERVE_TRANSACTION = 'reserve_transaction';
const TYPE_RESERVED_FUNDS = 'reserved_funds';
const TYPE_STRIPE_FEE = 'stripe_fee';
const TYPE_STRIPE_FX_FEE = 'stripe_fx_fee';
const TYPE_TAX_FEE = 'tax_fee';
const TYPE_TOPUP = 'topup';
const TYPE_TOPUP_REVERSAL = 'topup_reversal';
const TYPE_TRANSFER = 'transfer';
const TYPE_TRANSFER_CANCEL = 'transfer_cancel';
const TYPE_TRANSFER_FAILURE = 'transfer_failure';
const TYPE_TRANSFER_REFUND = 'transfer_refund';
}

View File

@ -31,6 +31,16 @@ class BankAccount extends ApiResource
use ApiOperations\Delete;
use ApiOperations\Update;
/**
* Possible string representations of the bank verification status.
* @link https://stripe.com/docs/api/external_account_bank_accounts/object#account_bank_account_object-status
*/
const STATUS_NEW = 'new';
const STATUS_VALIDATED = 'validated';
const STATUS_VERIFIED = 'verified';
const STATUS_VERIFICATION_FAILED = 'verification_failed';
const STATUS_ERRORED = 'errored';
/**
* @return string The instance URL for this resource. It needs to be special
* cased because it doesn't fit into the standard resource pattern.

View File

@ -11,7 +11,9 @@ namespace Stripe;
* @property int $amount_refunded
* @property string $application
* @property string $application_fee
* @property int $application_fee_amount
* @property string $balance_transaction
* @property mixed $billing_details
* @property bool $captured
* @property int $created
* @property string $currency
@ -30,6 +32,8 @@ namespace Stripe;
* @property mixed $outcome
* @property bool $paid
* @property string $payment_intent
* @property string $payment_method
* @property mixed $payment_method_details
* @property string $receipt_email
* @property string $receipt_number
* @property string $receipt_url
@ -86,6 +90,7 @@ class Charge extends ApiResource
const DECLINED_INVALID_PIN = 'invalid_pin';
const DECLINED_ISSUER_NOT_AVAILABLE = 'issuer_not_available';
const DECLINED_LOST_CARD = 'lost_card';
const DECLINED_MERCHANT_BLACKLIST = 'merchant_blacklist';
const DECLINED_NEW_ACCOUNT_INFORMATION_AVAILABLE = 'new_account_information_available';
const DECLINED_NO_ACTION_TAKEN = 'no_action_taken';
const DECLINED_NOT_PERMITTED = 'not_permitted';

View File

@ -15,6 +15,7 @@ namespace Stripe\Checkout;
* @property bool $livemode
* @property string $payment_intent
* @property string[] $payment_method_types
* @property string $submit_type
* @property string $subscription
* @property string $success_url
*
@ -27,4 +28,13 @@ class Session extends \Stripe\ApiResource
use \Stripe\ApiOperations\Create;
use \Stripe\ApiOperations\Retrieve;
/**
* Possible string representations of submit type.
* @link https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-submit_type
*/
const SUBMIT_TYPE_AUTO = 'auto';
const SUBMIT_TYPE_BOOK = 'book';
const SUBMIT_TYPE_DONATE = 'donate';
const SUBMIT_TYPE_PAY = 'pay';
}

View File

@ -8,6 +8,7 @@ namespace Stripe;
* @property string $id
* @property string $object
* @property int $amount
* @property string $customer_balance_transaction
* @property int $created
* @property string $currency
* @property string $customer

View File

@ -7,8 +7,8 @@ namespace Stripe;
*
* @property string $id
* @property string $object
* @property int $account_balance
* @property mixed $address
* @property int $balance
* @property string $created
* @property string $currency
* @property string $default_source
@ -26,6 +26,7 @@ namespace Stripe;
* @property mixed $shipping
* @property Collection $sources
* @property Collection $subscriptions
* @property string $tax_exempt
* @property Collection $tax_ids
*
* @package Stripe
@ -61,6 +62,7 @@ class Customer extends ApiResource
return $savedNestedResources;
}
const PATH_BALANCE_TRANSACTIONS = '/balance_transactions';
const PATH_SOURCES = '/sources';
const PATH_TAX_IDS = '/tax_ids';
@ -264,4 +266,55 @@ class Customer extends ApiResource
{
return self::_allNestedResources($id, static::PATH_TAX_IDS, $params, $opts);
}
/**
* @param string|null $id The ID of the customer on which to create the balance transaction.
* @param array|null $params
* @param array|string|null $opts
*
* @return ApiResource
*/
public static function createBalanceTransaction($id, $params = null, $opts = null)
{
return self::_createNestedResource($id, static::PATH_BALANCE_TRANSACTIONS, $params, $opts);
}
/**
* @param string|null $id The ID of the customer to which the balance transaction belongs.
* @param string|null $balanceTransactionId The ID of the balance transaction to retrieve.
* @param array|null $params
* @param array|string|null $opts
*
* @return ApiResource
*/
public static function retrieveBalanceTransaction($id, $balanceTransactionId, $params = null, $opts = null)
{
return self::_retrieveNestedResource($id, static::PATH_BALANCE_TRANSACTIONS, $balanceTransactionId, $params, $opts);
}
/**
* @param string|null $id The ID of the customer on which to update the balance transaction.
* @param string|null $balanceTransactionId The ID of the balance transaction to update.
* @param array|null $params
* @param array|string|null $opts
*
*
* @return ApiResource
*/
public static function updateBalanceTransaction($id, $balanceTransactionId, $params = null, $opts = null)
{
return self::_updateNestedResource($id, static::PATH_BALANCE_TRANSACTIONS, $balanceTransactionId, $params, $opts);
}
/**
* @param string|null $id The ID of the customer on which to retrieve the customer balance transactions.
* @param array|null $params
* @param array|string|null $opts
*
* @return Collection The list of customer balance transactions.
*/
public static function allBalanceTransactions($id, $params = null, $opts = null)
{
return self::_allNestedResources($id, static::PATH_BALANCE_TRANSACTIONS, $params, $opts);
}
}

View File

@ -0,0 +1,88 @@
<?php
namespace Stripe;
/**
* Class CustomerBalanceTransaction
*
* @package Stripe
*
* @property string $id
* @property string $object
* @property int $amount
* @property string $credit_note
* @property int $created
* @property string $currency
* @property string $customer
* @property string $description
* @property int $ending_balance
* @property string $invoice
* @property bool $livemode
* @property StripeObject $metadata
* @property string $type
*/
class CustomerBalanceTransaction extends ApiResource
{
const OBJECT_NAME = "customer_balance_transaction";
/**
* Possible string representations of a balance transaction's type.
* @link https://stripe.com/docs/api/customers/customer_balance_transaction_object#customer_balance_transaction_object-type
*/
const TYPE_ADJUSTEMENT = 'adjustment';
const TYPE_APPLIED_TO_INVOICE = 'applied_to_invoice';
const TYPE_CREDIT_NOTE = 'credit_note';
const TYPE_INITIAL = 'initial';
const TYPE_INVOICE_TOO_LARGE = 'invoice_too_large';
const TYPE_INVOICE_TOO_SMALL = 'invoice_too_small';
const TYPE_UNSPENT_RECEIVER_CREDIT = 'unspent_receiver_credit';
/**
* @return string The API URL for this balance transaction.
*/
public function instanceUrl()
{
$id = $this['id'];
$customer = $this['customer'];
if (!$id) {
throw new Error\InvalidRequest(
"Could not determine which URL to request: class instance has invalid ID: $id",
null
);
}
$id = Util\Util::utf8($id);
$customer = Util\Util::utf8($customer);
$base = Customer::classUrl();
$customerExtn = urlencode($customer);
$extn = urlencode($id);
return "$base/$customerExtn/balance_transactions/$extn";
}
/**
* @param array|string $_id
* @param array|string|null $_opts
*
* @throws \Stripe\Error\InvalidRequest
*/
public static function retrieve($_id, $_opts = null)
{
$msg = "Customer Balance Transactions cannot be accessed without a customer ID. " .
"Retrieve a balance transaction using Customer::retrieveBalanceTransaction('cus_123', 'cbtxn_123') instead.";
throw new Error\InvalidRequest($msg, null);
}
/**
* @param string $_id
* @param array|null $_params
* @param array|string|null $_options
*
* @throws \Stripe\Error\InvalidRequest
*/
public static function update($_id, $_params = null, $_options = null)
{
$msg = "Customer Balance Transactions cannot be accessed without a customer ID. " .
"Update a balance transaction using Customer::updateBalanceTransaction('cus_123', 'cbtxn_123', \$params) instead.";
throw new Error\InvalidRequest($msg, null);
}
}

View File

@ -19,6 +19,7 @@ namespace Stripe;
* @property string $billing
* @property string $billing_reason
* @property string $charge
* @property string $collection_method
* @property int $created
* @property string $currency
* @property array $custom_fields
@ -28,6 +29,7 @@ namespace Stripe;
* @property string $customer_name
* @property string $customer_phone
* @property mixed $customer_shipping
* @property string $customer_tax_exempt
* @property array $customer_tax_ids
* @property string $default_payment_method
* @property string $default_source
@ -77,6 +79,25 @@ class Invoice extends ApiResource
use ApiOperations\Retrieve;
use ApiOperations\Update;
/**
* Possible string representations of the billing reason.
* @link https://stripe.com/docs/api/invoices/object#invoice_object-billing_reason
*/
const BILLING_REASON_MANUAL = 'manual';
const BILLING_REASON_SUBSCRIPTION = 'subscription';
const BILLING_REASON_SUBSCRIPTION_CREATE = 'subscription_create';
const BILLING_REASON_SUBSCRIPTION_CYCLE = 'subscription_cycle';
const BILLING_REASON_SUBSCRIPTION_THRESHOLD = 'subscription_threshold';
const BILLING_REASON_SUBSCRIPTION_UPDATE = 'subscription_update';
const BILLING_REASON_UPCOMING = 'upcoming';
/**
* Possible string representations of the `collection_method` property.
* @link https://stripe.com/docs/api/invoices/object#invoice_object-collection_method
*/
const COLLECTION_METHOD_CHARGE_AUTOMATICALLY = 'charge_automatically';
const COLLECTION_METHOD_SEND_INVOICE = 'send_invoice';
/**
* Possible string representations of the invoice status.
* @link https://stripe.com/docs/api/invoices/object#invoice_object-status
@ -88,23 +109,12 @@ class Invoice extends ApiResource
const STATUS_VOID = 'void';
/**
* Possible string representations of the billing.
* Possible string representations of the `billing` property.
* @deprecated Use `collection_method` instead.
* @link https://stripe.com/docs/api/invoices/object#invoice_object-billing
*/
const BILLING_SEND_INVOICE = 'send_invoice';
const BILLING_CHARGE_AUTOMATICALLY = 'charge_automatically';
/**
* Possible string representations of the billing reason.
* @link https://stripe.com/docs/api/invoices/object#invoice_object-billing_reason
*/
const BILLING_REASON_SUBSCRIPTION = 'subscription';
const BILLING_REASON_SUBSCRIPTION_CREATE = 'subscription_create';
const BILLING_REASON_SUBSCRIPTION_CYCLE = 'subscription_cycle';
const BILLING_REASON_SUBSCRIPTION_UPDATE = 'subscription_update';
const BILLING_REASON_SUBSCRIPTION_THRESHOLD = 'subscription_threshold';
const BILLING_REASON_MANUAL = 'manual';
const BILLING_REASON_UPCOMING = 'upcoming';
const BILLING_SEND_INVOICE = 'send_invoice';
/**
* @param array|null $params

View File

@ -17,6 +17,8 @@ namespace Stripe\Issuing;
* @property string $dispute
* @property bool $livemode
* @property mixed $merchant_data
* @property int $merchant_amount
* @property string $merchant_currency
* @property \Stripe\StripeObject $metadata
* @property string $type
*

View File

@ -23,7 +23,7 @@ namespace Stripe;
* @property Collection $returns
* @property string $selected_shipping_method
* @property mixed $shipping
* @property mixed $shipping_methods
* @property array $shipping_methods
* @property string $status
* @property mixed $status_transitions
* @property int $updated

View File

@ -50,6 +50,19 @@ class PaymentIntent extends ApiResource
use ApiOperations\Retrieve;
use ApiOperations\Update;
/**
* These constants are possible representations of the status field.
*
* @link https://stripe.com/docs/api/payment_intents/object#payment_intent_object-status
*/
const STATUS_CANCELED = 'canceled';
const STATUS_PROCESSING = 'processing';
const STATUS_REQUIRES_ACTION = 'requires_action';
const STATUS_REQUIRES_CAPTURE = 'requires_capture';
const STATUS_REQUIRES_CONFIRMATION = 'requires_confirmation';
const STATUS_REQUIRES_PAYMENT_METHOD = 'requires_payment_method';
const STATUS_SUCCEEDED = 'succeeded';
/**
* @param array|null $params
* @param array|string|null $options

View File

@ -45,7 +45,7 @@ class Person extends ApiResource
* Possible string representations of a person's gender.
* @link https://stripe.com/docs/api/persons/object#person_object-gender
*/
const GENDER_MALE = 'male';
const GENDER_MALE = 'male';
const GENDER_FEMALE = 'female';
/**

View File

@ -0,0 +1,36 @@
<?php
namespace Stripe\Radar;
/**
* Class EarlyFraudWarning
*
* @property string $id
* @property string $object
* @property bool $actionable
* @property string $charge
* @property int $created
* @property string $fraud_type
* @property bool $livemode
*
* @package Stripe\Radar
*/
class EarlyFraudWarning extends \Stripe\ApiResource
{
const OBJECT_NAME = "radar.early_fraud_warning";
use \Stripe\ApiOperations\All;
use \Stripe\ApiOperations\Retrieve;
/**
* Possible string representations of an early fraud warning's fraud type.
* @link https://stripe.com/docs/api/early_fraud_warnings/object#early_fraud_warning_object-fraud_type
*/
const FRAUD_TYPE_CARD_NEVER_RECEIVED = 'card_never_received';
const FRAUD_TYPE_FRAUDULENT_CARD_APPLICATION = 'fraudulent_card_application';
const FRAUD_TYPE_MADE_WITH_COUNTERFEIT_CARD = 'made_with_counterfeit_card';
const FRAUD_TYPE_MADE_WITH_LOST_CARD = 'made_with_lost_card';
const FRAUD_TYPE_MADE_WITH_STOLEN_CARD = 'made_with_stolen_card';
const FRAUD_TYPE_MISC = 'misc';
const FRAUD_TYPE_UNAUTHORIZED_USE_OF_CARD = 'unauthorized_use_of_card';
}

View File

@ -0,0 +1,75 @@
<?php
namespace Stripe;
/**
* Class SetupIntent
*
* @property string $id
* @property string $object
* @property string $application
* @property string $client_secret
* @property int $created
* @property string $customer
* @property string $description
* @property mixed $last_setup_error
* @property bool $livemode
* @property StripeObject $metadata
* @property mixed $next_action
* @property string $on_behalf_of
* @property string $payment_method
* @property string[] $payment_method_types
* @property string $status
*
* @package Stripe
*/
class SetupIntent extends ApiResource
{
const OBJECT_NAME = "setup_intent";
use ApiOperations\All;
use ApiOperations\Create;
use ApiOperations\Retrieve;
use ApiOperations\Update;
/**
* These constants are possible representations of the status field.
*
* @link https://stripe.com/docs/api/setup_intents/object#setup_intent_object-status
*/
const STATUS_CANCELED = 'canceled';
const STATUS_PROCESSING = 'processing';
const STATUS_REQUIRES_ACTION = 'requires_action';
const STATUS_REQUIRES_CONFIRMATION = 'requires_confirmation';
const STATUS_REQUIRES_PAYMENT_METHOD = 'requires_payment_method';
const STATUS_SUCCEEDED = 'succeeded';
/**
* @param array|null $params
* @param array|string|null $options
*
* @return SetupIntent The canceled setup intent.
*/
public function cancel($params = null, $options = null)
{
$url = $this->instanceUrl() . '/cancel';
list($response, $opts) = $this->_request('post', $url, $params, $options);
$this->refreshFrom($response, $opts);
return $this;
}
/**
* @param array|null $params
* @param array|string|null $options
*
* @return SetupIntent The confirmed setup intent.
*/
public function confirm($params = null, $options = null)
{
$url = $this->instanceUrl() . '/confirm';
list($response, $opts) = $this->_request('post', $url, $params, $options);
$this->refreshFrom($response, $opts);
return $this;
}
}

View File

@ -18,6 +18,7 @@ namespace Stripe;
* @property mixed $code_verification
* @property int $created
* @property string $currency
* @property string $customer
* @property mixed $eps
* @property string $flow
* @property mixed $giropay

View File

@ -47,7 +47,7 @@ class Stripe
public static $maxNetworkRetries = 0;
// @var boolean Whether client telemetry is enabled. Defaults to false.
public static $enableTelemetry = false;
public static $enableTelemetry = true;
// @var float Maximum delay between retries, in seconds
private static $maxNetworkRetryDelay = 2.0;
@ -55,7 +55,7 @@ class Stripe
// @var float Initial delay between retries, in seconds
private static $initialNetworkRetryDelay = 0.5;
const VERSION = '6.35.0';
const VERSION = '6.41.0';
/**
* @return string The API key used for requests.

View File

@ -13,6 +13,7 @@ namespace Stripe;
* @property mixed $billing_thresholds
* @property bool $cancel_at_period_end
* @property int $canceled_at
* @property string $collection_method
* @property int $created
* @property int $current_period_end
* @property int $current_period_start
@ -31,6 +32,7 @@ namespace Stripe;
* @property int $quantity
* @property SubscriptionSchedule $schedule
* @property int $start
* @property int $start_date
* @property string $status
* @property float $tax_percent
* @property int $trial_end

View File

@ -12,7 +12,6 @@ namespace Stripe;
* @property string $country
* @property int $created
* @property string $customer
* @property bool $deleted
* @property bool $livemode
* @property string $type
* @property string $value
@ -27,10 +26,12 @@ class TaxId extends ApiResource
/**
* Possible string representations of a tax id's type.
* @link https://stripe.com/docs/api/customers/tax_id_object#tax_id_object-type
* @link https://stripe.com/docs/api/customer_tax_ids/object#tax_id_object-type
*/
const TYPE_AU_ABN = 'au_abn';
const TYPE_EU_VAT = 'eu_vat';
const TYPE_IN_GST = 'in_gst';
const TYPE_NO_VAT = 'no_vat';
const TYPE_NZ_GST = 'nz_gst';
const TYPE_UNKNOWN = 'unknown';

View File

@ -88,6 +88,7 @@ abstract class Util
\Stripe\Coupon::OBJECT_NAME => 'Stripe\\Coupon',
\Stripe\CreditNote::OBJECT_NAME => 'Stripe\\CreditNote',
\Stripe\Customer::OBJECT_NAME => 'Stripe\\Customer',
\Stripe\CustomerBalanceTransaction::OBJECT_NAME => 'Stripe\\CustomerBalanceTransaction',
\Stripe\Discount::OBJECT_NAME => 'Stripe\\Discount',
\Stripe\Dispute::OBJECT_NAME => 'Stripe\\Dispute',
\Stripe\EphemeralKey::OBJECT_NAME => 'Stripe\\EphemeralKey',
@ -117,6 +118,7 @@ abstract class Util
\Stripe\Person::OBJECT_NAME => 'Stripe\\Person',
\Stripe\Plan::OBJECT_NAME => 'Stripe\\Plan',
\Stripe\Product::OBJECT_NAME => 'Stripe\\Product',
\Stripe\Radar\EarlyFraudWarning::OBJECT_NAME => 'Stripe\\Radar\\EarlyFraudWarning',
\Stripe\Radar\ValueList::OBJECT_NAME => 'Stripe\\Radar\\ValueList',
\Stripe\Radar\ValueListItem::OBJECT_NAME => 'Stripe\\Radar\\ValueListItem',
\Stripe\Recipient::OBJECT_NAME => 'Stripe\\Recipient',
@ -125,6 +127,7 @@ abstract class Util
\Stripe\Reporting\ReportRun::OBJECT_NAME => 'Stripe\\Reporting\\ReportRun',
\Stripe\Reporting\ReportType::OBJECT_NAME => 'Stripe\\Reporting\\ReportType',
\Stripe\Review::OBJECT_NAME => 'Stripe\\Review',
\Stripe\SetupIntent::OBJECT_NAME => 'Stripe\\SetupIntent',
\Stripe\SKU::OBJECT_NAME => 'Stripe\\SKU',
\Stripe\Sigma\ScheduledQueryRun::OBJECT_NAME => 'Stripe\\Sigma\\ScheduledQueryRun',
\Stripe\Source::OBJECT_NAME => 'Stripe\\Source',

View File

@ -24,6 +24,8 @@ abstract class Webhook
*/
public static function constructEvent($payload, $sigHeader, $secret, $tolerance = self::DEFAULT_TOLERANCE)
{
WebhookSignature::verifyHeader($payload, $sigHeader, $secret, $tolerance);
$data = json_decode($payload, true);
$jsonError = json_last_error();
if ($data === null && $jsonError !== JSON_ERROR_NONE) {
@ -33,8 +35,6 @@ abstract class Webhook
}
$event = Event::constructFrom($data);
WebhookSignature::verifyHeader($payload, $sigHeader, $secret, $tolerance);
return $event;
}
}

View File

@ -60,7 +60,7 @@ abstract class WebhookSignature
}
// Check if timestamp is within tolerance
if (($tolerance > 0) && ((time() - $timestamp) > $tolerance)) {
if (($tolerance > 0) && (abs(time() - $timestamp) > $tolerance)) {
throw new Error\SignatureVerification(
"Timestamp outside the tolerance zone",
$header,

View File

@ -44,6 +44,11 @@ create table llx_entrepot_extrafields
ALTER TABLE llx_entrepot_extrafields ADD INDEX idx_entrepot_extrafields (fk_object);
ALTER TABLE llx_facture ADD COLUMN retained_warranty real DEFAULT NULL after situation_final;
ALTER TABLE llx_facture ADD COLUMN retained_warranty_date_limit date DEFAULT NULL after retained_warranty;
ALTER TABLE llx_facture ADD COLUMN retained_warranty_fk_cond_reglement integer DEFAULT NULL after retained_warranty_date_limit;
ALTER TABLE llx_c_shipment_mode ADD COLUMN entity integer DEFAULT 1 NOT NULL;
ALTER TABLE llx_c_shipment_mode DROP INDEX uk_c_shipment_mode;

View File

@ -285,7 +285,6 @@ DELETE from llx_accounting_account where rowid in (select minid from tmp_llx_acc
--update llx_facture_fourn_det set fk_code_ventilation = maxid WHERE fk_code_ventilation = minid;
--update llx_expensereport_det set fk_code_ventilation = maxid WHERE fk_code_ventilation = minid;
ALTER TABLE llx_accounting_account DROP INDEX uk_accounting_account;
ALTER TABLE llx_accounting_account ADD UNIQUE INDEX uk_accounting_account (account_number, entity, fk_pcg_version);

View File

@ -88,6 +88,10 @@ create table llx_facture
situation_counter smallint, -- situation counter
situation_final smallint, -- is the situation final ?
retained_warranty real DEFAULT NULL, -- % of retained warranty
retained_warranty_date_limit date DEFAULT NULL,
retained_warranty_fk_cond_reglement integer DEFAULT NULL, -- payment condition of retained warranty
import_key varchar(14),
extraparams varchar(255), -- for other parameters with json format

View File

@ -450,6 +450,11 @@ if ($action == "set")
$buffer=trim($buffer);
if ($buffer)
{
// Replace the prefix in table names
if ($dolibarr_main_db_prefix != 'llx_')
{
$buffer=preg_replace('/llx_/i', $dolibarr_main_db_prefix, $buffer);
}
dolibarr_install_syslog("step2: request: " . $buffer);
print "<!-- Insert line : ".$buffer."<br>-->\n";
$resql=$db->query($buffer, 0, 'dml');

View File

@ -291,6 +291,7 @@ Modelcsv_quadratus=Export for Quadratus QuadraCompta
Modelcsv_ebp=Export for EBP
Modelcsv_cogilog=Export for Cogilog
Modelcsv_agiris=Export for Agiris
Modelcsv_LDCompta=Export for LD Compta (v9 & higher) (Test)
Modelcsv_openconcerto=Export for OpenConcerto (Test)
Modelcsv_configurable=Export CSV Configurable
Modelcsv_FEC=Export FEC

View File

@ -1931,3 +1931,4 @@ EndPointFor=End point for %s : %s
DeleteEmailCollector=Delete email collector
ConfirmDeleteEmailCollector=Are you sure you want to delete this email collector?
RecipientEmailsWillBeReplacedWithThisValue=Recipient emails will be always replaced with this value
AtLeastOneDefaultBankAccountMandatory=At least 1 default bank account must be defined

View File

@ -214,6 +214,20 @@ ShowInvoiceReplace=Show replacing invoice
ShowInvoiceAvoir=Show credit note
ShowInvoiceDeposit=Show down payment invoice
ShowInvoiceSituation=Show situation invoice
UseSituationInvoices=Allow situation invoice
UseSituationInvoicesCreditNote=Allow situation invoice credit note
Retainedwarranty=Retained warranty
RetainedwarrantyDefaultPercent=Retained warranty default percent
ToPayOn=To pay on %s
toPayOn=to pay on %s
RetainedWarranty=Retained Warranty
PaymentConditionsShortRetainedWarranty=Retained warranty payment terms
DefaultPaymentConditionsRetainedWarranty=Default retained warranty payment terms
setPaymentConditionsShortRetainedWarranty=Set retained warranty payment terms
setretainedwarranty=Set retained warranty
setretainedwarrantyDateLimit=Set retained warranty date limit
RetainedWarrantyDateLimit=Retained warranty date limit
RetainedWarrantyNeed100Percent=The situation invoice need to be at 100%% progress to be displayed on PDF
ShowPayment=Show payment
AlreadyPaid=Already paid
AlreadyPaidBack=Already paid back
@ -552,4 +566,4 @@ AutoFillDateFromShort=Set start date
AutoFillDateTo=Set end date for service line with next invoice date
AutoFillDateToShort=Set end date
MaxNumberOfGenerationReached=Max number of gen. reached
BILL_DELETEInDolibarr=Invoice deleted
BILL_DELETEInDolibarr=Invoice deleted

View File

@ -90,7 +90,7 @@ ErrorSpecialCharNotAllowedForField=Special characters are not allowed for field
ErrorNumRefModel=A reference exists into database (%s) and is not compatible with this numbering rule. Remove record or renamed reference to activate this module.
ErrorQtyTooLowForThisSupplier=Quantity too low for this vendor or no price defined on this product for this vendor
ErrorOrdersNotCreatedQtyTooLow=Some orders haven't been created because of too-low quantities
ErrorModuleSetupNotComplete=Setup of module looks to be uncomplete. Go on Home - Setup - Modules to complete.
ErrorModuleSetupNotComplete=Setup of module %s looks to be uncomplete. Go on Home - Setup - Modules to complete.
ErrorBadMask=Error on mask
ErrorBadMaskFailedToLocatePosOfSequence=Error, mask without sequence number
ErrorBadMaskBadRazMonth=Error, bad reset value

View File

@ -64,4 +64,6 @@ ShowInStripe=Show in Stripe
StripeUserAccountForActions=User account to use for email notification of some Stripe events (Stripe payouts)
StripePayoutList=List of Stripe payouts
ToOfferALinkForTestWebhook=Link to setup Stripe WebHook to call the IPN (test mode)
ToOfferALinkForLiveWebhook=Link to setup Stripe WebHook to call the IPN (live mode)
ToOfferALinkForLiveWebhook=Link to setup Stripe WebHook to call the IPN (live mode)
PaymentWillBeRecordedForNextPeriod=Payment will be recorded for the next period.
ClickHereToTryAgain=<a href="%s">Click here to try again...</a>

View File

@ -76,7 +76,8 @@ WithdrawalFile=Withdrawal file
SetToStatusSent=Set to status "File Sent"
ThisWillAlsoAddPaymentOnInvoice=This will also record payments to invoices and will classify them as "Paid" if remain to pay is null
StatisticsByLineStatus=Statistics by status of lines
RUM=UMR
RUM=Unique Mandate Reference (UMR)
DateRUM=Mandate signature date
RUMLong=Unique Mandate Reference
RUMWillBeGenerated=If empty, a UMR (Unique Mandate Reference) will be generated once the bank account information is saved.
WithdrawMode=Direct debit mode (FRST or RECUR)

View File

@ -295,6 +295,7 @@ Modelcsv_openconcerto=Export pour OpenConcerto (Test)
Modelcsv_configurable=Export configurable
Modelcsv_FEC=Export FEC
Modelcsv_Sage50_Swiss=Export pour Sage 50 Suisse
Modelcsv_charlemagne=Export vers Charlemagne
ChartofaccountsId=Id plan comptable
## Tools - Init accounting account on product / service

View File

@ -90,7 +90,7 @@ ErrorSpecialCharNotAllowedForField=Les caractères spéciaux ne sont pas admis p
ErrorNumRefModel=Une référence existe en base (%s) et est incompatible avec cette numérotation. Supprimez la ligne ou renommez la référence pour activer ce module.
ErrorQtyTooLowForThisSupplier=Quantité insuffisante pour ce fournisseur ou aucun tarif défini sur ce produit pour ce fournisseur
ErrorOrdersNotCreatedQtyTooLow=Certaines commandes n'ont pas été créées en raison de quantités trop faibles
ErrorModuleSetupNotComplete=La configuration des modules semble incomplète. Aller sur la page Accueil - Configuration - Modules pour corriger.
ErrorModuleSetupNotComplete=La configuration du module '%s' semble incomplète. Aller sur la page Accueil - Configuration - Modules pour corriger.
ErrorBadMask=Erreur sur le masque
ErrorBadMaskFailedToLocatePosOfSequence=Erreur, masque sans numéro de séquence
ErrorBadMaskBadRazMonth=Erreur, mauvais valeur de remise à zéro

View File

@ -1695,6 +1695,7 @@ if ($action != 'dopayment')
{
$langs->load("members");
print '<br><span class="amountpaymentcomplete">'.$langs->trans("MembershipPaid", dol_print_date($object->datefin, 'day')).'</span><br>';
print '<span class="opacitymedium">'.$langs->trans("PaymentWillBeRecordedForNextPeriod").'</span><br>';
}
// Buttons for all payments registration methods
@ -1934,7 +1935,8 @@ if (preg_match('/^dopayment/', $action)) // If we choosed/click on the payment
// JS Code for Stripe
if (empty($stripearrayofkeys['publishable_key']))
{
print info_admin($langs->trans("ErrorModuleSetupNotComplete", "stripe"), 0, 0, 'error');
$langs->load("errors");
print info_admin($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Stripe")), 0, 0, 'error');
}
else
{

View File

@ -235,7 +235,7 @@ elseif (! empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$lo
// Output html code for logo
if ($urllogo)
{
print '<center><img id="dolpaymentlogo" title="'.$title.'" src="'.$urllogo.'"';
print '<center><img id="dolpaymentlogo" src="'.$urllogo.'"';
if ($width) print ' width="'.$width.'"';
print '></center>';
print '<br>';
@ -246,6 +246,17 @@ print $langs->trans("YourPaymentHasNotBeenRecorded")."<br><br>";
$key='ONLINE_PAYMENT_MESSAGE_KO';
if (! empty($conf->global->$key)) print $conf->global->$key;
$type = GETPOST('s', 'alpha');
$ref = GETPOST('ref', 'none');
$tag = GETPOST('tag', 'alpha');
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
if ($type || $tag)
{
$urlsubscription =getOnlinePaymentUrl(0, ($type?$type:'free'), $ref, $FinalPaymentAmt, $tag);
print $langs->trans("ClickHereToTryAgain", $urlsubscription);
}
print "\n</div>\n";

Some files were not shown because too many files have changed in this diff Show More