Merge remote-tracking branch 'uptream/develop' into 7.0-f2

# Conflicts:
#	htdocs/install/mysql/migration/6.0.0-7.0.0.sql
This commit is contained in:
Alexandre SPANGARO
2017-09-01 07:24:55 +02:00
54 changed files with 3609 additions and 2685 deletions

View File

@@ -2,9 +2,9 @@
![Build status](https://img.shields.io/travis/Dolibarr/dolibarr/develop.svg) ![Downloads per day](https://img.shields.io/sourceforge/dm/dolibarr.svg)
Dolibarr ERP & CRM is a modern software package to manage your organization's activity (contacts, suppliers, invoices, orders, stocks, agenda, ...).
Dolibarr ERP & CRM is a modern software package to manage your organization's activity (contacts, suppliers, invoices, orders, stocks, agenda).
It's an Open Source software (wrote in PHP language) designed for small, medium or large companies, foundations and freelances.
It's an Open Source Software (written in PHP language) designed for small, medium or large companies, foundations and freelances.
You can freely use, study, modify or distribute it according to its Free Software licence.
@@ -29,18 +29,25 @@ Other licenses apply for some included dependencies. See [COPYRIGHT](https://git
Releases can be downloaded from [official website](https://www.dolibarr.org/).
### Install from composer
If you do not already have Composer installed, you may do so by following the instructions at getcomposer.org. On Linux and Mac OS X, you'll run the following commands:
If you do not already have Composer installed, you may do so by following the instructions at [getcomposer.org](https://getcomposer.org/). On Linux and macOS, you may run the following commands:
```bash
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
```
On Windows, you'll download and run https://getcomposer.org/Composer-Setup.exe
On Windows, you can download and run https://getcomposer.org/Composer-Setup.exe
You can then create a new project
```bash
composer create-project dolibarr/dolibarr erp
```
### Simple setup
If you have low technical skills and you're looking to install Dolibarr ERP/CRM in few clicks, you can use one of the packaged versions:
If you have low technical skills and you're looking to install Dolibarr ERP/CRM in just a few clicks, you can use one of the packaged versions:
- DoliWamp for Windows
- DoliDeb for Debian or Ubuntu
@@ -48,11 +55,11 @@ If you have low technical skills and you're looking to install Dolibarr ERP/CRM
### Advanced setup
You can use a Web server and a supported database (MariaDb, MySql or Postgresql) to install the standard version.
You can use a Web server and a supported database (MariaDB, MySQL or PostgreSQL) to install the standard version.
- Uncompress the downloaded archive
- Copy directory "dolibarr" and all its files inside your web server root, or copy directory anywhere and set up your web server to use "dolibarr/htdocs" as root for a new web server virtual host (second choice need to be server administrator)
- Create an empty file "htdocs/conf/conf.php" and set permissions for your web server user (write permissions will be removed once install is finished)
- Copy the "dolibarr" directory and all its files inside your web server root or anywhere you'd like and set up your web server to use "*dolibarr/htdocs*" as root for a new web server virtual host (second choice need to be server administrator)
- Create an empty `htdocs/conf/conf.php` file and set permissions for your web server user (*write* permissions will be removed once install is finished)
- From your browser, go to the dolibarr "install/" page
The URL will depends on choices made in the first step:
@@ -73,10 +80,10 @@ You can use a Web server and a supported database (MariaDb, MySql or Postgresql)
## UPGRADING
- Overwrite all old files from 'dolibarr' directory with files provided into the new version's package.
- At first next access, Dolibarr will redirect your to the "install/" page to make the upgrade process.
If a file install.lock exists to lock any run of upgrade process, the application will ask you to remove the file manually (you should find the install.lock file into the directory used to store generated and uploaded documents, in most cases, it is the directory called "documents").
- At first next access, Dolibarr will redirect your to the "install/" page to follow the upgrade process.
 If an `install.lock` file exists to lock any other upgrade process, the application will ask you to remove the file manually (you should find the `install.lock` file into the directory used to store generated and uploaded documents, in most cases, it is the directory called "*documents*").
*Note: migration process can safely be done multiple times by calling the page /install/index.php*
*Note: migration process can be safely done multiple times by calling the `/install/index.php` page*
## WHAT'S NEW
@@ -172,7 +179,7 @@ Administrator, user, developer and translator's documentations are available alo
## CONTRIBUTING
See file [CONTRIBUTING](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CONTRIBUTING.md)
See [CONTRIBUTING](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CONTRIBUTING.md) file
## CREDITS

View File

@@ -69,8 +69,8 @@ $arrayfields=array(
'aa.account_number'=>array('label'=>$langs->trans("AccountNumber"), 'checked'=>1),
'aa.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
'aa.account_parent'=>array('label'=>$langs->trans("Accountparent"), 'checked'=>0),
'aa.pcg_type'=>array('label'=>$langs->trans("Pcgtype"), 'checked'=>0),
'aa.pcg_subtype'=>array('label'=>$langs->trans("Pcgsubtype"), 'checked'=>0),
'aa.pcg_type'=>array('label'=>$langs->trans("Pcgtype"), 'checked'=>0, 'help'=>'PcgtypeDesc'),
'aa.pcg_subtype'=>array('label'=>$langs->trans("Pcgsubtype"), 'checked'=>0, 'help'=>'PcgtypeDesc'),
'aa.active'=>array('label'=>$langs->trans("Activated"), 'checked'=>1)
);
@@ -94,9 +94,9 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
if (empty($reshook))
{
if (! empty($cancel)) $action = '';
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers
{
$search_account = "";
@@ -106,13 +106,13 @@ if (empty($reshook))
$search_pcgsubtype = "";
$search_array_options=array();
}
if (GETPOST('change_chart'))
{
$chartofaccounts = GETPOST('chartofaccounts', 'int');
if (! empty($chartofaccounts)) {
if (! dolibarr_set_const($db, 'CHARTOFACCOUNTS', $chartofaccounts, 'chaine', 0, '', $conf->entity)) {
$error ++;
}
@@ -120,12 +120,12 @@ if (empty($reshook))
$error ++;
}
}
if ($action == 'disable') {
if ($accounting->fetch($id)) {
$result = $accounting->account_desactivate($id);
}
$action = 'update';
if ($result < 0) {
setEventMessages($accounting->error, $accounting->errors, 'errors');
@@ -179,7 +179,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{
$resql = $db->query($sql);
$nbtotalofrecords = $db->num_rows($resql);
}
}
$sql .= $db->plimit($limit + 1, $offset);
@@ -209,11 +209,11 @@ if ($resql)
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
$htmlbuttonadd = '<a class="butAction" href="./card.php?action=create">' . $langs->trans("Addanaccount") . '</a>';
print_barre_liste($langs->trans('ListAccounts'), $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $htmlbuttonadd);
// Box to select active chart of account
print $langs->trans("Selectchartofaccounts") . " : ";
print '<select class="flat" name="chartofaccounts" id="chartofaccounts">';
@@ -227,22 +227,22 @@ if ($resql)
$i = 0;
while ( $i < $numbis ) {
$row = $db->fetch_row($resqlchart);
print '<option value="' . $row[0] . '"';
print $pcgver == $row[0] ? ' selected' : '';
print '>' . $row[1] . ' - ' . $row[2] . '</option>';
$i ++;
}
}
print "</select>";
print '<input type="submit" class="button" name="change_chart" value="'.dol_escape_htmltag($langs->trans("ChangeAndLoad")).'">';
print '<br>';
print '<br>';
print '<br>';
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
@@ -259,13 +259,13 @@ if ($resql)
print $searchpicto;
print '</td>';
print '</tr>';
print '<tr class="liste_titre">';
if (! empty($arrayfields['aa.account_number']['checked'])) print_liste_field_titre($arrayfields['aa.account_number']['label'], $_SERVER["PHP_SELF"],"aa.account_number","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['aa.label']['checked'])) print_liste_field_titre($arrayfields['aa.label']['label'], $_SERVER["PHP_SELF"],"aa.label","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['aa.account_parent']['checked'])) print_liste_field_titre($arrayfields['aa.account_parent']['label'], $_SERVER["PHP_SELF"],"aa.account_parent", "", $param,'align="left"',$sortfield,$sortorder);
if (! empty($arrayfields['aa.pcg_type']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_type']['label'],$_SERVER["PHP_SELF"],'aa.pcg_type','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['aa.pcg_subtype']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_subtype']['label'],$_SERVER["PHP_SELF"],'aa.pcg_subtype','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['aa.pcg_type']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_type']['label'],$_SERVER["PHP_SELF"],'aa.pcg_type','',$param,'',$sortfield,$sortorder,'',$arrayfields['aa.pcg_type']['help']);
if (! empty($arrayfields['aa.pcg_subtype']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_subtype']['label'],$_SERVER["PHP_SELF"],'aa.pcg_subtype','',$param,'',$sortfield,$sortorder,'',$arrayfields['aa.pcg_subtype']['help']);
if (! empty($arrayfields['aa.active']['checked'])) print_liste_field_titre($arrayfields['aa.active']['label'],$_SERVER["PHP_SELF"],'aa.active','',$param,'',$sortfield,$sortorder);
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n";
@@ -274,14 +274,14 @@ if ($resql)
$accountparent = new AccountingAccount($db);
$i=0;
while ($i < min($num, $limit))
while ($i < min($num, $limit))
{
$obj = $db->fetch_object($resql);
$accountstatic->id = $obj->rowid;
$accountstatic->label = $obj->label;
$accountstatic->account_number = $obj->account_number;
print '<tr class="oddeven">';
// Account number
@@ -310,7 +310,7 @@ if ($resql)
$accountparent->id = $obj->rowid2;
$accountparent->label = $obj->label2;
$accountparent->account_number = $obj->account_number2;
print "<td>";
print $accountparent->getNomUrl(1);
print "</td>\n";
@@ -371,11 +371,11 @@ if ($resql)
}
print '</td>' . "\n";
if (! $i) $totalarray['nbfield']++;
print "</tr>\n";
$i++;
}
print "</table>";
print "</div>";
print '</form>';

View File

@@ -458,6 +458,10 @@ $titlepicto='title_setup';
print load_fiche_titre($titre,$linkback,$titlepicto);
if ($id == 32)
{
print $langs->trans("AccountingAccountGroupsDesc", $langs->transnoentitiesnoconv("ByPersonalizedAccountGroups")).'<br><br>';
}
// Confirmation de la suppression de la ligne
if ($action == 'delete')

View File

@@ -334,19 +334,20 @@ class AccountancyCategory
/**
* Function to show result of an accounting account from the ledger with a direction and a period
*
* @param int $cpt Id accounting account
* @param string $month Specifig month - Can be empty
* @param string $year Specific year
* @param int $sens Sens of the account 0: credit - debit 1: debit - credit
*
* @return integer Result in table
* @param int $cpt Id accounting account
* @param string $month Specifig month - Can be empty
* @param string $date_start Date start
* @param string $date_end Date end
* @param int $sens Sens of the account 0: credit - debit 1: debit - credit
* @return integer Result in table
*/
public function getResult($cpt, $month, $year, $sens) {
public function getResult($cpt, $month, $date_start, $date_end, $sens)
{
$sql = "SELECT SUM(t.debit) as debit, SUM(t.credit) as credit";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as t";
$sql .= " WHERE t.numero_compte = '" . $cpt."'";
$sql .= " AND YEAR(t.doc_date) = " . $year;
if (! empty($date_start) && ! empty($date_end))
$sql.= " AND t.doc_date >= '".$this->db->idate($date_start)."' AND t.doc_date <= '".$this->db->idate($date_end)."'";
if (! empty($month)) {
$sql .= " AND MONTH(t.doc_date) = " . $month;
}

View File

@@ -138,6 +138,9 @@ print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step,
print "<br>\n";
print '<br>';
print "<br>\n";
print_fiche_titre($langs->trans("AccountancyAreaDescActionFreq"), '', 'object_calendarweek');
print '<hr>';

View File

@@ -1,302 +0,0 @@
<?php
/* Copyright (C) 2016/17 Jamal Elbaz <jamelbaz@gmail.com>
* Copyright (C) 2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.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/accountancy/report/result.php
* \ingroup Advanced accountancy
* \brief Page for accounting result
*/
require '../../main.inc.php';
// Class
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/report.lib.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountancycategory.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
$error = 0;
// Langs
$langs->load("accountancy");
$langs->load("compta");
$mesg = '';
$action = GETPOST('action','aZ09');
$cat_id = GETPOST('account_category');
$selectcpt = GETPOST('cpt_bk');
$id = GETPOST('id', 'int');
$rowid = GETPOST('rowid', 'int');
$cancel = GETPOST('cancel');
$simple_report = GETPOST('simple_report');
// Filter
$year = GETPOST('year','int');
if ($year == 0) {
$year_current = strftime("%Y", time());
$year_start = $year_current;
} else {
$year_current = $year;
$year_start = $year;
}
if($cat_id == 0){
$cat_id = null;
}
// Security check
if ($user->societe_id > 0)
accessforbidden();
if (! $user->rights->accounting->comptarapport->lire)
accessforbidden();
$AccCat = new AccountancyCategory($db);
/*
* View
*/
llxheader('', $langs->trans('ReportInOut'));
$formaccounting = new FormAccounting($db);
$form = new Form($db);
$textprevyear = '<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current - 1) . '">' . img_previous() . '</a>';
$textnextyear = '&nbsp;<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current + 1) . '">' . img_next() . '</a>';
$nom = $langs->trans("ReportInOut").', '.$langs->trans("ByAccounts");
$nomlink = '';
$periodlink = '';
$exportlink = '';
$builddate = time();
$description = '';
$period = $langs->trans("Detail").' '. $form->selectyesno('simple_report',$simple_report,0) . " " .$textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear ;
report_header($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''));
$moreforfilter='';
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
$months = array( $langs->trans("JanuaryMin"),
$langs->trans("FebruaryMin"),
$langs->trans("MarchMin"),
$langs->trans("AprilMin"),
$langs->trans("MayMin"),
$langs->trans("JuneMin"),
$langs->trans("JulyMin"),
$langs->trans("AugustMin"),
$langs->trans("SeptemberMin"),
$langs->trans("OctoberMin"),
$langs->trans("NovemberMin"),
$langs->trans("DecemberMin"),
);
print '<tr class="liste_titre">';
print '<th class="liste_titre">'.$langs->trans("Account").'</th>';
print '<th class="liste_titre">'.$langs->trans("Description").'</th>';
print '<th class="liste_titre" align="center">N-1</th>';
print '<th class="liste_titre" align="center">'.$langs->trans("NReal").'</th>';
foreach($months as $k => $v){
print '<th class="liste_titre" align="center">'.$langs->trans($v).'</th>';
}
print '</tr>';
//All categories
$cats = $AccCat->getCats();
if ($catsCalcule < 0) dol_print_error($db, $AccCat->error, $AccCat->errors);
$j=1;
$sommes = array();
foreach($cats as $cat ){
if(!empty($cat['category_type'])){ // category calculed
$formula = $cat['formula'];
print "<tr class='liste_titre'>";
print '<td colspan="2">' . $cat['label'] . '</td>';
$vars = array();
// Previous Fiscal year (N-1)
foreach($sommes as $code => $det){
$vars[$code] = $det['NP'];
}
$result = strtr($formula, $vars);
$r = $AccCat->calculate($result);
print '<td align="right"><font color="blue">' . price($r) . '</td>';
$code = $cat['code']; // code categorie de calcule
$sommes[$code]['NP'] += $r;
// Current fiscal year (N)
if (is_array($sommes) && ! empty($sommes)){
foreach($sommes as $code => $det){
$vars[$code] = $det['N'];
}
}
$result = strtr($formula, $vars);
$r = $AccCat->calculate($result);
print '<td align="right"><font color="blue">' . price($r) . '</td>';
$sommes[$code]['N'] += $r;
// Detail by month
foreach($months as $k => $v){
foreach($sommes as $code => $det){
$vars[$code] = $det['M'][$k];
}
$result = strtr($formula, $vars);
$r = $AccCat->calculate($result);
print '<td align="right"><font color="blue">' . price($r) . '</td>';
$sommes[$code]['M'][$k] += $r;
}
print "</tr>\n";
}else{ // normal category
$totCat = array();
$totCat['M'] = array();
// get cpts of category
$cpts = $AccCat->getCptsCat($cat['rowid']);
print "<tr class='liste_titre'>";
print '<td colspan="2">' . $cat['label'] . '</td>';
foreach($cpts as $i => $cpt){
$var = ! $var;
$code = $cat['code'];
// N-1
$return = $AccCat->getResult($cpt['account_number'], 0, $year_current -1, $cpt['dc']);
if ($return < 0) {
setEventMessages(null, $AccCat->errors, 'errors');
$resultNP=0;
} else {
$resultNP=$AccCat->sdc;
}
//N
$return = $AccCat->getResult($cpt['account_number'], 0, $year_current, $cpt['dc']);
if ($return < 0) {
setEventMessages(null, $AccCat->errors, 'errors');
$resultN=0;
} else {
$resultN=$AccCat->sdc;
}
$totCat['NP'] += $resultNP;
$totCat['N'] += $resultN;
foreach($months as $k => $v){
$return = $AccCat->getResult($cpt['account_number'], $k+1, $year_current, $cpt['dc']);
if ($return < 0) {
setEventMessages(null, $AccCat->errors, 'errors');
$resultM=0;
} else {
$resultM=$AccCat->sdc;
}
$totCat['M'][$k] += $resultM;
}
}
print '<td align="right">' . price($totCat['NP']) . '</td>';
print '<td align="right">' . price($totCat['N']) . '</td>';
foreach($totCat['M'] as $k => $v){
print '<td align="right">' . price($v) . '</td>';
}
print "</tr>\n";
foreach($cpts as $i => $cpt){
$var = ! $var;
$code = $cat['code'];
// N-1
$return = $AccCat->getResult($cpt['account_number'], 0, $year_current -1, $cpt['dc']);
if ($return < 0) {
setEventMessages(null, $AccCat->errors, 'errors');
$resultNP=0;
} else {
$resultNP=$AccCat->sdc;
}
//N
$return = $AccCat->getResult($cpt['account_number'], 0, $year_current, $cpt['dc']);
if ($return < 0) {
setEventMessages(null, $AccCat->errors, 'errors');
$resultN=0;
} else {
$resultN=$AccCat->sdc;
}
$sommes[$code]['NP'] += $resultNP;
$sommes[$code]['N'] += $resultN;
print '<tr'. $bc[$var].'>';
if ($simple_report == 'yes') {
print '<td>' . length_accountg($cpt['account_number']) . '</td>';
print '<td>' . $cpt['name_cpt'] . '</td>';
print '<td align="right">' . price($resultNP) . '</td>';
print '<td align="right">' . price($resultN) . '</td>';
}
foreach($months as $k => $v){
$return = $AccCat->getResult($cpt['account_number'], $k+1, $year_current, $cpt['dc']);
if ($return < 0) {
setEventMessages(null, $AccCat->errors, 'errors');
$resultM=0;
} else {
$resultM=$AccCat->sdc;
}
$sommes[$code]['M'][$k] += $resultM;
if ($simple_report == 'yes') {
print '<td align="right">' . price($resultM) . '</td>';
}
}
print "</tr>\n";
}
}
}
print "</table>";
print '</div>';
llxFooter();
$db->close();

View File

@@ -84,8 +84,8 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
$date_start=dol_get_first_day($pastmonthyear,$pastmonth,false); $date_end=dol_get_last_day($pastmonthyear,$pastmonth,false);
}
$nom=$langs->trans("PurchasesJournal");
$nomlink='';
$name=$langs->trans("PurchasesJournal");
$namelink='';
$periodlink='';
$exportlink='';
$builddate=time();
@@ -93,7 +93,8 @@ $description=$langs->trans("DescPurchasesJournal").'<br>';
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded");
else $description.= $langs->trans("DepositsAreIncluded");
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink);
report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink);
$p = explode(":", $conf->global->MAIN_INFO_SOCIETE_COUNTRY);
$idpays = $p[0];

View File

@@ -89,7 +89,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
}
$nom=$langs->trans("SellsJournal");
$nomlink='';
$namelink='';
$periodlink='';
$exportlink='';
$builddate=time();
@@ -97,7 +97,7 @@ $description=$langs->trans("DescSellsJournal").'<br>';
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded");
else $description.= $langs->trans("DepositsAreIncluded");
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink);
report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink);
$p = explode(":", $conf->global->MAIN_INFO_SOCIETE_COUNTRY);
$idpays = $p[0];
@@ -170,7 +170,7 @@ if ($result)
$prev_progress = 0;
if ($obj->type==Facture::TYPE_SITUATION) {
// Avoid divide by 0
if ($obj->situation_percent == 0) {
if ($obj->situation_percent == 0) {
$situation_ratio = 0;
} else {
$prev_progress = $line->get_prev_progress($obj->rowid); // id on invoice

View File

@@ -142,7 +142,7 @@ if ($calc==2) // Invoice for goods, payment for services
$productsup=$langs->trans("Description");
$amountsup=$langs->trans("AmountHT");
}
report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode);
report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode);
$vatcust=$langs->transcountry($local==1?"LT1":"LT2",$mysoc->country_code);
@@ -169,7 +169,7 @@ if($calc ==0 || $calc == 2)
$parameters["end"] = $date_end;
$parameters["direction"] = 'sell';
$parameters["type"] = 'localtax'.$local;
// Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('externalbalance'));
$reshook=$hookmanager->executeHooks('addVatLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
@@ -183,7 +183,7 @@ if($calc ==0 || $calc == 2)
{
if(($min == 0 or ($min > 0 && $coll->amount > $min)) && ($local==1?$coll->localtax1:$coll->localtax2) !=0)
{
$intra = str_replace($find,$replace,$coll->tva_intra);
if(empty($intra))
{
@@ -247,7 +247,7 @@ if($calc ==0 || $calc == 1){
$coll_list = vat_by_thirdparty($db,0,$date_start,$date_end,$modetax,'buy');
$parameters["direction"] = 'buy';
$parameters["type"] = 'localtax'.$local;
$reshook=$hookmanager->executeHooks('addVatLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if (is_array($coll_list))
{
@@ -258,7 +258,7 @@ if($calc ==0 || $calc == 1){
{
if(($min == 0 or ($min > 0 && $coll->amount > $min)) && ($local==1?$coll->localtax1:$coll->localtax2) != 0)
{
$intra = str_replace($find,$replace,$coll->tva_intra);
if(empty($intra))
{

View File

@@ -177,7 +177,7 @@ if ($conf->global->$calc==2) // Invoice for goods, payment for services
$vatsup=$langs->trans("VATPaid");
if ($mysoc->tva_assuj) $vatsup.=' ('.$langs->trans("ToGetBack").')';
}
report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode);
report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode);
if($local==1){
@@ -336,7 +336,7 @@ else
if (! empty($fields['ddate_start'])) $type=1;
if (! empty($fields['ddate_end'])) $type=1;
print '<tr class="oddeven">';
// Ref
@@ -499,7 +499,7 @@ else
if (! empty($fields['ddate_start'])) $type=1;
if (! empty($fields['ddate_end'])) $type=1;
print '<tr class="oddeven">';
// Ref

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,461 @@
<?php
/* Copyright (C) 2016-2017 Jamal Elbaz <jamelbaz@gmail.com>
* Copyright (C) 2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.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/compta/resultat/result.php
* \ingroup compta, accountancy
* \brief Page for accounting result
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancycategory.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
$langs->loadLangs(array('compta','bills','donation','salaries'));
$error = 0;
$mesg = '';
$action = GETPOST('action','aZ09');
$cat_id = GETPOST('account_category');
$selectcpt = GETPOST('cpt_bk');
$id = GETPOST('id', 'int');
$rowid = GETPOST('rowid', 'int');
$cancel = GETPOST('cancel');
$simple_report = GETPOST('simple_report');
$date_startmonth=GETPOST('date_startmonth');
$date_startday=GETPOST('date_startday');
$date_startyear=GETPOST('date_startyear');
$date_endmonth=GETPOST('date_endmonth');
$date_endday=GETPOST('date_endday');
$date_endyear=GETPOST('date_endyear');
$nbofyear=1;
// Date range
$year=GETPOST('year','int');
if (empty($year))
{
$year_current = strftime("%Y",dol_now());
$month_current = strftime("%m",dol_now());
$year_start = $year_current - ($nbofyear - 1);
} else {
$year_current = $year;
$month_current = strftime("%m",dol_now());
$year_start = $year - ($nbofyear - 1);
}
$date_start=dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
$date_end=dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
// We define date_start and date_end
if (empty($date_start) || empty($date_end)) // We define date_start and date_end
{
$q=GETPOST("q")?GETPOST("q"):0;
if ($q==0)
{
// We define date_start and date_end
$year_end=$year_start + ($nbofyear - 1);
$month_start=GETPOST("month")?GETPOST("month"):($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);
if (! GETPOST('month'))
{
if (! GETPOST("year") && $month_start > $month_current)
{
$year_start--;
$year_end--;
}
$month_end=$month_start-1;
if ($month_end < 1) $month_end=12;
else $year_end++;
}
else $month_end=$month_start;
$date_start=dol_get_first_day($year_start,$month_start,false); $date_end=dol_get_last_day($year_end,$month_end,false);
}
if ($q==1) { $date_start=dol_get_first_day($year_start,1,false); $date_end=dol_get_last_day($year_start,3,false); }
if ($q==2) { $date_start=dol_get_first_day($year_start,4,false); $date_end=dol_get_last_day($year_start,6,false); }
if ($q==3) { $date_start=dol_get_first_day($year_start,7,false); $date_end=dol_get_last_day($year_start,9,false); }
if ($q==4) { $date_start=dol_get_first_day($year_start,10,false); $date_end=dol_get_last_day($year_start,12,false); }
}
if (($date_start < dol_time_plus_duree($date_end, -1, 'y')) || ($date_start > $date_end))
{
$date_end = dol_time_plus_duree($date_start - 1, 1, 'y');
}
// $date_start and $date_end are defined. We force $start_year and $nbofyear
$tmps=dol_getdate($date_start);
$start_year = $tmps['year'];
$tmpe=dol_getdate($date_end);
$year_end = $tmpe['year'];
$nbofyear = ($year_end - $start_year) + 1;
$date_start_previous = dol_time_plus_duree($date_start, -1, 'y');
$date_end_previous = dol_time_plus_duree($date_end, -1, 'y');
//var_dump($date_start." ".$date_end." ".$date_start_previous." ".$date_end_previous." ".$nbofyear);
if($cat_id == 0){
$cat_id = null;
}
// Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES' or 'BOOKKEEPING')
$modecompta = $conf->global->ACCOUNTING_MODE;
if (! empty($conf->accounting->enabled)) $modecompta='BOOKKEEPING';
if (GETPOST("modecompta")) $modecompta=GETPOST("modecompta",'alpha');
// Security check
if ($user->societe_id > 0)
accessforbidden();
if (! $user->rights->accounting->comptarapport->lire)
accessforbidden();
$AccCat = new AccountancyCategory($db);
/*
* View
*/
llxheader('', $langs->trans('ReportInOut'));
$formaccounting = new FormAccounting($db);
$form = new Form($db);
$textprevyear = '<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($start_year - 1) . '">' . img_previous() . '</a>';
$textnextyear = '&nbsp;<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($start_year + 1) . '">' . img_next() . '</a>';
// Affiche en-tete de rapport
if ($modecompta=="CREANCES-DETTES")
{
$name=$langs->trans("AnnualByAccountDueDebtMode");
$calcmode=$langs->trans("CalcModeDebt");
$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$start_year.(GETPOST("month")>0?'&month='.GETPOST("month"):'').'&modecompta=RECETTES-DEPENSES">','</a>').')';
$calcmode.='<br>('.$langs->trans("SeeReportInBookkeepingMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$start_year.'&modecompta=BOOKKEEPING">','</a>').')';
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
//$periodlink='<a href="'.$_SERVER["PHP_SELF"].'?year='.($year-1).'&modecompta='.$modecompta.'">'.img_previous().'</a> <a href="'.$_SERVER["PHP_SELF"].'?year='.($year+1).'&modecompta='.$modecompta.'">'.img_next().'</a>';
$description=$langs->trans("RulesResultDue");
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded");
else $description.= $langs->trans("DepositsAreIncluded");
$builddate=time();
//$exportlink=$langs->trans("NotYetAvailable");
}
else if ($modecompta=="RECETTES-DEPENSES") {
$name=$langs->trans("AnnualByAccountInputOutputMode");
$calcmode=$langs->trans("CalcModeEngagement");
$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.(GETPOST("month")>0?'&month='.GETPOST("month"):'').'&modecompta=CREANCES-DETTES">','</a>').')';
$calcmode.='<br>('.$langs->trans("SeeReportInBookkeepingMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&modecompta=BOOKKEEPING">','</a>').')';
//$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',1,1,0,'',1,0,1);
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
//$periodlink='<a href="'.$_SERVER["PHP_SELF"].'?year='.($year-1).'&modecompta='.$modecompta.'">'.img_previous().'</a> <a href="'.$_SERVER["PHP_SELF"].'?year='.($year+1).'&modecompta='.$modecompta.'">'.img_next().'</a>';
$description=$langs->trans("RulesResultInOut");
$builddate=time();
//$exportlink=$langs->trans("NotYetAvailable");
}
else if ($modecompta=="BOOKKEEPING")
{
$name = $langs->trans("ReportInOut").', '.$langs->trans("ByPersonalizedAccountGroups");
$calcmode=$langs->trans("CalcModeBookkeeping");
//$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
//$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
$nomlink = '';
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
$period.=' &nbsp; &nbsp; '.$langs->trans("DetailByAccount").' '. $form->selectyesno('simple_report',$simple_report,0);
$periodlink = $textprevyear . " " . $langs->trans("Year") . " " . $start_year . " " . $textnextyear ;
$exportlink = '';
$description=$langs->trans("RulesResultBookkeepingPersonalized", $langs->transnoentitiesnoconv("Accountancy").' / '.$langs->transnoentitiesnoconv("Setup").' / '.$langs->trans("AccountingCategory"));
//if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded");
//else $description.= $langs->trans("DepositsAreIncluded");
$builddate = time();
}
report_header($name, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('modecompta'=>$modecompta, 'action' => ''), $calcmode);
if (! empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING')
{
print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
}
$moreforfilter='';
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
$months = array( $langs->trans("JanuaryMin"),
$langs->trans("FebruaryMin"),
$langs->trans("MarchMin"),
$langs->trans("AprilMin"),
$langs->trans("MayMin"),
$langs->trans("JuneMin"),
$langs->trans("JulyMin"),
$langs->trans("AugustMin"),
$langs->trans("SeptemberMin"),
$langs->trans("OctoberMin"),
$langs->trans("NovemberMin"),
$langs->trans("DecemberMin"),
);
print '<tr class="liste_titre">';
print '<th class="liste_titre">'.$langs->trans("AccountingCategory").'</th>';
print '<th class="liste_titre"></th>';
print '<th class="liste_titre" align="right">'.$langs->trans("PreviousYear").'</th>';
print '<th class="liste_titre" align="right">'.$langs->trans("SelectedPeriod").'</th>';
foreach($months as $k => $v){
print '<th class="liste_titre" align="right">'.$langs->trans($v).'</th>';
}
print '</tr>';
if ($modecompta == 'CREANCES-DETTES')
{
//if (! empty($date_start) && ! empty($date_end))
// $sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
}
else if ($modecompta=="RECETTES-DEPENSES")
{
//if (! empty($date_start) && ! empty($date_end))
// $sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
}
else if ($modecompta=="BOOKKEEPING")
{
// TODO
//if (! empty($date_start) && ! empty($date_end))
// $sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
//All categories
$cats = $AccCat->getCats();
if ($catsCalcule < 0) dol_print_error($db, $AccCat->error, $AccCat->errors);
$j=1;
$sommes = array();
foreach ($cats as $cat) // Loop on each group
{
if (!empty($cat['category_type'])) // category calculed
{
$formula = $cat['formula'];
print "<tr>";
//print '<td colspan="2"><font color="blue">' . $cat['label'] . '</font></td>';
print '<td colspan="2">' . $cat['label'] . '</td>';
$vars = array();
// Previous Fiscal year (N-1)
foreach($sommes as $code => $det){
$vars[$code] = $det['NP'];
}
$result = strtr($formula, $vars);
$r = $AccCat->calculate($result);
print '<td align="right"><font color="blue">' . price($r) . '</font></td>';
$code = $cat['code']; // code categorie de calcule
$sommes[$code]['NP'] += $r;
// Current fiscal year (N)
if (is_array($sommes) && ! empty($sommes)){
foreach($sommes as $code => $det){
$vars[$code] = $det['N'];
}
}
$result = strtr($formula, $vars);
$r = $AccCat->calculate($result);
print '<td align="right"><font color="blue">' . price($r) . '</font></td>';
$sommes[$code]['N'] += $r;
// Detail by month
foreach($months as $k => $v){
foreach($sommes as $code => $det){
$vars[$code] = $det['M'][$k];
}
$result = strtr($formula, $vars);
$r = $AccCat->calculate($result);
print '<td align="right"><font color="blue">' . price($r) . '</font></td>';
$sommes[$code]['M'][$k] += $r;
}
print "</tr>\n";
}
else // normal category
{
$totCat = array();
$totCat['NP'] = 0;
$totCat['N'] = 0;
$totCat['M'] = array();
foreach($months as $k => $v)
{
$totCat['M'][$k] = 0;
}
// Get cpts of category/group
$cpts = $AccCat->getCptsCat($cat['rowid']);
print "<tr>";
// Column group
print '<td colspan="2">';
print $cat['label'];
if (count($cpts) > 0)
{
$i=0;
foreach($cpts as $cpt)
{
if ($i > 5)
{
print '...)';
break;
}
if ($i > 0) print ', ';
else print ' (';
print $cpt['account_number'];
$i++;
}
if ($i <= 5) print ')';
}
else
{
print ' - <span class="warning">'.$langs->trans("GroupIsEmptyCheckSetup").'</span>';
}
print '</td>';
$code = $cat['code'];
// Column N Previous and N
foreach($cpts as $i => $cpt)
{
// N-1
$return = $AccCat->getResult($cpt['account_number'], 0, $date_start_previous, $date_end_previous, $cpt['dc']);
if ($return < 0) {
setEventMessages(null, $AccCat->errors, 'errors');
$resultNP=0;
} else {
$resultNP=$AccCat->sdc;
}
//N
$return = $AccCat->getResult($cpt['account_number'], 0, $date_start, $date_end, $cpt['dc']);
if ($return < 0) {
setEventMessages(null, $AccCat->errors, 'errors');
$resultN=0;
} else {
$resultN=$AccCat->sdc;
}
$totCat['NP'] += $resultNP;
$totCat['N'] += $resultN;
foreach($months as $k => $v)
{
$return = $AccCat->getResult($cpt['account_number'], $k+1, $date_start, $date_end, $cpt['dc']);
if ($return < 0) {
setEventMessages(null, $AccCat->errors, 'errors');
$resultM=0;
} else {
$resultM=$AccCat->sdc;
}
$totCat['M'][$k] += $resultM;
}
}
print '<td align="right">' . price($totCat['NP']) . '</td>';
print '<td align="right">' . price($totCat['N']) . '</td>';
foreach($totCat['M'] as $k => $v){
print '<td align="right">' . price($v) . '</td>';
}
print "</tr>\n";
//
foreach($cpts as $i => $cpt)
{
// N-1
$return = $AccCat->getResult($cpt['account_number'], 0, $date_start_previous, $date_end_previous, $cpt['dc']);
if ($return < 0) {
setEventMessages(null, $AccCat->errors, 'errors');
$resultNP=0;
} else {
$resultNP=$AccCat->sdc;
}
//N
$return = $AccCat->getResult($cpt['account_number'], 0, $date_start, $date_end, $cpt['dc']);
if ($return < 0) {
setEventMessages(null, $AccCat->errors, 'errors');
$resultN=0;
} else {
$resultN=$AccCat->sdc;
}
$sommes[$code]['NP'] += $resultNP;
$sommes[$code]['N'] += $resultN;
if ($simple_report == 'yes') {
print '<tr>';
print '<td> &nbsp; &nbsp; ' . length_accountg($cpt['account_number']) . '</td>';
print '<td>' . $cpt['name_cpt'] . '</td>';
print '<td align="right">' . price($resultNP) . '</td>';
print '<td align="right">' . price($resultN) . '</td>';
}
foreach($months as $k => $v)
{
$return = $AccCat->getResult($cpt['account_number'], $k+1, $date_start, $date_end, $cpt['dc']);
if ($return < 0) {
setEventMessages(null, $AccCat->errors, 'errors');
$resultM=0;
} else {
$resultM=$AccCat->sdc;
}
$sommes[$code]['M'][$k] += $resultM;
if ($simple_report == 'yes') {
print '<td align="right">' . price($resultM) . '</td>';
}
}
if ($simple_report == 'yes') {
print "</tr>\n";
}
}
}
}
}
print "</table>";
print '</div>';
llxFooter();
$db->close();

View File

@@ -27,7 +27,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$langs->load("products");
$langs->load("categories");
@@ -143,12 +143,14 @@ foreach($allparams as $key => $value) {
/*
* View
*/
llxHeader();
$form=new Form($db);
$formother = new FormOther($db);
// Show report header
$nom=$langs->trans("SalesTurnover").', '.$langs->trans("ByProductsAndServices");
$name=$langs->trans("SalesTurnover").', '.$langs->trans("ByProductsAndServices");
if ($modecompta=="CREANCES-DETTES") {
$calcmode=$langs->trans("CalcModeDebt");
@@ -176,14 +178,17 @@ if ($modecompta=="CREANCES-DETTES") {
$builddate=time();
}
report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,$tableparams,$calcmode);
report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,$tableparams,$calcmode);
if (! empty($conf->accounting->enabled))
if (! empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING')
{
print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
}
$name=array();
// SQL request
$catotal=0;
$catotal_ht=0;
@@ -266,7 +271,7 @@ if ($modecompta == 'CREANCES-DETTES')
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
// Category filter
print '<tr class="liste_titre">';
print '<td>';
@@ -283,11 +288,11 @@ if ($modecompta == 'CREANCES-DETTES')
print $langs->trans("Type"). ': ';
$form->select_type_of_lines(isset($selected_type)?$selected_type:-1,'search_type',1,1,1);
print '</td>';
print '<td colspan="5" align="right">';
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '</td></tr>';
// Array header
print "<tr class=\"liste_titre\">";
print_liste_field_titre(
@@ -357,7 +362,7 @@ if ($modecompta == 'CREANCES-DETTES')
if (count($name)) {
foreach($name as $key=>$value) {
print '<tr class="oddeven">';
// Product
@@ -369,15 +374,15 @@ if ($modecompta == 'CREANCES-DETTES')
}
print "<td>".$linkname."</td>\n";
// Quantity
print '<td align="right">';
print $qty[$key];
print '</td>';
// Percent;
print '<td align="right">'.($qtytotal > 0 ? round(100 * $qty[$key] / $qtytotal, 2).'%' : '&nbsp;').'</td>';
// Amount w/o VAT
print '<td align="right">';
/*if ($key > 0) {
@@ -388,7 +393,7 @@ if ($modecompta == 'CREANCES-DETTES')
print price($amount_ht[$key]);
//print '</a>';
print '</td>';
// Amount with VAT
print '<td align="right">';
/*if ($key > 0) {
@@ -399,12 +404,12 @@ if ($modecompta == 'CREANCES-DETTES')
print price($amount[$key]);
//print '</a>';
print '</td>';
// Percent;
print '<td align="right">'.($catotal > 0 ? round(100 * $amount[$key] / $catotal, 2).'%' : '&nbsp;').'</td>';
// TODO: statistics?
print "</tr>\n";
$i++;
}
@@ -423,7 +428,7 @@ if ($modecompta == 'CREANCES-DETTES')
}
print "</table>";
print '</div>';
print '</form>';
} else {
// $modecompta != 'CREANCES-DETTES'

View File

@@ -131,12 +131,11 @@ foreach($allparams as $key => $value) {
llxHeader();
$form=new Form($db);
// Show report header
if ($modecompta=="CREANCES-DETTES") {
$nom=$langs->trans("SalesTurnover").', '.$langs->trans("ByUserAuthorOfInvoice");
$name=$langs->trans("SalesTurnover").', '.$langs->trans("ByUserAuthorOfInvoice");
$calcmode=$langs->trans("CalcModeDebt");
$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&modecompta=RECETTES-DEPENSES">','</a>').')';
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
@@ -147,7 +146,7 @@ if ($modecompta=="CREANCES-DETTES") {
$builddate=time();
//$exportlink=$langs->trans("NotYetAvailable");
} else {
$nom=$langs->trans("SalesTurnover").', '.$langs->trans("ByUserAuthorOfInvoice");
$name=$langs->trans("SalesTurnover").', '.$langs->trans("ByUserAuthorOfInvoice");
$calcmode=$langs->trans("CalcModeEngagement");
$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&modecompta=CREANCES-DETTES">','</a>').')';
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
@@ -160,14 +159,16 @@ if ($modecompta=="CREANCES-DETTES") {
$moreparam=array();
if (! empty($modecompta)) $moreparam['modecompta']=$modecompta;
report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,$moreparam,$calcmode);
report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,$moreparam,$calcmode);
if (! empty($conf->accounting->enabled))
if (! empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING')
{
print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
}
$name=array();
// Show array
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
// Extra parameters management
@@ -350,9 +351,9 @@ if (count($amount)) {
}
$i = 0;
foreach($arrayforsort as $key => $value) {
print '<tr class="oddeven">';
// Third party

View File

@@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$langs->load("companies");
$langs->load("categories");
@@ -165,7 +165,7 @@ $formother = new FormOther($db);
// Show report header
if ($modecompta=="CREANCES-DETTES")
{
$nom=$langs->trans("SalesTurnover").', '.$langs->trans("ByThirdParties");
$name=$langs->trans("SalesTurnover").', '.$langs->trans("ByThirdParties");
$calcmode=$langs->trans("CalcModeDebt");
$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&modecompta=RECETTES-DEPENSES">','</a>').')';
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
@@ -176,7 +176,7 @@ if ($modecompta=="CREANCES-DETTES")
$builddate=time();
//$exportlink=$langs->trans("NotYetAvailable");
} else {
$nom=$langs->trans("SalesTurnover").', '.$langs->trans("ByThirdParties");
$name=$langs->trans("SalesTurnover").', '.$langs->trans("ByThirdParties");
$calcmode=$langs->trans("CalcModeEngagement");
$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&modecompta=CREANCES-DETTES">','</a>').')';
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
@@ -187,14 +187,16 @@ if ($modecompta=="CREANCES-DETTES")
//$exportlink=$langs->trans("NotYetAvailable");
}
report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,$tableparams,$calcmode);
report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,$tableparams,$calcmode);
if (! empty($conf->accounting->enabled))
if (! empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING')
{
print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
}
$name=array();
// Show Array
$catotal=0;
if ($modecompta == 'CREANCES-DETTES') {

View File

@@ -25,21 +25,69 @@
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
$langs->loadLangs(array('compta','bills','donation','salaries'));
$date_startmonth=GETPOST('date_startmonth');
$date_startday=GETPOST('date_startday');
$date_startyear=GETPOST('date_startyear');
$date_endmonth=GETPOST('date_endmonth');
$date_endday=GETPOST('date_endday');
$date_endyear=GETPOST('date_endyear');
$year_start=GETPOST("year_start");
$year_current = strftime("%Y",time());
$nbofyear=4;
if (! $year_start) {
$year_start = $year_current - ($nbofyear-1);
$year_end = $year_current;
// Date range
$year=GETPOST('year','int');
if (empty($year))
{
$year_current = strftime("%Y",dol_now());
$month_current = strftime("%m",dol_now());
$year_start = $year_current - ($nbofyear - 1);
} else {
$year_current = $year;
$month_current = strftime("%m",dol_now());
$year_start = $year - ($nbofyear - 1);
}
else {
$year_end=$year_start + ($nbofyear-1);
$date_start=dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
$date_end=dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
// We define date_start and date_end
if (empty($date_start) || empty($date_end)) // We define date_start and date_end
{
$q=GETPOST("q")?GETPOST("q"):0;
if ($q==0)
{
// We define date_start and date_end
$year_end=$year_start + ($nbofyear - 1);
$month_start=GETPOST("month")?GETPOST("month"):($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);
if (! GETPOST('month'))
{
if (! GETPOST("year") && $month_start > $month_current)
{
$year_start--;
$year_end--;
}
$month_end=$month_start-1;
if ($month_end < 1) $month_end=12;
else $year_end++;
}
else $month_end=$month_start;
$date_start=dol_get_first_day($year_start,$month_start,false); $date_end=dol_get_last_day($year_end,$month_end,false);
}
if ($q==1) { $date_start=dol_get_first_day($year_start,1,false); $date_end=dol_get_last_day($year_start,3,false); }
if ($q==2) { $date_start=dol_get_first_day($year_start,4,false); $date_end=dol_get_last_day($year_start,6,false); }
if ($q==3) { $date_start=dol_get_first_day($year_start,7,false); $date_end=dol_get_last_day($year_start,9,false); }
if ($q==4) { $date_start=dol_get_first_day($year_start,10,false); $date_end=dol_get_last_day($year_start,12,false); }
}
$userid=GETPOST('userid','int');
$socid = GETPOST('socid','int');
// Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES')
// Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES' or 'BOOKKEEPING')
$modecompta = $conf->global->ACCOUNTING_MODE;
if (! empty($conf->accounting->enabled)) $modecompta='BOOKKEEPING';
if (GETPOST("modecompta")) $modecompta=GETPOST("modecompta",'alpha');
// Security check
@@ -55,16 +103,17 @@ if (! empty($conf->accounting->enabled)) $result=restrictedArea($user,'accountin
*/
llxHeader();
$form=new Form($db);
// Affiche en-tete du rapport
if ($modecompta=="CREANCES-DETTES")
{
$nom=$langs->trans("SalesTurnover");
$name=$langs->trans("SalesTurnover");
$calcmode=$langs->trans("CalcModeDebt");
$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
$calcmode.='<br>('.$langs->trans("SeeReportInBookkeepingMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=BOOKKEEPING">','</a>').')';
$period="$year_start - $year_end";
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
$periodlink=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?year_start=".($year_start-1)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year_start=".($year_start+1)."&modecompta=".$modecompta."'>".img_next()."</a>":"");
$description=$langs->trans("RulesCADue");
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded");
@@ -74,11 +123,11 @@ if ($modecompta=="CREANCES-DETTES")
}
else if ($modecompta=="RECETTES-DEPENSES")
{
$nom=$langs->trans("SalesTurnover");
$name=$langs->trans("SalesTurnover");
$calcmode=$langs->trans("CalcModeEngagement");
$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
$calcmode.='<br>('.$langs->trans("SeeReportInBookkeepingMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=BOOKKEEPING">','</a>').')';
$period="$year_start - $year_end";
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
$periodlink=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?year_start=".($year_start-1)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year_start=".($year_start+1)."&modecompta=".$modecompta."'>".img_next()."</a>":"");
$description=$langs->trans("RulesCAIn");
$description.= $langs->trans("DepositsAreIncluded");
@@ -87,23 +136,24 @@ else if ($modecompta=="RECETTES-DEPENSES")
}
else if ($modecompta=="BOOKKEEPING")
{
$nom=$langs->trans("BookkeepingTurnover");
$name=$langs->trans("SalesTurnover");
$calcmode=$langs->trans("CalcModeBookkeeping");
$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
$period="$year_start - $year_end";
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
$periodlink=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?year_start=".($year_start-1)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year_start=".($year_start+1)."&modecompta=".$modecompta."'>".img_next()."</a>":"");
$description=$langs->trans("RulesCABookkeeping");
$description.= $langs->trans("DepositsAreIncluded");
$description=$langs->trans("RulesCADue");
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded");
else $description.= $langs->trans("DepositsAreIncluded");
$builddate=time();
//$exportlink=$langs->trans("NotYetAvailable");
}
$moreparam=array();
if (! empty($modecompta)) $moreparam['modecompta']=$modecompta;
report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,$moreparam,$calcmode);
report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,$moreparam,$calcmode);
if (! empty($conf->accounting->enabled))
if (! empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING')
{
print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
}
@@ -252,7 +302,7 @@ for ($mois = 1+$nb_mois_decalage ; $mois <= 12+$nb_mois_decalage ; $mois++)
{
$mois_modulo = $mois;// ajout
if($mois>12){$mois_modulo = $mois-12;} // ajout
print '<tr class="oddeven">';
print "<td>".dol_print_date(dol_mktime(12,0,0,$mois_modulo,1,2000),"%B")."</td>";
@@ -342,7 +392,7 @@ for ($mois = 1+$nb_mois_decalage ; $mois <= 12+$nb_mois_decalage ; $mois++)
/*
for ($mois = 1 ; $mois < 13 ; $mois++)
{
print '<tr class="oddeven">';
print "<td>".dol_print_date(dol_mktime(12,0,0,$mois,1,2000),"%B")."</td>";
@@ -510,7 +560,7 @@ print '</div>';
$totalam_Rac += $obj->am;
$i++;
}
print "<tr ".$bc[$var]."><td align=\"right\" colspan=\"5\"><i>Facture a encaisser : </i></td><td align=\"right\"><i>".price($total_ttc_Rac)."</i></td><td colspan=\"5\"><-- bug ici car n'exclut pas le deja r?gl? des factures partiellement r?gl?es</td></tr>";
}
$db->free($resql);
@@ -560,7 +610,7 @@ print '</div>';
$total_pr += $obj->total_ttc-$obj->tot_fttc;
$i++;
}
print "<tr ".$bc[$var]."><td align=\"right\" colspan=\"5\"><i>Signe et non facture:</i></td><td align=\"right\"><i>".price($total_pr)."</i></td><td colspan=\"5\"><-- bug ici, ca devrait exclure le deja facture</td></tr>";
}
$db->free($resql);

View File

@@ -220,7 +220,7 @@ if ($modetax==0) { // Invoice for goods, payment for services
$vatsup.=' ('.$langs->trans("ToGetBack").')';
}
}
report_header($name,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode);
report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode);
$vatcust=$langs->trans("VATReceived");
$vatsup=$langs->trans("VATPaid");
@@ -260,7 +260,7 @@ if (is_array($coll_list)) {
$i = 1;
foreach ($coll_list as $coll) {
if ($min == 0 or ($min > 0 && $coll->amount > $min)) {
$intra = str_replace($find,$replace,$coll->tva_intra);
if(empty($intra)) {
if($coll->assuj == '1') {
@@ -340,7 +340,7 @@ if (is_array($coll_list)) {
$i = 1;
foreach ($coll_list as $coll) {
if ($min == 0 or ($min > 0 && $coll->amount > $min)) {
$intra = str_replace($find,$replace,$coll->tva_intra);
if (empty($intra)) {
if ($coll->assuj == '1') {

View File

@@ -133,7 +133,7 @@ $fsearch.=' <input type="hidden" name="modetax" value="'.$modetax.'">';
// Affiche en-tete du rapport
if ($modetax==1) // Calculate on invoice for goods and services
{
$nom=$langs->trans("VATReportByQuartersInDueDebtMode");
$name=$langs->trans("VATReportByQuartersInDueDebtMode");
$calcmode=$langs->trans("CalcModeVATDebt");
$calcmode.='<br>('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')';
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
@@ -172,7 +172,7 @@ if ($modetax==1) // Calculate on invoice for goods and services
}
if ($modetax==0) // Invoice for goods, payment for services
{
$nom=$langs->trans("VATReportByQuartersInInputOutputMode");
$name=$langs->trans("VATReportByQuartersInInputOutputMode");
$calcmode=$langs->trans("CalcModeVATEngagement");
$calcmode.='<br>('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')';
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
@@ -210,7 +210,7 @@ if ($modetax==0) // Invoice for goods, payment for services
if ($mysoc->tva_assuj) $vatsup.=' ('.$langs->trans("ToGetBack").')';
}
report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode);
report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode);
$vatcust=$langs->trans("VATReceived");
$vatsup=$langs->trans("VATPaid");
@@ -396,7 +396,7 @@ else
if (! empty($fields['ddate_start'])) $type=1;
if (! empty($fields['ddate_end'])) $type=1;
print '<tr class="oddeven">';
// Ref
@@ -553,7 +553,7 @@ else
if (! empty($fields['ddate_start'])) $type=1;
if (! empty($fields['ddate_end'])) $type=1;
print '<tr class="oddeven">';
// Ref

View File

@@ -146,7 +146,7 @@ $fsearch.=' <input type="hidden" name="modetax" value="'.$modetax.'">';
// Affiche en-tete du rapport
if ($modetax==1) { // Calculate on invoice for goods and services
$nom=$langs->trans("VATReportByQuartersInDueDebtMode");
$name=$langs->trans("VATReportByQuartersInDueDebtMode");
$calcmode=$langs->trans("CalcModeVATDebt");
$calcmode.='<br>('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')';
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
@@ -195,7 +195,7 @@ if ($modetax==1) { // Calculate on invoice for goods and services
}
}
if ($modetax==0) { // Invoice for goods, payment for services
$nom=$langs->trans("VATReportByQuartersInInputOutputMode");
$name=$langs->trans("VATReportByQuartersInInputOutputMode");
$calcmode=$langs->trans("CalcModeVATEngagement");
$calcmode.='<br>('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')';
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
@@ -244,7 +244,7 @@ if ($modetax==0) { // Invoice for goods, payment for services
$vatsup.=' ('.$langs->trans("ToGetBack").')';
}
}
report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode);
report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode);
$vatcust=$langs->trans("VATReceived");
$vatsup=$langs->trans("VATPaid");
@@ -373,18 +373,18 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
print '<td align="right">'.$langs->trans("AmountHTVATRealReceived").'</td>';
print '<td align="right">'.$vatcust.'</td>';
print '</tr>';
$action = "tvadetail";
$parameters["mode"] = $modetax;
$parameters["start"] = $date_start;
$parameters["end"] = $date_end;
$parameters["type"] = 'vat';
$object = array(&$x_coll, &$x_paye, &$x_both);
// Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('externalbalance'));
$reshook=$hookmanager->executeHooks('addVatLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
foreach (array_keys($x_coll) as $rate) {
$subtot_coll_total_ht = 0;
$subtot_coll_vat = 0;
@@ -408,7 +408,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
$type=1;
}
print '<tr class="oddeven">';
// Ref
@@ -576,7 +576,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
$type=1;
}
print '<tr class="oddeven">';
// Ref

View File

@@ -628,9 +628,10 @@ class Form
* @param string $htmloption Options html on select object
* @param integer $maxlength Max length for labels (0=no limit)
* @param string $morecss More css class
* @param string $usecodeaskey 'code3'=Use code on 3 alpha as key, 'code2"=Use code on 2 alpha as key
* @return string HTML string with select
*/
function select_country($selected='',$htmlname='country_id',$htmloption='',$maxlength=0,$morecss='minwidth300')
function select_country($selected='',$htmlname='country_id',$htmloption='',$maxlength=0,$morecss='minwidth300',$usecodeaskey='')
{
global $conf,$langs;
@@ -684,11 +685,11 @@ class Form
if ($selected && $selected != '-1' && ($selected == $row['rowid'] || $selected == $row['code_iso'] || $selected == $row['code_iso3'] || $selected == $row['label']) )
{
$foundselected=true;
$out.= '<option value="'.$row['rowid'].'" selected>';
$out.= '<option value="'.($usecodeaskey?($usecodeaskey=='code2'?$row['code_iso']:$row['code_iso3']):$row['rowid']).'" selected>';
}
else
{
$out.= '<option value="'.$row['rowid'].'">';
$out.= '<option value="'.($usecodeaskey?($usecodeaskey=='code2'?$row['code_iso']:$row['code_iso3']):$row['rowid']).'">';
}
$out.= dol_trunc($row['label'],$maxlength,'middle');
if ($row['code_iso']) $out.= ' ('.$row['code_iso'] . ')';

View File

@@ -304,7 +304,7 @@ class FormActions
}
else
{
$out.=$form->selectarray($htmlname, $arraylist, $selected);
$out.=$form->selectarray($htmlname, $arraylist, $selected, 0, 0, 0, '', 0, 0, 0, '', '', 1);
}
if ($user->admin && empty($onlyautoornot) && $hideinfohelp <= 0)

View File

@@ -3284,32 +3284,34 @@ function dol_print_error_email($prefixcode, $errormessage='')
* @param string $sortfield Current field used to sort
* @param string $sortorder Current sort order
* @param string $prefix Prefix for css. Use space after prefix to add your own CSS tag.
* @param string $tooltip Tooltip
* @return void
*/
function print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $td="", $sortfield="", $sortorder="", $prefix="")
function print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $td="", $sortfield="", $sortorder="", $prefix="", $tooltip="")
{
print getTitleFieldOfList($name, 0, $file, $field, $begin, $moreparam, $td, $sortfield, $sortorder, $prefix);
print getTitleFieldOfList($name, 0, $file, $field, $begin, $moreparam, $td, $sortfield, $sortorder, $prefix, 0, $tooltip);
}
/**
* Get title line of an array
*
* @param string $name Translation key of field
* @param int $thead 0=To use with standard table format, 1=To use inside <thead><tr>, 2=To use with <div>
* @param string $file Url used when we click on sort picto
* @param string $field Field to use for new sorting. Empty if this field is not sortable.
* @param string $begin ("" by defaut)
* @param string $moreparam Add more parameters on sort url links ("" by default)
* @param string $moreattrib Add more attributes on th ("" by defaut). To add more css class, use param $prefix.
* @param string $sortfield Current field used to sort (Ex: 'd.datep,d.id')
* @param string $sortorder Current sort order (Ex: 'asc,desc')
* @param string $prefix Prefix for css. Use space after prefix to add your own CSS tag.
* @param string $name Translation key of field
* @param int $thead 0=To use with standard table format, 1=To use inside <thead><tr>, 2=To use with <div>
* @param string $file Url used when we click on sort picto
* @param string $field Field to use for new sorting. Empty if this field is not sortable.
* @param string $begin ("" by defaut)
* @param string $moreparam Add more parameters on sort url links ("" by default)
* @param string $moreattrib Add more attributes on th ("" by defaut). To add more css class, use param $prefix.
* @param string $sortfield Current field used to sort (Ex: 'd.datep,d.id')
* @param string $sortorder Current sort order (Ex: 'asc,desc')
* @param string $prefix Prefix for css. Use space after prefix to add your own CSS tag.
* @param string $disablesortlink 1=Disable sort link
* @param string $tooltip Tooltip
* @return string
*/
function getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0)
function getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='')
{
global $conf, $langs;
global $conf, $langs, $form;
//print "$name, $file, $field, $begin, $options, $moreattrib, $sortfield, $sortorder<br>\n";
$sortorder=strtoupper($sortorder);
@@ -3350,7 +3352,8 @@ function getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $m
}
}
$out.=$langs->trans($name);
if ($tooltip) $out.=$form->textwithpicto($langs->trans($name), $langs->trans($tooltip));
else $out.=$langs->trans($name);
if (empty($thead) && $field && empty($disablesortlink)) // If this is a sort field
{

View File

@@ -35,7 +35,7 @@
* @param string $exportlink Link for export or ''
* @param array $moreparam Array with list of params to add into form
* @param string $calcmode Calculation mode
* @param string $varlink Add a variable into the address of the page
* @param string $varlink Add a variable into the address of the page
* @return void
*/
function report_header($nom,$variante,$period,$periodlink,$description,$builddate,$exportlink='',$moreparam=array(),$calcmode='', $varlink='')
@@ -43,9 +43,9 @@ function report_header($nom,$variante,$period,$periodlink,$description,$builddat
global $langs;
if (empty($hselected)) $hselected='report';
print "\n\n<!-- debut cartouche rapport -->\n";
if(! empty($varlink)) $varlink = '?'.$varlink;
$h=0;
@@ -116,7 +116,7 @@ function report_header($nom,$variante,$period,$periodlink,$description,$builddat
print '</form>';
dol_fiche_end();
print "\n<!-- fin cartouche rapport -->\n\n";
}

View File

@@ -249,10 +249,10 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
-- Balance
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2435__+MAX_llx_menu__, 'accountancy', 'balance', 2400__+MAX_llx_menu__, '/accountancy/bookkeeping/balance.php?mainmenu=accountancy&leftmenu=accountancy_balance', 'AccountBalance', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 16, __ENTITY__);
-- Reports
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2440__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2400__+MAX_llx_menu__, '/accountancy/report/result.php?mainmenu=accountancy&leftmenu=accountancy_report', 'Reportings', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 17, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_report"', __HANDLER__, 'left', 2441__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2440__+MAX_llx_menu__, '/compta/resultat/index.php?mainmenu=accountancy&leftmenu=accountancy_report', 'ReportInOut', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 19, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_report"', __HANDLER__, 'left', 2442__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2441__+MAX_llx_menu__, '/accountancy/report/result.php?mainmenu=accountancy&leftmenu=accountancy_report', 'ByAccounts', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 18, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_report"', __HANDLER__, 'left', 2443__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2441__+MAX_llx_menu__, '/compta/resultat/clientfourn.php?mainmenu=accountancy&leftmenu=accountancy_report', 'ByCompanies', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 20, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2440__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2400__+MAX_llx_menu__, '/compta/resultat/index.php?mainmenu=accountancy&leftmenu=accountancy_report', 'Reportings', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 17, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_report"', __HANDLER__, 'left', 2441__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2440__+MAX_llx_menu__, '/compta/resultat/index.php?mainmenu=accountancy&leftmenu=accountancy_report', 'ReportInOut', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 18, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_report"', __HANDLER__, 'left', 2443__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2441__+MAX_llx_menu__, '/compta/resultat/clientfourn.php?mainmenu=accountancy&leftmenu=accountancy_report', 'ByPredefinedAccountGroups', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 19, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_report"', __HANDLER__, 'left', 2442__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2441__+MAX_llx_menu__, '/compta/resultat/result.php?mainmenu=accountancy&leftmenu=accountancy_report', 'ByPersonalizedAccountGroups', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 20, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_report"', __HANDLER__, 'left', 2444__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2440__+MAX_llx_menu__, '/compta/stats/index.php?mainmenu=accountancy&leftmenu=accountancy_report', 'ReportTurnover', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 21, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_report"', __HANDLER__, 'left', 2445__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2444__+MAX_llx_menu__, '/compta/stats/casoc.php?mainmenu=accountancy&leftmenu=accountancy_report', 'ByCompanies', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 22, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_report"', __HANDLER__, 'left', 2446__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2444__+MAX_llx_menu__, '/compta/stats/cabyuser.php?mainmenu=accountancy&leftmenu=accountancy_report', 'ByUsers', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 23, __ENTITY__);

View File

@@ -1118,11 +1118,11 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
// Reports
$langs->load("compta");
$newmenu->add("/accountancy/report/result.php?mainmenu=accountancy&amp;leftmenu=accountancy_report",$langs->trans("Reportings"),1,$user->rights->accounting->comptarapport->lire, '', $mainmenu, 'ca');
$newmenu->add("/compta/resultat/index.php?mainmenu=accountancy&amp;leftmenu=accountancy_report",$langs->trans("Reportings"),1,$user->rights->accounting->comptarapport->lire, '', $mainmenu, 'ca');
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/resultat/index.php?leftmenu=accountancy_report",$langs->trans("ReportInOut"),2,$user->rights->accounting->comptarapport->lire);
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/accountancy/report/result.php?leftmenu=accountancy_report",$langs->trans("ByAccounts"),3,$user->rights->accounting->comptarapport->lire);
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/resultat/clientfourn.php?leftmenu=accountancy_report",$langs->trans("ByCompanies"),3,$user->rights->accounting->comptarapport->lire);
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/resultat/clientfourn.php?leftmenu=accountancy_report",$langs->trans("ByPredefinedAccountGroups"),3,$user->rights->accounting->comptarapport->lire);
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/resultat/result.php?leftmenu=accountancy_report",$langs->trans("ByPersonalizedAccountGroups"),3,$user->rights->accounting->comptarapport->lire);
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report",$langs->trans("ReportTurnover"),2,$user->rights->accounting->comptarapport->lire);
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report",$langs->trans("ByCompanies"),3,$user->rights->accounting->comptarapport->lire);
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report",$langs->trans("ByUsers"),3,$user->rights->accounting->comptarapport->lire);

File diff suppressed because it is too large Load Diff

View File

@@ -24,6 +24,6 @@
-- Categories compte de résultat Français
--
INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 1,'VTE', 'Ventes de marchandises', '707xxx', 0, 0, '', '10', 1, 1);
INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 2,'MAR', 'Coût achats marchandises vendues', '603xxx | 607xxx | 609xxx', 0, 0, '', '20', 1, 1);
INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 3,'MARGE','Marge commerciale', '', 0, 1, '1 + 2', '30', 1, 1);
INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 1, 'VTE', 'Ventes de marchandises', '707xxx', 0, 0, '', '10', 1, 1);
INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 2, 'MAR', 'Coût achats marchandises vendues', '603xxx | 607xxx | 609xxx', 0, 0, '', '20', 1, 1);
INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 3, 'MARGE', 'Marge commerciale', '', 0, 1, '1 + 2', '30', 1, 1);

View File

@@ -203,3 +203,30 @@ ALTER TABLE llx_holiday_config ADD UNIQUE INDEX idx_holiday_config (name);
ALTER TABLE llx_payment_various ADD COLUMN fk_projet integer DEFAULT NULL after accountancy_code;
UPDATE llx_const set name = 'ONLINE_PAYMENT_MESSAGE_OK' where name = 'PAYPAL_MESSAGE_OK';
UPDATE llx_const set name = 'ONLINE_PAYMENT_MESSAGE_KO' where name = 'PAYPAL_MESSAGE_KO';
UPDATE llx_const set name = 'ONLINE_PAYMENT_CREDITOR' where name = 'PAYPAL_CREDITOR';
UPDATE llx_const set name = 'ONLINE_PAYMENT_CSS_URL' where name = 'PAYPAL_CSS_URL';
UPDATE llx_const set name = 'ONLINE_PAYMENT_NEWFORMTEXT' where name = 'PAYPAL_NEWFORMTEXT';
UPDATE llx_const set name = 'ONLINE_PAYMENT_LOGO' where name = 'PAYPAL_LOGO';
UPDATE llx_accounting_account SET pcg_type = 'INCOME' where pcg_type = 'PROD';
UPDATE llx_accounting_account SET pcg_type = 'EXPENSE' where pcg_type = 'CHARGE';
UPDATE llx_accounting_account SET pcg_type = 'INCOME' where pcg_type = 'VENTAS_E_INGRESOS';
UPDATE llx_accounting_account SET pcg_type = 'EXPENSE' where pcg_type = 'COMPRAS_GASTOS';
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_accounting_account MODIFY account_number VARCHAR(20) CHARACTER SET utf8;
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_accounting_account MODIFY account_number VARCHAR(20) COLLATE utf8_unicode_ci;
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_accounting_bookkeeping MODIFY numero_compte VARCHAR(20) CHARACTER SET utf8;
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_accounting_bookkeeping MODIFY numero_compte VARCHAR(20) COLLATE utf8_unicode_ci;
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_stock_mouvement MODIFY batch VARCHAR(30) CHARACTER SET utf8;
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_stock_mouvement MODIFY batch VARCHAR(30) COLLATE utf8_unicode_ci;
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_product_lot MODIFY batch VARCHAR(30) CHARACTER SET utf8;
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_product_lot MODIFY batch VARCHAR(30) COLLATE utf8_unicode_ci;
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_product_batch MODIFY batch VARCHAR(30) CHARACTER SET utf8;
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_product_batch MODIFY batch VARCHAR(30) COLLATE utf8_unicode_ci;
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_product MODIFY accountancy_code_sell VARCHAR(32) CHARACTER SET utf8;
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_product MODIFY accountancy_code_sell VARCHAR(32) COLLATE utf8_unicode_ci;
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_product MODIFY accountancy_code_buy VARCHAR(32) CHARACTER SET utf8;
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_product MODIFY accountancy_code_buy VARCHAR(32) COLLATE utf8_unicode_ci;

View File

@@ -31,6 +31,10 @@ ConfirmDeleteCptCategory=Are you sure you want to remove this accounting account
JournalizationInLedgerStatus=Status of journalization
AlreadyInGeneralLedger=Already journalized in ledgers
NotYetInGeneralLedger=Not yet journalized in ledgers
PreviousYear=Previous year
SelectedPeriod=Selected period
GroupIsEmptyCheckSetup=Group is empty, check setup of the accounting group
DetailByAccount=Show detail by account
MainAccountForCustomersNotDefined=Main accounting account for customers not defined in setup
MainAccountForSuppliersNotDefined=Main accounting account for suppliers not defined in setup
@@ -150,7 +154,10 @@ NumPiece=Piece number
TransactionNumShort=Num. transaction
AccountingCategory=Accounting account groups
GroupByAccountAccounting=Group by accounting account
AccountingAccountGroupsDesc=You can define here some groups of accounting account. It will be used in the report <b>%s</b> to show your income/expense with data grouped according to your groups.
ByAccounts=By accounts
ByPredefinedAccountGroups=By predefined groups
ByPersonalizedAccountGroups=By personalized groups
NotMatch=Not Set
DeleteMvt=Delete Ledger lines
DelYear=Year to delete
@@ -180,8 +187,9 @@ ListAccounts=List of the accounting accounts
UnknownAccountForThirdparty=Unknown third party account. We will use %s
UnknownAccountForThirdpartyBlocking=Unknown third party account. Blocking error
Pcgtype=Class of account
Pcgsubtype=Subclass of account
Pcgtype=Group of account
Pcgsubtype=Subgroup of account
PcgtypeDesc=Group and subgroup of account are used as predefined 'filter' and 'grouping' criterias for some accounting reports. For example, 'INCOME' or 'EXPENSE' are used as group for accounting account products to build the expense/income report.
TotalVente=Total turnover before tax
TotalMarge=Total sales margin

View File

@@ -134,6 +134,7 @@ CalcModeVATDebt=Mode <b>%sVAT on commitment accounting%s</b>.
CalcModeVATEngagement=Mode <b>%sVAT on incomes-expenses%s</b>.
CalcModeDebt=Mode <b>%sClaims-Debts%s</b> said <b>Commitment accounting</b>.
CalcModeEngagement=Mode <b>%sIncomes-Expenses%s</b> said <b>cash accounting</b>
CalcModeBookkeeping=Analysis of <b>data journalized in Bookkeeping Ledger table</b>
CalcModeLT1= Mode <b>%sRE on customer invoices - suppliers invoices%s</b>
CalcModeLT1Debt=Mode <b>%sRE on customer invoices%s</b>
CalcModeLT1Rec= Mode <b>%sRE on suppliers invoices%s</b>
@@ -142,15 +143,20 @@ CalcModeLT2Debt=Mode <b>%sIRPF on customer invoices%s</b>
CalcModeLT2Rec= Mode <b>%sIRPF on suppliers invoices%s</b>
AnnualSummaryDueDebtMode=Balance of income and expenses, annual summary
AnnualSummaryInputOutputMode=Balance of income and expenses, annual summary
AnnualByCompaniesDueDebtMode=Balance of income and expenses, detail by third parties, mode <b>%sClaims-Debts%s</b> said <b>Commitment accounting</b>.
AnnualByCompaniesInputOutputMode=Balance of income and expenses, detail by third parties, mode <b>%sIncomes-Expenses%s</b> said <b>cash accounting</b>.
AnnualByCompanies=Income / Expenses, By predefined groups of account
AnnualByCompaniesDueDebtMode=Balance of income and expenses, detail by predefined groups, mode <b>%sClaims-Debts%s</b> said <b>Commitment accounting</b>.
AnnualByCompaniesInputOutputMode=Balance of income and expenses, detail by predefined groups, mode <b>%sIncomes-Expenses%s</b> said <b>cash accounting</b>.
SeeReportInInputOutputMode=See report <b>%sIncomes-Expenses%s</b> said <b>cash accounting</b> for a calculation on actual payments made
SeeReportInDueDebtMode=See report <b>%sClaims-Debts%s</b> said <b>commitment accounting</b> for a calculation on issued invoices
SeeReportInBookkeepingMode=See report <b>%sBookeeping%s</b> for a calculation on bookkeeping table analysis
RulesAmountWithTaxIncluded=- Amounts shown are with all taxes included
RulesResultDue=- It includes outstanding invoices, expenses, VAT, donations whether they are paid or not. Is also includes paid salaries.<br>- It is based on the validation date of invoices and VAT and on the due date for expenses. For salaries defined with Salary module, the value date of payment is used.
RulesResultInOut=- It includes the real payments made on invoices, expenses, VAT and salaries. <br>- It is based on the payment dates of the invoices, expenses, VAT and salaries. The donation date for donation.
RulesCADue=- It includes the client's due invoices whether they are paid or not. <br>- It is based on the validation date of these invoices.<br>
RulesCAIn=- It includes all the effective payments of invoices received from clients.<br>- It is based on the payment date of these invoices<br>
RulesAmountOnInOutBookkeepingRecord=It includes record in your Ledger with accounting accounts that has the group "EXPENSE" or "INCOME" (See <b>%s</b>)
RulesResultBookkeepingPredefined=It includes record in your Ledger with accounting accounts that has the group "EXPENSE" or "INCOME" (See <b>%s</b>)
RulesResultBookkeepingPersonalized=It show record in your Ledger with accounting accounts <b>grouped by personalized groups</b> (See menu <b>%s</b> to define accounting account groups)
DepositsAreNotIncluded=- Down payment invoices are nor included
DepositsAreIncluded=- Down payment invoices are included
LT2ReportByCustomersInInputOutputModeES=Report by third party IRPF
@@ -225,3 +231,4 @@ ImportDataset_tax_vat=Vat payments
ErrorBankAccountNotFound=Error: Bank account not found
FiscalPeriod=Accounting period
ListSocialContributionAssociatedProject=List of social contributions associated with the project
DeleteFromCat=Remove from accounting group

View File

@@ -10,7 +10,7 @@ ToComplete=To complete
YourEMail=Email to receive payment confirmation
Creditor=Creditor
PaymentCode=Payment code
PayBoxDoPayment=Go on payment
PayBoxDoPayment=Pay with Credit or Debit Card (Paybox)
ToPay=Do payment
YouWillBeRedirectedOnPayBox=You will be redirected on secured Paybox page to input you credit card information
Continue=Next

View File

@@ -1,7 +1,7 @@
# Dolibarr language file - Source file is en_US - paypal
PaypalSetup=PayPal module setup
PaypalDesc=This module offer pages to allow payment on <a href="http://www.paypal.com" target="_blank">PayPal</a> by customers. This can be used for a free payment or for a payment on a particular Dolibarr object (invoice, order, ...)
PaypalOrCBDoPayment=Pay with credit card or Paypal
PaypalOrCBDoPayment=Pay with Paypal (Credit Card or Paypal)
PaypalDoPayment=Pay with Paypal
PAYPAL_API_SANDBOX=Mode test/sandbox
PAYPAL_API_USER=API username
@@ -11,14 +11,14 @@ PAYPAL_SSLVERSION=Curl SSL Version
PAYPAL_API_INTEGRAL_OR_PAYPALONLY=Offer payment "integral" (Credit card+Paypal) or "Paypal" only
PaypalModeIntegral=Integral
PaypalModeOnlyPaypal=PayPal only
PAYPAL_CSS_URL=Optionnal URL of CSS style sheet on payment page
ONLINE_PAYMENT_CSS_URL=Optionnal URL of CSS style sheet on online payment page
ThisIsTransactionId=This is id of transaction: <b>%s</b>
PAYPAL_ADD_PAYMENT_URL=Add the url of Paypal payment when you send a document by mail
PredefinedMailContentLink=You can click on the secure link below to make your payment (PayPal) if it is not already done.\n\n%s\n\n
YouAreCurrentlyInSandboxMode=You are currently in the "sandbox" mode
YouAreCurrentlyInSandboxMode=You are currently in the %s "sandbox" mode
NewOnlinePaymentReceived=New online payment received
NewOnlinePaymentFailed=New online payment tried but failed
PAYPAL_PAYONLINE_SENDEMAIL=EMail to warn after a payment (success or not)
ONLINE_PAYMENT_SENDEMAIL=EMail to warn after a payment (success or not)
ReturnURLAfterPayment=Return URL after payment
ValidationOfOnlinePaymentFailed=Validation of online payment failed
PaymentSystemConfirmPaymentPageWasCalledButFailed=Payment confirmation page was called by payment system returned an error

View File

@@ -12,7 +12,7 @@ YourEMail=Email to receive payment confirmation
STRIPE_PAYONLINE_SENDEMAIL=EMail to warn after a payment (success or not)
Creditor=Creditor
PaymentCode=Payment code
StripeDoPayment=Go on payment
StripeDoPayment=Pay with Credit or Debit Card (Stripe)
YouWillBeRedirectedOnStripe=You will be redirected on secured Stripe page to input you credit card information
Continue=Next
ToOfferALinkForOnlinePayment=URL for %s payment

View File

@@ -69,6 +69,7 @@ class MyObject extends CommonObject
* 'position' is the sort order of field.
* 'searchall' is 1 if we want to search in this field when making a search from the quick search button.
* 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8).
* 'help' is a string visible as a tooltip on field
* 'comment' is not used. You can store here any text of your choice.
*/
@@ -81,7 +82,7 @@ class MyObject extends CommonObject
'ref' =>array('type'=>'varchar(64)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'),
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'index'=>1, 'position'=>20),
'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1),
'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'searchall'=>0, 'isameasure'=>1),
'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Amount'),
'status' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'index'=>1, 'position'=>1000),
'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500),
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500),

View File

@@ -35,7 +35,7 @@ $langs->load("paybox");
if (!$user->admin)
accessforbidden();
$action = GETPOST('action','alpha');
@@ -53,17 +53,17 @@ if ($action == 'setvalue' && $user->admin)
if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "PAYBOX_PBX_IDENTIFIANT",GETPOST('PAYBOX_PBX_IDENTIFIANT','alpha'),'chaine',0,'',$conf->entity);
if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "PAYBOX_CREDITOR",GETPOST('PAYBOX_CREDITOR','alpha'),'chaine',0,'',$conf->entity);
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_CREDITOR",GETPOST('ONLINE_PAYMENT_CREDITOR','alpha'),'chaine',0,'',$conf->entity);
if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "PAYBOX_CSS_URL",GETPOST('PAYBOX_CSS_URL','alpha'),'chaine',0,'',$conf->entity);
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_CSS_URL",GETPOST('ONLINE_PAYMENT_CSS_URL','alpha'),'chaine',0,'',$conf->entity);
if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "PAYBOX_MESSAGE_OK",GETPOST('PAYBOX_MESSAGE_OK','alpha'),'chaine',0,'',$conf->entity);
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_OK",GETPOST('ONLINE_PAYMENT_OK','alpha'),'chaine',0,'',$conf->entity);
if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "PAYBOX_MESSAGE_KO",GETPOST('PAYBOX_MESSAGE_KO','alpha'),'chaine',0,'',$conf->entity);
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_KO",GETPOST('ONLINE_PAYMENT_KO','alpha'),'chaine',0,'',$conf->entity);
if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "PAYBOX_PAYONLINE_SENDEMAIL",GETPOST('PAYBOX_PAYONLINE_SENDEMAIL'),'chaine',0,'',$conf->entity);
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_SENDEMAIL",GETPOST('ONLINE_PAYMENT_SENDEMAIL'),'chaine',0,'',$conf->entity);
if (! $result > 0) $error++;
if (! $error)
{
$db->commit();
@@ -170,35 +170,35 @@ print '</td></tr>';
print '<tr class="oddeven"><td>';
print $langs->trans("VendorName").'</td><td>';
print '<input size="64" type="text" name="PAYBOX_CREDITOR" value="'.$conf->global->PAYBOX_CREDITOR.'">';
print '<input size="64" type="text" name="ONLINE_PAYMENT_CREDITOR" value="'.$conf->global->ONLINE_PAYMENT_CREDITOR.'">';
print '<br>'.$langs->trans("Example").': '.$mysoc->name;
print '</td></tr>';
print '<tr class="oddeven"><td>';
print $langs->trans("CSSUrlForPaymentForm").'</td><td>';
print '<input size="64" type="text" name="PAYBOX_CSS_URL" value="'.$conf->global->PAYBOX_CSS_URL.'">';
print '<input size="64" type="text" name="ONLINE_PAYMENT_CSS_URL" value="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'">';
print '<br>'.$langs->trans("Example").': http://mysite/mycss.css';
print '</td></tr>';
print '<tr class="oddeven"><td>';
print $langs->trans("MessageOK").'</td><td>';
$doleditor=new DolEditor('PAYBOX_MESSAGE_OK',$conf->global->PAYBOX_MESSAGE_OK,'',100,'dolibarr_details','In',false,true,true,ROWS_2,'90%');
$doleditor=new DolEditor('ONLINE_PAYMENT_MESSAGE_OK',$conf->global->ONLINE_PAYMENT_MESSAGE_OK,'',100,'dolibarr_details','In',false,true,true,ROWS_2,'90%');
$doleditor->Create();
print '</td></tr>';
print '<tr class="oddeven"><td>';
print $langs->trans("MessageKO").'</td><td>';
$doleditor=new DolEditor('PAYBOX_MESSAGE_KO',$conf->global->PAYBOX_MESSAGE_KO,'',100,'dolibarr_details','In',false,true,true,ROWS_2,'90%');
$doleditor=new DolEditor('ONLINE_PAYMENT_MESSAGE_KO',$conf->global->ONLINE_PAYMENT_MESSAGE_KO,'',100,'dolibarr_details','In',false,true,true,ROWS_2,'90%');
$doleditor->Create();
print '</td></tr>';
print '<tr class="oddeven"><td>';
print $langs->trans("PAYBOX_PAYONLINE_SENDEMAIL").'</td><td>';
print '<input size="32" type="email" name="PAYBOX_PAYONLINE_SENDEMAIL" value="'.$conf->global->PAYBOX_PAYONLINE_SENDEMAIL.'">';
print $langs->trans("ONLINE_PAYMENT_SENDEMAIL").'</td><td>';
print '<input size="32" type="email" name="ONLINE_PAYMENT_SENDEMAIL" value="'.$conf->global->ONLINE_PAYMENT_SENDEMAIL.'">';
print ' &nbsp; '.$langs->trans("Example").': myemail@myserver.com';
print '</td></tr>';

View File

@@ -43,7 +43,7 @@ $action = GETPOST('action','alpha');
if ($action == 'setvalue' && $user->admin)
{
$db->begin();
$result=dolibarr_set_const($db, "PAYPAL_API_USER",GETPOST('PAYPAL_API_USER','alpha'),'chaine',0,'',$conf->entity);
if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "PAYPAL_API_PASSWORD",GETPOST('PAYPAL_API_PASSWORD','alpha'),'chaine',0,'',$conf->entity);
@@ -52,11 +52,11 @@ if ($action == 'setvalue' && $user->admin)
if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "PAYPAL_SSLVERSION",GETPOST('PAYPAL_SSLVERSION','alpha'),'chaine',0,'',$conf->entity);
if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "PAYPAL_CREDITOR",GETPOST('PAYPAL_CREDITOR','alpha'),'chaine',0,'',$conf->entity);
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_CREDITOR",GETPOST('ONLINE_PAYMENT_CREDITOR','alpha'),'chaine',0,'',$conf->entity);
if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "PAYPAL_API_INTEGRAL_OR_PAYPALONLY",GETPOST('PAYPAL_API_INTEGRAL_OR_PAYPALONLY','alpha'),'chaine',0,'',$conf->entity);
if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "PAYPAL_CSS_URL",GETPOST('PAYPAL_CSS_URL','alpha'),'chaine',0,'',$conf->entity);
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_CSS_URL",GETPOST('ONLINE_PAYMENT_CSS_URL','alpha'),'chaine',0,'',$conf->entity);
if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "PAYPAL_SECURITY_TOKEN",GETPOST('PAYPAL_SECURITY_TOKEN','alpha'),'chaine',0,'',$conf->entity);
if (! $result > 0) $error++;
@@ -64,13 +64,13 @@ if ($action == 'setvalue' && $user->admin)
if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "PAYPAL_ADD_PAYMENT_URL",GETPOST('PAYPAL_ADD_PAYMENT_URL','alpha'),'chaine',0,'',$conf->entity);
if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "PAYPAL_MESSAGE_OK",GETPOST('PAYPAL_MESSAGE_OK'),'chaine',0,'',$conf->entity);
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_OK",GETPOST('ONLINE_PAYMENT_MESSAGE_OK'),'chaine',0,'',$conf->entity);
if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "PAYPAL_MESSAGE_KO",GETPOST('PAYPAL_MESSAGE_KO'),'chaine',0,'',$conf->entity);
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_KO",GETPOST('ONLINE_PAYMENT_MESSAGE_KO'),'chaine',0,'',$conf->entity);
if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "PAYPAL_PAYONLINE_SENDEMAIL",GETPOST('PAYPAL_PAYONLINE_SENDEMAIL'),'chaine',0,'',$conf->entity);
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_SENDEMAIL",GETPOST('ONLINE_PAYMENT_SENDEMAIL'),'chaine',0,'',$conf->entity);
if (! $result > 0) $error++;
if (! $error)
{
$db->commit();
@@ -202,14 +202,14 @@ print '</td></tr>';
print '<tr class="oddeven"><td>';
print $langs->trans("VendorName").'</td><td>';
print '<input size="64" type="text" name="PAYPAL_CREDITOR" value="'.$conf->global->PAYPAL_CREDITOR.'">';
print '<input size="64" type="text" name="ONLINE_PAYMENT_CREDITOR" value="'.$conf->global->ONLINE_PAYMENT_CREDITOR.'">';
print ' &nbsp; '.$langs->trans("Example").': '.$mysoc->name;
print '</td></tr>';
print '<tr class="oddeven"><td>';
print $langs->trans("CSSUrlForPaymentForm").'</td><td>';
print '<input size="64" type="text" name="PAYPAL_CSS_URL" value="'.$conf->global->PAYPAL_CSS_URL.'">';
print '<input size="64" type="text" name="ONLINE_PAYMENT_CSS_URL" value="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'">';
print ' &nbsp; '.$langs->trans("Example").': http://mysite/mycss.css';
print '</td></tr>';
@@ -222,21 +222,21 @@ print '</td></tr>';
print '<tr class="oddeven"><td>';
print $langs->trans("MessageOK").'</td><td>';
$doleditor=new DolEditor('PAYPAL_MESSAGE_OK',$conf->global->PAYPAL_MESSAGE_OK,'',100,'dolibarr_details','In',false,true,true,ROWS_4,'90%');
$doleditor=new DolEditor('ONLINE_PAYMENT_MESSAGE_OK',$conf->global->ONLINE_PAYMENT_MESSAGE_OK,'',100,'dolibarr_details','In',false,true,true,ROWS_4,'90%');
$doleditor->Create();
print '</td></tr>';
print '<tr class="oddeven"><td>';
print $langs->trans("MessageKO").'</td><td>';
$doleditor=new DolEditor('PAYPAL_MESSAGE_KO',$conf->global->PAYPAL_MESSAGE_KO,'',100,'dolibarr_details','In',false,true,true,ROWS_4,'90%');
$doleditor=new DolEditor('ONLINE_PAYMENT_MESSAGE_KO',$conf->global->ONLINE_PAYMENT_MESSAGE_KO,'',100,'dolibarr_details','In',false,true,true,ROWS_4,'90%');
$doleditor->Create();
print '</td></tr>';
print '<tr class="oddeven"><td>';
print $langs->trans("PAYPAL_PAYONLINE_SENDEMAIL").'</td><td>';
print '<input size="32" type="email" name="PAYPAL_PAYONLINE_SENDEMAIL" value="'.$conf->global->PAYPAL_PAYONLINE_SENDEMAIL.'">';
print $langs->trans("ONLINE_PAYMENT_SENDEMAIL").'</td><td>';
print '<input size="32" type="email" name="ONLINE_PAYMENT_SENDEMAIL" value="'.$conf->global->ONLINE_PAYMENT_SENDEMAIL.'">';
print ' &nbsp; '.$langs->trans("Example").': myemail@myserver.com';
print '</td></tr>';

View File

@@ -355,7 +355,7 @@ function callSetExpressCheckout($paymentAmount, $currencyCodeType, $paymentType,
if (! empty($desc)) $nvpstr = $nvpstr . "&DESC=" . urlencode($desc); // DESC deprecated by paypal -> PAYMENTREQUEST_n_DESC
$_SESSION["Payment_Amount"] = $paymentAmount;
$_SESSION["FinalPaymentAmt"] = $paymentAmount;
$_SESSION["currencyCodeType"] = $currencyCodeType;
$_SESSION["PaymentType"] = $paymentType;
$_SESSION['ipaddress'] = $_SERVER['REMOTE_ADDR ']; // Payer ip

View File

@@ -164,7 +164,7 @@ print '<!-- Form to sign -->'."\n";
print '<table id="dolpaymenttable" summary="Payment form" class="center">'."\n";
// Show logo (search order: logo defined by PAYBOX_LOGO_suffix, then PAYBOX_LOGO, then small company logo, large company logo, theme logo, common logo)
// Show logo (search order: logo defined by ONLINE_SIGN_LOGO_suffix, then ONLINE_SIGN_LOGO_, then small company logo, large company logo, theme logo, common logo)
$width=0;
// Define logo and logosmall
$logosmall=$mysoc->logo_small;

View File

@@ -162,7 +162,7 @@ if (GETPOST('action','aZ09') == 'dopayment')
*/
$head='';
if (! empty($conf->global->PAYBOX_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->PAYBOX_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
if (! empty($conf->global->ONLINE_PAYMENT_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
$conf->dol_hide_topmenu=1;
$conf->dol_hide_leftmenu=1;
@@ -171,9 +171,9 @@ llxHeader($head, $langs->trans("PaymentForm"), '', '', 0, 0, '', '', '', 'online
// Common variables
$creditor=$mysoc->name;
$paramcreditor='PAYBOX_CREDITOR_'.$suffix;
$paramcreditor='ONLINE_PAYMENT_CREDITOR_'.$suffix;
if (! empty($conf->global->$paramcreditor)) $creditor=$conf->global->$paramcreditor;
else if (! empty($conf->global->PAYBOX_CREDITOR)) $creditor=$conf->global->PAYBOX_CREDITOR;
else if (! empty($conf->global->ONLINE_PAYMENT_CREDITOR)) $creditor=$conf->global->ONLINE_PAYMENT_CREDITOR;
// Check link validity
if (! empty($SOURCE) && in_array($ref, array('member_ref', 'contractline_ref', 'invoice_ref', 'order_ref', '')))
@@ -194,7 +194,7 @@ print '<input type="hidden" name="tag" value="'.GETPOST("tag",'alpha').'">';
print '<input type="hidden" name="suffix" value="'.GETPOST("suffix",'alpha').'">';
print "\n";
print '<!-- Form to send a Paybox payment -->'."\n";
print '<!-- PAYBOX_CREDITOR = '.$conf->global->PAYPAL_CREDITOR.' -->'."\n";
print '<!-- ONLINE_PAYMENT_CREDITOR = '.$conf->global->ONLINE_PAYMENT_CREDITOR.' -->'."\n";
print '<!-- creditor = '.$creditor.' -->'."\n";
print '<!-- urlok = '.$urlok.' -->'."\n";
print '<!-- urlko = '.$urlko.' -->'."\n";
@@ -202,14 +202,14 @@ print "\n";
print '<table id="dolpaymenttable" summary="Payment form" class="center">'."\n";
// Show logo (search order: logo defined by PAYBOX_LOGO_suffix, then PAYBOX_LOGO, then small company logo, large company logo, theme logo, common logo)
// Show logo (search order: logo defined by PAYMENT_LOGO_suffix, then PAYMENT_LOGO, then small company logo, large company logo, theme logo, common logo)
$width=0;
// Define logo and logosmall
$logosmall=$mysoc->logo_small;
$logo=$mysoc->logo;
$paramlogo='PAYBOX_LOGO_'.$suffix;
$paramlogo='PAYMENT_LOGO_'.$suffix;
if (! empty($conf->global->$paramlogo)) $logosmall=$conf->global->$paramlogo;
else if (! empty($conf->global->PAYBOX_LOGO)) $logosmall=$conf->global->PAYBOX_LOGO;
else if (! empty($conf->global->PAYMENT_LOGO)) $logosmall=$conf->global->PAYMENT_LOGO;
//print '<!-- Show logo (logosmall='.$logosmall.' logo='.$logo.') -->'."\n";
// Define urllogo
$urllogo='';
@@ -234,11 +234,11 @@ if ($urllogo)
// Output introduction text
$text='';
if (! empty($conf->global->PAYBOX_NEWFORM_TEXT))
if (! empty($conf->global->PAYMENT_NEWFORM_TEXT))
{
$langs->load("members");
if (preg_match('/^\((.*)\)$/',$conf->global->PAYBOX_NEWFORM_TEXT,$reg)) $text.=$langs->trans($reg[1])."<br>\n";
else $text.=$conf->global->PAYBOX_NEWFORM_TEXT."<br>\n";
if (preg_match('/^\((.*)\)$/',$conf->global->PAYMENT_NEWFORM_TEXT,$reg)) $text.=$langs->trans($reg[1])."<br>\n";
else $text.=$conf->global->PAYMENT_NEWFORM_TEXT."<br>\n";
$text='<tr><td align="center"><br>'.$text.'<br></td></tr>'."\n";
}
if (empty($text))

View File

@@ -82,26 +82,26 @@ if (! empty($_SESSION['ipaddress'])) // To avoid to make action twice
// Set by newpayment.php
$paymentType = $_SESSION['PaymentType'];
$currencyCodeType = $_SESSION['currencyCodeType'];
$FinalPaymentAmt = $_SESSION["Payment_Amount"];
$FinalPaymentAmt = $_SESSION["FinalPaymentAmt"];
// From env
$ipaddress = $_SESSION['ipaddress'];
// Appel des triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($db);
$result=$interface->run_triggers('PAYBOX_PAYMENT_OK',$object,$user,$langs,$conf);
if ($result < 0) { $error++; $errors=$interface->errors; }
// Fin appel triggers
// Send an email
$sendemail = '';
if (! empty($conf->global->PAYBOX_PAYONLINE_SENDEMAIL)) $sendemail=$conf->global->PAYBOX_PAYONLINE_SENDEMAIL;
if (! empty($conf->global->ONLINE_PAYMENT_SENDEMAIL)) $sendemail=$conf->global->ONLINE_PAYMENT_SENDEMAIL;
if ($sendemail)
{
$sendto=$sendemail;
$from=$conf->global->MAILING_EMAIL_FROM;
// Define link to login card
$appli=constant('DOL_APPLICATION_TITLE');
if (! empty($conf->global->MAIN_APPLICATION_TITLE))
@@ -114,7 +114,7 @@ if (! empty($_SESSION['ipaddress'])) // To avoid to make action twice
else $appli.=" ".DOL_VERSION;
}
else $appli.=" ".DOL_VERSION;
$urlback=$_SERVER["REQUEST_URI"];
$topic='['.$appli.'] '.$langs->transnoentitiesnoconv("NewOnlinePaymentFailed");
$content="";
@@ -126,7 +126,7 @@ if (! empty($_SESSION['ipaddress'])) // To avoid to make action twice
$content.="tag=".$fulltag."\npaymentType=".$paymentType." currencycodeType=".$currencyCodeType." payerId=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt;
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
$mailfile = new CMailFile($topic, $sendto, $from, $content);
$result=$mailfile->sendfile();
if ($result)
{
@@ -137,12 +137,12 @@ if (! empty($_SESSION['ipaddress'])) // To avoid to make action twice
dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_paybox');
}
}
unset($_SESSION['ipaddress']);
}
$head='';
if (! empty($conf->global->PAYBOX_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->PAYBOX_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
if (! empty($conf->global->ONLINE_PAYMENT_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
$conf->dol_hide_topmenu=1;
$conf->dol_hide_leftmenu=1;
@@ -156,7 +156,7 @@ print '<div id="dolpaymentdiv" align="center">'."\n";
print $langs->trans("YourPaymentHasNotBeenRecorded")."<br><br>\n";
if (! empty($conf->global->PAYBOX_MESSAGE_KO)) print $conf->global->PAYBOX_MESSAGE_KO;
if (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_KO)) print $conf->global->ONLINE_PAYMENT_MESSAGE_KO;
print "\n</div>\n";

View File

@@ -84,7 +84,7 @@ dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_paybox');
$head='';
if (! empty($conf->global->PAYBOX_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->PAYBOX_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
if (! empty($conf->global->ONLINE_PAYMENT_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
$conf->dol_hide_topmenu=1;
$conf->dol_hide_leftmenu=1;
@@ -105,7 +105,7 @@ $fulltag = $FULLTAG;
// Set by newpayment.php
$paymentType = $_SESSION['PaymentType'];
$currencyCodeType = $_SESSION['currencyCodeType'];
$FinalPaymentAmt = $_SESSION["Payment_Amount"];
$FinalPaymentAmt = $_SESSION["FinalPaymentAmt"];
// From env
$ipaddress = $_SESSION['ipaddress'];
@@ -115,7 +115,7 @@ dol_syslog("Call newpaymentok with token=".$onlinetoken." paymentType=".$payment
print $langs->trans("YourPaymentHasBeenRecorded")."<br><br>\n";
if (! empty($conf->global->PAYBOX_MESSAGE_OK)) print $conf->global->PAYBOX_MESSAGE_OK;
if (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_OK)) print $conf->global->ONLINE_PAYMENT_MESSAGE_OK;
// Appel des triggers
@@ -127,9 +127,9 @@ if ($result < 0) { $error++; $errors=$interface->errors; }
// Send an email
if (! empty($conf->global->PAYBOX_PAYONLINE_SENDEMAIL))
if (! empty($conf->global->ONLINE_PAYMENT_SENDEMAIL))
{
$sendto=$conf->global->PAYBOX_PAYONLINE_SENDEMAIL;
$sendto=$conf->global->ONLINE_PAYMENT_SENDEMAIL;
$from=$conf->global->MAILING_EMAIL_FROM;
// Define $urlwithroot
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
@@ -148,7 +148,7 @@ if (! empty($conf->global->PAYBOX_PAYONLINE_SENDEMAIL))
else $appli.=" ".DOL_VERSION;
}
else $appli.=" ".DOL_VERSION;
$urlback=$_SERVER["REQUEST_URI"];
$topic='['.$appli.'] '.$langs->transnoentitiesnoconv("NewOnlinePaymentReceived");
$tmptag=dolExplodeIntoArray($fulltag,'.','=');

View File

@@ -16,8 +16,9 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For paypal test: https://developer.paypal.com/
* For paybox test: ???
* For Paypal test: https://developer.paypal.com/
* For Paybox test: ???
* For Stripe test: Use credit card 4242424242424242 .More example on https://stripe.com/docs/testing
*/
/**
@@ -52,7 +53,7 @@ $langs->load("companies");
$langs->load("errors");
$langs->load("paybox"); // File with generic data
$action=GETPOST('action','alpha');
$action=GETPOST('action','aZ09');
// Input are:
// type ('invoice','order','contractline'),
@@ -160,6 +161,7 @@ if (! empty($conf->paypal->enabled))
require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php';
require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypalfunctions.lib.php';
// Check parameters
$PAYPAL_API_OK="";
if ($urlok) $PAYPAL_API_OK=$urlok;
$PAYPAL_API_KO="";
@@ -180,29 +182,6 @@ if (! empty($conf->paypal->enabled))
return -1;
}
// Check security token
$valid=true;
if (! empty($conf->global->PAYPAL_SECURITY_TOKEN))
{
if (! empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE))
{
if ($SOURCE && $REF) $token = dol_hash($conf->global->PAYPAL_SECURITY_TOKEN . $SOURCE . $REF, 2); // Use the source in the hash to avoid duplicates if the references are identical
else $token = dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2);
}
else
{
$token = $conf->global->PAYPAL_SECURITY_TOKEN;
}
if ($SECUREKEY != $token) $valid=false;
if (! $valid)
{
print '<div class="error">Bad value for key.</div>';
//print 'SECUREKEY='.$SECUREKEY.' token='.$token.' valid='.$valid;
exit;
}
}
$validpaymentmethod['paypal']='valid';
}
@@ -212,10 +191,24 @@ if (! empty($conf->paybox->enabled))
// TODO
$validpaymentmethod['paybox']='valid';
$validpaymentmethod['paybox']='valid';
}
if (! empty($conf->stripe->enabled))
{
$langs->load("stripe");
require_once DOL_DOCUMENT_ROOT.'/stripe/config.php';
/* already included into /stripe/config.php
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
require_once DOL_DOCUMENT_ROOT.'/stripe/lib/stripe.lib.php';
require_once DOL_DOCUMENT_ROOT.'/includes/stripe/init.php';
*/
$validpaymentmethod['stripe']='valid';
}
// TODO Add check of other payment mode
// Check security token
@@ -242,9 +235,18 @@ if (! empty($conf->global->PAYMENT_SECURITY_TOKEN))
}
if (empty($validpaymentmethod))
{
print 'No active payment module (Paypal, Stripe, Paybox, ...)';
exit;
}
if (empty($validpaymentmethod)) accessforbidden('', 0, 0, 1);
// Common variables
$creditor=$mysoc->name;
$paramcreditor='ONLINE_PAYMENT_CREDITOR';
$paramcreditorlong='ONLINE_PAYMENT_CREDITOR_'.$suffix;
if (! empty($conf->global->$paramcreditorlong)) $creditor=$conf->global->$paramcreditorlong;
else if (! empty($conf->global->$paramcreditor)) $creditor=$conf->global->$paramcreditor;
@@ -252,7 +254,6 @@ if (empty($validpaymentmethod)) accessforbidden('', 0, 0, 1);
* Actions
*/
if ($action == 'dopayment')
{
if ($paymentmethod == 'paypal')
@@ -312,7 +313,7 @@ if ($action == 'dopayment')
dol_syslog("SCRIPT_URI: ".(empty($_SERVER["SCRIPT_URI"])?'':$_SERVER["SCRIPT_URI"]), LOG_DEBUG); // If defined script uri must match domain of PAYPAL_API_OK and PAYPAL_API_KO
//$_SESSION["PaymentType"]=$PAYPAL_PAYMENT_TYPE;
//$_SESSION["currencyCodeType"]=$PAYPAL_API_DEVISE;
//$_SESSION["Payment_Amount"]=$PAYPAL_API_PRICE;
//$_SESSION["FinalPaymentAmt"]=$PAYPAL_API_PRICE;
// A redirect is added if API call successfull
print_paypal_redirect($PAYPAL_API_PRICE,$PAYPAL_API_DEVISE,$PAYPAL_PAYMENT_TYPE,$PAYPAL_API_OK,$PAYPAL_API_KO, $FULLTAG);
@@ -320,6 +321,162 @@ if ($action == 'dopayment')
exit;
}
}
if ($paymentmethod == 'paybox')
{
$PRICE=price2num(GETPOST("newamount"),'MT');
$email=GETPOST("email");
$origfulltag=GETPOST("fulltag",'alpha');
$mesg='';
if (empty($PRICE) || ! is_numeric($PRICE)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Amount"));
elseif (empty($email)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("YourEMail"));
elseif (! isValidEMail($email)) $mesg=$langs->trans("ErrorBadEMail",$email);
elseif (! $origfulltag) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("PaymentCode"));
elseif (dol_strlen($urlok) > 150) $mesg='Error urlok too long '.$urlok;
elseif (dol_strlen($urlko) > 150) $mesg='Error urlko too long '.$urlko;
if (empty($mesg))
{
dol_syslog("newpayment.php call paybox api and do redirect", LOG_DEBUG);
print_paybox_redirect($PRICE, $conf->currency, $email, $urlok, $urlko, $FULLTAG);
session_destroy();
exit;
}
}
if ($paymentmethod == 'stripe')
{
if (GETPOST('newamount')) $amount = GETPOST('newamount');
else
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Amount")), null, 'errors');
$action = '';
}
}
}
if ($action == 'charge')
{
// Correct the amount according to unit of currency
// See https://support.stripe.com/questions/which-zero-decimal-currencies-does-stripe-support
$arrayzerounitcurrency=array('BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'VND', 'VUV', 'XAF', 'XOF', 'XPF');
if (! in_array($currency, $arrayzerounitcurrency)) $amount=$amount * 100;
dol_syslog("POST keys : ".join(',', array_keys($_POST)), LOG_DEBUG, 0, '_stripe');
dol_syslog("POST values: ".join(',', $_POST), LOG_DEBUG, 0, '_stripe');
$stripeToken = GETPOST("stripeToken",'alpha');
$email = GETPOST("stripeEmail",'alpha');
dol_syslog("stripeToken = ".$stripeToken, LOG_DEBUG, 0, '_stripe');
dol_syslog("stripeEmail = ".$stripeEmail, LOG_DEBUG, 0, '_stripe');
$error = 0;
try {
dol_syslog("Create customer", LOG_DEBUG, 0, '_stripe');
$customer = \Stripe\Customer::create(array(
'email' => $email,
'description' => ($email?'Customer for '.$email:null),
'metadata' => array('ipaddress'=>$_SERVER['REMOTE_ADDR']),
'source' => $stripeToken // source can be a token OR array('object'=>'card', 'exp_month'=>xx, 'exp_year'=>xxxx, 'number'=>xxxxxxx, 'cvc'=>xxx, 'name'=>'Cardholder's full name', zip ?)
));
// TODO Add 'business_vat_id' ?
dol_syslog("Create charge", LOG_DEBUG, 0, '_stripe');
$charge = \Stripe\Charge::create(array(
'customer' => $customer->id,
'amount' => price2num($amount, 'MU'),
'currency' => $currency,
'description' => 'Stripe payment: '.$FULLTAG,
'metadata' => array("FULLTAG" => $FULLTAG, 'Recipient' => $mysoc->name),
'statement_descriptor' => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 6, 'right', 'UTF-8', 1).' '.$FULLTAG, 22, 'right', 'UTF-8', 1) // 22 chars that appears on bank receipt
));
} catch(\Stripe\Error\Card $e) {
// Since it's a decline, \Stripe\Error\Card will be caught
$body = $e->getJsonBody();
$err = $body['error'];
print('Status is:' . $e->getHttpStatus() . "\n");
print('Type is:' . $err['type'] . "\n");
print('Code is:' . $err['code'] . "\n");
// param is '' in this case
print('Param is:' . $err['param'] . "\n");
print('Message is:' . $err['message'] . "\n");
$error++;
setEventMessages($e->getMessage(), null, 'errors');
dol_syslog($e->getMessage(), LOG_WARNING, 0, '_stripe');
$action='';
} catch (\Stripe\Error\RateLimit $e) {
// Too many requests made to the API too quickly
$error++;
dol_syslog($e->getMessage(), LOG_WARNING, 0, '_stripe');
setEventMessages($e->getMessage(), null, 'errors');
$action='';
} catch (\Stripe\Error\InvalidRequest $e) {
// Invalid parameters were supplied to Stripe's API
$error++;
dol_syslog($e->getMessage(), LOG_WARNING, 0, '_stripe');
setEventMessages($e->getMessage(), null, 'errors');
$action='';
} catch (\Stripe\Error\Authentication $e) {
// Authentication with Stripe's API failed
// (maybe you changed API keys recently)
$error++;
dol_syslog($e->getMessage(), LOG_WARNING, 0, '_stripe');
setEventMessages($e->getMessage(), null, 'errors');
$action='';
} catch (\Stripe\Error\ApiConnection $e) {
// Network communication with Stripe failed
$error++;
dol_syslog($e->getMessage(), LOG_WARNING, 0, '_stripe');
setEventMessages($e->getMessage(), null, 'errors');
$action='';
} catch (\Stripe\Error\Base $e) {
// Display a very generic error to the user, and maybe send
// yourself an email
$error++;
dol_syslog($e->getMessage(), LOG_WARNING, 0, '_stripe');
setEventMessages($e->getMessage(), null, 'errors');
$action='';
} catch (Exception $e) {
// Something else happened, completely unrelated to Stripe
$error++;
dol_syslog($e->getMessage(), LOG_WARNING, 0, '_stripe');
setEventMessages($e->getMessage(), null, 'errors');
$action='';
}
$_SESSION["onlinetoken"] = $stripeToken;
$_SESSION["FinalPaymentAmt"] = $amount;
$_SESSION["currencyCodeType"] = $currency;
$_SESSION["paymentType"] = '';
$_SESSION['ipaddress'] = $_SERVER['REMOTE_ADDR']; // Payer ip
$_SESSION['payerID'] = is_object($customer)?$customer->id:'';
$_SESSION['TRANSACTIONID'] = is_object($charge)?$charge->id:'';
dol_syslog("Action charge stripe result=".$error." ip=".$_SESSION['ipaddress'], LOG_DEBUG, 0, '_stripe');
dol_syslog("onlinetoken=".$_SESSION["onlinetoken"]." FinalPaymentAmt=".$_SESSION["FinalPaymentAmt"]." currencyCodeType=".$_SESSION["currencyCodeType"]." payerID=".$_SESSION['payerID']." TRANSACTIONID=".$_SESSION['TRANSACTIONID'], LOG_DEBUG, 0, '_stripe');
dol_syslog("FULLTAG=".$FULLTAG, LOG_DEBUG, 0, '_stripe');
dol_syslog("Now call the redirect to paymentok or paymentko", LOG_DEBUG, 0, '_stripe');
if ($error)
{
header("Location: ".$urlko);
exit;
}
else
{
header("Location: ".$urlok);
exit;
}
}
@@ -328,7 +485,7 @@ if ($action == 'dopayment')
*/
$head='';
if (! empty($conf->global->PAYMENT_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
if (! empty($conf->global->ONLINE_PAYMENT_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
$conf->dol_hide_topmenu=1;
$conf->dol_hide_leftmenu=1;
@@ -345,19 +502,17 @@ if (! empty($SOURCE) && in_array($ref, array('member_ref', 'contractline_ref', '
exit;
}
if (! empty($conf->paypal->enabled))
{
// Common variables
$creditor=$mysoc->name;
$paramcreditor='PAYPAL_CREDITOR_'.$suffix;
if (! empty($conf->global->$paramcreditor)) $creditor=$conf->global->$paramcreditor;
else if (! empty($conf->global->PAYPAL_CREDITOR)) $creditor=$conf->global->PAYPAL_CREDITOR;
if (! empty($PAYPAL_API_SANDBOX))
{
dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode'),'','warning');
}
// Show sandbox warning
if (! empty($conf->paypal->enabled) && ! empty($conf->global->PAYPAL_API_SANDBOX))
{
dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode','Paypal'),'','warning');
}
if (! empty($conf->stripe->enabled) && empty($conf->global->STRIPE_LIVE))
{
dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode','Stripe'),'','warning');
}
print '<span id="dolpaymentspan"></span>'."\n";
print '<div class="center">'."\n";
@@ -370,32 +525,35 @@ print '<input type="hidden" name="securekey" value="'.$SECUREKEY.'">'."\n";
print '<input type="hidden" name="entity" value="'.$entity.'" />';
print "\n";
print '<!-- Form to send a payment -->'."\n";
print '<!-- creditor = '.$creditor.' -->'."\n";
// Additionnal information for each payment system
if (! empty($conf->paypal->enabled))
{
print '<!-- PAYPAL_API_SANDBOX = '.$conf->global->PAYPAL_API_SANDBOX.' -->'."\n";
print '<!-- PAYPAL_API_INTEGRAL_OR_PAYPALONLY = '.$conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY.' -->'."\n";
print '<!-- creditor = '.$creditor.' -->'."\n";
}
if (! empty($conf->paybox->enabled))
{
}
// TODO Add others
if (! empty($conf->stripe->enabled))
{
print '<!-- STRIPE_LIVE = '.$conf->global->STRIPE_LIVE.' -->'."\n";
}
print '<!-- urlok = '.$urlok.' -->'."\n";
print '<!-- urlko = '.$urlko.' -->'."\n";
print "\n";
print '<table id="dolpaymenttable" summary="Payment form" class="center">'."\n";
// Show logo (search order: logo defined by PAYBOX_LOGO_suffix, then PAYBOX_LOGO, then small company logo, large company logo, theme logo, common logo)
// Show logo (search order: logo defined by PAYMENT_LOGO_suffix, then PAYMENT_LOGO, then small company logo, large company logo, theme logo, common logo)
$width=0;
// Define logo and logosmall
$logosmall=$mysoc->logo_small;
$logo=$mysoc->logo;
$paramlogo='PAYMENT_LOGO_'.$suffix;
if (! empty($conf->global->$paramlogo)) $logosmall=$conf->global->$paramlogo;
else if (! empty($conf->global->PAYMENT_LOGO)) $logosmall=$conf->global->PAYBOX_LOGO;
else if (! empty($conf->global->PAYMENT_LOGO)) $logosmall=$conf->global->PAYMENT_LOGO;
//print '<!-- Show logo (logosmall='.$logosmall.' logo='.$logo.') -->'."\n";
// Define urllogo
$urllogo='';
@@ -420,11 +578,11 @@ if ($urllogo)
// Output introduction text
$text='';
if (! empty($conf->global->PAYPAL_NEWFORM_TEXT))
if (! empty($conf->global->PAYMENT_NEWFORM_TEXT))
{
$langs->load("members");
if (preg_match('/^\((.*)\)$/',$conf->global->PAYPAL_NEWFORM_TEXT,$reg)) $text.=$langs->trans($reg[1])."<br>\n";
else $text.=$conf->global->PAYPAL_NEWFORM_TEXT."<br>\n";
if (preg_match('/^\((.*)\)$/',$conf->global->PAYMENT_NEWFORM_TEXT,$reg)) $text.=$langs->trans($reg[1])."<br>\n";
else $text.=$conf->global->PAYMENT_NEWFORM_TEXT."<br>\n";
$text='<tr><td align="center"><br>'.$text.'<br></td></tr>'."\n";
}
if (empty($text))
@@ -1067,25 +1225,27 @@ if ($action != 'dopayment')
if ($conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY == 'integral')
{
print '<br><input class="button" type="submit" name="dopayment_paypal" value="'.$langs->trans("PaypalOrCBDoPayment").'">';
print '<br><input class="button buttonpayment buttonpaymentpaypal" type="submit" name="dopayment_paypal" value="'.$langs->trans("PaypalOrCBDoPayment").'">';
}
if ($conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY == 'paypalonly')
{
print '<br><input class="button" type="submit" name="dopayment_paypal" value="'.$langs->trans("PaypalDoPayment").'">';
print '<br><input class="button buttonpayment buttonpaymentpaypal" type="submit" name="dopayment_paypal" value="'.$langs->trans("PaypalDoPayment").'">';
}
}
if (! empty($conf->paybox->enabled))
{
print '<br><input class="button buttonpayment buttonpaymentpaybox" type="submit" name="dopayment_paybox" value="'.$langs->trans("PayBoxDoPayment").'">';
}
// TODO Other methods
if (! empty($conf->stripe->enabled))
{
print '<br><input class="button buttonpayment buttonpaymentstripe" type="submit" name="dopayment_stripe" value="'.$langs->trans("StripeDoPayment").'">';
}
}
else
{
dol_print_error_email('ERRORNEWPAYMENTPAYPAL');
dol_print_error_email('ERRORNEWPAYMENT');
}
}
else
@@ -1101,6 +1261,183 @@ print '</div>'."\n";
print '<br>';
// Add more content on page for some services
if (preg_match('/^dopayment/',$action))
{
// Strip
if (GETPOST('dopayment_stripe','alpha'))
{
// Simple checkout
/*
print '<script src="https://checkout.stripe.com/checkout.js"
class="stripe-button"
data-key="'.$stripe['publishable_key'].'"
data-amount="'.$ttc.'"
data-currency="'.$conf->currency.'"
data-description="'.$ref.'">
</script>';
*/
// Personalized checkout
print '<style>
/**
* The CSS shown here will not be introduced in the Quickstart guide, but shows
* how you can use CSS to style your Element s container.
*/
.StripeElement {
background-color: white;
padding: 8px 12px;
border-radius: 4px;
border: 1px solid transparent;
box-shadow: 0 1px 3px 0 #e6ebf1;
-webkit-transition: box-shadow 150ms ease;
transition: box-shadow 150ms ease;
}
.StripeElement--focus {
box-shadow: 0 1px 3px 0 #cfd7df;
}
.StripeElement--invalid {
border-color: #fa755a;
}
.StripeElement--webkit-autofill {
background-color: #fefde5 !important;
}
</style>';
print '
<br>
<form action="'.$_SERVER['REQUEST_URI'].'" method="POST" id="payment-form">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'."\n";
print '<input type="hidden" name="dopayment_stripe" value="1">'."\n";
print '<input type="hidden" name="action" value="charge">'."\n";
print '<input type="hidden" name="tag" value="'.$TAG.'">'."\n";
print '<input type="hidden" name="source" value="'.$SOURCE.'">'."\n";
print '<input type="hidden" name="ref" value="'.$REF.'">'."\n";
print '<input type="hidden" name="fulltag" value="'.$FULLTAG.'">'."\n";
print '<input type="hidden" name="suffix" value="'.$suffix.'">'."\n";
print '<input type="hidden" name="securekey" value="'.$SECUREKEY.'">'."\n";
print '<input type="hidden" name="entity" value="'.$entity.'" />';
print '<input type="hidden" name="amount" value="'.$amount.'">'."\n";
print '<input type="hidden" name="currency" value="'.$currency.'">'."\n";
print '
<table id="dolpaymenttable" summary="Payment form" class="center">
<tbody><tr><td class="textpublicpayment">
<div class="form-row left">
<label for="card-element">
Credit or debit card
</label>
<div id="card-element">
<!-- a Stripe Element will be inserted here. -->
</div>
<!-- Used to display form errors -->
<div id="card-errors" role="alert"></div>
</div>
<br>
<button class="button" id="buttontopay">'.$langs->trans("ToPay").'</button>
<img id="hourglasstopay" class="hidden" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/working.gif'.'">
</td></tr></tbody></table>
</form>
<script src="https://js.stripe.com/v2/"></script>
<script src="https://js.stripe.com/v3/"></script>
<script type="text/javascript" language="javascript">';
?>
// Create a Stripe client
var stripe = Stripe('<?php echo $stripe['publishable_key']; ?>');
// Create an instance of Elements
var elements = stripe.elements();
// Custom styling can be passed to options when creating an Element.
// (Note that this demo uses a wider set of styles than the guide below.)
var style = {
base: {
color: '#32325d',
lineHeight: '24px',
fontFamily: '"Helvetica Neue", Helvetica, sans-serif',
fontSmoothing: 'antialiased',
fontSize: '16px',
'::placeholder': {
color: '#aab7c4'
}
},
invalid: {
color: '#fa755a',
iconColor: '#fa755a'
}
};
// Create an instance of the card Element
var card = elements.create('card', {style: style});
// Add an instance of the card Element into the `card-element` <div>
card.mount('#card-element');
// Handle real-time validation errors from the card Element.
card.addEventListener('change', function(event) {
var displayError = document.getElementById('card-errors');
if (event.error) {
displayError.textContent = event.error.message;
} else {
displayError.textContent = '';
}
});
// Handle form submission
var form = document.getElementById('payment-form');
console.log(form);
form.addEventListener('submit', function(event) {
event.preventDefault();
stripe.createToken(card).then(function(result) {
if (result.error) {
// Inform the user if there was an error
var errorElement = document.getElementById('card-errors');
errorElement.textContent = result.error.message;
} else {
// Send the token to your server
stripeTokenHandler(result.token);
}
});
});
function stripeTokenHandler(token) {
// Insert the token ID into the form so it gets submitted to the server
var form = document.getElementById('payment-form');
var hiddenInput = document.createElement('input');
hiddenInput.setAttribute('type', 'hidden');
hiddenInput.setAttribute('name', 'stripeToken');
hiddenInput.setAttribute('value', token.id);
form.appendChild(hiddenInput);
// Submit the form
jQuery('#buttontopay').hide();
jQuery('#hourglasstopay').show();
console.log("submit");
form.submit();
}
<?php
print '</script>';
}
}
htmlPrintOnlinePaymentFooter($mysoc,$langs);
llxFooter('', 'public');

View File

@@ -51,6 +51,7 @@ $langs->load("bills");
$langs->load("companies");
$langs->load("paybox");
$langs->load("paypal");
$langs->load("stripe");
if (! empty($conf->paypal->enabled))
{
@@ -59,7 +60,12 @@ if (! empty($conf->paypal->enabled))
$PAYPALPAYERID=GETPOST('PAYERID');
if (empty($PAYPALPAYERID)) $PAYPALPAYERID=GETPOST('PayerID');
}
// TODO Other payment method
if (! empty($conf->paybox->enabled))
{
}
if (! empty($conf->stripe->enabled))
{
}
$FULLTAG=GETPOST('FULLTAG');
if (empty($FULLTAG)) $FULLTAG=GETPOST('fulltag');
@@ -106,7 +112,7 @@ $object = new stdClass(); // For triggers
* View
*/
dol_syslog("Callback url when a PayPal payment was canceled. query_string=".(empty($_SERVER["QUERY_STRING"])?'':$_SERVER["QUERY_STRING"])." script_uri=".(empty($_SERVER["SCRIPT_URI"])?'':$_SERVER["SCRIPT_URI"]), LOG_DEBUG, 0, '_payment');
dol_syslog("Callback url when an online payment is canceled. query_string=".(empty($_SERVER["QUERY_STRING"])?'':$_SERVER["QUERY_STRING"])." script_uri=".(empty($_SERVER["SCRIPT_URI"])?'':$_SERVER["SCRIPT_URI"]), LOG_DEBUG, 0, '_payment');
$tracepost = "";
foreach($_POST as $k => $v) $tracepost .= "{$k} - {$v}\n";
@@ -122,48 +128,29 @@ if (! empty($_SESSION['ipaddress'])) // To avoid to make action twice
// Set by newpayment.php
$paymentType = $_SESSION['PaymentType'];
$currencyCodeType = $_SESSION['currencyCodeType'];
$FinalPaymentAmt = $_SESSION["Payment_Amount"];
$FinalPaymentAmt = $_SESSION['FinalPaymentAmt'];
// From env
$ipaddress = $_SESSION['ipaddress'];
// Appel des triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($db);
$result=$interface->run_triggers('PAYMENTONLINE_PAYMENT_KO',$object,$user,$langs,$conf);
if ($result < 0) { $error++; $errors=$interface->errors; }
// Fin appel triggers
// Send an email
$sendemail = '';
if (! empty($conf->paypal->enabled))
{
if (! empty($conf->global->PAYPAL_PAYONLINE_SENDEMAIL))
{
$sendemail = $conf->global->PAYPAL_PAYONLINE_SENDEMAIL;
}
if (! empty($conf->global->ONLINE_PAYMENT_SENDEMAIL))
{
$sendemail = $conf->global->ONLINE_PAYMENT_SENDEMAIL;
}
// Send an email
if (! empty($conf->paybox->enabled))
{
if (! empty($conf->global->PAYBOX_PAYONLINE_SENDEMAIL))
{
$sendemail = $conf->global->PAYBOX_PAYONLINE_SENDEMAIL;
}
}
// Send an email
if (! empty($conf->stripe->enabled))
{
if (! empty($conf->global->STRIPE_PAYONLINE_SENDEMAIL))
{
$sendemail = $conf->global->STRIPE_PAYONLINE_SENDEMAIL;
}
}
if ($sendemail)
{
$from=$conf->global->MAILING_EMAIL_FROM;
$sendto=$sendemail;
// Define link to login card
$appli=constant('DOL_APPLICATION_TITLE');
if (! empty($conf->global->MAIN_APPLICATION_TITLE))
@@ -176,7 +163,7 @@ if (! empty($_SESSION['ipaddress'])) // To avoid to make action twice
else $appli.=" ".DOL_VERSION;
}
else $appli.=" ".DOL_VERSION;
$urlback=$_SERVER["REQUEST_URI"];
$topic='['.$appli.'] '.$langs->transnoentitiesnoconv("NewOnlinePaymentFailed");
$content="";
@@ -188,7 +175,7 @@ if (! empty($_SESSION['ipaddress'])) // To avoid to make action twice
$content.="tag=".$fulltag."\ntoken=".$onlinetoken." paymentType=".$paymentType." currencycodeType=".$currencyCodeType." payerId=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt;
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
$mailfile = new CMailFile($topic, $sendto, $from, $content);
$result=$mailfile->sendfile();
if ($result)
{
@@ -199,12 +186,12 @@ if (! empty($_SESSION['ipaddress'])) // To avoid to make action twice
dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_payment');
}
}
unset($_SESSION['ipaddress']);
}
$head='';
if (! empty($conf->global->PAYMENT_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
if (! empty($conf->global->ONLINE_PAYMENT_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
$conf->dol_hide_topmenu=1;
$conf->dol_hide_leftmenu=1;
@@ -217,7 +204,7 @@ print '<span id="dolpaymentspan"></span>'."\n";
print '<div id="dolpaymentdiv" align="center">'."\n";
print $langs->trans("YourPaymentHasNotBeenRecorded")."<br><br>";
if (! empty($conf->global->PAYMENT_MESSAGE_KO)) print $conf->global->PAYMENT_MESSAGE_KO;
if (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_KO)) print $conf->global->ONLINE_PAYMENT_MESSAGE_KO;
print "\n</div>\n";

View File

@@ -67,21 +67,6 @@ if (! empty($conf->paypal->enabled))
if ($urlok) $PAYPAL_API_OK=$urlok;
$PAYPAL_API_KO="";
if ($urlko) $PAYPAL_API_KO=$urlko;
if (empty($PAYPAL_API_USER))
{
dol_print_error('',"Paypal setup param PAYPAL_API_USER not defined");
return -1;
}
if (empty($PAYPAL_API_PASSWORD))
{
dol_print_error('',"Paypal setup param PAYPAL_API_PASSWORD not defined");
return -1;
}
if (empty($PAYPAL_API_SIGNATURE))
{
dol_print_error('',"Paypal setup param PAYPAL_API_SIGNATURE not defined");
return -1;
}
$PAYPALTOKEN=GETPOST('TOKEN');
if (empty($PAYPALTOKEN)) $PAYPALTOKEN=GETPOST('token');
@@ -143,14 +128,14 @@ $object = new stdClass(); // For triggers
* View
*/
dol_syslog("Callback url when a payment was done. query_string=".(empty($_SERVER["QUERY_STRING"])?'':$_SERVER["QUERY_STRING"])." script_uri=".(empty($_SERVER["SCRIPT_URI"])?'':$_SERVER["SCRIPT_URI"]), LOG_DEBUG, 0, '_payment');
dol_syslog("Callback url when a payment was done. query_string=".(dol_escape_htmltag($_SERVER["QUERY_STRING"])?dol_escape_htmltag($_SERVER["QUERY_STRING"]):'')." script_uri=".(dol_escape_htmltag($_SERVER["SCRIPT_URI"])?dol_escape_htmltag($_SERVER["SCRIPT_URI"]):''), LOG_DEBUG, 0, '_payment');
$tracepost = "";
foreach($_POST as $k => $v) $tracepost .= "{$k} - {$v}\n";
dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_payment');
$head='';
if (! empty($conf->global->PAYMENT_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
if (! empty($conf->global->ONLINE_PAYMENT_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
$conf->dol_hide_topmenu=1;
$conf->dol_hide_leftmenu=1;
@@ -166,69 +151,81 @@ print '<div id="dolpaymentdiv" align="center">'."\n";
if (! empty($conf->paypal->enabled))
{
if ($PAYPALTOKEN)
if ($paymentmethod == 'paypal')
{
// Get on url call
$onlinetoken = $PAYPALTOKEN;
$fulltag = $FULLTAG;
$payerID = $PAYPALPAYERID;
// Set by newpayment.php
$paymentType = $_SESSION['PaymentType'];
$currencyCodeType = $_SESSION['currencyCodeType'];
$FinalPaymentAmt = $_SESSION["Payment_Amount"];
// From env
$ipaddress = $_SESSION['ipaddress'];
dol_syslog("Call paymentok with token=".$onlinetoken." paymentType=".$paymentType." currencyCodeType=".$currencyCodeType." payerID=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt." fulltag=".$fulltag, LOG_DEBUG, 0, '_paypal');
// Validate record
if (! empty($paymentType))
{
dol_syslog("We call GetExpressCheckoutDetails", LOG_DEBUG, 0, '_payment');
$resArray=getDetails($onlinetoken);
//var_dump($resarray);
dol_syslog("We call DoExpressCheckoutPayment token=".$onlinetoken." paymentType=".$paymentType." currencyCodeType=".$currencyCodeType." payerID=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt." fulltag=".$fulltag, LOG_DEBUG, 0, '_payment');
$resArray=confirmPayment($onlinetoken, $paymentType, $currencyCodeType, $payerID, $ipaddress, $FinalPaymentAmt, $fulltag);
$ack = strtoupper($resArray["ACK"]);
if ($ack=="SUCCESS" || $ack=="SUCCESSWITHWARNING")
{
$object->source = $source;
$object->ref = $ref;
$object->payerID = $payerID;
$object->fulltag = $fulltag;
$object->resArray = $resArray;
// resArray was built from a string like that
// TOKEN=EC%2d1NJ057703V9359028&TIMESTAMP=2010%2d11%2d01T11%3a40%3a13Z&CORRELATIONID=1efa8c6a36bd8&ACK=Success&VERSION=56&BUILD=1553277&TRANSACTIONID=9B994597K9921420R&TRANSACTIONTYPE=expresscheckout&PAYMENTTYPE=instant&ORDERTIME=2010%2d11%2d01T11%3a40%3a12Z&AMT=155%2e57&FEEAMT=5%2e54&TAXAMT=0%2e00&CURRENCYCODE=EUR&PAYMENTSTATUS=Completed&PENDINGREASON=None&REASONCODE=None
$PAYMENTSTATUS=urldecode($resArray["PAYMENTSTATUS"]); // Should contains 'Completed'
$TRANSACTIONID=urldecode($resArray["TRANSACTIONID"]);
$TAXAMT=urldecode($resArray["TAXAMT"]);
$NOTE=urldecode($resArray["NOTE"]);
if ($PAYPALTOKEN)
{
// Get on url call
$onlinetoken = $PAYPALTOKEN;
$fulltag = $FULLTAG;
$payerID = $PAYPALPAYERID;
// Set by newpayment.php
$paymentType = $_SESSION['PaymentType'];
$currencyCodeType = $_SESSION['currencyCodeType'];
$FinalPaymentAmt = $_SESSION["FinalPaymentAmt"];
// From env
$ipaddress = $_SESSION['ipaddress'];
$ispaymentok=True;
}
else
{
//Display a user friendly Error on the page using any of the following error information returned by PayPal
$ErrorCode = urldecode($resArray["L_ERRORCODE0"]);
$ErrorShortMsg = urldecode($resArray["L_SHORTMESSAGE0"]);
$ErrorLongMsg = urldecode($resArray["L_LONGMESSAGE0"]);
$ErrorSeverityCode = urldecode($resArray["L_SEVERITYCODE0"]);
}
}
else
{
dol_print_error('','Session expired');
}
dol_syslog("Call paymentok with token=".$onlinetoken." paymentType=".$paymentType." currencyCodeType=".$currencyCodeType." payerID=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt." fulltag=".$fulltag, LOG_DEBUG, 0, '_paypal');
// Validate record
if (! empty($paymentType))
{
dol_syslog("We call GetExpressCheckoutDetails", LOG_DEBUG, 0, '_payment');
$resArray=getDetails($onlinetoken);
//var_dump($resarray);
dol_syslog("We call DoExpressCheckoutPayment token=".$onlinetoken." paymentType=".$paymentType." currencyCodeType=".$currencyCodeType." payerID=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt." fulltag=".$fulltag, LOG_DEBUG, 0, '_payment');
$resArray=confirmPayment($onlinetoken, $paymentType, $currencyCodeType, $payerID, $ipaddress, $FinalPaymentAmt, $fulltag);
$ack = strtoupper($resArray["ACK"]);
if ($ack=="SUCCESS" || $ack=="SUCCESSWITHWARNING")
{
$object->source = $source;
$object->ref = $ref;
$object->payerID = $payerID;
$object->fulltag = $fulltag;
$object->resArray = $resArray;
// resArray was built from a string like that
// TOKEN=EC%2d1NJ057703V9359028&TIMESTAMP=2010%2d11%2d01T11%3a40%3a13Z&CORRELATIONID=1efa8c6a36bd8&ACK=Success&VERSION=56&BUILD=1553277&TRANSACTIONID=9B994597K9921420R&TRANSACTIONTYPE=expresscheckout&PAYMENTTYPE=instant&ORDERTIME=2010%2d11%2d01T11%3a40%3a12Z&AMT=155%2e57&FEEAMT=5%2e54&TAXAMT=0%2e00&CURRENCYCODE=EUR&PAYMENTSTATUS=Completed&PENDINGREASON=None&REASONCODE=None
$PAYMENTSTATUS=urldecode($resArray["PAYMENTSTATUS"]); // Should contains 'Completed'
$TRANSACTIONID=urldecode($resArray["TRANSACTIONID"]);
$TAXAMT=urldecode($resArray["TAXAMT"]);
$NOTE=urldecode($resArray["NOTE"]);
$ispaymentok=True;
}
else
{
//Display a user friendly Error on the page using any of the following error information returned by PayPal
$ErrorCode = urldecode($resArray["L_ERRORCODE0"]);
$ErrorShortMsg = urldecode($resArray["L_SHORTMESSAGE0"]);
$ErrorLongMsg = urldecode($resArray["L_LONGMESSAGE0"]);
$ErrorSeverityCode = urldecode($resArray["L_SEVERITYCODE0"]);
}
}
else
{
dol_print_error('','Session expired');
}
}
else
{
dol_print_error('','$PAYPALTOKEN not defined');
}
}
else
{
dol_print_error('','$PAYPALTOKEN not defined');
}
}
if (! empty($conf->paybox->enabled))
{
if ($paymentmethod == 'paybox') $ispaymentok = true; // We call this page only if payment is ok
}
if (! empty($conf->stripe->enabled))
{
if ($paymentmethod == 'stripe') $ispaymentok = true; // We call this page only if payment is ok
}
if ($ispaymentok)
@@ -240,10 +237,11 @@ if ($ispaymentok)
// Set by newpayment.php
$paymentType = $_SESSION['PaymentType'];
$currencyCodeType = $_SESSION['currencyCodeType'];
$FinalPaymentAmt = $_SESSION["Payment_Amount"];
$FinalPaymentAmt = $_SESSION["FinalPaymentAmt"];
// From env
$ipaddress = $_SESSION['ipaddress'];
$TRANSACTIONID = $_SESSION['TRANSACTIONID'];
// Appel des triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($db);
@@ -251,18 +249,14 @@ if ($ispaymentok)
if ($result < 0) { $error++; $errors=$interface->errors; }
// Fin appel triggers
print $langs->trans("YourPaymentHasBeenRecorded")."<br>\n";
print $langs->trans("ThisIsTransactionId",$TRANSACTIONID)."<br><br>\n";
if (! empty($conf->global->PAYMENT_MESSAGE_OK)) print $conf->global->PAYMENT_MESSAGE_OK;
if (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_OK)) print $conf->global->ONLINE_PAYMENT_MESSAGE_OK;
$sendemail = '';
if (! empty($conf->global->PAYMENTONLINE_SENDEMAIL)) $sendemail=$conf->global->PAYMENTONLINE_SENDEMAIL;
// TODO Remove local option to keep only the generic one ?
if ($paymentmethod == 'paypal' && ! empty($conf->global->PAYPAL_PAYONLINE_SENDEMAIL)) $sendemail=$conf->global->PAYPAL_PAYONLINE_SENDEMAIL;
if ($paymentmethod == 'paybox' && ! empty($conf->global->PAYBOX_PAYONLINE_SENDEMAIL)) $sendemail=$conf->global->PAYBOX_PAYONLINE_SENDEMAIL;
if ($paymentmethod == 'stripe' && ! empty($conf->global->STRIPE_PAYONLINE_SENDEMAIL)) $sendemail=$conf->global->STRIPE_PAYONLINE_SENDEMAIL;
if (! empty($conf->global->ONLINE_PAYMENT_SENDEMAIL)) $sendemail=$conf->global->ONLINE_PAYMENT_SENDEMAIL;
// Send an email
if ($sendemail)
{
@@ -285,7 +279,7 @@ if ($ispaymentok)
else $appli.=" ".DOL_VERSION;
}
else $appli.=" ".DOL_VERSION;
$urlback=$_SERVER["REQUEST_URI"];
$topic='['.$appli.'] '.$langs->transnoentitiesnoconv("NewOnlinePaymentReceived");
$tmptag=dolExplodeIntoArray($fulltag,'.','=');
@@ -333,33 +327,33 @@ else
// Set by newpayment.php
$paymentType = $_SESSION['PaymentType'];
$currencyCodeType = $_SESSION['currencyCodeType'];
$FinalPaymentAmt = $_SESSION["Payment_Amount"];
$FinalPaymentAmt = $_SESSION["FinalPaymentAmt"];
// From env
$ipaddress = $_SESSION['ipaddress'];
// Appel des triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($db);
$result=$interface->run_triggers('PAYMENTONLINE_PAYMENT_KO',$object,$user,$langs,$conf);
if ($result < 0) { $error++; $errors=$interface->errors; }
// Fin appel triggers
print $langs->trans('DoExpressCheckoutPaymentAPICallFailed') . "<br>\n";
print $langs->trans('DetailedErrorMessage') . ": " . $ErrorLongMsg."<br>\n";
print $langs->trans('ShortErrorMessage') . ": " . $ErrorShortMsg."<br>\n";
print $langs->trans('ErrorCode') . ": " . $ErrorCode."<br>\n";
print $langs->trans('ErrorSeverityCode') . ": " . $ErrorSeverityCode."<br>\n";
if ($mysoc->email) print "\nPlease, send a screenshot of this page to ".$mysoc->email."<br>\n";
$sendemail = '';
if (! empty($conf->global->PAYMENTONLINE_SENDEMAIL)) $sendemail=$conf->global->PAYMENTONLINE_SENDEMAIL;
// TODO Remove local option to keep only the generic one ?
if ($paymentmethod == 'paypal' && ! empty($conf->global->PAYPAL_PAYONLINE_SENDEMAIL)) $sendemail=$conf->global->PAYPAL_PAYONLINE_SENDEMAIL;
if ($paymentmethod == 'paybox' && ! empty($conf->global->PAYBOX_PAYONLINE_SENDEMAIL)) $sendemail=$conf->global->PAYBOX_PAYONLINE_SENDEMAIL;
if ($paymentmethod == 'stripe' && ! empty($conf->global->STRIPE_PAYONLINE_SENDEMAIL)) $sendemail=$conf->global->STRIPE_PAYONLINE_SENDEMAIL;
// Send an email
if ($sendemail)
{
@@ -369,7 +363,7 @@ else
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
// Define link to login card
$appli=constant('DOL_APPLICATION_TITLE');
if (! empty($conf->global->MAIN_APPLICATION_TITLE))
@@ -382,7 +376,7 @@ else
else $appli.=" ".DOL_VERSION;
}
else $appli.=" ".DOL_VERSION;
$urlback=$_SERVER["REQUEST_URI"];
$topic='['.$appli.'] '.$langs->transnoentitiesnoconv("ValidationOfPaymentFailed");
$content="";
@@ -392,12 +386,12 @@ else
$content.=$langs->transnoentitiesnoconv("OnlinePaymentSystem").': '.$paymentmethod."\n";
$content.=$langs->transnoentitiesnoconv("ReturnURLAfterPayment").': '.$urlback."\n";
$content.="tag=".$fulltag."\ntoken=".$onlinetoken." paymentType=".$paymentType." currencycodeType=".$currencyCodeType." payerId=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt;
$ishtml=dol_textishtml($content); // May contain urls
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
$mailfile = new CMailFile($topic, $sendto, $from, $content, array(), array(), array(), '', '', 0, $ishtml);
$result=$mailfile->sendfile();
if ($result)
{

View File

@@ -3,9 +3,9 @@
* Copyright (C) 2006-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009-2012 Regis Houssin <regis.houssin@capnetworks.com>
*
* This program is free software: you can redistribute it and/or modify
* 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
* 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,
@@ -16,7 +16,8 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For test: https://developer.paypal.com/
* For paypal test: https://developer.paypal.com/
* For paybox test: ???
*/
/**
@@ -242,7 +243,7 @@ if (GETPOST('action','aZ09') == 'dopayment')
dol_syslog("SCRIPT_URI: ".(empty($_SERVER["SCRIPT_URI"])?'':$_SERVER["SCRIPT_URI"]), LOG_DEBUG); // If defined script uri must match domain of PAYPAL_API_OK and PAYPAL_API_KO
//$_SESSION["PaymentType"]=$PAYPAL_PAYMENT_TYPE;
//$_SESSION["currencyCodeType"]=$PAYPAL_API_DEVISE;
//$_SESSION["Payment_Amount"]=$PAYPAL_API_PRICE;
//$_SESSION["FinalPaymentAmt"]=$PAYPAL_API_PRICE;
// A redirect is added if API call successfull
print_paypal_redirect($PAYPAL_API_PRICE,$PAYPAL_API_DEVISE,$PAYPAL_PAYMENT_TYPE,$PAYPAL_API_OK,$PAYPAL_API_KO, $FULLTAG);
@@ -258,7 +259,7 @@ if (GETPOST('action','aZ09') == 'dopayment')
*/
$head='';
if (! empty($conf->global->PAYPAL_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->PAYPAL_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
if (! empty($conf->global->ONLINE_PAYMENT_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
$conf->dol_hide_topmenu=1;
$conf->dol_hide_leftmenu=1;
@@ -267,9 +268,9 @@ llxHeader($head, $langs->trans("PaymentForm"), '', '', 0, 0, '', '', '', 'online
// Common variables
$creditor=$mysoc->name;
$paramcreditor='PAYPAL_CREDITOR_'.$suffix;
$paramcreditor='ONLINE_PAYMENT_CREDITOR_'.$suffix;
if (! empty($conf->global->$paramcreditor)) $creditor=$conf->global->$paramcreditor;
else if (! empty($conf->global->PAYPAL_CREDITOR)) $creditor=$conf->global->PAYPAL_CREDITOR;
else if (! empty($conf->global->ONLINE_PAYMENT_CREDITOR)) $creditor=$conf->global->ONLINE_PAYMENT_CREDITOR;
// Check link validity
if (! empty($SOURCE) && in_array($ref, array('member_ref', 'contractline_ref', 'invoice_ref', 'order_ref', '')))
@@ -306,14 +307,14 @@ print "\n";
print '<table id="dolpaymenttable" summary="Payment form" class="center">'."\n";
// Show logo (search order: logo defined by PAYBOX_LOGO_suffix, then PAYBOX_LOGO, then small company logo, large company logo, theme logo, common logo)
// Show logo (search order: logo defined by PAYMENT_LOGO_suffix, then PAYMENT_LOGO, then small company logo, large company logo, theme logo, common logo)
$width=0;
// Define logo and logosmall
$logosmall=$mysoc->logo_small;
$logo=$mysoc->logo;
$paramlogo='PAYBOX_LOGO_'.$suffix;
$paramlogo='PAYMENT_LOGO_'.$suffix;
if (! empty($conf->global->$paramlogo)) $logosmall=$conf->global->$paramlogo;
else if (! empty($conf->global->PAYBOX_LOGO)) $logosmall=$conf->global->PAYBOX_LOGO;
else if (! empty($conf->global->PAYMENT_LOGO)) $logosmall=$conf->global->PAYMENT_LOGO;
//print '<!-- Show logo (logosmall='.$logosmall.' logo='.$logo.') -->'."\n";
// Define urllogo
$urllogo='';
@@ -338,11 +339,11 @@ if ($urllogo)
// Output introduction text
$text='';
if (! empty($conf->global->PAYPAL_NEWFORM_TEXT))
if (! empty($conf->global->PAYMENT_NEWFORM_TEXT))
{
$langs->load("members");
if (preg_match('/^\((.*)\)$/',$conf->global->PAYPAL_NEWFORM_TEXT,$reg)) $text.=$langs->trans($reg[1])."<br>\n";
else $text.=$conf->global->PAYPAL_NEWFORM_TEXT."<br>\n";
if (preg_match('/^\((.*)\)$/',$conf->global->PAYMENT_NEWFORM_TEXT,$reg)) $text.=$langs->trans($reg[1])."<br>\n";
else $text.=$conf->global->PAYMENT_NEWFORM_TEXT."<br>\n";
$text='<tr><td align="center"><br>'.$text.'<br></td></tr>'."\n";
}
if (empty($text))

View File

@@ -91,7 +91,7 @@ if (! empty($_SESSION['ipaddress'])) // To avoid to make action twice
// Set by newpayment.php
$paymentType = $_SESSION['PaymentType'];
$currencyCodeType = $_SESSION['currencyCodeType'];
$FinalPaymentAmt = $_SESSION["Payment_Amount"];
$FinalPaymentAmt = $_SESSION["FinalPaymentAmt"];
// From env
$ipaddress = $_SESSION['ipaddress'];
@@ -104,7 +104,7 @@ if (! empty($_SESSION['ipaddress'])) // To avoid to make action twice
// Send an email
$sendemail = '';
if (! empty($conf->global->PAYPAL_PAYONLINE_SENDEMAIL)) $sendemail=$conf->global->PAYPAL_PAYONLINE_SENDEMAIL;
if (! empty($conf->global->ONLINE_PAYMENT_SENDEMAIL)) $sendemail=$conf->global->ONLINE_PAYMENT_SENDEMAIL;
if ($sendemail)
{
@@ -153,7 +153,7 @@ if (! empty($_SESSION['ipaddress'])) // To avoid to make action twice
$head='';
if (! empty($conf->global->PAYPAL_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->PAYPAL_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
if (! empty($conf->global->ONLINE_PAYMENT_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
$conf->dol_hide_topmenu=1;
$conf->dol_hide_leftmenu=1;
@@ -166,7 +166,7 @@ print '<span id="dolpaymentspan"></span>'."\n";
print '<div id="dolpaymentdiv" align="center">'."\n";
print $langs->trans("YourPaymentHasNotBeenRecorded")."<br><br>";
if (! empty($conf->global->PAYPAL_MESSAGE_KO)) print $conf->global->PAYPAL_MESSAGE_KO;
if (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_KO)) print $conf->global->ONLINE_PAYMENT_MESSAGE_KO;
print "\n</div>\n";

View File

@@ -114,7 +114,7 @@ dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_paypal');
$head='';
if (! empty($conf->global->PAYPAL_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->PAYPAL_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
if (! empty($conf->global->ONLINE_PAYMENT_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
$conf->dol_hide_topmenu=1;
$conf->dol_hide_leftmenu=1;
@@ -135,7 +135,7 @@ if ($PAYPALTOKEN)
// Set by newpayment.php
$paymentType = $_SESSION['PaymentType'];
$currencyCodeType = $_SESSION['currencyCodeType'];
$FinalPaymentAmt = $_SESSION["Payment_Amount"];
$FinalPaymentAmt = $_SESSION["FinalPaymentAmt"];
// From env
$ipaddress = $_SESSION['ipaddress'];
@@ -170,7 +170,7 @@ if ($PAYPALTOKEN)
print $langs->trans("YourPaymentHasBeenRecorded")."<br>\n";
print $langs->trans("ThisIsTransactionId",$TRANSACTIONID)."<br><br>\n";
if (! empty($conf->global->PAYPAL_MESSAGE_OK)) print $conf->global->PAYPAL_MESSAGE_OK;
if (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_OK)) print $conf->global->ONLINE_PAYMENT_MESSAGE_OK;
// Appel des triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
@@ -180,9 +180,9 @@ if ($PAYPALTOKEN)
// Fin appel triggers
// Send an email
if (! empty($conf->global->PAYPAL_PAYONLINE_SENDEMAIL))
if (! empty($conf->global->ONLINE_PAYMENT_SENDEMAIL))
{
$sendto=$conf->global->PAYPAL_PAYONLINE_SENDEMAIL;
$sendto=$conf->global->ONLINE_PAYMENT_SENDEMAIL;
$from=$conf->global->MAILING_EMAIL_FROM;
// Define $urlwithroot
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
@@ -201,7 +201,7 @@ if ($PAYPALTOKEN)
else $appli.=" ".DOL_VERSION;
}
else $appli.=" ".DOL_VERSION;
$urlback=$_SERVER["REQUEST_URI"];
$topic='['.$appli.'] '.$langs->transnoentitiesnoconv("NewOnlinePaymentReceived");
$tmptag=dolExplodeIntoArray($fulltag,'.','=');
@@ -248,7 +248,7 @@ if ($PAYPALTOKEN)
$result=$interface->run_triggers('PAYPAL_PAYMENT_KO',$object,$user,$langs,$conf);
if ($result < 0) { $error++; $errors=$interface->errors; }
// Fin appel triggers
//Display a user friendly Error on the page using any of the following error information returned by PayPal
$ErrorCode = urldecode($resArray["L_ERRORCODE0"]);
$ErrorShortMsg = urldecode($resArray["L_SHORTMESSAGE0"]);
@@ -264,9 +264,9 @@ if ($PAYPALTOKEN)
if ($mysoc->email) echo "\nPlease, send a screenshot of this page to ".$mysoc->email."<br>\n";
// Send an email
if (! empty($conf->global->PAYPAL_PAYONLINE_SENDEMAIL))
if (! empty($conf->global->ONLINE_PAYMENT_SENDEMAIL))
{
$sendto=$conf->global->PAYPAL_PAYONLINE_SENDEMAIL;
$sendto=$conf->global->ONLINE_PAYMENT_SENDEMAIL;
$from=$conf->global->MAILING_EMAIL_FROM;
// Define $urlwithroot
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
@@ -285,7 +285,7 @@ if ($PAYPALTOKEN)
else $appli.=" ".DOL_VERSION;
}
else $appli.=" ".DOL_VERSION;
$urlback=$_SERVER["REQUEST_URI"];
$topic='['.$appli.'] '.$langs->transnoentitiesnoconv("ValidationOfPaymentFailed");
$content="";

View File

@@ -183,9 +183,9 @@ if (! empty($conf->global->STRIPE_SECURITY_TOKEN))
// Common variables
$creditor=$mysoc->name;
$paramcreditor='STRIPE_CREDITOR_'.$suffix;
$paramcreditor='ONLINE_PAYMENT_CREDITOR_'.$suffix;
if (! empty($conf->global->$paramcreditor)) $creditor=$conf->global->$paramcreditor;
else if (! empty($conf->global->STRIPE_CREDITOR)) $creditor=$conf->global->STRIPE_CREDITOR;
else if (! empty($conf->global->ONLINE_PAYMENT_CREDITOR)) $creditor=$conf->global->ONLINE_PAYMENT_CREDITOR;
@@ -297,7 +297,7 @@ if ($action == 'charge')
}
$_SESSION["onlinetoken"] = $stripeToken;
$_SESSION["Payment_Amount"] = $amount;
$_SESSION["FinalPaymentAmt"] = $amount;
$_SESSION["currencyCodeType"] = $currency;
$_SESSION["paymentType"] = '';
$_SESSION['ipaddress'] = $_SERVER['REMOTE_ADDR']; // Payer ip
@@ -328,7 +328,7 @@ if ($action == 'charge')
*/
$head='';
if (! empty($conf->global->STRIPE_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->STRIPE_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
if (! empty($conf->global->ONLINE_PAYMENT_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
$conf->dol_hide_topmenu=1;
$conf->dol_hide_leftmenu=1;
@@ -369,14 +369,14 @@ print "\n";
print '<table id="dolpaymenttable" summary="Payment form" class="center">'."\n";
// Show logo (search order: logo defined by PAYBOX_LOGO_suffix, then PAYBOX_LOGO, then small company logo, large company logo, theme logo, common logo)
// Show logo (search order: logo defined by PAYMENT_LOGO_suffix, then PAYMENT_LOGO, then small company logo, large company logo, theme logo, common logo)
$width=0;
// Define logo and logosmall
$logosmall=$mysoc->logo_small;
$logo=$mysoc->logo;
$paramlogo='STRIPE_LOGO_'.$suffix;
$paramlogo='PAYMENT_LOGO_'.$suffix;
if (! empty($conf->global->$paramlogo)) $logosmall=$conf->global->$paramlogo;
else if (! empty($conf->global->STRIPE_LOGO)) $logosmall=$conf->global->STRIPE_LOGO;
else if (! empty($conf->global->PAYMENT_LOGO)) $logosmall=$conf->global->PAYMENT_LOGO;
//print '<!-- Show logo (logosmall='.$logosmall.' logo='.$logo.') -->'."\n";
// Define urllogo
$urllogo='';
@@ -401,11 +401,11 @@ if ($urllogo)
// Output introduction text
$text='';
if (! empty($conf->global->STRIPE_NEWFORM_TEXT))
if (! empty($conf->global->PAYMENT_NEWFORM_TEXT))
{
$langs->load("members");
if (preg_match('/^\((.*)\)$/',$conf->global->STRIPE_NEWFORM_TEXT,$reg)) $text.=$langs->trans($reg[1])."<br>\n";
else $text.=$conf->global->STRIPE_NEWFORM_TEXT."<br>\n";
if (preg_match('/^\((.*)\)$/',$conf->global->PAYMENT_NEWFORM_TEXT,$reg)) $text.=$langs->trans($reg[1])."<br>\n";
else $text.=$conf->global->PAYMENT_NEWFORM_TEXT."<br>\n";
$text='<tr><td align="center"><br>'.$text.'<br></td></tr>'."\n";
}
if (empty($text))

View File

@@ -82,24 +82,24 @@ if (! empty($_SESSION['ipaddress'])) // To avoid to make action twice
$paymentType = $_SESSION['paymentType'];
$FinalPaymentAmt = $_SESSION['FinalPaymentAmt'];
$ipaddress = $_SESSION['ipaddress'];
// Appel des triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($db);
$result=$interface->run_triggers('STRIPE_PAYMENT_KO',$object,$user,$langs,$conf);
if ($result < 0) { $error++; $errors=$interface->errors; }
// Fin appel triggers
// Send an email
$sendemail = '';
if (! empty($conf->global->PAYPAL_PAYONLINE_SENDEMAIL)) $sendemail=$conf->global->PAYPAL_PAYONLINE_SENDEMAIL;
if (! empty($conf->global->ONLINE_PAYMENT_SENDEMAIL)) $sendemail=$conf->global->ONLINE_PAYMENT_SENDEMAIL;
if ($sendemail)
{
// Get on url call
$sendto=$sendemail;
$from=$conf->global->MAILING_EMAIL_FROM;
// Define link to login card
$appli=constant('DOL_APPLICATION_TITLE');
if (! empty($conf->global->MAIN_APPLICATION_TITLE))
@@ -112,7 +112,7 @@ if (! empty($_SESSION['ipaddress'])) // To avoid to make action twice
else $appli.=" ".DOL_VERSION;
}
else $appli.=" ".DOL_VERSION;
$urlback=$_SERVER["REQUEST_URI"];
$topic='['.$appli.'] '.$langs->transnoentitiesnoconv("NewOnlinePaymentFailed");
$content="";
@@ -124,7 +124,7 @@ if (! empty($_SESSION['ipaddress'])) // To avoid to make action twice
$content.="tag=".$fulltag."\ntoken=".$onlinetoken." paymentType=".$paymentType." currencycodeType=".$currencyCodeType." payerId=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt;
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
$mailfile = new CMailFile($topic, $sendto, $from, $content);
$result=$mailfile->sendfile();
if ($result)
{
@@ -140,7 +140,7 @@ if (! empty($_SESSION['ipaddress'])) // To avoid to make action twice
}
$head='';
if (! empty($conf->global->STRIPE_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->STRIPE_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
if (! empty($conf->global->ONLINE_PAYMENT_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
$conf->dol_hide_topmenu=1;
$conf->dol_hide_leftmenu=1;
@@ -153,7 +153,7 @@ print '<span id="dolpaymentspan"></span>'."\n";
print '<div id="dolpaymentdiv" align="center">'."\n";
print $langs->trans("YourPaymentHasNotBeenRecorded")."<br><br>";
if (! empty($conf->global->STRIPE_MESSAGE_KO)) print $conf->global->STRIPE_MESSAGE_KO;
if (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_KO)) print $conf->global->ONLINE_PAYMENT_MESSAGE_KO;
print "\n</div>\n";

View File

@@ -82,7 +82,7 @@ foreach($_POST as $k => $v) $tracepost .= "{$k} - {$v}\n";
dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_stripe');
$head='';
if (! empty($conf->global->STRIPE_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->STRIPE_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
if (! empty($conf->global->ONLINE_PAYMENT_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
$conf->dol_hide_topmenu=1;
$conf->dol_hide_leftmenu=1;
@@ -105,7 +105,7 @@ if ($ispaymentok)
// Set by newpayment.php
$paymentType = $_SESSION['PaymentType'];
$currencyCodeType = $_SESSION['currencyCodeType'];
$FinalPaymentAmt = $_SESSION["Payment_Amount"];
$FinalPaymentAmt = $_SESSION["FinalPaymentAmt"];
// From env
$ipaddress = $_SESSION['ipaddress'];
$TRANSACTIONID = $_SESSION['TRANSACTIONID'];
@@ -117,14 +117,14 @@ if ($ispaymentok)
if ($result < 0) { $error++; $errors=$interface->errors; }
// Fin appel triggers
print $langs->trans("YourPaymentHasBeenRecorded")."<br>\n";
print $langs->trans("ThisIsTransactionId",$TRANSACTIONID)."<br><br>\n";
if (! empty($conf->global->STRIPE_MESSAGE_OK)) print $conf->global->STRIPE_MESSAGE_OK;
if (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_OK)) print $conf->global->ONLINE_PAYMENT_MESSAGE_OK;
$sendemail = '';
if (! empty($conf->global->STRIPE_PAYONLINE_SENDEMAIL)) $sendemail=$conf->global->STRIPE_PAYONLINE_SENDEMAIL;
if (! empty($conf->global->ONLINE_PAYMENT_SENDEMAIL)) $sendemail=$conf->global->ONLINE_PAYMENT_SENDEMAIL;
// Send an email
if ($sendemail)
{
@@ -147,7 +147,7 @@ if ($ispaymentok)
else $appli.=" ".DOL_VERSION;
}
else $appli.=" ".DOL_VERSION;
$urlback=$_SERVER["REQUEST_URI"];
$topic='['.$appli.'] '.$langs->transnoentitiesnoconv("NewOnlinePaymentReceived");
$tmptag=dolExplodeIntoArray($fulltag,'.','=');

View File

@@ -37,7 +37,7 @@ $langs->load("paybox");
$langs->load("stripe");
if (! $user->admin) accessforbidden();
$action = GETPOST('action','alpha');
@@ -55,17 +55,17 @@ if ($action == 'setvalue' && $user->admin)
if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "STRIPE_LIVE_SECRET_KEY",GETPOST('STRIPE_LIVE_SECRET_KEY','alpha'),'chaine',0,'',$conf->entity);
if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "STRIPE_CREDITOR",GETPOST('STRIPE_CREDITOR','alpha'),'chaine',0,'',$conf->entity);
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_CREDITOR",GETPOST('ONLINE_PAYMENT_CREDITOR','alpha'),'chaine',0,'',$conf->entity);
if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "STRIPE_CSS_URL",GETPOST('STRIPE_CSS_URL','alpha'),'chaine',0,'',$conf->entity);
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_CSS_URL",GETPOST('ONLINE_PAYMENT_CSS_URL','alpha'),'chaine',0,'',$conf->entity);
if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "STRIPE_MESSAGE_OK",GETPOST('STRIPE_MESSAGE_OK','alpha'),'chaine',0,'',$conf->entity);
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_OK",GETPOST('ONLINE_PAYMENT_MESSAGE_OK','alpha'),'chaine',0,'',$conf->entity);
if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "STRIPE_MESSAGE_KO",GETPOST('STRIPE_MESSAGE_KO','alpha'),'chaine',0,'',$conf->entity);
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_KO",GETPOST('ONLINE_PAYMENT_MESSAGE_KO','alpha'),'chaine',0,'',$conf->entity);
if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "STRIPE_PAYONLINE_SENDEMAIL",GETPOST('STRIPE_PAYONLINE_SENDEMAIL'),'chaine',0,'',$conf->entity);
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_SENDEMAIL",GETPOST('ONLINE_PAYMENT_SENDEMAIL'),'chaine',0,'',$conf->entity);
if (! $result > 0) $error++;
if (! $error)
{
$db->commit();
@@ -184,31 +184,31 @@ print "</tr>\n";
print '<tr class="oddeven"><td>';
print $langs->trans("VendorName").'</td><td>';
print '<input size="64" type="text" name="STRIPE_CREDITOR" value="'.$conf->global->STRIPE_CREDITOR.'">';
print '<input size="64" type="text" name="ONLINE_PAYMENT_CREDITOR" value="'.$conf->global->ONLINE_PAYMENT_CREDITOR.'">';
print ' &nbsp; '.$langs->trans("Example").': '.$mysoc->name;
print '</td></tr>';
print '<tr class="oddeven"><td>';
print $langs->trans("CSSUrlForPaymentForm").'</td><td>';
print '<input size="64" type="text" name="STRIPE_CSS_URL" value="'.$conf->global->STRIPE_CSS_URL.'">';
print '<input size="64" type="text" name="ONLINE_PAYMENT_CSS_URL" value="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'">';
print ' &nbsp; '.$langs->trans("Example").': http://mysite/mycss.css';
print '</td></tr>';
print '<tr class="oddeven"><td>';
print $langs->trans("MessageOK").'</td><td>';
$doleditor=new DolEditor('STRIPE_MESSAGE_OK',$conf->global->STRIPE_MESSAGE_OK,'',100,'dolibarr_details','In',false,true,true,ROWS_2,'90%');
$doleditor=new DolEditor('ONLINE_PAYMENT_MESSAGE_OK',$conf->global->ONLINE_PAYMENT_MESSAGE_OK,'',100,'dolibarr_details','In',false,true,true,ROWS_2,'90%');
$doleditor->Create();
print '</td></tr>';
print '<tr class="oddeven"><td>';
print $langs->trans("MessageKO").'</td><td>';
$doleditor=new DolEditor('STRIPE_MESSAGE_KO',$conf->global->STRIPE_MESSAGE_KO,'',100,'dolibarr_details','In',false,true,true,ROWS_2,'90%');
$doleditor=new DolEditor('ONLINE_PAYMENT_MESSAGE_KO',$conf->global->ONLINE_PAYMENT_MESSAGE_KO,'',100,'dolibarr_details','In',false,true,true,ROWS_2,'90%');
$doleditor->Create();
print '</td></tr>';
print '<tr class="oddeven"><td>';
print $langs->trans("STRIPE_PAYONLINE_SENDEMAIL").'</td><td>';
print '<input size="32" type="email" name="STRIPE_PAYONLINE_SENDEMAIL" value="'.$conf->global->STRIPE_PAYONLINE_SENDEMAIL.'">';
print $langs->trans("ONLINE_PAYMENT_SENDEMAIL").'</td><td>';
print '<input size="32" type="email" name="ONLINE_PAYMENT_SENDEMAIL" value="'.$conf->global->ONLINE_PAYMENT_SENDEMAIL.'">';
print ' &nbsp; '.$langs->trans("Example").': myemail@myserver.com';
print '</td></tr>';

View File

@@ -343,6 +343,26 @@ input.smallpadd { /* Used for timesheet input */
input.buttongen {
vertical-align: middle;
}
input.buttonpayment {
width: 300px;
margin-bottom: 15px;
background-image: none;
}
input.buttonpaymentpaypal {
background-image: url(<?php echo dol_buildpath($path.'/paypal/img/object_paypal.png',1) ?>);
background-repeat: no-repeat;
background-position: 5px 4px;
}
input.buttonpaymentpaybox {
background-image: url(<?php echo dol_buildpath($path.'/paybox/img/object_paybox.png',1) ?>);
background-repeat: no-repeat;
background-position: 5px 4px;
}
input.buttonpaymentstripe {
background-image: url(<?php echo dol_buildpath($path.'/stripe/img/object_stripe.png',1) ?>);
background-repeat: no-repeat;
background-position: 5px 3px;
}
span.timesheetalreadyrecorded input {
border: none;
border-bottom: solid 1px rgba(0,0,0,0.4);
@@ -1224,21 +1244,6 @@ div#id-top {
display:none;
<?php } else { ?>
background: rgb(<?php echo $colorbackhmenu1 ?>);
/*-webkit-box-shadow: 0 0 6px rgba(0,0,0,0.4);
box-shadow: 0 0 6px rgba(0,0,0,0.4); */
/*
background-image: linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%);
background-image: -o-linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%);
background-image: -moz-linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%);
background-image: -webkit-linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%);
background-image: -ms-linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%);
background-image: -webkit-gradient( linear, left top, left bottom, color-stop(0, rgba(255,255,255,.1)), color-stop(1, rgba(0,0,0,.4)) );
*/
/*<?php if ($disableimages) { ?>
height: 34px;
<?php } else { ?>
height: <?php print $heightmenu2; ?>px;
<?php } ?>*/
<?php } ?>
}
@@ -1310,15 +1315,6 @@ ul.tmenu { /* t r b l */
display: table;
}
ul.tmenu li { /* We need this to have background color when menu entry wraps on new lines */
/* background: rgb(<?php echo $colorbackhmenu1 ?>);
/*
background-image: linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%);
background-image: -o-linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%);
background-image: -moz-linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%);
background-image: -webkit-linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%);
background-image: -ms-linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%);
background-image: -webkit-gradient( linear, left top, left bottom, color-stop(0, rgba(255,255,255,.1)), color-stop(1, rgba(0,0,0,.4)) );
*/
}
li.tmenu, li.tmenusel {
<?php print $minwidthtmenu?'min-width: '.$minwidthtmenu.'px;':''; ?>