forked from Wavyzz/dolibarr
Merge branch 'develop' into clean_10_beta
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2013-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
@@ -111,6 +111,8 @@ if ($action == 'update') {
|
||||
|
||||
$accounting_product_modes = array (
|
||||
'ACCOUNTANCY_SELL',
|
||||
'ACCOUNTANCY_SELL_INTRA',
|
||||
'ACCOUNTANCY_SELL_EXPORT',
|
||||
'ACCOUNTANCY_BUY'
|
||||
);
|
||||
|
||||
@@ -158,6 +160,12 @@ if ($action == 'update') {
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
|
||||
$sql .= " SET accountancy_code_sell = " . $accounting->account_number;
|
||||
}
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
|
||||
$sql .= " SET accountancy_code_sell_intra = " . $accounting->account_number;
|
||||
}
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT') {
|
||||
$sql .= " SET accountancy_code_sell_export = " . $accounting->account_number;
|
||||
}
|
||||
$sql .= " WHERE rowid = " . $productid;
|
||||
|
||||
dol_syslog("/accountancy/admin/productaccount.php sql=" . $sql, LOG_DEBUG);
|
||||
@@ -192,16 +200,20 @@ $form = new FormAccounting($db);
|
||||
// at this time ACCOUNTING_SERVICE_SOLD_ACCOUNT & ACCOUNTING_PRODUCT_SOLD_ACCOUNT are account number not accountingacount rowid
|
||||
// so we need to get those default value rowid first
|
||||
$accounting = new AccountingAccount($db);
|
||||
// TODO: we should need to check if result is a really exist accountaccount rowid.....
|
||||
$aarowid_servbuy = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT, 1);
|
||||
$aarowid_prodbuy = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT, 1);
|
||||
$aarowid_servsell = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT, 1);
|
||||
$aarowid_prodsell = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT, 1);
|
||||
// TODO: we should need to check if result is already exists accountaccount rowid.....
|
||||
$aarowid_servbuy = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT, 1);
|
||||
$aarowid_prodbuy = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT, 1);
|
||||
$aarowid_servsell = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT, 1);
|
||||
$aarowid_prodsell = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT, 1);
|
||||
$aarowid_prodsell_intra = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT, 1);
|
||||
$aarowid_prodsell_export = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT, 1);
|
||||
|
||||
$aacompta_servbuy = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodbuy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_servsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodsell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_servbuy = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodbuy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_servsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodsell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodsell_intra = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodsell_export = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
|
||||
llxHeader('', $langs->trans("ProductsBinding"));
|
||||
|
||||
@@ -209,27 +221,45 @@ $pcgverid = $conf->global->CHARTOFACCOUNTS;
|
||||
$pcgvercode = dol_getIdFromCode($db, $pcgverid, 'accounting_system', 'rowid', 'pcg_version');
|
||||
if (empty($pcgvercode)) $pcgvercode=$pcgverid;
|
||||
|
||||
$sql = "SELECT p.rowid, p.ref, p.label, p.description, p.tosell, p.tobuy, p.accountancy_code_sell, p.accountancy_code_buy, p.tms, p.fk_product_type as product_type,";
|
||||
$sql = "SELECT p.rowid, p.ref, p.label, p.description, p.tosell, p.tobuy, p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export, p.accountancy_code_buy, p.tms, p.fk_product_type as product_type,";
|
||||
$sql.= " aa.rowid as aaid";
|
||||
$sql.= " FROM " . MAIN_DB_PREFIX . "product as p";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON";
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
||||
$sql.=" p.accountancy_code_buy = aa.account_number AND aa.fk_pcg_version = '" . $pcgvercode . "'";
|
||||
}
|
||||
else
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL')
|
||||
{
|
||||
$sql.=" p.accountancy_code_sell = aa.account_number AND aa.fk_pcg_version = '" . $pcgvercode . "'";
|
||||
}
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA')
|
||||
{
|
||||
$sql.=" p.accountancy_code_sell_intra = aa.account_number AND aa.fk_pcg_version = '" . $pcgvercode . "'";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql.=" p.accountancy_code_sell_intra = aa.account_number AND aa.fk_pcg_version = '" . $pcgvercode . "'";
|
||||
}
|
||||
$sql.= ' WHERE p.entity IN ('.getEntity('product').')';
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
||||
if (strlen(trim($search_current_account))) {
|
||||
$sql .= natural_search("p.accountancy_code_buy", $search_current_account);
|
||||
}
|
||||
} else {
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
|
||||
if (strlen(trim($search_current_account))) {
|
||||
$sql .= natural_search("p.accountancy_code_sell", $search_current_account);
|
||||
}
|
||||
}
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
|
||||
if (strlen(trim($search_current_account))) {
|
||||
$sql .= natural_search("p.accountancy_code_sell_intra", $search_current_account);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (strlen(trim($search_current_account))) {
|
||||
$sql .= natural_search("p.accountancy_code_sell_export", $search_current_account);
|
||||
}
|
||||
}
|
||||
if ($search_current_account_valid == 'withoutvalidaccount')
|
||||
{
|
||||
$sql .= " AND aa.account_number IS NULL";
|
||||
@@ -301,9 +331,18 @@ if ($result)
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>' . $langs->trans('Options') . '</td><td>' . $langs->trans('Description') . '</td>';
|
||||
print "</tr>\n";
|
||||
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_SELL"' . ($accounting_product_mode != 'ACCOUNTANCY_BUY' ? ' checked' : '') . '> ' . $langs->trans('OptionModeProductSell') . '</td>';
|
||||
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_SELL"' . ($accounting_product_mode == 'ACCOUNTANCY_SELL' ? ' checked' : '') . '> ' . $langs->trans('OptionModeProductSell') . '</td>';
|
||||
print '<td>'.$langs->trans('OptionModeProductSellDesc');
|
||||
print "</td></tr>\n";
|
||||
if ($mysoc->isInEEC())
|
||||
{
|
||||
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_SELL_INTRA"' . ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA' ? ' checked' : '') . '> ' . $langs->trans('OptionModeProductSellIntra') . '</td>';
|
||||
print '<td>'.$langs->trans('OptionModeProductSellIntraDesc');
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_SELL_EXPORT"' . ($accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT' ? ' checked' : '') . '> ' . $langs->trans('OptionModeProductSellExport') . '</td>';
|
||||
print '<td>'.$langs->trans('OptionModeProductSellExportDesc');
|
||||
print "</td></tr>\n";
|
||||
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_BUY"' . ($accounting_product_mode == 'ACCOUNTANCY_BUY' ? ' checked' : '') . '> ' . $langs->trans('OptionModeProductBuy') . '</td>';
|
||||
print '<td>'.$langs->trans('OptionModeProductBuyDesc')."</td></tr>\n";
|
||||
print "</table>\n";
|
||||
@@ -318,8 +357,8 @@ if ($result)
|
||||
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
|
||||
$buttonsave = '<input type="submit" class="button" id="changeaccount" name="changeaccount" value="' . $langs->trans("Save") . '">';
|
||||
//print '<br><div class="center">'.$buttonsave.'</div>';
|
||||
$buttonsave = '<input type="submit" class="button" id="changeaccount" name="changeaccount" value="' . $langs->trans("Save") . '">';
|
||||
//print '<br><div class="center">'.$buttonsave.'</div>';
|
||||
|
||||
$texte=$langs->trans("ListOfProductsServices");
|
||||
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $buttonsave, $num, $nbtotalofrecords, '', 0, '', '', $limit);
|
||||
@@ -332,7 +371,7 @@ if ($result)
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
||||
if (! empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
||||
// On sell
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_SELL') print '<td class="liste_titre"></td>';
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_SELL' || $accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA' || $accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT') print '<td class="liste_titre"></td>';
|
||||
// On buy
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') print '<td class="liste_titre"></td>';
|
||||
// Current account
|
||||
@@ -352,10 +391,19 @@ if ($result)
|
||||
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
|
||||
if (! empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "p.description", "", $param, '', $sortfield, $sortorder);
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_SELL') print_liste_field_titre("OnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') print_liste_field_titre("OnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') $fieldtosortaccount="p.accountancy_code_buy";
|
||||
else $fieldtosortaccount="p.accountancy_code_sell";
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
|
||||
print_liste_field_titre("OnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
$fieldtosortaccount="p.accountancy_code_sell";
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
|
||||
print_liste_field_titre("OnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
$fieldtosortaccount="p.accountancy_code_sell_intra";
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT') {
|
||||
print_liste_field_titre("OnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
$fieldtosortaccount="p.accountancy_code_sell_export";
|
||||
} else {
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') print_liste_field_titre("OnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
$fieldtosortaccount="p.accountancy_code_buy";
|
||||
}
|
||||
print_liste_field_titre("CurrentDedicatedAccountingAccount", $_SERVER["PHP_SELF"], $fieldtosortaccount, "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("AssignDedicatedAccountingAccount");
|
||||
$clickpitco=$form->showCheckAddButtons('checkforselect', 1);
|
||||
@@ -378,10 +426,16 @@ if ($result)
|
||||
$product_static->status = $obj->tosell;
|
||||
$product_static->status_buy = $obj->tobuy;
|
||||
|
||||
if ($obj->product_type == 0) {
|
||||
if ($obj->product_type == 0 && $accounting_product_mode == 'ACCOUNTANCY_SELL') {
|
||||
$compta_prodsell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell_id = $aarowid_prodsell;
|
||||
} else {
|
||||
} elseif ($obj->product_type == 0 && $accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
|
||||
$compta_prodsell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell_id = $aarowid_prodsell_intra;
|
||||
} elseif ($obj->product_type == 0 && $accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT') {
|
||||
$compta_prodsell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell_id = $aarowid_prodsell_export;
|
||||
} else {
|
||||
$compta_prodsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell_id = $aarowid_servsell;
|
||||
}
|
||||
@@ -411,7 +465,7 @@ if ($result)
|
||||
print '<td style="' . $code_sell_p_l_differ . '">' . nl2br(dol_trunc($obj->description, $trunclengh)) . '</td>';
|
||||
}
|
||||
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_SELL')
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_SELL' || $accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA' || $accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT')
|
||||
print '<td class="center">'.$product_static->getLibStatut(3, 0).'</td>';
|
||||
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY')
|
||||
@@ -422,12 +476,16 @@ if ($result)
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
||||
print length_accountg($obj->accountancy_code_buy);
|
||||
if ($obj->accountancy_code_buy && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount"));
|
||||
}
|
||||
else
|
||||
{
|
||||
print length_accountg($obj->accountancy_code_sell);
|
||||
if ($obj->accountancy_code_sell && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount"));
|
||||
}
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
|
||||
print length_accountg($obj->accountancy_code_sell);
|
||||
if ($obj->accountancy_code_sell && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount"));
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
|
||||
print length_accountg($obj->accountancy_code_sell_intra);
|
||||
if ($obj->accountancy_code_sell_intra && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount"));
|
||||
} else {
|
||||
print length_accountg($obj->accountancy_code_sell_export);
|
||||
if ($obj->accountancy_code_sell_export && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount"));
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Dedicated account
|
||||
@@ -441,7 +499,7 @@ if ($result)
|
||||
if (! empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
|
||||
print $form->select_account($defaultvalue, 'codeventil_' . $product_static->id, 1, array(), 1);
|
||||
print '</td>';
|
||||
} else {
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
|
||||
// Accounting account sell
|
||||
print '<td class="left">';
|
||||
//$defaultvalue=GETPOST('codeventil_' . $product_static->id,'alpha'); This is id and we need a code
|
||||
@@ -451,7 +509,26 @@ if ($result)
|
||||
if (! empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
|
||||
print $form->select_account($defaultvalue, 'codeventil_' . $product_static->id, 1, array(), 1);
|
||||
print '</td>';
|
||||
}
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
|
||||
// Accounting account sell intra (In EEC)
|
||||
print '<td class="left">';
|
||||
//$defaultvalue=GETPOST('codeventil_' . $product_static->id,'alpha'); This is id and we need a code
|
||||
if (empty($defaultvalue)) $defaultvalue=$compta_prodsell;
|
||||
$codesell=length_accountg($obj->accountancy_code_sell_intra);
|
||||
//var_dump($defaultvalue.' - '.$codesell.' - '.$compta_prodsell);
|
||||
if (! empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
|
||||
print $form->select_account($defaultvalue, 'codeventil_' . $product_static->id, 1, array(), 1);
|
||||
print '</td>';
|
||||
} else {
|
||||
// Accounting account sell export (Out of EEC)
|
||||
print '<td class="left">';
|
||||
//$defaultvalue=GETPOST('codeventil_' . $product_static->id,'alpha'); This is id and we need a code
|
||||
if (empty($defaultvalue)) $defaultvalue=$compta_prodsell;
|
||||
$codesell=length_accountg($obj->accountancy_code_sell_export);
|
||||
if (! empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
|
||||
print $form->select_account($defaultvalue, 'codeventil_' . $product_static->id, 1, array(), 1);
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Checkbox select
|
||||
print '<td class="center">';
|
||||
@@ -462,7 +539,6 @@ if ($result)
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
// Example : Adding jquery code
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
function init_savebutton()
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2013-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -30,6 +30,7 @@ require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
|
||||
|
||||
@@ -53,26 +54,31 @@ $offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if ($sortorder == "")
|
||||
$sortorder = "DESC";
|
||||
$sortorder = "ASC";
|
||||
if ($sortfield == "")
|
||||
$sortfield = "bk.doc_date";
|
||||
|
||||
$search_year = GETPOST("search_year", 'int');
|
||||
$search_doc_type = GETPOST("search_doc_type", 'alpha');
|
||||
/*
|
||||
$search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int'));
|
||||
$search_date_end = dol_mktime(0, 0, 0, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int'));
|
||||
//$search_doc_type = GETPOST("search_doc_type", 'alpha');
|
||||
$search_doc_ref = GETPOST("search_doc_ref", 'alpha');
|
||||
*/
|
||||
|
||||
$lettering = GETPOST('lettering', 'alpha');
|
||||
if (! empty($lettering)) {
|
||||
$action = $lettering;
|
||||
}
|
||||
|
||||
// Did we click on purge search criteria ?
|
||||
// All tests are required to be compatible with all browsers
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
|
||||
$search_year = '';
|
||||
$search_doc_type = '';
|
||||
/*
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$search_date_start = '';
|
||||
$search_date_end = '';
|
||||
//$search_doc_type = '';
|
||||
$search_doc_ref = '';
|
||||
}
|
||||
*/
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST("socid", 'int');
|
||||
@@ -102,6 +108,7 @@ if ($action == 'lettering') {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
if ($action == 'autolettrage') {
|
||||
|
||||
$result = $lettering->letteringThirdparty($socid);
|
||||
@@ -111,9 +118,9 @@ if ($action == 'autolettrage') {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
@@ -136,19 +143,17 @@ dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'n
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<br>';
|
||||
|
||||
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, ";
|
||||
$sql .= " bk.subledger_account, bk.numero_compte , bk.label_compte, bk.debit, ";
|
||||
$sql .= " bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.lettering_code ";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
|
||||
$sql .= " WHERE (bk.subledger_account = '" . $object->code_compta . "' AND bk.numero_compte = '" . $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER . "' )";
|
||||
|
||||
if (dol_strlen($search_year)) {
|
||||
$date_start = dol_mktime(0, 0, 0, 1, 1, $search_year);
|
||||
$date_end = dol_mktime(23, 59, 59, 12, 31, $search_year);
|
||||
$sql .= " AND ( bk.doc_date BETWEEN '" . $db->idate($date_start) . "' AND '" . $db->idate($date_end) . "' )";
|
||||
/*
|
||||
if (dol_strlen($search_date_start) || dol_strlen($search_date_end)) {
|
||||
$sql .= " AND ( bk.doc_date BETWEEN '" . $db->idate($search_date_start) . "' AND '" . $db->idate($search_date_end) . "' )";
|
||||
}
|
||||
*/
|
||||
|
||||
$sql.= ' AND bk.entity IN ('.getEntity('accountingbookkeeping').')';
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
@@ -190,83 +195,110 @@ if ($resql) {
|
||||
print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '?socid=' . $object->id . '" method="POST">';
|
||||
print '<input type="hidden" name="socid" value="' . $object->id . '">';
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, '', '', $limit);
|
||||
$letteringbutton = '<a class="divButAction"><span class="valignmiddle"><input class="butAction" type="submit" value="lettering" name="lettering" id="lettering"></span></a>';
|
||||
//$letteringbutton = '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=lettering" value="lettering" name="lettering" id="lettering"><span class="valignmiddle">' . $langs->trans("Lettering") . '</span></a>';
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, $letteringbutton, '', $limit);
|
||||
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
|
||||
/*
|
||||
print '<tr class="liste_titre">';
|
||||
//print '<td><input type="text" name="search_doc_type" value="' . $search_doc_type . '"></td>';
|
||||
|
||||
// Date
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From') . ' ';
|
||||
print $form->selectDate($search_date_start, 'date_creation_start', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to') . ' ';
|
||||
print $form->selectDate($search_date_end, 'date_creation_end', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
|
||||
// Piece
|
||||
print '<td><input type="text" name="search_doc_ref" value="' . $search_doc_ref . '"></td>';
|
||||
|
||||
print '<td colspan="6"> </td>';
|
||||
print '<td class="right">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
*/
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("Doctype", $_SERVER["PHP_SELF"], "bk.doc_type", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Docdate", $_SERVER["PHP_SELF"], "bk.doc_date", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Docref", $_SERVER["PHP_SELF"], "bk.doc_ref", "", $param, "", $sortfield, $sortorder);
|
||||
//print_liste_field_titre("Doctype", $_SERVER["PHP_SELF"], "bk.doc_type", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Docdate", $_SERVER["PHP_SELF"], "bk.doc_date", "", $param, "", $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre("Piece", $_SERVER["PHP_SELF"], "bk.doc_ref", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("LabelAccount", $_SERVER["PHP_SELF"], "bk.label_compte", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Debit", $_SERVER["PHP_SELF"], "bk.debit", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Credit", $_SERVER["PHP_SELF"], "bk.credit", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Balancing", $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Codejournal", $_SERVER["PHP_SELF"], "bk.code_journal", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("LetteringCode", $_SERVER["PHP_SELF"], "bk.lettering_code", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Codejournal", $_SERVER["PHP_SELF"], "bk.code_journal", "", $param, "", $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre("LetteringCode", $_SERVER["PHP_SELF"], "bk.lettering_code", "", $param, "", $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre("", "", "", '', '', "", $sortfield, $sortorder, 'maxwidthsearch center ');
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td><input type="text" name="search_doc_type" value="' . $search_doc_type . '"></td>';
|
||||
print '<td><input type="text" name="search_year" value="' . $search_year . '"></td>';
|
||||
print '<td><input type="text" name="search_doc_refe" value="' . $search_doc_ref . '"></td>';
|
||||
print '<td colspan="5"> </td>';
|
||||
print '<td class="right">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
$solde = 0;
|
||||
$tmp = '';
|
||||
while ( $obj = $db->fetch_object($resql) ) {
|
||||
|
||||
while ( $obj = $db->fetch_object($resql) ) {
|
||||
|
||||
if ($tmp != $obj->lettering_code || empty($tmp)) $tmp = $obj->lettering_code;
|
||||
/*if ($tmp != $obj->lettering_code || empty($obj->lettering_code))*/ $solde += ($obj->credit - $obj->debit);
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
if (empty($obj->lettering_code)) {
|
||||
print '<td><a href="' . dol_buildpath('/accountancy/bookkeeping/card.php', 1) . '?piece_num=' . $obj->piece_num . '">';
|
||||
print img_edit();
|
||||
print '</a> ' . $obj->doc_type . '</td>' . "\n";
|
||||
} else {
|
||||
print '<td>' . $obj->doc_type . '</td>' . "\n";
|
||||
}
|
||||
|
||||
print '<td>' . dol_print_date($db->jdate($obj->doc_date), 'day') . '</td>';
|
||||
//print '<td>' . $obj->doc_type . '</td>' . "\n";
|
||||
print '<td class="center">' . dol_print_date($db->jdate($obj->doc_date), 'day') . '</td>';
|
||||
print '<td>' . $obj->doc_ref . '</td>';
|
||||
print '<td>' . $obj->label_compte . '</td>';
|
||||
print '<td class="right">' . price($obj->debit) . '</td>';
|
||||
print '<td class="right">' . price($obj->credit) . '</td>';
|
||||
print '<td class="right">' . price(round($solde, 2)) . '</td>';
|
||||
print '<td class="center">' . $obj->code_journal . '</td>';
|
||||
|
||||
if (empty($obj->lettering_code)) {
|
||||
print '<td class="nowrap center"><input type="checkbox" class="flat checkforselect" name="toselect[]" id="toselect[]" value="' . $obj->rowid . '" /></td>';
|
||||
} else
|
||||
print '<td class="center">' . $obj->lettering_code . '</td>';
|
||||
// Journal
|
||||
$accountingjournal = new AccountingJournal($db);
|
||||
$result = $accountingjournal->fetch('', $obj->code_journal);
|
||||
$journaltoshow = (($result > 0)?$accountingjournal->getNomUrl(0, 0, 0, '', 0) : $obj->code_journal);
|
||||
print '<td class="center">' . $journaltoshow . '</td>';
|
||||
|
||||
if (empty($obj->lettering_code)) {
|
||||
print '<td class="nowrap center"><input type="checkbox" class="flat checkforselect" name="toselect[]" id="toselect[]" value="' . $obj->rowid . '" /></td>';
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?piece_num=' . $obj->piece_num . '">';
|
||||
print img_edit();
|
||||
print '</a></td>' . "\n";
|
||||
} else {
|
||||
print '<td class="center">' . $obj->lettering_code . '</td>';
|
||||
print '<td></td>';
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="right" colspan="4">'.$langs->trans("Total").':</td>' . "\n";
|
||||
print '<td class="right" colspan="3">'.$langs->trans("Total").':</td>' . "\n";
|
||||
print '<td class="right"><strong>' . price($debit) . '</strong></td>';
|
||||
print '<td class="right"><strong>' . price($credit) . '</strong></td>';
|
||||
print '<td colspan="5"></td>';
|
||||
print '<td colspan="4"></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="right" colspan="4">'.$langs->trans("Balancing").':</td>' . "\n";
|
||||
print '<td class="right" colspan="3">'.$langs->trans("Balancing").':</td>' . "\n";
|
||||
print '<td colspan="2"> </td>';
|
||||
print '<td class="right"><strong>' . price($credit - $debit) . '</strong></td>';
|
||||
print '<td colspan="3"></td>';
|
||||
print '<td colspan="6"></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print "</table>";
|
||||
|
||||
print '<input class="butAction" type="submit" value="lettering" name="lettering" id="lettering">';
|
||||
//print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?socid=' . $object->id . '&action=autolettering">' . $langs->trans('AccountancyAutoLettering') . '</a>';
|
||||
print '<div class="tabsAction tabsActionNoBottom">'."\n";
|
||||
print $letteringbutton;
|
||||
print '</div>';
|
||||
|
||||
print "</form>";
|
||||
$db->free($resql);
|
||||
} else {
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2013-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -30,6 +30,7 @@ require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
|
||||
|
||||
@@ -53,27 +54,31 @@ $offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if ($sortorder == "")
|
||||
$sortorder = "DESC";
|
||||
$sortorder = "ASC";
|
||||
if ($sortfield == "")
|
||||
$sortfield = "bk.doc_date";
|
||||
|
||||
$search_year = GETPOST("search_year", 'int');
|
||||
$search_doc_type = GETPOST("search_doc_type", 'alpha');
|
||||
$search_doc_ref = GETPOST("search_doc_ref", 'alpha');
|
||||
/*
|
||||
$search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int'));
|
||||
$search_date_end = dol_mktime(0, 0, 0, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int'));
|
||||
//$search_doc_type = GETPOST("search_doc_type",'alpha');
|
||||
$search_doc_ref = GETPOST("search_doc_ref",'alpha');
|
||||
*/
|
||||
|
||||
$lettering = GETPOST('lettering', 'alpha');
|
||||
if (!empty($lettering)) {
|
||||
$action=$lettering;
|
||||
}
|
||||
|
||||
// Did we click on purge search criteria ?
|
||||
// All tests are required to be compatible with all browsers
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha'))
|
||||
/*
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$search_year='';
|
||||
$search_doc_type='';
|
||||
$search_date_start = '';
|
||||
$search_date_end = '';
|
||||
//$search_doc_type='';
|
||||
$search_doc_ref='';
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
// Security check
|
||||
@@ -103,6 +108,7 @@ if ($action == 'lettering') {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
if ($action == 'autolettrage') {
|
||||
|
||||
$result = $lettering->letteringThirdparty($socid);
|
||||
@@ -112,7 +118,7 @@ if ($action == 'autolettrage') {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
* View
|
||||
@@ -142,10 +148,8 @@ $sql .= " bk.subledger_account, bk.numero_compte , bk.label_compte, bk.debit, ";
|
||||
$sql .= " bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.lettering_code ";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
|
||||
$sql .= " WHERE (bk.subledger_account = '" . $object->code_compta_fournisseur . "' AND bk.numero_compte = '" . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . "' )";
|
||||
if (dol_strlen($search_year)) {
|
||||
$date_start = dol_mktime(0, 0, 0, 1, 1, $search_year);
|
||||
$date_end = dol_mktime(23, 59, 59, 12, 31, $search_year);
|
||||
$sql .= " AND ( bk.doc_date BETWEEN '".$db->idate($date_start)."' AND '".$db->idate($date_end)."' )";
|
||||
if (dol_strlen($search_date_start) || dol_strlen($search_date_end)) {
|
||||
$sql .= " AND (bk.doc_date BETWEEN '".$db->idate($search_date_start)."' AND '".$db->idate($search_date_end)."' )";
|
||||
}
|
||||
$sql.= ' AND bk.entity IN ('.getEntity('accountingbookkeeping').')';
|
||||
$sql.= $db->order($sortfield, $sortorder);
|
||||
@@ -190,32 +194,52 @@ if ($resql) {
|
||||
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'?socid=' . $object->id . '" method="POST">';
|
||||
print '<input type="hidden" name="socid" value="' . $object->id . '">';
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, '', '', $limit);
|
||||
$letteringbutton = '<a class="divButAction"><span class="valignmiddle"><input class="butAction" type="submit" value="lettering" name="lettering" id="lettering"></span></a>';
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, $letteringbutton, '', $limit);
|
||||
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
|
||||
/*
|
||||
print '<tr class="liste_titre">';
|
||||
//print '<td><input type="text" name="search_doc_type" value="' . $search_doc_type . '"></td>';
|
||||
|
||||
// Date
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From') . ' ';
|
||||
print $form->selectDate($search_date_start, 'date_creation_start', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to') . ' ';
|
||||
print $form->selectDate($search_date_end, 'date_creation_end', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
|
||||
// Piece
|
||||
print '<td><input type="text" name="search_doc_ref" value="' . $search_doc_ref . '"></td>';
|
||||
|
||||
print '<td colspan="6"> </td>';
|
||||
print '<td class="right">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
*/
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("Doctype", $_SERVER["PHP_SELF"], "bk.doc_type", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Docdate", $_SERVER["PHP_SELF"], "bk.doc_date", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Docref", $_SERVER["PHP_SELF"], "bk.doc_ref", "", $param, "", $sortfield, $sortorder);
|
||||
//print_liste_field_titre("Doctype", $_SERVER["PHP_SELF"], "bk.doc_type", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Docdate", $_SERVER["PHP_SELF"], "bk.doc_date", "", $param, "", $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre("Piece", $_SERVER["PHP_SELF"], "bk.doc_ref", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("LabelAccount", $_SERVER["PHP_SELF"], "bk.label_compte", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Debit", $_SERVER["PHP_SELF"], "bk.debit", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Credit", $_SERVER["PHP_SELF"], "bk.credit", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Balancing", $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Codejournal", $_SERVER["PHP_SELF"], "bk.code_journal", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("LetteringCode", $_SERVER["PHP_SELF"], "bk.lettering_code", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Codejournal", $_SERVER["PHP_SELF"], "bk.code_journal", "", $param, "", $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre("LetteringCode", $_SERVER["PHP_SELF"], "bk.lettering_code", "", $param, "", $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre("", "", "", '', '', "", $sortfield, $sortorder, 'maxwidthsearch center ');
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td><input type="text" name="search_doc_type" value="' . $search_doc_type . '"></td>';
|
||||
print '<td><input type="text" name="search_year" value="' . $search_year . '"></td>';
|
||||
print '<td><input type="text" name="search_doc_refe" value="' . $search_doc_ref . '"></td>';
|
||||
print '<td colspan="6"> </td>';
|
||||
print '<td class="right">';
|
||||
$searchpicto=$form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
$solde = 0;
|
||||
$tmp = '';
|
||||
while ($obj = $db->fetch_object($resql)) {
|
||||
@@ -225,48 +249,53 @@ if ($resql) {
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
if (empty($obj->lettering_code)) {
|
||||
print '<td><a href="' . dol_buildpath('/accountancy/bookkeeping/card.php', 1) . '?piece_num=' . $obj->piece_num . '">';
|
||||
print img_edit();
|
||||
print '</a> ' . $obj->doc_type . '</td>' . "\n";
|
||||
} else {
|
||||
print '<td>' . $obj->doc_type . '</td>' . "\n";
|
||||
}
|
||||
|
||||
print '<td>' . dol_print_date($db->jdate($obj->doc_date), 'day') . '</td>';
|
||||
//print '<td>' . $obj->doc_type . '</td>' . "\n";
|
||||
print '<td class="center">' . dol_print_date($db->jdate($obj->doc_date), 'day') . '</td>';
|
||||
print '<td>' . $obj->doc_ref . '</td>';
|
||||
print '<td>' . $obj->label_compte . '</td>';
|
||||
print '<td class="right">' . price($obj->debit) . '</td>';
|
||||
print '<td class="right">' . price($obj->credit) . '</td>';
|
||||
print '<td class="right">' . price(round($solde, 2)) . '</td>';
|
||||
print '<td class="center">' . $obj->code_journal . '</td>';
|
||||
|
||||
// Journal
|
||||
$accountingjournal = new AccountingJournal($db);
|
||||
$result = $accountingjournal->fetch('', $obj->code_journal);
|
||||
$journaltoshow = (($result > 0)?$accountingjournal->getNomUrl(0, 0, 0, '', 0) : $obj->code_journal);
|
||||
print '<td class="center">' . $journaltoshow . '</td>';
|
||||
|
||||
if (empty($obj->lettering_code)) {
|
||||
print '<td class="nowrap center"><input type="checkbox" class="flat checkforselect" name="toselect[]" id="toselect[]" value="' . $obj->rowid . '" /></td>';
|
||||
} else
|
||||
print '<td class="center">' . $obj->lettering_code . '</td>';
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?piece_num=' . $obj->piece_num . '">';
|
||||
print img_edit();
|
||||
print '</a></td>' . "\n";
|
||||
} else {
|
||||
print '<td class="center">' . $obj->lettering_code . '</td>';
|
||||
print '<td></td>';
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="right" colspan="4">'.$langs->trans("Total").':</td>' . "\n";
|
||||
print '<td class="right" colspan="3">'.$langs->trans("Total").':</td>' . "\n";
|
||||
print '<td class="right"><strong>' . price($debit) . '</strong></td>';
|
||||
print '<td class="right"><strong>' . price($credit) . '</strong></td>';
|
||||
print '<td colspan="5"></td>';
|
||||
print '<td colspan="6"></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="right" colspan="4">'.$langs->trans("Balancing").':</td>' . "\n";
|
||||
print '<td class="right" colspan="3">'.$langs->trans("Balancing").':</td>' . "\n";
|
||||
print '<td colspan="2"> </td>';
|
||||
print '<td class="right"><strong>' . price($credit - $debit) . '</strong></td>';
|
||||
print '<td colspan="3"></td>';
|
||||
print '<td colspan="4"></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print "</table>";
|
||||
|
||||
print '<input class="butAction" type="submit" value="' . $langs->trans('AccountancyLettering') . '" name="lettering" id="lettering">';
|
||||
//print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?socid=' . $object->id . '&action=autolettrage">'.$langs->trans('AccountancyAutoLettering').'</a>';
|
||||
print '<div class="tabsAction tabsActionNoBottom">'."\n";
|
||||
print $letteringbutton;
|
||||
print '</div>';
|
||||
|
||||
print "</form>";
|
||||
$db->free($resql);
|
||||
} else {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2013-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -66,13 +66,13 @@ class Lettering extends BookKeeping
|
||||
$sql .= " , bk.sens , bk.code_journal , bk.piece_num, bk.date_lettering, bu.url_id , bu.type ";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu ON(bk.fk_doc = bu.fk_bank AND bu.type IN ('payment', 'payment_supplier') ) ";
|
||||
$sql .= " WHERE ( ";
|
||||
$sql .= " WHERE ( ";
|
||||
if (! empty($object->code_compta))
|
||||
$sql .= " bk.subledger_account = '" . $object->code_compta . "' ";
|
||||
$sql .= " bk.subledger_account = '" . $object->code_compta . "' ";
|
||||
if (! empty($object->code_compta) && ! empty($object->code_compta_fournisseur))
|
||||
$sql .= " OR ";
|
||||
$sql .= " OR ";
|
||||
if (! empty($object->code_compta_fournisseur))
|
||||
$sql .= " bk.subledger_account = '" . $object->code_compta_fournisseur . "' ";
|
||||
$sql .= " bk.subledger_account = '" . $object->code_compta_fournisseur . "' ";
|
||||
|
||||
$sql .= " ) AND (bk.date_lettering ='' OR bk.date_lettering IS NULL) ";
|
||||
$sql .= " AND (bk.lettering_code != '' OR bk.lettering_code IS NULL) ";
|
||||
@@ -128,15 +128,15 @@ class Lettering extends BookKeeping
|
||||
$sql .= " AND facf.entity = ".$conf->entity;
|
||||
$sql .= " AND ( ";
|
||||
if (! empty($object->code_compta)) {
|
||||
$sql .= " bk.subledger_account = '" . $object->code_compta . "' ";
|
||||
$sql .= " bk.subledger_account = '" . $object->code_compta . "' ";
|
||||
}
|
||||
if (! empty($object->code_compta) && ! empty($object->code_compta_fournisseur)) {
|
||||
$sql .= " OR ";
|
||||
$sql .= " OR ";
|
||||
}
|
||||
if (! empty($object->code_compta_fournisseur)) {
|
||||
$sql .= " bk.subledger_account = '" . $object->code_compta_fournisseur . "' ";
|
||||
$sql .= " bk.subledger_account = '" . $object->code_compta_fournisseur . "' ";
|
||||
}
|
||||
$sql .= " ) ";
|
||||
$sql .= ") ";
|
||||
|
||||
$resql2 = $this->db->query($sql);
|
||||
if ($resql2) {
|
||||
@@ -253,7 +253,7 @@ class Lettering extends BookKeeping
|
||||
$error++;
|
||||
}
|
||||
|
||||
$sql = "SELECT SUM(ABS(debit)) as deb, SUM(ABS(credit)) as cred FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE ";
|
||||
$sql = "SELECT SUM(ABS(debit)) as deb, SUM(ABS(credit)) as cred FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE ";
|
||||
$sql .= " rowid IN (" . implode(',', $ids) . ") ";
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
|
||||
@@ -82,7 +82,7 @@ if (! empty($canvas))
|
||||
}
|
||||
|
||||
// Security check
|
||||
$result=restrictedArea($user, 'adherent', $id, '', '', 'fk_soc', 'rowid', $objcanvas);
|
||||
$result=restrictedArea($user, 'adherent', $id, '', '', 'socid', 'rowid', $objcanvas);
|
||||
|
||||
if ($id > 0)
|
||||
{
|
||||
@@ -163,10 +163,10 @@ if (empty($reshook))
|
||||
$error=0;
|
||||
if (! $error)
|
||||
{
|
||||
if ($socid != $object->fk_soc) // If link differs from currently in database
|
||||
if ($socid != $object->socid) // If link differs from currently in database
|
||||
{
|
||||
$sql ="SELECT rowid FROM ".MAIN_DB_PREFIX."adherent";
|
||||
$sql.=" WHERE fk_soc = '".$socid."'";
|
||||
$sql.=" WHERE socid = '".$socid."'";
|
||||
$sql.=" AND entity = ".$conf->entity;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
@@ -492,7 +492,7 @@ if (empty($reshook))
|
||||
//$object->note = $comment;
|
||||
$object->morphy = $morphy;
|
||||
$object->user_id = $userid;
|
||||
$object->fk_soc = $socid;
|
||||
$object->socid = $socid;
|
||||
$object->public = $public;
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
@@ -1333,10 +1333,10 @@ else
|
||||
if (! empty($conf->societe->enabled))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("LinkedToDolibarrThirdParty").'</td><td colspan="2" class="valeur">';
|
||||
if ($object->fk_soc)
|
||||
if ($object->socid)
|
||||
{
|
||||
$company=new Societe($db);
|
||||
$result=$company->fetch($object->fk_soc);
|
||||
$result=$company->fetch($object->socid);
|
||||
print $company->getNomUrl(1);
|
||||
}
|
||||
else
|
||||
@@ -1421,7 +1421,7 @@ else
|
||||
$text=$langs->trans("ConfirmCreateLogin").'<br>';
|
||||
if (! empty($conf->societe->enabled))
|
||||
{
|
||||
if ($object->fk_soc > 0) $text.=$langs->trans("UserWillBeExternalUser");
|
||||
if ($object->socid > 0) $text.=$langs->trans("UserWillBeExternalUser");
|
||||
else $text.=$langs->trans("UserWillBeInternalUser");
|
||||
}
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"]."?rowid=".$object->id, $langs->trans("CreateDolibarrLogin"), $text, "confirm_create_user", $formquestion, 'yes');
|
||||
@@ -1688,17 +1688,17 @@ else
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
|
||||
print '<tr><td>';
|
||||
print $form->select_company($object->fk_soc, 'socid', '', 1);
|
||||
print $form->select_company($object->socid, 'socid', '', 1);
|
||||
print '</td>';
|
||||
print '<td class="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
|
||||
print '</tr></table></form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($object->fk_soc)
|
||||
if ($object->socid)
|
||||
{
|
||||
$company=new Societe($db);
|
||||
$result=$company->fetch($object->fk_soc);
|
||||
$result=$company->fetch($object->socid);
|
||||
print $company->getNomUrl(1);
|
||||
}
|
||||
else
|
||||
@@ -1848,7 +1848,7 @@ else
|
||||
}
|
||||
|
||||
// Create third party
|
||||
if (! empty($conf->societe->enabled) && ! $object->fk_soc)
|
||||
if (! empty($conf->societe->enabled) && ! $object->socid)
|
||||
{
|
||||
if ($user->rights->societe->creer)
|
||||
{
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
* Copyright (C) 2015-2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2018-2019 Thibault FOUCART <support@ptibogxiv.net>
|
||||
*
|
||||
* 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
|
||||
@@ -557,7 +558,7 @@ class Adherent extends CommonObject
|
||||
$sql.= ", gender = ".($this->gender != -1 ? "'".$this->db->escape($this->gender)."'" : "null"); // 'man' or 'woman'
|
||||
$sql.= ", login = ".($this->login?"'".$this->db->escape($this->login)."'":"null");
|
||||
$sql.= ", societe = ".($this->societe?"'".$this->db->escape($this->societe)."'":"null");
|
||||
$sql.= ", fk_soc = ".($this->fk_soc > 0?$this->db->escape($this->fk_soc):"null");
|
||||
$sql.= ", fk_soc = ".($this->socid > 0?$this->db->escape($this->socid):"null");
|
||||
$sql.= ", address = ".($this->address?"'".$this->db->escape($this->address)."'":"null");
|
||||
$sql.= ", zip = ".($this->zip?"'".$this->db->escape($this->zip)."'":"null");
|
||||
$sql.= ", town = ".($this->town?"'".$this->db->escape($this->town)."'":"null");
|
||||
@@ -1223,7 +1224,7 @@ class Adherent extends CommonObject
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$sql = "SELECT d.rowid, d.ref_ext, d.civility as civility_id, d.gender, d.firstname, d.lastname, d.societe as company, d.fk_soc, d.statut, d.public, d.address, d.zip, d.town, d.note_private,";
|
||||
$sql = "SELECT d.rowid, d.ref_ext, d.civility as civility_code, d.gender, d.firstname, d.lastname, d.societe as company, d.fk_soc, d.statut, d.public, d.address, d.zip, d.town, d.note_private,";
|
||||
$sql.= " d.note_public,";
|
||||
$sql.= " d.email, d.skype, d.twitter, d.facebook, d.linkedin, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass, d.pass_crypted,";
|
||||
$sql.= " d.photo, d.fk_adherent_type, d.morphy, d.entity,";
|
||||
@@ -1267,7 +1268,11 @@ class Adherent extends CommonObject
|
||||
$this->ref = $obj->rowid;
|
||||
$this->id = $obj->rowid;
|
||||
$this->ref_ext = $obj->ref_ext;
|
||||
$this->civility_id = $obj->civility_id;
|
||||
|
||||
$this->civility_id = $obj->civility_code; // Bad. Kept for backard compatibility
|
||||
$this->civility_code = $obj->civility_code;
|
||||
$this->civility = $obj->civility_code?($langs->trans("Civility".$obj->civility_code) != ("Civility".$obj->civility_code) ? $langs->trans("Civility".$obj->civility_code) : $obj->civility_code):'';
|
||||
|
||||
$this->firstname = $obj->firstname;
|
||||
$this->lastname = $obj->lastname;
|
||||
$this->gender = $obj->gender;
|
||||
|
||||
@@ -251,6 +251,7 @@ print '<tr class="liste_titre">';
|
||||
$texthelp=$langs->trans("PageUrlForDefaultValues");
|
||||
if ($mode == 'createform') $texthelp.=$langs->trans("PageUrlForDefaultValuesCreate", 'societe/card.php', 'societe/card.php?abc=val1&def=val2');
|
||||
else $texthelp.=$langs->trans("PageUrlForDefaultValuesList", 'societe/list.php', 'societe/list.php?abc=val1&def=val2');
|
||||
$texthelp.='<br><br>'.$langs->trans("AlsoDefaultValuesAreEffectiveForActionCreate");
|
||||
$texturl=$form->textwithpicto($langs->trans("Url"), $texthelp);
|
||||
print_liste_field_titre($texturl, $_SERVER["PHP_SELF"], 'page,param', '', $param, '', $sortfield, $sortorder);
|
||||
// Field
|
||||
|
||||
@@ -652,6 +652,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
if ($fieldnamekey == 'sortorder') $fieldnamekey = 'SortOrder';
|
||||
if ($fieldnamekey == 'category_type') $fieldnamekey = 'Calculated';
|
||||
if ($fieldnamekey == 'revenuestamp_type') $fieldnamekey = 'TypeOfRevenueStamp';
|
||||
if ($fieldnamekey == 'use_default') $fieldnamekey = 'UseByDefault';
|
||||
|
||||
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
|
||||
}
|
||||
@@ -1053,11 +1054,12 @@ if ($id)
|
||||
continue;
|
||||
}
|
||||
|
||||
// Determine le nom du champ par rapport aux noms possibles
|
||||
// dans les dictionnaires de donnees
|
||||
// Define field friedly name from its technical name
|
||||
$valuetoshow=ucfirst($fieldlist[$field]); // Par defaut
|
||||
$valuetoshow=$langs->trans($valuetoshow); // try to translate
|
||||
$class='';
|
||||
|
||||
if ($fieldlist[$field]=='pos') { $valuetoshow=$langs->trans("Position"); $class='width100'; }
|
||||
if ($fieldlist[$field]=='source') { $valuetoshow=$langs->trans("Contact"); }
|
||||
if ($fieldlist[$field]=='price') { $valuetoshow=$langs->trans("PriceUHT"); }
|
||||
if ($fieldlist[$field]=='taux') {
|
||||
@@ -1125,6 +1127,7 @@ if ($id)
|
||||
if ($fieldlist[$field]=='range_ik') { $valuetoshow=$langs->trans("RangeIk"); }
|
||||
if ($fieldlist[$field]=='fk_c_exp_tax_cat') { $valuetoshow=$langs->trans("CarCategory"); }
|
||||
if ($fieldlist[$field]=='revenuestamp_type') { $valuetoshow=$langs->trans('TypeOfRevenueStamp'); }
|
||||
if ($fieldlist[$field]=='use_default') { $valuetoshow=$langs->trans('Default'); }
|
||||
|
||||
if ($id == 2) // Special cas for state page
|
||||
{
|
||||
@@ -1197,8 +1200,10 @@ if ($id)
|
||||
|
||||
print '</form>';
|
||||
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from', 'alpha')).'">';
|
||||
@@ -1221,7 +1226,7 @@ if ($id)
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
// Title line with search boxes
|
||||
// Title line with search input fields
|
||||
print '<tr class="liste_titre_filter">';
|
||||
$filterfound=0;
|
||||
foreach ($fieldlist as $field => $value)
|
||||
@@ -1276,17 +1281,12 @@ if ($id)
|
||||
// dans les dictionnaires de donnees
|
||||
$showfield=1; // By defaut
|
||||
$align="left";
|
||||
$cssprefix='';
|
||||
$sortable=1;
|
||||
$valuetoshow='';
|
||||
/*
|
||||
$tmparray=getLabelOfField($fieldlist[$field]);
|
||||
$showfield=$tmp['showfield'];
|
||||
$valuetoshow=$tmp['valuetoshow'];
|
||||
$align=$tmp['align'];
|
||||
$sortable=$tmp['sortable'];
|
||||
*/
|
||||
$valuetoshow=ucfirst($fieldlist[$field]); // By defaut
|
||||
$valuetoshow=$langs->trans($valuetoshow); // try to translate
|
||||
|
||||
// Special cases
|
||||
if ($fieldlist[$field]=='source') { $valuetoshow=$langs->trans("Contact"); }
|
||||
if ($fieldlist[$field]=='price') { $valuetoshow=$langs->trans("PriceUHT"); }
|
||||
if ($fieldlist[$field]=='taux') {
|
||||
@@ -1304,10 +1304,7 @@ if ($id)
|
||||
if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); }
|
||||
if ($fieldlist[$field]=='position') { $align='right'; }
|
||||
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Label"); }
|
||||
if ($fieldlist[$field]=='libelle_facture') {
|
||||
//$valuetoshow=$form->textwithtooltip($langs->trans("LabelOnDocuments"), $langs->trans("LabelUsedByDefault"),2,1,img_help(1,''));
|
||||
$valuetoshow=$langs->trans("LabelOnDocuments");
|
||||
}
|
||||
if ($fieldlist[$field]=='libelle_facture') { $valuetoshow=$langs->trans("LabelOnDocuments"); }
|
||||
if ($fieldlist[$field]=='country') { $valuetoshow=$langs->trans("Country"); }
|
||||
if ($fieldlist[$field]=='recuperableonly') { $valuetoshow=$langs->trans("NPR"); $align="center"; }
|
||||
if ($fieldlist[$field]=='nbjour') { $valuetoshow=$langs->trans("NbOfDays"); }
|
||||
@@ -1316,7 +1313,6 @@ if ($id)
|
||||
if ($fieldlist[$field]=='width' || $fieldlist[$field]=='nx') { $valuetoshow=$langs->trans("Width"); }
|
||||
if ($fieldlist[$field]=='height' || $fieldlist[$field]=='ny') { $valuetoshow=$langs->trans("Height"); }
|
||||
if ($fieldlist[$field]=='unit' || $fieldlist[$field]=='metric') { $valuetoshow=$langs->trans("MeasuringUnit"); }
|
||||
if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $showfield=0; }
|
||||
if ($fieldlist[$field]=='accountancy_code'){ $valuetoshow=$langs->trans("AccountancyCode"); }
|
||||
if ($fieldlist[$field]=='accountancy_code_sell'){ $valuetoshow=$langs->trans("AccountancyCodeSell"); $sortable=0; }
|
||||
if ($fieldlist[$field]=='accountancy_code_buy'){ $valuetoshow=$langs->trans("AccountancyCodeBuy"); $sortable=0; }
|
||||
@@ -1347,11 +1343,14 @@ if ($id)
|
||||
if ($fieldlist[$field]=='range_ik') { $valuetoshow=$langs->trans("RangeIk"); }
|
||||
if ($fieldlist[$field]=='fk_c_exp_tax_cat') { $valuetoshow=$langs->trans("CarCategory"); }
|
||||
if ($fieldlist[$field]=='revenuestamp_type') { $valuetoshow=$langs->trans('TypeOfRevenueStamp'); }
|
||||
if ($fieldlist[$field]=='use_default') { $valuetoshow=$langs->trans('Default'); }
|
||||
|
||||
// Affiche nom du champ
|
||||
if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $showfield=0; }
|
||||
|
||||
// Show field title
|
||||
if ($showfield)
|
||||
{
|
||||
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable?$fieldlist[$field]:''), ($page?'page='.$page.'&':''), $param, "align=".$align, $sortfield, $sortorder);
|
||||
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable?$fieldlist[$field]:''), ($page?'page='.$page.'&':''), $param, "align=".$align, $sortfield, $sortorder, $cssprefix);
|
||||
}
|
||||
}
|
||||
// Favorite - Only activated on country dictionary
|
||||
@@ -1806,7 +1805,6 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
if (in_array('region_id', $fieldlist))
|
||||
{
|
||||
print '<td>';
|
||||
//print join(',',$fieldlist);
|
||||
print '</td>';
|
||||
continue;
|
||||
} // For state page, we do not show the country input (we link to region, not country)
|
||||
@@ -1912,7 +1910,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
print '<td><input type="text" class="flat minwidth75" value="'.price((! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'')).'" name="'.$fieldlist[$field].'"></td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) {
|
||||
print '<td class="maxxxx"><input type="text" class="flat minwidth75 maxwidth100" value="'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'"></td>';
|
||||
print '<td><input type="text" class="flat minwidth75 maxwidth100" value="'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'"></td>';
|
||||
}
|
||||
elseif ($fieldlist[$field]=='unit') {
|
||||
print '<td>';
|
||||
@@ -1972,12 +1970,8 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
|
||||
$classtd=''; $class='';
|
||||
if ($fieldlist[$field]=='code') $classtd='width100';
|
||||
if ($fieldlist[$field]=='affect') $class='maxwidth50';
|
||||
if ($fieldlist[$field]=='delay') $class='maxwidth50';
|
||||
if ($fieldlist[$field]=='position') $class='maxwidth50';
|
||||
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $class='quatrevingtpercent';
|
||||
if ($fieldlist[$field]=='tracking') $class='quatrevingtpercent';
|
||||
if ($fieldlist[$field]=='sortorder' || $fieldlist[$field]=='sens' || $fieldlist[$field]=='category_type') $class='maxwidth50';
|
||||
if (in_array($fieldlist[$field], array('pos', 'use_default', 'affect', 'delay', 'position', 'sortorder', 'sens', 'category_type'))) $class='maxwidth50';
|
||||
if (in_array($fieldlist[$field], array('libelle', 'label', 'tracking'))) $class='quatrevingtpercent';
|
||||
print '<td class="'.$classtd.'">';
|
||||
$transfound=0;
|
||||
if (in_array($fieldlist[$field], array('label','libelle')))
|
||||
|
||||
@@ -17,7 +17,10 @@
|
||||
*/
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/admin/dolistore/class/PSWebServiceLibrary.class.php';
|
||||
if (! class_exists('PrestaShopWebservice')) // We keep this because some modules add this lib too into a different path. This is to avoid "Cannot declare class PrestaShopWebservice" errors.
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/admin/dolistore/class/PSWebServiceLibrary.class.php';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -76,9 +76,7 @@ elseif ($action == 'update_currency')
|
||||
{
|
||||
$error = 0;
|
||||
|
||||
$submit = GETPOST('submit', 'alpha');
|
||||
|
||||
if ($submit == $langs->trans('Modify'))
|
||||
if (GETPOST('updatecurrency', 'alpha'))
|
||||
{
|
||||
$fk_multicurrency = GETPOST('fk_multicurrency', 'int');
|
||||
$rate = price2num(GETPOST('rate', 'alpha'));
|
||||
@@ -97,7 +95,7 @@ elseif ($action == 'update_currency')
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif ($submit == $langs->trans('Delete'))
|
||||
elseif (GETPOST('deletecurrency', 'alpha'))
|
||||
{
|
||||
$fk_multicurrency = GETPOST('fk_multicurrency', 'int');
|
||||
$currency = new MultiCurrency($db);
|
||||
@@ -109,9 +107,18 @@ elseif ($action == 'update_currency')
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif ($action == 'synchronize')
|
||||
elseif ($action == 'setapilayer')
|
||||
{
|
||||
MultiCurrency::syncRates($conf->global->MULTICURRENCY_APP_ID);
|
||||
if (GETPOSTISSET('modify_apilayer'))
|
||||
{
|
||||
dolibarr_set_const($db, 'MULTICURRENCY_APP_ID', GETPOST('MULTICURRENCY_APP_ID', 'alpha'));
|
||||
dolibarr_set_const($db, 'MULTICURRENCY_APP_SOURCE', GETPOST('MULTICURRENCY_APP_SOURCE', 'alpha'));
|
||||
//dolibarr_set_const($db, 'MULTICURRENCY_ALTERNATE_SOURCE', GETPOST('MULTICURRENCY_ALTERNATE_SOURCE', 'alpha'));
|
||||
}
|
||||
else
|
||||
{
|
||||
MultiCurrency::syncRates($conf->global->MULTICURRENCY_APP_ID);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -177,17 +184,20 @@ if ($conf->use_javascript_ajax) {
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
//Online payment with currency on document
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->transnoentitiesnoconv("multicurrency_useCurrency").'</td>';
|
||||
print '<td align="center">';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('MULTICURRENCY_USE_CURRENCY_ON_DOCUMENT');
|
||||
} else {
|
||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||
print $form->selectarray("MULTICURRENCY_USE_CURRENCY_ON_DOCUMENT", $arrval, $conf->global->MULTICURRENCY_USE_CURRENCY_ON_DOCUMENT);
|
||||
// Online payment with currency on document. This option should be on by default.
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||
{
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->transnoentitiesnoconv("MULTICURRENCY_USE_CURRENCY_ON_DOCUMENT").'</td>';
|
||||
print '<td align="center">';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('MULTICURRENCY_USE_CURRENCY_ON_DOCUMENT');
|
||||
} else {
|
||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||
print $form->selectarray("MULTICURRENCY_USE_CURRENCY_ON_DOCUMENT", $arrval, $conf->global->MULTICURRENCY_USE_CURRENCY_ON_DOCUMENT);
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
/* TODO uncomment when the functionality will integrated
|
||||
|
||||
@@ -224,59 +234,48 @@ print '<br>';
|
||||
|
||||
if (!empty($conf->global->MAIN_MULTICURRENCY_ALLOW_SYNCHRONIZATION))
|
||||
{
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'" id="form_sync">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="setapilayer">';
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$form->textwithpicto($langs->trans("CurrencyLayerAccount"), $langs->trans("CurrencyLayerAccount_help_to_synchronize")).'</td>'."\n";
|
||||
print '<td class="right">';
|
||||
print '<form id="form_sync" action="" method="POST">';
|
||||
print '<input type="hidden" name="action" value="synchronize" />';
|
||||
print '<textarea id="response" class="hideobject" name="response"></textarea>';
|
||||
print $langs->trans("Value").' <input type="button" id="bt_sync" class="button" onclick="javascript:getRates();" value="'.$langs->trans('Synchronize').'" />';
|
||||
print '</form>';
|
||||
print '</td></tr>';
|
||||
$urlforapilayer='https://currencylayer.com'; //https://apilayer.net
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$form->textwithpicto($langs->trans("CurrencyLayerAccount"), $langs->trans("CurrencyLayerAccount_help_to_synchronize", $urlforapilayer)).'</td>'."\n";
|
||||
print '<td class="right">';
|
||||
print '<textarea id="response" class="hideobject" name="response"></textarea>';
|
||||
print '<input type="submit" name="modify_apilayer" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print '<input type="submit" id="bt_sync" name="bt_sync_apilayer" class="button" value="'.$langs->trans('Synchronize').'" />';
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td><a target="_blank" href="https://currencylayer.com">'.$langs->transnoentitiesnoconv("multicurrency_appId").'</a></td>';
|
||||
print '<td class="fieldrequired"><a target="_blank" href="'.$urlforapilayer.'">'.$langs->transnoentitiesnoconv("multicurrency_appId").'</a></td>';
|
||||
print '<td class="right">';
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="set_MULTICURRENCY_APP_ID">';
|
||||
print '<input type="text" name="MULTICURRENCY_APP_ID" value="'.$conf->global->MULTICURRENCY_APP_ID.'" size="28" /> ';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->transnoentitiesnoconv("multicurrency_appCurrencySource").'</td>';
|
||||
print '<td class="right">';
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="set_MULTICURRENCY_APP_SOURCE">';
|
||||
print '<input type="text" name="MULTICURRENCY_APP_SOURCE" value="'.$conf->global->MULTICURRENCY_APP_SOURCE.'" size="10" placeholder="USD" /> '; // Default: USD
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
/*print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->transnoentitiesnoconv("multicurrency_alternateCurrencySource").'</td>';
|
||||
print '<td class="right">';
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="set_MULTICURRENCY_ALTERNATE_SOURCE">';
|
||||
print '<input type="text" name="MULTICURRENCY_ALTERNATE_SOURCE" value="'.$conf->global->MULTICURRENCY_ALTERNATE_SOURCE.'" size="10" placeholder="EUR" /> '; // Example: EUR
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
print '</td></tr>';
|
||||
print '</td></tr>';*/
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
@@ -287,15 +286,17 @@ print '<td align="center">'.$langs->trans("Rate").'</td>'."\n";
|
||||
print '</tr>';
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$form->selectCurrency('', 'code').'</td>';
|
||||
print '<td class="right">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="add_currency">';
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$form->selectCurrency('', 'code', 1).'</td>';
|
||||
print '<td class="right">';
|
||||
print '<input type="text" name="rate" value="" size="13" placeholder="'.$langs->trans('Rate').'" /> ';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
@@ -316,8 +317,8 @@ foreach ($TCurrency as &$currency)
|
||||
print '<input type="hidden" name="fk_multicurrency" value="'.$currency->id.'">';
|
||||
print '1 '.$conf->currency.' = ';
|
||||
print '<input type="text" name="rate" value="'.($currency->rate->rate ? $currency->rate->rate : '').'" size="13" /> '.$currency->code.' ';
|
||||
print '<input type="submit" name="submit" class="button" value="'.$langs->trans("Modify").'"> ';
|
||||
print '<input type="submit" name="submit" class="button" value="'.$langs->trans("Delete").'">';
|
||||
print '<input type="submit" name="updatecurrency" class="button" value="'.$langs->trans("Modify").'"> ';
|
||||
print '<input type="submit" name="deletecurrency" class="button" value="'.$langs->trans("Delete").'">';
|
||||
print '</form>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
@@ -330,15 +331,7 @@ print '
|
||||
function getRates()
|
||||
{
|
||||
$("#bt_sync").attr("disabled", true);
|
||||
var url_sync = "http://apilayer.net/api/live?access_key='.$conf->global->MULTICURRENCY_APP_ID.'&format=1'.(!empty($conf->global->MULTICURRENCY_APP_SOURCE) ? '&source='.$conf->global->MULTICURRENCY_APP_SOURCE : '').'";
|
||||
|
||||
$.ajax({
|
||||
url: url_sync,
|
||||
dataType: "jsonp"
|
||||
}).done(function(response) {
|
||||
$("#response").val(JSON.stringify(response));
|
||||
$("#form_sync").submit();
|
||||
});
|
||||
return true;
|
||||
}
|
||||
</script>
|
||||
';
|
||||
|
||||
@@ -216,7 +216,7 @@ class DolibarrApi
|
||||
*
|
||||
* @param string $resource element to check
|
||||
* @param int $resource_id Object ID if we want to check a particular record (optional) is linked to a owned thirdparty (optional).
|
||||
* @param type $dbtablename 'TableName&SharedElement' with Tablename is table where object is stored. SharedElement is an optional key to define where to check entity. Not used if objectid is null (optional)
|
||||
* @param string $dbtablename 'TableName&SharedElement' with Tablename is table where object is stored. SharedElement is an optional key to define where to check entity. Not used if objectid is null (optional)
|
||||
* @param string $feature2 Feature to check, second level of permission (optional). Can be or check with 'level1|level2'.
|
||||
* @param string $dbt_keyfield Field name for socid foreign key if not fk_soc. Not used if objectid is null (optional)
|
||||
* @param string $dbt_select Field name for select if not rowid. Not used if objectid is null (optional)
|
||||
|
||||
@@ -234,12 +234,13 @@ if (! empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/swagger.json' &&
|
||||
|
||||
$classname = ucwords($module);
|
||||
|
||||
dol_syslog('Search /' . $moduledirforclass . '/class/api_' . $classfile . '.class.php => dir_part_file=' . $dir_part_file . ' classname=' . $classname);
|
||||
dol_syslog('Search api file /' . $moduledirforclass . '/class/api_' . $classfile . '.class.php => dir_part_file=' . $dir_part_file . ' classname=' . $classname);
|
||||
|
||||
$res = false;
|
||||
if ($dir_part_file)
|
||||
$res = include_once $dir_part_file;
|
||||
if (! $res) {
|
||||
dol_syslog('Failed to make include_once '.$dir_part_file, LOG_WARNING);
|
||||
print 'API not found (failed to include API file)';
|
||||
header('HTTP/1.1 501 API not found (failed to include API file)');
|
||||
exit(0);
|
||||
|
||||
@@ -28,21 +28,13 @@ require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php';
|
||||
*/
|
||||
|
||||
/**
|
||||
* API class for bom bom
|
||||
* API class for bom
|
||||
*
|
||||
* @access protected
|
||||
* @class DolibarrApiAccess {@requires user,external}
|
||||
*/
|
||||
class BOMs extends DolibarrApi
|
||||
class Boms extends DolibarrApi
|
||||
{
|
||||
/**
|
||||
* @var array $FIELDS Mandatory fields, checked when create and update object
|
||||
*/
|
||||
static $FIELDS = array(
|
||||
'label'
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* @var BOM $bom {@type BOM}
|
||||
*/
|
||||
@@ -71,16 +63,16 @@ class BOMs extends DolibarrApi
|
||||
*/
|
||||
public function get($id)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->bom->read) {
|
||||
if (! DolibarrApiAccess::$user->rights->bom->read) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->bom->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (! $result) {
|
||||
throw new RestException(404, 'BOM not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('bom', $this->bom->id)) {
|
||||
if (! DolibarrApi::_checkAccessToResource('bom', $this->bom->id, 'bom_bom')) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@@ -107,33 +99,33 @@ class BOMs extends DolibarrApi
|
||||
global $db, $conf;
|
||||
|
||||
$obj_ret = array();
|
||||
$tmpobject = new BOM($db);
|
||||
|
||||
$socid = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : '';
|
||||
|
||||
$restictonsocid = 0; // Set to 1 if there is a field socid in table of object
|
||||
$restrictonsocid = 0; // Set to 1 if there is a field socid in table of object
|
||||
|
||||
// If the internal user must only see his customers, force searching by him
|
||||
$search_sale = 0;
|
||||
if ($restictonsocid && ! DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) $search_sale = DolibarrApiAccess::$user->id;
|
||||
if ($restrictonsocid && ! DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) $search_sale = DolibarrApiAccess::$user->id;
|
||||
|
||||
$sql = "SELECT t.rowid";
|
||||
if ($restictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bom_mytable as t";
|
||||
if ($restrictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX.$tmpobject->table_element." as t";
|
||||
|
||||
if ($restictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
|
||||
if ($restrictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
|
||||
$sql.= " WHERE 1 = 1";
|
||||
|
||||
// Example of use $mode
|
||||
//if ($mode == 1) $sql.= " AND s.client IN (1, 3)";
|
||||
//if ($mode == 2) $sql.= " AND s.client IN (2, 3)";
|
||||
|
||||
$tmpobject = new BOM($db);
|
||||
if ($tmpobject->ismultientitymanaged) $sql.= ' AND t.entity IN ('.getEntity('bom').')';
|
||||
if ($restictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc";
|
||||
if ($restictonsocid && $socid) $sql.= " AND t.fk_soc = ".$socid;
|
||||
if ($restictonsocid && $search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
|
||||
if ($restrictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc";
|
||||
if ($restrictonsocid && $socid) $sql.= " AND t.fk_soc = ".$socid;
|
||||
if ($restrictonsocid && $search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
|
||||
// Insert sale filter
|
||||
if ($restictonsocid && $search_sale > 0)
|
||||
if ($restrictonsocid && $search_sale > 0)
|
||||
{
|
||||
$sql .= " AND sc.fk_user = ".$search_sale;
|
||||
}
|
||||
@@ -190,7 +182,7 @@ class BOMs extends DolibarrApi
|
||||
*/
|
||||
public function post($request_data = null)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->bom->create) {
|
||||
if(! DolibarrApiAccess::$user->rights->bom->write) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
// Check mandatory fields
|
||||
@@ -215,7 +207,7 @@ class BOMs extends DolibarrApi
|
||||
*/
|
||||
public function put($id, $request_data = null)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->bom->create) {
|
||||
if(! DolibarrApiAccess::$user->rights->bom->write) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
@@ -224,7 +216,7 @@ class BOMs extends DolibarrApi
|
||||
throw new RestException(404, 'BOM not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('bom', $this->bom->id)) {
|
||||
if( ! DolibarrApi::_checkAccessToResource('bom', $this->bom->id, 'bom_bom')) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@@ -239,7 +231,7 @@ class BOMs extends DolibarrApi
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new RestException(500, $this->commande->error);
|
||||
throw new RestException(500, $this->bom->error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -259,7 +251,7 @@ class BOMs extends DolibarrApi
|
||||
throw new RestException(404, 'BOM not found');
|
||||
}
|
||||
|
||||
if (! DolibarrApi::_checkAccessToResource('bom', $this->bom->id)) {
|
||||
if (! DolibarrApi::_checkAccessToResource('bom', $this->bom->id, 'bom_bom')) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@@ -309,12 +301,13 @@ class BOMs extends DolibarrApi
|
||||
*/
|
||||
private function _validate($data)
|
||||
{
|
||||
$bom = array();
|
||||
foreach (BOMs::$FIELDS as $field) {
|
||||
$myobject = array();
|
||||
foreach ($this->myobject->fields as $field => $propfield) {
|
||||
if (in_array($field, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat')) || $propfield['notnull'] != 1) continue; // Not a mandatory field
|
||||
if (!isset($data[$field]))
|
||||
throw new RestException(400, "$field field missing");
|
||||
$bom[$field] = $data[$field];
|
||||
$myobject[$field] = $data[$field];
|
||||
}
|
||||
return $bom;
|
||||
return $myobject;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -391,8 +391,11 @@ class Categories extends DolibarrApi
|
||||
} elseif ($type == 'contact') {
|
||||
$objects_api = new Contacts();
|
||||
}
|
||||
foreach ($objects as $obj) {
|
||||
$cleaned_objects[] = $objects_api->_cleanObjectDatas($obj);
|
||||
if (is_object($objects_api))
|
||||
{
|
||||
foreach ($objects as $obj) {
|
||||
$cleaned_objects[] = $objects_api->_cleanObjectDatas($obj);
|
||||
}
|
||||
}
|
||||
|
||||
return $cleaned_objects;
|
||||
|
||||
@@ -281,6 +281,7 @@ class ActionComm extends CommonObject
|
||||
if (! empty($this->datep) && ! empty($this->datef) && $this->datep > $this->datef) $this->datef=$this->datep;
|
||||
//if (! empty($this->date) && ! empty($this->dateend) && $this->date > $this->dateend) $this->dateend=$this->date;
|
||||
if (! isset($this->fk_project) || $this->fk_project < 0) $this->fk_project = 0;
|
||||
// For backward compatibility
|
||||
if ($this->elementtype=='facture') $this->elementtype='invoice';
|
||||
if ($this->elementtype=='commande') $this->elementtype='order';
|
||||
if ($this->elementtype=='contrat') $this->elementtype='contract';
|
||||
|
||||
@@ -968,6 +968,7 @@ if ($resql)
|
||||
print ' ';
|
||||
}
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Extra fields
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2019 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
||||
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -127,6 +128,8 @@ if ($action == 'confirm_split' && GETPOST("confirm") == 'yes')
|
||||
|
||||
$db->begin();
|
||||
$discount->fk_facture_source=0; // This is to delete only the require record (that we will recreate with two records) and not all family with same fk_facture_source
|
||||
// This is to delete only the require record (that we will recreate with two records) and not all family with same fk_invoice_supplier_source
|
||||
$discount->fk_invoice_supplier_source=0;
|
||||
$res=$discount->delete($user);
|
||||
$newid1=$newdiscount1->create($user);
|
||||
$newid2=$newdiscount2->create($user);
|
||||
|
||||
@@ -200,7 +200,7 @@ if ($action == 'confirm_delete' && ! empty($permissiontodelete))
|
||||
}
|
||||
|
||||
$result=$object->delete($user);
|
||||
var_dump($result);
|
||||
//var_dump($result);
|
||||
if ($result > 0)
|
||||
{
|
||||
// Delete OK
|
||||
|
||||
@@ -2894,7 +2894,7 @@ if ($action == 'create')
|
||||
{
|
||||
// First situation invoice
|
||||
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
||||
$tmp='<input id="radio_situation invoice" type="radio" name="type" value="5"' . (GETPOST('type') == 5 ? ' checked' : '') . '> ';
|
||||
$tmp='<input id="radio_situation" type="radio" name="type" value="5"' . (GETPOST('type') == 5 ? ' checked' : '') . '> ';
|
||||
$tmp = $tmp.'<label for="radio_situation invoice" >'.$langs->trans("InvoiceFirstSituationAsk").'</label>';
|
||||
$desc = $form->textwithpicto($tmp, $langs->transnoentities("InvoiceFirstSituationDesc"), 1, 'help', '', 0, 3);
|
||||
print $desc;
|
||||
@@ -2949,7 +2949,23 @@ if ($action == 'create')
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
||||
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
||||
$tmp='<input type="radio" name="type" id="radio_situation" value="0" disabled> ';
|
||||
$text = '<label>'.$tmp.$langs->trans("InvoiceFirstSituationAsk") . '</label> ';
|
||||
$text.= '('.$langs->trans("YouMustCreateInvoiceFromThird").') ';
|
||||
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceFirstSituationDesc"), 1, 'help', '', 0, 3);
|
||||
print $desc;
|
||||
print '</div></div>';
|
||||
|
||||
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
||||
$tmp='<input type="radio" name="type" id="radio_situation" value="0" disabled> ';
|
||||
$text = '<label>'.$tmp.$langs->trans("InvoiceSituationAsk") . '</label> ';
|
||||
$text.= '('.$langs->trans("YouMustCreateInvoiceFromThird").') ';
|
||||
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceFirstSituationDesc"), 1, 'help', '', 0, 3);
|
||||
print $desc;
|
||||
print '</div></div>';
|
||||
|
||||
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
||||
$tmp='<input type="radio" name="type" id="radio_replacement" value="0" disabled> ';
|
||||
$text = '<label>'.$tmp.$langs->trans("InvoiceReplacement") . '</label> ';
|
||||
$text.= '('.$langs->trans("YouMustCreateInvoiceFromThird").') ';
|
||||
|
||||
@@ -67,6 +67,11 @@ $confirm=GETPOST('confirm', 'alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$contextpage=GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'invoicelist';
|
||||
|
||||
if ($contextpage == 'poslist')
|
||||
{
|
||||
$_GET['optioncss'] = 'print';
|
||||
}
|
||||
|
||||
$lineid=GETPOST('lineid', 'int');
|
||||
$userid=GETPOST('userid', 'int');
|
||||
$search_product_category=GETPOST('search_product_category', 'int');
|
||||
@@ -950,7 +955,12 @@ if ($resql)
|
||||
$totalpay = $facturestatic->total_ttc - $remaintopay;
|
||||
}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<tr class="oddeven"';
|
||||
if ($contextpage == 'poslist')
|
||||
{
|
||||
print ' onclick="parent.$(\'#poslines\').load(\'invoice.php?action=history&placeid='.$obj->id.'\', function() {parent.$.colorbox.close();});"';
|
||||
}
|
||||
print '>';
|
||||
if (! empty($arrayfields['f.ref']['checked']))
|
||||
{
|
||||
print '<td class="nowrap">';
|
||||
@@ -958,7 +968,14 @@ if ($resql)
|
||||
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
||||
|
||||
print '<td class="nobordernopadding nowraponall">';
|
||||
print $facturestatic->getNomUrl(1, '', 200, 0, '', 0, 1);
|
||||
if ($contextpage == 'poslist')
|
||||
{
|
||||
print $obj->ref;
|
||||
}
|
||||
else
|
||||
{
|
||||
print $facturestatic->getNomUrl(1, '', 200, 0, '', 0, 1);
|
||||
}
|
||||
print empty($obj->increment)?'':' ('.$obj->increment.')';
|
||||
|
||||
$filename=dol_sanitizeFileName($obj->ref);
|
||||
|
||||
@@ -400,7 +400,7 @@ $num = $db->num_rows($result);
|
||||
|
||||
$arrayofselected=is_array($toselect)?$toselect:array();
|
||||
|
||||
if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && ($sall != '' || $seearch_cti != ''))
|
||||
if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && ($sall != '' || $search_cti != ''))
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$id = $obj->rowid;
|
||||
|
||||
@@ -1939,7 +1939,7 @@ class Contrat extends CommonObject
|
||||
|
||||
if ($user->rights->contrat->lire) {
|
||||
$label = '<u>'.$langs->trans("ShowContract").'</u>';
|
||||
$label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
|
||||
$label .= '<br><b>'.$langs->trans('Ref').':</b> '.($this->ref?$this->ref:$this->id);
|
||||
$label .= '<br><b>'.$langs->trans('RefCustomer').':</b> '.($this->ref_customer ? $this->ref_customer : $this->ref_client);
|
||||
$label .= '<br><b>'.$langs->trans('RefSupplier').':</b> '.$this->ref_supplier;
|
||||
if (!empty($this->total_ht)) {
|
||||
@@ -1971,7 +1971,7 @@ class Contrat extends CommonObject
|
||||
|
||||
$result .= $linkstart;
|
||||
if ($withpicto) $result.=img_object(($notooltip?'':$label), $this->picto, ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
|
||||
if ($withpicto != 2) $result.= $this->ref;
|
||||
if ($withpicto != 2) $result.= ($this->ref?$this->ref:$this->id);
|
||||
$result .= $linkend;
|
||||
|
||||
return $result;
|
||||
@@ -2120,7 +2120,7 @@ class Contrat extends CommonObject
|
||||
$this->from.= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $this->from.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
|
||||
if ($mode == 'inactives')
|
||||
if ($mode == 'inactive')
|
||||
{
|
||||
$sql = "SELECT cd.rowid, cd.date_ouverture_prevue as datefin";
|
||||
$sql.= $this->from;
|
||||
@@ -2135,25 +2135,43 @@ class Contrat extends CommonObject
|
||||
$sql.= " WHERE c.statut = 1";
|
||||
$sql.= " AND c.rowid = cd.fk_contrat";
|
||||
$sql.= " AND cd.statut = 4";
|
||||
$sql.= " AND cd.date_fin_validite < '".$this->db->idate(time())."'";
|
||||
$sql.= " AND cd.date_fin_validite < '".$this->db->idate(dol_now())."'";
|
||||
}
|
||||
elseif ($mode == 'active')
|
||||
{
|
||||
$sql = "SELECT cd.rowid, cd.date_fin_validite as datefin";
|
||||
$sql.= $this->from;
|
||||
$sql.= " WHERE c.statut = 1";
|
||||
$sql.= " AND c.rowid = cd.fk_contrat";
|
||||
$sql.= " AND cd.statut = 4";
|
||||
//$datetouse = dol_now();
|
||||
//$sql.= " AND cd.date_fin_validite < '".$this->db->idate($datetouse)."'";
|
||||
}
|
||||
$sql.= " AND c.fk_soc = s.rowid";
|
||||
$sql.= " AND c.entity = ".$conf->entity;
|
||||
if ($user->societe_id) $sql.=" AND c.fk_soc = ".$user->societe_id;
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$langs->load("contracts");
|
||||
$now=dol_now();
|
||||
|
||||
if ($mode == 'inactives') {
|
||||
if ($mode == 'inactive') {
|
||||
$warning_delay = $conf->contrat->services->inactifs->warning_delay;
|
||||
$label = $langs->trans("BoardNotActivatedServices");
|
||||
$url = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&mode=0';
|
||||
$url = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&mode=0&sortfield=cd.date_fin_validite&sortorder=asc';
|
||||
}
|
||||
elseif ($mode == 'expired') {
|
||||
$warning_delay = $conf->contrat->services->expires->warning_delay;
|
||||
$url = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&mode=4&filter=expired&sortfield=cd.date_fin_validite&sortorder=asc';
|
||||
$label = $langs->trans("BoardExpiredServices");
|
||||
} else {
|
||||
$warning_delay = $conf->contrat->services->expires->warning_delay;
|
||||
$url = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&mode=4&filter=expired';
|
||||
$url = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&mode=4&sortfield=cd.date_fin_validite&sortorder=asc';
|
||||
//$url.= '&op2day='.$arraydatetouse['mday'].'&op2month='.$arraydatetouse['mon'].'&op2year='.$arraydatetouse['year'];
|
||||
//if ($warning_delay >= 0) $url.='&filter=expired';
|
||||
$label = $langs->trans("BoardRunningServices");
|
||||
}
|
||||
|
||||
|
||||
@@ -216,7 +216,7 @@ if (! $error && $massaction == 'confirm_presend')
|
||||
$resaction.='<div class="error">'.$langs->trans('ErrorOnlyProposalNotDraftCanBeSentInMassAction', $objectobj->ref).'</div><br>';
|
||||
continue; // Payment done or started or canceled
|
||||
}
|
||||
if ($objectclass == 'Commande' && $objectoj->statut == Commande::STATUS_DRAFT)
|
||||
if ($objectclass == 'Commande' && $objectojb->statut == Commande::STATUS_DRAFT)
|
||||
{
|
||||
$langs->load("errors");
|
||||
$nbignored++;
|
||||
|
||||
@@ -6525,7 +6525,7 @@ abstract class CommonObject
|
||||
$out .= $extrafields->showOutputField($key, $value);
|
||||
break;
|
||||
case "edit":
|
||||
$out .= $extrafields->showInputField($key, $value, '', $keysuffix, '', 0, $this->id);
|
||||
$out .= $extrafields->showInputField($key, $value, '', $keysuffix, '', 0, $this->id, $this->table_element);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -1567,6 +1567,9 @@ class ExtraFields
|
||||
if ($type == 'date') $out.=' (YYYY-MM-DD)';
|
||||
elseif ($type == 'datetime') $out.=' (YYYY-MM-DD HH:MM:SS)';
|
||||
*/
|
||||
if (! empty($help)) {
|
||||
$out .= $form->textwithpicto("", $help);
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
|
||||
|
||||
@@ -4781,9 +4781,10 @@ class Form
|
||||
*
|
||||
* @param string $selected preselected currency code
|
||||
* @param string $htmlname name of HTML select list
|
||||
* @param string $mode 0 = Add currency symbol into label, 1 = Add 3 letter iso code
|
||||
* @return string
|
||||
*/
|
||||
public function selectCurrency($selected = '', $htmlname = 'currency_id')
|
||||
public function selectCurrency($selected = '', $htmlname = 'currency_id', $mode = 0)
|
||||
{
|
||||
global $conf,$langs,$user;
|
||||
|
||||
@@ -4805,7 +4806,14 @@ class Form
|
||||
$out.= '<option value="'.$code_iso.'">';
|
||||
}
|
||||
$out.= $currency['label'];
|
||||
$out.= ' ('.$langs->getCurrencySymbol($code_iso).')';
|
||||
if ($mode == 1)
|
||||
{
|
||||
$out.= ' ('.$code_iso.')';
|
||||
}
|
||||
else
|
||||
{
|
||||
$out.= ' ('.$langs->getCurrencySymbol($code_iso).')';
|
||||
}
|
||||
$out.= '</option>';
|
||||
}
|
||||
$out.= '</select>';
|
||||
|
||||
@@ -710,7 +710,7 @@ class FormMail extends Form
|
||||
}
|
||||
else
|
||||
{
|
||||
$out.= '<input class="minwidth200" id="sendtocc" name="sendtocc" value="'.((! is_array($this->withtocc) && ! is_numeric($this->withtocc))? (isset($_POST["sendtocc"])?$_POST["sendtocc"]:$this->withtocc) : (isset($_POST["sendtocc"])?$_POST["sendtocc"]:"") ).'" />';
|
||||
$out.= '<input class="minwidth200" id="sendtocc" name="sendtocc" value="'.(GETPOST("sendtocc", "alpha") ? GETPOST("sendtocc", "alpha") : ((! is_array($this->withtocc) && ! is_numeric($this->withtocc)) ? $this->withtocc : '')).'" />';
|
||||
if (! empty($this->withtocc) && is_array($this->withtocc))
|
||||
{
|
||||
$out.= " ".$langs->trans("and")."/".$langs->trans("or")." ";
|
||||
@@ -1022,7 +1022,7 @@ class FormMail extends Form
|
||||
if (! empty($this->withtocccreadonly)) {
|
||||
$out.= (! is_array($this->withtoccc) && ! is_numeric($this->withtoccc))?$this->withtoccc:"";
|
||||
} else {
|
||||
$out.= '<input class="minwidth200" id="sendtoccc" name="sendtoccc" value="'.((! is_array($this->withtoccc) && ! is_numeric($this->withtoccc))? (isset($_POST["sendtoccc"])?$_POST["sendtoccc"]:$this->withtoccc) : (isset($_POST["sendtoccc"])?$_POST["sendtoccc"]:"") ).'" />';
|
||||
$out.= '<input class="minwidth200" id="sendtoccc" name="sendtoccc" value="'.(GETPOST("sendtoccc", "alpha") ? GETPOST("sendtoccc", "alpha") : ((! is_array($this->withtoccc) && ! is_numeric($this->withtoccc)) ? $this->withtoccc : '')).'" />';
|
||||
if (! empty($this->withtoccc) && is_array($this->withtoccc)) {
|
||||
$out.= " ".$langs->trans("and")."/".$langs->trans("or")." ";
|
||||
// multiselect array convert html entities into options tags, even if we dont want this, so we encode them a second time
|
||||
|
||||
@@ -834,7 +834,7 @@ class FormTicket
|
||||
if ($user->rights->ticket->write && !$user->socid)
|
||||
{
|
||||
print '<tr><td width="30%"></td><td colspan="2">';
|
||||
$checkbox_selected = ( GETPOST('send_email') == "1" ? ' checked' : '');
|
||||
$checkbox_selected = (GETPOST('send_email') == "1" ? ' checked' : '');
|
||||
print '<input type="checkbox" name="send_email" value="1" id="send_msg_email" '.$checkbox_selected.'/> ';
|
||||
print '<label for="send_msg_email">' . $langs->trans('SendMessageByEmail') . '</label>';
|
||||
print '</td></tr>';
|
||||
@@ -852,20 +852,10 @@ class FormTicket
|
||||
print '</div></td>';
|
||||
}
|
||||
|
||||
// Substitution array
|
||||
if ($this->withsubstit) {
|
||||
print '<tr class="email_line"><td></td><td colspan="2">';
|
||||
$help="";
|
||||
foreach ($this->substit as $key => $val) {
|
||||
$help.=$key.' -> '.$langs->trans($val).'<br>';
|
||||
}
|
||||
print $form->textwithpicto($langs->trans("TicketMessageSubstitutionReplacedByGenericValues"), $help);
|
||||
print "</td></tr>";
|
||||
}
|
||||
|
||||
// Private message (not visible by customer/external user)
|
||||
if (! $user->socid) {
|
||||
print '<tr><td width="30%"></td><td>';
|
||||
$checkbox_selected = ( GETPOST('private_message') == "1" ? ' checked' : '');
|
||||
$checkbox_selected = (GETPOST('private_message', 'alpha') == "1" ? ' checked' : '');
|
||||
print '<input type="checkbox" name="private_message" value="1" id="private_message" '.$checkbox_selected.'/> ';
|
||||
print '<label for="private_message">' . $langs->trans('MarkMessageAsPrivate') . '</label>';
|
||||
print '</td><td align="center">';
|
||||
@@ -873,8 +863,7 @@ class FormTicket
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
print '<tr class="email_line"><td width=20%">' . $langs->trans('Subject') . '</td>';
|
||||
print '<tr class="email_line"><td class="titlefieldcreate">' . $langs->trans('Subject') . '</td>';
|
||||
$label_title = empty($conf->global->MAIN_APPLICATION_TITLE) ? $mysoc->name : $conf->global->MAIN_APPLICATION_TITLE;
|
||||
print '<td colspan="2"><input type="text" class="text" size="80" name="subject" value="[' . $label_title . ' - ticket #' . $this->track_id . '] ' . $langs->trans('TicketNewMessage') . '" />';
|
||||
print '</td></tr>';
|
||||
|
||||
@@ -307,7 +307,7 @@ function GETPOST($paramname, $check = 'none', $method = 0, $filter = null, $opti
|
||||
}
|
||||
if (! empty($conf->global->MAIN_ENABLE_DEFAULT_VALUES))
|
||||
{
|
||||
if (! empty($_GET['action']) && $_GET['action'] == 'create' && ! isset($_GET[$paramname]) && ! isset($_POST[$paramname]))
|
||||
if (! empty($_GET['action']) && (preg_match('/^create/', $_GET['action']) || preg_match('/^presend/', $_GET['action'])) && ! isset($_GET[$paramname]) && ! isset($_POST[$paramname]))
|
||||
{
|
||||
// Now search in setup to overwrite default values
|
||||
if (! empty($user->default_values)) // $user->default_values defined from menu 'Setup - Default values'
|
||||
@@ -1299,6 +1299,7 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
|
||||
if ($object->element == 'member') $modulepart='memberphoto';
|
||||
if ($object->element == 'user') $modulepart='userphoto';
|
||||
if ($object->element == 'product') $modulepart='product';
|
||||
if ($object->element == 'ticket') $modulepart='ticket';
|
||||
|
||||
if (class_exists("Imagick"))
|
||||
{
|
||||
|
||||
@@ -2436,6 +2436,9 @@ function getModuleDirForApiClass($module)
|
||||
elseif ($module == 'tickets') {
|
||||
$moduledirforclass = 'ticket';
|
||||
}
|
||||
elseif ($module == 'boms') {
|
||||
$moduledirforclass = 'bom';
|
||||
}
|
||||
|
||||
return $moduledirforclass;
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ function showOnlinePaymentUrl($type, $ref)
|
||||
* @param string $localorexternal 0=Url for browser, 1=Url for external access
|
||||
* @return string Url string
|
||||
*/
|
||||
function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag = 'your_free_tag', $localorexternal = 0)
|
||||
function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag = 'your_tag', $localorexternal = 0)
|
||||
{
|
||||
global $conf, $dolibarr_main_url_root;
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
* 25=multicurrency_total_tax1 for total_ht
|
||||
* 26=multicurrency_total_tax2 for total_ht
|
||||
*/
|
||||
function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocaltax1_rate, $uselocaltax2_rate, $remise_percent_global, $price_base_type, $info_bits, $type, $seller = '', $localtaxes_array='', $progress=100, $multicurrency_tx=1, $pu_devise=0)
|
||||
function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocaltax1_rate, $uselocaltax2_rate, $remise_percent_global, $price_base_type, $info_bits, $type, $seller = '', $localtaxes_array = '', $progress = 100, $multicurrency_tx = 1, $pu_devise = 0)
|
||||
{
|
||||
global $conf,$mysoc,$db;
|
||||
|
||||
@@ -188,9 +188,9 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
|
||||
//If input unit price is 'HT', we need to have the totals with main VAT for a correct calculation
|
||||
if ($price_base_type != 'TTC')
|
||||
{
|
||||
$tot_sans_remise_wt = price2num($tot_sans_remise * (1 + ($txtva / 100)),'MU');
|
||||
$tot_avec_remise_wt = price2num($tot_avec_remise * (1 + ($txtva / 100)),'MU');
|
||||
$pu_wt = price2num($pu * (1 + ($txtva / 100)),'MU');
|
||||
$tot_sans_remise_wt = price2num($tot_sans_remise * (1 + ($txtva / 100)), 'MU');
|
||||
$tot_avec_remise_wt = price2num($tot_avec_remise * (1 + ($txtva / 100)), 'MU');
|
||||
$pu_wt = price2num($pu * (1 + ($txtva / 100)), 'MU');
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -203,7 +203,7 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
|
||||
|
||||
$localtaxes = array(0,0,0);
|
||||
$apply_tax = false;
|
||||
switch($localtax1_type) {
|
||||
switch($localtax1_type) {
|
||||
case '2': // localtax on product or service
|
||||
$apply_tax = true;
|
||||
break;
|
||||
@@ -227,16 +227,16 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
|
||||
}
|
||||
|
||||
$apply_tax = false;
|
||||
switch($localtax2_type) {
|
||||
case '2': // localtax on product or service
|
||||
$apply_tax = true;
|
||||
break;
|
||||
case '4': // localtax on product
|
||||
if ($type == 0) $apply_tax = true;
|
||||
break;
|
||||
case '6': // localtax on service
|
||||
if ($type == 1) $apply_tax = true;
|
||||
break;
|
||||
switch($localtax2_type) {
|
||||
case '2': // localtax on product or service
|
||||
$apply_tax = true;
|
||||
break;
|
||||
case '4': // localtax on product
|
||||
if ($type == 0) $apply_tax = true;
|
||||
break;
|
||||
case '6': // localtax on service
|
||||
if ($type == 1) $apply_tax = true;
|
||||
break;
|
||||
}
|
||||
if ($uselocaltax2_rate && $apply_tax) {
|
||||
$result[15] = price2num(($tot_sans_remise_wt * (1 + ( $localtax2_rate / 100))) - $tot_sans_remise_wt, 'MT');
|
||||
@@ -292,9 +292,9 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
|
||||
//If input unit price is 'TTC', we need to have the totals without main VAT for a correct calculation
|
||||
if ($price_base_type == 'TTC')
|
||||
{
|
||||
$tot_sans_remise= price2num($tot_sans_remise / (1 + ($txtva / 100)),'MU');
|
||||
$tot_avec_remise= price2num($tot_avec_remise / (1 + ($txtva / 100)),'MU');
|
||||
$pu = price2num($pu / (1 + ($txtva / 100)),'MU');
|
||||
$tot_sans_remise= price2num($tot_sans_remise / (1 + ($txtva / 100)), 'MU');
|
||||
$tot_avec_remise= price2num($tot_avec_remise / (1 + ($txtva / 100)), 'MU');
|
||||
$pu = price2num($pu / (1 + ($txtva / 100)), 'MU');
|
||||
}
|
||||
|
||||
$apply_tax = false;
|
||||
@@ -321,16 +321,16 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
|
||||
}
|
||||
|
||||
$apply_tax = false;
|
||||
switch($localtax2_type) {
|
||||
case '1': // localtax on product or service
|
||||
$apply_tax = true;
|
||||
break;
|
||||
case '3': // localtax on product
|
||||
if ($type == 0) $apply_tax = true;
|
||||
break;
|
||||
case '5': // localtax on service
|
||||
if ($type == 1) $apply_tax = true;
|
||||
break;
|
||||
switch($localtax2_type) {
|
||||
case '1': // localtax on product or service
|
||||
$apply_tax = true;
|
||||
break;
|
||||
case '3': // localtax on product
|
||||
if ($type == 0) $apply_tax = true;
|
||||
break;
|
||||
case '5': // localtax on service
|
||||
if ($type == 1) $apply_tax = true;
|
||||
break;
|
||||
}
|
||||
if ($uselocaltax2_rate && $apply_tax) {
|
||||
$result[15] = price2num(($tot_sans_remise * (1 + ( $localtax2_rate / 100))) - $tot_sans_remise, 'MT'); // amount tax2 for total_ht_without_discount
|
||||
@@ -411,4 +411,3 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
@@ -145,7 +145,7 @@ function dolKeepOnlyPhpCode($str)
|
||||
$newstr = '';
|
||||
|
||||
//split on each opening tag
|
||||
$parts = explode('<?php',$str);
|
||||
$parts = explode('<?php', $str);
|
||||
if (!empty($parts))
|
||||
{
|
||||
$i=0;
|
||||
|
||||
@@ -1318,7 +1318,7 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
$posy+=4;
|
||||
$pdf->SetXY($posx, $posy);
|
||||
$pdf->SetTextColor(0, 0, 60);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("OrderDate")." : " . dol_print_date($object->date, "%d %b %Y", false, $outputlangs, true), '', 'R');
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("OrderDate")." : " . dol_print_date($object->date, "day", false, $outputlangs, true), '', 'R');
|
||||
|
||||
// Get contact
|
||||
if (!empty($conf->global->DOC_SHOW_FIRST_SALES_REP))
|
||||
|
||||
@@ -201,10 +201,10 @@ class modProduct extends DolibarrModules
|
||||
if (! empty($conf->fournisseur->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('s.nom'=>'product_supplier_ref','pf.ref_fourn'=>'product_supplier_ref','pf.unitprice'=>'product_supplier_ref','pf.quantity'=>'product_supplier_ref','pf.remise_percent'=>'product_supplier_ref','pf.delivery_time_days'=>'product_supplier_ref'));
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('l.lang'=>'translation', 'l.label'=>'translation','l.description'=>'translation','l.note'=>'translation'));
|
||||
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_dependencies_array[$r]=array('category'=>'p.rowid');
|
||||
if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.stock'=>'product','p.pmp'=>'product'));
|
||||
if (! empty($conf->barcode->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.barcode'=>'product'));
|
||||
if (! empty($conf->fournisseur->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('s.nom'=>'product_supplier_ref','pf.ref_fourn'=>'product_supplier_ref','pf.unitprice'=>'product_supplier_ref','pf.quantity'=>'product_supplier_ref','pf.remise_percent'=>'product_supplier_ref','pf.delivery_time_days'=>'product_supplier_ref'));
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('l.lang'=>'translation', 'l.label'=>'translation','l.description'=>'translation','l.note'=>'translation'));
|
||||
if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p.stock'=>'product','p.pmp'=>'product'));
|
||||
if (! empty($conf->barcode->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p.barcode'=>'product'));
|
||||
if (! empty($conf->fournisseur->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('s.nom'=>'product_supplier_ref','pf.ref_fourn'=>'product_supplier_ref','pf.unitprice'=>'product_supplier_ref','pf.quantity'=>'product_supplier_ref','pf.remise_percent'=>'product_supplier_ref','pf.delivery_time_days'=>'product_supplier_ref'));
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('l.lang'=>'translation', 'l.label'=>'translation','l.description'=>'translation','l.note'=>'translation'));
|
||||
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_dependencies_array[$r]=array('category'=>'p.rowid');
|
||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||
@@ -349,7 +349,7 @@ class modProduct extends DolibarrModules
|
||||
'p.note_public' => "PublicNote",//public note
|
||||
'p.note' => "PrivateNote",//private note
|
||||
'p.customcode' => 'CustomCode',
|
||||
'p.price' => "SellingPriceHT",//without tax
|
||||
'p.price' => "SellingPriceHT",//without
|
||||
'p.price_min' => "MinPrice",
|
||||
'p.price_ttc' => "SellingPriceTTC",//with tax
|
||||
'p.price_min_ttc' => "SellingMinPriceTTC",
|
||||
@@ -518,19 +518,22 @@ class modProduct extends DolibarrModules
|
||||
if (is_object($mysoc) && $mysoc->useLocalTax(1)) $import_sample=array_merge($import_sample, array('p.localtax1_tx'=>'', 'p.localtax1_type'=>''));
|
||||
if (is_object($mysoc) && $mysoc->useLocalTax(2)) $import_sample=array_merge($import_sample, array('p.localtax2_tx'=>'', 'p.localtax2_type'=>''));
|
||||
if (! empty($conf->barcode->enabled)) $import_sample=array_merge($import_sample, array('p.barcode'=>''));
|
||||
if (! empty($conf->global->PRODUCT_USE_UNITS)) {
|
||||
$import_sample = array_merge($import_sample, array(
|
||||
'p.fk_unit' => 'use a unit of measure from the dictionary. G/KG/M2/M3 etc....matches field "code" in table "' . MAIN_DB_PREFIX . 'c_units"'
|
||||
));
|
||||
if (! empty($conf->global->PRODUCT_USE_UNITS)) {
|
||||
$import_sample = array_merge(
|
||||
$import_sample,
|
||||
array(
|
||||
'p.fk_unit' => 'use a unit of measure from the dictionary. G/KG/M2/M3 etc....matches field "code" in table "' . MAIN_DB_PREFIX . 'c_units"'
|
||||
)
|
||||
);
|
||||
|
||||
$this->import_convertvalue_array[$r] = array_merge($this->import_convertvalue_array[$r], array(
|
||||
'p.fk_unit' => array(
|
||||
'rule' => 'fetchidfromcodeorlabel',
|
||||
'classfile' => '/core/class/cunits.class.php',
|
||||
'class' => 'CUnits',
|
||||
'method' => 'fetch',
|
||||
'dict' => 'DictionaryUnits'
|
||||
)
|
||||
'p.fk_unit' => array(
|
||||
'rule' => 'fetchidfromcodeorlabel',
|
||||
'classfile' => '/core/class/cunits.class.php',
|
||||
'class' => 'CUnits',
|
||||
'method' => 'fetch',
|
||||
'dict' => 'DictionaryUnits'
|
||||
)
|
||||
));
|
||||
}
|
||||
$this->import_examplevalues_array[$r]=array_merge($import_sample, $import_extrafield_sample);
|
||||
|
||||
@@ -143,32 +143,32 @@ class modService extends DolibarrModules
|
||||
$this->export_permission[$r]=array(array("service","export"));
|
||||
$this->export_fields_array[$r]=array('p.rowid'=>"Id",'p.ref'=>"Ref",'p.label'=>"Label",'p.description'=>"Description",'p.url'=>"PublicUrl",'p.accountancy_code_sell'=>"ProductAccountancySellCode",'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",'p.note'=>"Note",'p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC",'p.tva_tx'=>'VATRate','p.tosell'=>"OnSell",'p.tobuy'=>"OnBuy",'p.duration'=>"Duration",'p.datec'=>'DateCreation','p.tms'=>'DateModification');
|
||||
if (is_object($mysoc) && $mysoc->useNPR()) $this->export_fields_array[$r]['p.recuperableonly']='NPR';
|
||||
if (! empty($conf->stock->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.stock'=>'Stock','p.seuil_stock_alerte'=>'StockLimit','p.desiredstock'=>'DesiredStock','p.pmp'=>'PMPValue'));
|
||||
if (! empty($conf->barcode->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.barcode'=>'BarCode'));
|
||||
if (! empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.cost_price'=>'CostPrice'));
|
||||
if (! empty($conf->stock->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p.stock'=>'Stock','p.seuil_stock_alerte'=>'StockLimit','p.desiredstock'=>'DesiredStock','p.pmp'=>'PMPValue'));
|
||||
if (! empty($conf->barcode->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p.barcode'=>'BarCode'));
|
||||
if (! empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p.cost_price'=>'CostPrice'));
|
||||
$keyforselect='product'; $keyforelement='product'; $keyforaliasextra='extra';
|
||||
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||
if (! empty($conf->fournisseur->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('s.nom'=>'Supplier','pf.ref_fourn'=>'SupplierRef','pf.quantity'=>'QtyMin','pf.remise_percent'=>'DiscountQtyMin','pf.unitprice'=>'BuyingPrice','pf.delivery_time_days'=>'NbDaysToDelivery'));
|
||||
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('group_concat(cat.label)'=>'Categories'));
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('l.lang'=>'Language', 'l.label'=>'TranslatedLabel','l.description'=>'TranslatedDescription','l.note'=>'TranslatedNote'));
|
||||
if (! empty($conf->fournisseur->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('s.nom'=>'Supplier','pf.ref_fourn'=>'SupplierRef','pf.quantity'=>'QtyMin','pf.remise_percent'=>'DiscountQtyMin','pf.unitprice'=>'BuyingPrice','pf.delivery_time_days'=>'NbDaysToDelivery'));
|
||||
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('group_concat(cat.label)'=>'Categories'));
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('l.lang'=>'Language', 'l.label'=>'TranslatedLabel','l.description'=>'TranslatedDescription','l.note'=>'TranslatedNote'));
|
||||
if (! empty($conf->global->PRODUCT_USE_UNITS)) $this->export_fields_array[$r]['p.fk_unit'] = 'Unit';
|
||||
$this->export_TypeFields_array[$r]=array('p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text",'p.note'=>"Text",'p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",'p.duration'=>"Duree",'p.datec'=>'Date','p.tms'=>'Date');
|
||||
if (! empty($conf->stock->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('p.stock'=>'Numeric'));
|
||||
if (! empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('p.barcode'=>'Text'));
|
||||
if (! empty($conf->fournisseur->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('s.nom'=>'Text','pf.ref_fourn'=>'Text','pf.unitprice'=>'Numeric','pf.quantity'=>'Numeric','pf.remise_percent'=>'Numeric','pf.delivery_time_days'=>'Numeric'));
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('l.lang'=>'Text', 'l.label'=>'Text','l.description'=>'Text','l.note'=>'Text'));
|
||||
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array("group_concat(cat.label)"=>'Text'));
|
||||
if (! empty($conf->stock->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('p.stock'=>'Numeric'));
|
||||
if (! empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('p.barcode'=>'Text'));
|
||||
if (! empty($conf->fournisseur->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('s.nom'=>'Text','pf.ref_fourn'=>'Text','pf.unitprice'=>'Numeric','pf.quantity'=>'Numeric','pf.remise_percent'=>'Numeric','pf.delivery_time_days'=>'Numeric'));
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('l.lang'=>'Text', 'l.label'=>'Text','l.description'=>'Text','l.note'=>'Text'));
|
||||
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array("group_concat(cat.label)"=>'Text'));
|
||||
$this->export_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
|
||||
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array("group_concat(cat.label)"=>'category'));
|
||||
if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.stock'=>'product','p.pmp'=>'product'));
|
||||
if (! empty($conf->barcode->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.barcode'=>'product'));
|
||||
if (! empty($conf->fournisseur->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('s.nom'=>'product_supplier_ref','pf.ref_fourn'=>'product_supplier_ref','pf.unitprice'=>'product_supplier_ref','pf.quantity'=>'product_supplier_ref','pf.remise_percent'=>'product_supplier_ref','pf.delivery_time_days'=>'product_supplier_ref'));
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('l.lang'=>'translation', 'l.label'=>'translation','l.description'=>'translation','l.note'=>'translation'));
|
||||
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array("group_concat(cat.label)"=>'category'));
|
||||
if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p.stock'=>'product','p.pmp'=>'product'));
|
||||
if (! empty($conf->barcode->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p.barcode'=>'product'));
|
||||
if (! empty($conf->fournisseur->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('s.nom'=>'product_supplier_ref','pf.ref_fourn'=>'product_supplier_ref','pf.unitprice'=>'product_supplier_ref','pf.quantity'=>'product_supplier_ref','pf.remise_percent'=>'product_supplier_ref','pf.delivery_time_days'=>'product_supplier_ref'));
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('l.lang'=>'translation', 'l.label'=>'translation','l.description'=>'translation','l.note'=>'translation'));
|
||||
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_dependencies_array[$r]=array('category'=>'p.rowid');
|
||||
if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.stock'=>'product','p.pmp'=>'product'));
|
||||
if (! empty($conf->barcode->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.barcode'=>'product'));
|
||||
if (! empty($conf->fournisseur->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('s.nom'=>'product_supplier_ref','pf.ref_fourn'=>'product_supplier_ref','pf.unitprice'=>'product_supplier_ref','pf.quantity'=>'product_supplier_ref','pf.remise_percent'=>'product_supplier_ref','pf.delivery_time_days'=>'product_supplier_ref'));
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('l.lang'=>'translation', 'l.label'=>'translation','l.description'=>'translation','l.note'=>'translation'));
|
||||
if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p.stock'=>'product','p.pmp'=>'product'));
|
||||
if (! empty($conf->barcode->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p.barcode'=>'product'));
|
||||
if (! empty($conf->fournisseur->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('s.nom'=>'product_supplier_ref','pf.ref_fourn'=>'product_supplier_ref','pf.unitprice'=>'product_supplier_ref','pf.quantity'=>'product_supplier_ref','pf.remise_percent'=>'product_supplier_ref','pf.delivery_time_days'=>'product_supplier_ref'));
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('l.lang'=>'translation', 'l.label'=>'translation','l.description'=>'translation','l.note'=>'translation'));
|
||||
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_dependencies_array[$r]=array('category'=>'p.rowid');
|
||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||
@@ -260,18 +260,18 @@ class modService extends DolibarrModules
|
||||
'p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC",'p.tva_tx'=>'VATRate','p.tosell'=>"OnSell",
|
||||
'p.tobuy'=>"OnBuy",'p.datec'=>'DateCreation','p.tms'=>'DateModification'
|
||||
);
|
||||
if (! empty($conf->stock->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.stock'=>'Stock','p.seuil_stock_alerte'=>'StockLimit','p.desiredstock'=>'DesiredStock','p.pmp'=>'PMPValue'));
|
||||
if (! empty($conf->barcode->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.barcode'=>'BarCode'));
|
||||
$this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('pa.qty'=>'Qty','pa.incdec'=>'ComposedProductIncDecStock'));
|
||||
if (! empty($conf->stock->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p.stock'=>'Stock','p.seuil_stock_alerte'=>'StockLimit','p.desiredstock'=>'DesiredStock','p.pmp'=>'PMPValue'));
|
||||
if (! empty($conf->barcode->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p.barcode'=>'BarCode'));
|
||||
$this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('pa.qty'=>'Qty','pa.incdec'=>'ComposedProductIncDecStock'));
|
||||
$this->export_TypeFields_array[$r]=array(
|
||||
'p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text",
|
||||
'p.note'=>"Text",'p.length'=>"Numeric",'p.surface'=>"Numeric",'p.volume'=>"Numeric",'p.weight'=>"Numeric",'p.customcode'=>'Text',
|
||||
'p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",
|
||||
'p.datec'=>'Date','p.tms'=>'Date'
|
||||
);
|
||||
if (! empty($conf->stock->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('p.stock'=>'Numeric','p.seuil_stock_alerte'=>'Numeric','p.desiredstock'=>'Numeric','p.pmp'=>'Numeric','p.cost_price'=>'Numeric'));
|
||||
if (! empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('p.barcode'=>'Text'));
|
||||
$this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('pa.qty'=>'Numeric'));
|
||||
if (! empty($conf->stock->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('p.stock'=>'Numeric','p.seuil_stock_alerte'=>'Numeric','p.desiredstock'=>'Numeric','p.pmp'=>'Numeric','p.cost_price'=>'Numeric'));
|
||||
if (! empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('p.barcode'=>'Text'));
|
||||
$this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('pa.qty'=>'Numeric'));
|
||||
$this->export_entities_array[$r]=array(
|
||||
'p.rowid'=>"virtualproduct",'p.ref'=>"virtualproduct",'p.label'=>"virtualproduct",'p.description'=>"virtualproduct",'p.url'=>"virtualproduct",
|
||||
'p.accountancy_code_sell'=>'virtualproduct','p.accountancy_code_buy'=>'virtualproduct','p.note'=>"virtualproduct",'p.length'=>"virtualproduct",
|
||||
@@ -279,13 +279,13 @@ class modService extends DolibarrModules
|
||||
'p.price_base_type'=>"virtualproduct",'p.price'=>"virtualproduct",'p.price_ttc'=>"virtualproduct",'p.tva_tx'=>"virtualproduct",
|
||||
'p.tosell'=>"virtualproduct",'p.tobuy'=>"virtualproduct",'p.datec'=>"virtualproduct",'p.tms'=>"virtualproduct"
|
||||
);
|
||||
if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.stock'=>'virtualproduct','p.seuil_stock_alerte'=>'virtualproduct','p.desiredstock'=>'virtualproduct','p.pmp'=>'virtualproduct'));
|
||||
if (! empty($conf->barcode->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.barcode'=>'virtualproduct'));
|
||||
$this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('pa.qty'=>"subproduct",'pa.incdec'=>'subproduct'));
|
||||
if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p.stock'=>'virtualproduct','p.seuil_stock_alerte'=>'virtualproduct','p.desiredstock'=>'virtualproduct','p.pmp'=>'virtualproduct'));
|
||||
if (! empty($conf->barcode->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p.barcode'=>'virtualproduct'));
|
||||
$this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('pa.qty'=>"subproduct",'pa.incdec'=>'subproduct'));
|
||||
$keyforselect='product'; $keyforelement='product'; $keyforaliasextra='extra';
|
||||
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||
$this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p2.rowid'=>"Id",'p2.ref'=>"Ref",'p2.label'=>"Label",'p2.description'=>"Description"));
|
||||
$this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p2.rowid'=>"subproduct",'p2.ref'=>"subproduct",'p2.label'=>"subproduct",'p2.description'=>"subproduct"));
|
||||
$this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p2.rowid'=>"Id",'p2.ref'=>"Ref",'p2.label'=>"Label",'p2.description'=>"Description"));
|
||||
$this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p2.rowid'=>"subproduct",'p2.ref'=>"subproduct",'p2.label'=>"subproduct",'p2.description'=>"subproduct"));
|
||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON p.rowid = extra.fk_object,';
|
||||
@@ -363,11 +363,11 @@ class modService extends DolibarrModules
|
||||
'p.tva_tx'=>'VATRate','p.tosell'=>"OnSell*",'p.tobuy'=>"OnBuy*",'p.fk_product_type'=>"Type*",'p.finished'=>'Nature','p.datec'=>'DateCreation'
|
||||
);
|
||||
//if (! empty($conf->stock->enabled)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('p.seuil_stock_alerte'=>'StockLimit','p.desiredstock'=>'DesiredStock','p.pmp'=>'PMPValue'));
|
||||
if (! empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('p.cost_price'=>'CostPrice'));
|
||||
if (is_object($mysoc) && $mysoc->useNPR()) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('p.recuperableonly'=>'NPR'));
|
||||
if (is_object($mysoc) && $mysoc->useLocalTax(1)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('p.localtax1_tx'=>'LT1', 'p.localtax1_type'=>'LT1Type'));
|
||||
if (is_object($mysoc) && $mysoc->useLocalTax(2)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('p.localtax2_tx'=>'LT2', 'p.localtax2_type'=>'LT2Type'));
|
||||
if (! empty($conf->barcode->enabled)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('p.barcode'=>'BarCode'));
|
||||
if (! empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r], array('p.cost_price'=>'CostPrice'));
|
||||
if (is_object($mysoc) && $mysoc->useNPR()) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r], array('p.recuperableonly'=>'NPR'));
|
||||
if (is_object($mysoc) && $mysoc->useLocalTax(1)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r], array('p.localtax1_tx'=>'LT1', 'p.localtax1_type'=>'LT1Type'));
|
||||
if (is_object($mysoc) && $mysoc->useLocalTax(2)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r], array('p.localtax2_tx'=>'LT2', 'p.localtax2_type'=>'LT2Type'));
|
||||
if (! empty($conf->barcode->enabled)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r], array('p.barcode'=>'BarCode'));
|
||||
if (! empty($conf->global->PRODUCT_USE_UNITS)) $this->import_fields_array[$r]['p.fk_unit'] = 'Unit';
|
||||
// Add extra fields
|
||||
$import_extrafield_sample=array();
|
||||
@@ -394,7 +394,7 @@ class modService extends DolibarrModules
|
||||
'p.recuperableonly'=>'^[0|1]$'
|
||||
);
|
||||
$import_sample=array('p.ref'=>"SERVICE_REF or id:123456",'p.label'=>"My product",'p.description'=>"This is a description example for record",'p.note'=>"Some note",'p.price'=>"100",'p.price_ttc'=>"110",'p.tva_tx'=>'10','p.tosell'=>"0 or 1",'p.tobuy'=>"0 or 1",'p.fk_product_type'=>"0 for product/1 for service",'p.finished'=>'','p.duration'=>"1y",'p.datec'=>'2008-12-31','p.recuperableonly'=>'0 or 1');
|
||||
$this->import_examplevalues_array[$r]=array_merge($import_sample,$import_extrafield_sample);
|
||||
$this->import_examplevalues_array[$r]=array_merge($import_sample, $import_extrafield_sample);
|
||||
$this->import_updatekeys_array[$r] = array('p.ref'=>'Ref');
|
||||
if (! empty($conf->barcode->enabled)) $this->import_updatekeys_array[$r]=array_merge($this->import_updatekeys_array[$r], array('p.barcode'=>'BarCode'));//only show/allow barcode as update key if Barcode module enabled
|
||||
|
||||
@@ -470,7 +470,7 @@ class modService extends DolibarrModules
|
||||
'pr.price_min'=>"MinPriceLevelUnitPriceHT",'pr.price_min_ttc'=>"MinPriceLevelUnitPriceTTC",
|
||||
'pr.date_price'=>'DateCreation*');
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) $this->import_fields_array[$r]['pr.tva_tx']='VATRate';
|
||||
if (is_object($mysoc) && $mysoc->useNPR()) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('pr.recuperableonly'=>'NPR'));
|
||||
if (is_object($mysoc) && $mysoc->useNPR()) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r], array('pr.recuperableonly'=>'NPR'));
|
||||
$this->import_regex_array[$r]=array('pr.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$','pr.recuperableonly'=>'^[0|1]$');
|
||||
$this->import_convertvalue_array[$r]=array(
|
||||
'pr.fk_product'=>array('rule'=>'fetchidfromref','classfile'=>'/product/class/product.class.php','class'=>'Product','method'=>'fetch','element'=>'Product')
|
||||
|
||||
@@ -120,15 +120,16 @@ class modTicket extends DolibarrModules
|
||||
}
|
||||
$this->dictionaries = array(
|
||||
'langs' => 'ticket',
|
||||
'tabname' => array(MAIN_DB_PREFIX . "c_ticket_type", MAIN_DB_PREFIX . "c_ticket_category", MAIN_DB_PREFIX . "c_ticket_severity"),
|
||||
'tablib' => array("TicketDictType", "TicketDictCategory", "TicketDictSeverity"),
|
||||
'tabsql' => array('SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM ' . MAIN_DB_PREFIX . 'c_ticket_type as f', 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM ' . MAIN_DB_PREFIX . 'c_ticket_category as f', 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM ' . MAIN_DB_PREFIX . 'c_ticket_severity as f'),
|
||||
'tabname' => array(MAIN_DB_PREFIX . "c_ticket_type", MAIN_DB_PREFIX . "c_ticket_severity", MAIN_DB_PREFIX . "c_ticket_category"),
|
||||
'tablib' => array("TicketDictType", "TicketDictSeverity", "TicketDictCategory"),
|
||||
'tabsql' => array('SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM ' . MAIN_DB_PREFIX . 'c_ticket_type as f', 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM ' . MAIN_DB_PREFIX . 'c_ticket_severity as f', 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM ' . MAIN_DB_PREFIX . 'c_ticket_category as f'),
|
||||
'tabsqlsort' => array("pos ASC", "pos ASC", "pos ASC"),
|
||||
'tabfield' => array("pos,code,label,use_default", "pos,code,label,use_default", "pos,code,label,use_default"),
|
||||
'tabfieldvalue' => array("pos,code,label,use_default", "pos,code,label,use_default", "pos,code,label,use_default"),
|
||||
'tabfieldinsert' => array("pos,code,label,use_default", "pos,code,label,use_default", "pos,code,label,use_default"),
|
||||
'tabrowid' => array("rowid", "rowid", "rowid"),
|
||||
'tabcond' => array($conf->ticket->enabled, $conf->ticket->enabled, $conf->ticket->enabled),
|
||||
'tabhelp' => array(array('code'=>$langs->trans("EnterAnyCode"), 'use_default'=>$langs->trans("Enter0or1")), array('code'=>$langs->trans("EnterAnyCode"), 'use_default'=>$langs->trans("Enter0or1")), array('code'=>$langs->trans("EnterAnyCode"), 'use_default'=>$langs->trans("Enter0or1"))),
|
||||
);
|
||||
|
||||
// Boxes
|
||||
|
||||
@@ -260,7 +260,7 @@ class pdf_timespent extends ModelePDFProjects
|
||||
//$progress=($object->lines[$i]->progress?$object->lines[$i]->progress.'%':'');
|
||||
$datestart=dol_print_date($object->lines[$i]->date_start, 'day');
|
||||
$dateend=dol_print_date($object->lines[$i]->date_end, 'day');
|
||||
$planned_timespent=convertSecondToTime((int) $object->lines[$i]->planned_timespent, 'allhourmin');
|
||||
$duration=convertSecondToTime((int) $object->lines[$i]->duration, 'allhourmin');
|
||||
|
||||
$showpricebeforepagebreak=1;
|
||||
|
||||
@@ -348,7 +348,7 @@ class pdf_timespent extends ModelePDFProjects
|
||||
$pdf->MultiCell($this->posxlabel-$this->posxref, 3, $outputlangs->convToOutputCharset($ref), 0, 'L');
|
||||
// timespent
|
||||
$pdf->SetXY($this->posxtimespent, $curY);
|
||||
$pdf->MultiCell($this->posxdatestart-$this->posxtimespent, 3, $planned_timespent?$planned_timespent:'', 0, 'R');
|
||||
$pdf->MultiCell($this->posxdatestart-$this->posxtimespent, 3, $duration?$duration:'', 0, 'R');
|
||||
// Progress
|
||||
//$pdf->SetXY($this->posxprogress, $curY);
|
||||
//$pdf->MultiCell($this->posxdatestart-$this->posxprogress, 3, $progress, 0, 'R');
|
||||
|
||||
@@ -136,7 +136,8 @@ if ($nolinesbefore) {
|
||||
print '<td class="linecolcycleref right">' . $langs->trans('Progress') . '</td>';
|
||||
print '<td class="linecolcycleref2 right"></td>';
|
||||
}
|
||||
if (! empty($usemargins))
|
||||
if (! empty($usemargins))
|
||||
|
||||
{
|
||||
if (!empty($user->rights->margins->creer)) {
|
||||
?>
|
||||
@@ -149,9 +150,7 @@ if ($nolinesbefore) {
|
||||
echo $langs->trans('BuyingPrice');
|
||||
else
|
||||
echo $langs->trans('CostPrice');
|
||||
?>
|
||||
</td>
|
||||
<?php
|
||||
echo '</td>';
|
||||
if ($user->rights->margins->creer && ! empty($conf->global->DISPLAY_MARGIN_RATES)) echo '<td class="margininfos linecolmargin2 right"><span class="np_marginRate">'.$langs->trans('MarginRate').'</span></td>';
|
||||
if ($user->rights->margins->creer && ! empty($conf->global->DISPLAY_MARK_RATES)) echo '<td class="margininfos linecolmargin2 right"><span class="np_markRate">'.$langs->trans('MarkRate').'</span></td>';
|
||||
}
|
||||
@@ -163,14 +162,12 @@ if ($nolinesbefore) {
|
||||
?>
|
||||
<tr class="pair nodrag nodrop nohoverpair<?php echo ($nolinesbefore || $object->element=='contrat')?'':' liste_titre_create'; ?>">
|
||||
<?php
|
||||
$coldisplay=0;
|
||||
$coldisplay=0;
|
||||
|
||||
// Adds a line numbering column
|
||||
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
|
||||
$coldisplay++;
|
||||
?>
|
||||
<td class="nobottom linecolnum center"></td>
|
||||
<?php
|
||||
// Adds a line numbering column
|
||||
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
|
||||
$coldisplay++;
|
||||
echo '<td class="nobottom linecolnum center"></td>';
|
||||
}
|
||||
|
||||
$coldisplay++;
|
||||
@@ -348,14 +345,12 @@ if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
|
||||
echo $form->selectyesno('date_end_fill', $line->date_end_fill, 1);
|
||||
echo '</div>';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
echo '</td>';
|
||||
|
||||
<?php
|
||||
if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines
|
||||
{
|
||||
?>
|
||||
$coldisplay++;
|
||||
?>
|
||||
<td class="nobottom linecolresupplier"><input id="fourn_ref" name="fourn_ref" class="flat maxwidth75" value="<?php echo (isset($_POST["fourn_ref"])?GETPOST("fourn_ref", 'alpha', 2):''); ?>"></td>
|
||||
<?php } ?>
|
||||
|
||||
@@ -458,9 +453,7 @@ if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
|
||||
if (is_object($objectline)) {
|
||||
print $objectline->showOptionals($extrafieldsline, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1);
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
if ((! empty($conf->service->enabled) || ($object->element == 'contrat')) && $dateSelector && GETPOST('type') != '0') // We show date field if required
|
||||
{
|
||||
?>
|
||||
|
||||
@@ -48,7 +48,6 @@ if (! is_object($websitepage))
|
||||
{
|
||||
$websitepage=new WebsitePage($db);
|
||||
}
|
||||
|
||||
if ($pageid > 0)
|
||||
{
|
||||
$websitepage->fetch($pageid);
|
||||
|
||||
@@ -1613,7 +1613,7 @@ class EmailCollector extends CommonObject
|
||||
if ($savesocid != $projecttocreate->socid)
|
||||
{
|
||||
$errorforactions++;
|
||||
setEventMessages('You loaded a thirdparty (id='.$savesocid.') and you force another thirdparty id (id='.$projecttocreate->socid.') by setting socid in operation with a different value');
|
||||
setEventMessages('You loaded a thirdparty (id='.$savesocid.') and you force another thirdparty id (id='.$projecttocreate->socid.') by setting socid in operation with a different value', null, 'errors');
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -1721,14 +1721,14 @@ class EmailCollector extends CommonObject
|
||||
if ($filefound)
|
||||
{
|
||||
$result=dol_include_once($reldir."core/modules/ticket/".$modele.'.php');
|
||||
$modProject = new $classname;
|
||||
$modTicket = new $classname;
|
||||
|
||||
if ($savesocid > 0)
|
||||
{
|
||||
if ($savesocid != $tickettocreate->socid)
|
||||
{
|
||||
$errorforactions++;
|
||||
setEventMessages('You loaded a thirdparty (id='.$savesocid.') and you force another thirdparty id (id='.$tickettocreate->socid.') by setting socid in operation with a different value');
|
||||
setEventMessages('You loaded a thirdparty (id='.$savesocid.') and you force another thirdparty id (id='.$tickettocreate->socid.') by setting socid in operation with a different value', null, 'errors');
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -1738,7 +1738,7 @@ class EmailCollector extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
$defaultref = $modTicket->getNextValue(($thirdpartystatic->id > 0 ? $thirdpartystatic : null), $projecttocreate);
|
||||
$defaultref = $modTicket->getNextValue(($thirdpartystatic->id > 0 ? $thirdpartystatic : null), $tickettocreate);
|
||||
}
|
||||
$tickettocreate->ref = $defaultref;
|
||||
}
|
||||
|
||||
@@ -2789,7 +2789,7 @@ else
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr class="oddeven"><td colspan="'.$nbcols.'" class="opacitymedium">'.$langs->trans("None").'</td><td></td><td></td></tr>';
|
||||
print '<tr class="oddeven"><td colspan="'.$nbcols.'"><span class="opacitymedium">'.$langs->trans("None").'</span></td><td></td><td></td></tr>';
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
service_name: travis-ci
|
||||
src_dir: .
|
||||
coverage_clover: clover.xml
|
||||
json_path: coveralls-upload.json
|
||||
@@ -1,40 +0,0 @@
|
||||
sudo: false
|
||||
|
||||
language: php
|
||||
|
||||
php:
|
||||
- 5.4
|
||||
- 5.5
|
||||
- 5.6
|
||||
- 7.0
|
||||
- 7.1
|
||||
- 7.2
|
||||
- hhvm
|
||||
|
||||
env:
|
||||
global:
|
||||
- STRIPE_MOCK_VERSION=0.8.0
|
||||
matrix:
|
||||
- AUTOLOAD=1
|
||||
- AUTOLOAD=0
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.composer/cache/files
|
||||
- stripe-mock
|
||||
|
||||
before_install:
|
||||
# Unpack and start stripe-mock so that the test suite can talk to it
|
||||
- |
|
||||
if [ ! -d "stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}" ]; then
|
||||
mkdir -p stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}/
|
||||
curl -L "https://github.com/stripe/stripe-mock/releases/download/v${STRIPE_MOCK_VERSION}/stripe-mock_${STRIPE_MOCK_VERSION}_linux_amd64.tar.gz" -o "stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}_linux_amd64.tar.gz"
|
||||
tar -zxf "stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}_linux_amd64.tar.gz" -C "stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}/"
|
||||
fi
|
||||
- |
|
||||
stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}/stripe-mock > /dev/null &
|
||||
STRIPE_MOCK_PID=$!
|
||||
|
||||
script: ./build.php ${AUTOLOAD}
|
||||
|
||||
after_script: ./vendor/bin/coveralls -v
|
||||
@@ -1,5 +1,221 @@
|
||||
# Changelog
|
||||
|
||||
## 6.34.3 - 2019-05-01
|
||||
* [#644](https://github.com/stripe/stripe-php/pull/644) Update return type to `static` to improve static analysis
|
||||
* [#645](https://github.com/stripe/stripe-php/pull/645) Fix constant for `payment_intent.payment_failed`
|
||||
|
||||
## 6.34.2 - 2019-04-26
|
||||
* [#642](https://github.com/stripe/stripe-php/pull/642) Fix an issue where existing idempotency keys would be overwritten when using automatic retries
|
||||
|
||||
## 6.34.1 - 2019-04-25
|
||||
* [#640](https://github.com/stripe/stripe-php/pull/640) Add missing phpdocs
|
||||
|
||||
## 6.34.0 - 2019-04-24
|
||||
* [#626](https://github.com/stripe/stripe-php/pull/626) Add support for the `TaxRate` resource and APIs
|
||||
* [#639](https://github.com/stripe/stripe-php/pull/639) Fix multiple phpdoc issues
|
||||
|
||||
## 6.33.0 - 2019-04-22
|
||||
* [#630](https://github.com/stripe/stripe-php/pull/630) Add support for the `TaxId` resource and APIs
|
||||
|
||||
## 6.32.1 - 2019-04-19
|
||||
* [#636](https://github.com/stripe/stripe-php/pull/636) Correct type of `$personId` in PHPDoc
|
||||
|
||||
## 6.32.0 - 2019-04-18
|
||||
* [#621](https://github.com/stripe/stripe-php/pull/621) Add support for `CreditNote`
|
||||
|
||||
## 6.31.5 - 2019-04-12
|
||||
* [#628](https://github.com/stripe/stripe-php/pull/628) Add constants for `person.*` event types
|
||||
* [#628](https://github.com/stripe/stripe-php/pull/628) Add missing constants for `Account` and `Person`
|
||||
|
||||
## 6.31.4 - 2019-04-05
|
||||
* [#624](https://github.com/stripe/stripe-php/pull/624) Fix encoding of nested parameters in multipart requests
|
||||
|
||||
## 6.31.3 - 2019-04-02
|
||||
* [#623](https://github.com/stripe/stripe-php/pull/623) Only use HTTP/2 with curl >= 7.60.0
|
||||
|
||||
## 6.31.2 - 2019-03-25
|
||||
* [#619](https://github.com/stripe/stripe-php/pull/619) Fix PHPDoc return types for list methods for nested resources
|
||||
|
||||
## 6.31.1 - 2019-03-22
|
||||
* [#612](https://github.com/stripe/stripe-php/pull/612) Add a lot of constants
|
||||
* [#614](https://github.com/stripe/stripe-php/pull/614) Add missing subscription status constants
|
||||
|
||||
## 6.31.0 - 2019-03-18
|
||||
* [#600](https://github.com/stripe/stripe-php/pull/600) Add support for the `PaymentMethod` resource and APIs
|
||||
* [#606](https://github.com/stripe/stripe-php/pull/606) Add support for retrieving a Checkout `Session`
|
||||
* [#611](https://github.com/stripe/stripe-php/pull/611) Add support for deleting a Terminal `Location` and `Reader`
|
||||
|
||||
## 6.30.5 - 2019-03-11
|
||||
* [#607](https://github.com/stripe/stripe-php/pull/607) Correctly handle case where a metadata key is called `metadata`
|
||||
|
||||
## 6.30.4 - 2019-02-27
|
||||
* [#602](https://github.com/stripe/stripe-php/pull/602) Add `subscription_schedule` to `Subscription` for PHPDoc.
|
||||
|
||||
## 6.30.3 - 2019-02-26
|
||||
* [#603](https://github.com/stripe/stripe-php/pull/603) Improve PHPDoc on the `Source` object to cover all types of Sources currently supported.
|
||||
|
||||
## 6.30.2 - 2019-02-25
|
||||
* [#601](https://github.com/stripe/stripe-php/pull/601) Fix PHPDoc across multiple resources and add support for new events.
|
||||
|
||||
## 6.30.1 - 2019-02-16
|
||||
* [#599](https://github.com/stripe/stripe-php/pull/599) Fix PHPDoc for `SubscriptionSchedule` and `SubscriptionScheduleRevision`
|
||||
|
||||
## 6.30.0 - 2019-02-12
|
||||
* [#590](https://github.com/stripe/stripe-php/pull/590) Add support for `SubscriptionSchedule` and `SubscriptionScheduleRevision`
|
||||
|
||||
## 6.29.3 - 2019-01-31
|
||||
* [#592](https://github.com/stripe/stripe-php/pull/592) Some more PHPDoc fixes
|
||||
|
||||
## 6.29.2 - 2019-01-31
|
||||
* [#591](https://github.com/stripe/stripe-php/pull/591) Fix PHPDoc for nested resources
|
||||
|
||||
## 6.29.1 - 2019-01-25
|
||||
* [#566](https://github.com/stripe/stripe-php/pull/566) Fix dangling message contents
|
||||
* [#586](https://github.com/stripe/stripe-php/pull/586) Don't overwrite `CURLOPT_HTTP_VERSION` option
|
||||
|
||||
## 6.29.0 - 2019-01-23
|
||||
* [#579](https://github.com/stripe/stripe-php/pull/579) Rename `CheckoutSession` to `Session` and move it under the `Checkout` namespace. This is a breaking change, but we've reached out to affected merchants and all new merchants would use the new approach.
|
||||
|
||||
## 6.28.1 - 2019-01-21
|
||||
* [#580](https://github.com/stripe/stripe-php/pull/580) Properly serialize `individual` on `Account` objects
|
||||
|
||||
## 6.28.0 - 2019-01-03
|
||||
* [#576](https://github.com/stripe/stripe-php/pull/576) Add support for iterating directly over `Collection` instances
|
||||
|
||||
## 6.27.0 - 2018-12-21
|
||||
* [#571](https://github.com/stripe/stripe-php/pull/571) Add support for the `CheckoutSession` resource
|
||||
|
||||
## 6.26.0 - 2018-12-11
|
||||
* [#568](https://github.com/stripe/stripe-php/pull/568) Enable persistent connections
|
||||
|
||||
## 6.25.0 - 2018-12-10
|
||||
* [#567](https://github.com/stripe/stripe-php/pull/567) Add support for account links
|
||||
|
||||
## 6.24.0 - 2018-11-28
|
||||
* [#562](https://github.com/stripe/stripe-php/pull/562) Add support for the Review resource
|
||||
* [#564](https://github.com/stripe/stripe-php/pull/564) Add event name constants for subscription schedule aborted/expiring
|
||||
|
||||
## 6.23.0 - 2018-11-27
|
||||
* [#542](https://github.com/stripe/stripe-php/pull/542) Add support for `ValueList` and `ValueListItem` for Radar
|
||||
|
||||
## 6.22.1 - 2018-11-20
|
||||
* [#561](https://github.com/stripe/stripe-php/pull/561) Add cast and some docs to telemetry introduced in 6.22.0/#549
|
||||
|
||||
## 6.22.0 - 2018-11-15
|
||||
* [#549](https://github.com/stripe/stripe-php/pull/549) Add support for client telemetry
|
||||
|
||||
## 6.21.1 - 2018-11-12
|
||||
* [#548](https://github.com/stripe/stripe-php/pull/548) Don't mutate `Exception` class properties from `OAuthBase` error
|
||||
|
||||
## 6.21.0 - 2018-11-08
|
||||
* [#537](https://github.com/stripe/stripe-php/pull/537) Add new API endpoints for the `Invoice` resource.
|
||||
|
||||
## 6.20.1 - 2018-11-07
|
||||
* [#546](https://github.com/stripe/stripe-php/pull/546) Drop files from the Composer package that aren't needed in the release
|
||||
|
||||
## 6.20.0 - 2018-10-30
|
||||
* [#536](https://github.com/stripe/stripe-php/pull/536) Add support for the `Person` resource
|
||||
* [#541](https://github.com/stripe/stripe-php/pull/541) Add support for the `WebhookEndpoint` resource
|
||||
|
||||
## 6.19.5 - 2018-10-17
|
||||
* [#539](https://github.com/stripe/stripe-php/pull/539) Fix methods on `\Stripe\PaymentIntent` to properly pass arguments to the API.
|
||||
|
||||
## 6.19.4 - 2018-10-11
|
||||
* [#534](https://github.com/stripe/stripe-php/pull/534) Fix PSR-4 autoloading for `\Stripe\FileUpload` class alias
|
||||
|
||||
## 6.19.3 - 2018-10-09
|
||||
* [#530](https://github.com/stripe/stripe-php/pull/530) Add constants for `flow` (`FLOW_*`), `status` (`STATUS_*`) and `usage` (`USAGE_*`) on `\Stripe\Source`
|
||||
|
||||
## 6.19.2 - 2018-10-08
|
||||
* [#531](https://github.com/stripe/stripe-php/pull/531) Store HTTP response headers in case-insensitive array
|
||||
|
||||
## 6.19.1 - 2018-09-25
|
||||
* [#526](https://github.com/stripe/stripe-php/pull/526) Ignore null values in request parameters
|
||||
|
||||
## 6.19.0 - 2018-09-24
|
||||
* [#523](https://github.com/stripe/stripe-php/pull/523) Add support for Stripe Terminal
|
||||
|
||||
## 6.18.0 - 2018-09-24
|
||||
* [#520](https://github.com/stripe/stripe-php/pull/520) Rename `\Stripe\FileUpload` to `\Stripe\File`
|
||||
|
||||
## 6.17.2 - 2018-09-18
|
||||
* [#522](https://github.com/stripe/stripe-php/pull/522) Fix warning when adding a new additional owner to an existing array
|
||||
|
||||
## 6.17.1 - 2018-09-14
|
||||
* [#517](https://github.com/stripe/stripe-php/pull/517) Integer-index encode all sequential arrays
|
||||
|
||||
## 6.17.0 - 2018-09-05
|
||||
* [#514](https://github.com/stripe/stripe-php/pull/514) Add support for reporting resources
|
||||
|
||||
## 6.16.0 - 2018-08-23
|
||||
* [#509](https://github.com/stripe/stripe-php/pull/509) Add support for usage record summaries
|
||||
|
||||
## 6.15.0 - 2018-08-03
|
||||
* [#504](https://github.com/stripe/stripe-php/pull/504) Add cancel support for topups
|
||||
|
||||
## 6.14.0 - 2018-08-02
|
||||
* [#505](https://github.com/stripe/stripe-php/pull/505) Add support for file links
|
||||
|
||||
## 6.13.0 - 2018-07-31
|
||||
* [#502](https://github.com/stripe/stripe-php/pull/502) Add `isDeleted()` method to `\Stripe\StripeObject`
|
||||
|
||||
## 6.12.0 - 2018-07-28
|
||||
* [#501](https://github.com/stripe/stripe-php/pull/501) Add support for scheduled query runs (`\Stripe\Sigma\ScheduledQueryRun`) for Sigma
|
||||
|
||||
## 6.11.0 - 2018-07-26
|
||||
* [#500](https://github.com/stripe/stripe-php/pull/500) Add support for Stripe Issuing
|
||||
|
||||
## 6.10.4 - 2018-07-19
|
||||
* [#498](https://github.com/stripe/stripe-php/pull/498) Internal improvements to the `\Stripe\ApiResource.classUrl()` method
|
||||
|
||||
## 6.10.3 - 2018-07-16
|
||||
* [#497](https://github.com/stripe/stripe-php/pull/497) Use HTTP/2 only for HTTPS requests
|
||||
|
||||
## 6.10.2 - 2018-07-11
|
||||
* [#494](https://github.com/stripe/stripe-php/pull/494) Enable HTTP/2 support
|
||||
|
||||
## 6.10.1 - 2018-07-10
|
||||
* [#493](https://github.com/stripe/stripe-php/pull/493) Add PHPDoc for `auto_advance` on `\Stripe\Invoice`
|
||||
|
||||
## 6.10.0 - 2018-06-28
|
||||
* [#488](https://github.com/stripe/stripe-php/pull/488) Add support for `$appPartnerId` to `Stripe::setAppInfo()`
|
||||
|
||||
## 6.9.0 - 2018-06-28
|
||||
* [#487](https://github.com/stripe/stripe-php/pull/487) Add support for payment intents
|
||||
|
||||
## 6.8.2 - 2018-06-24
|
||||
* [#486](https://github.com/stripe/stripe-php/pull/486) Make `Account.deauthorize()` return the `StripeObject` from the API
|
||||
|
||||
## 6.8.1 - 2018-06-13
|
||||
* [#472](https://github.com/stripe/stripe-php/pull/472) Added phpDoc for `ApiRequestor` and others, especially regarding thrown errors
|
||||
|
||||
## 6.8.0 - 2018-06-13
|
||||
* [#481](https://github.com/stripe/stripe-php/pull/481) Add new `\Stripe\Discount` and `\Stripe\OrderItem` classes, add more PHPDoc describing object attributes
|
||||
|
||||
## 6.7.4 - 2018-05-29
|
||||
* [#480](https://github.com/stripe/stripe-php/pull/480) PHPDoc changes for API version 2018-05-21 and the addition of the new `CHARGE_EXPIRED` event type
|
||||
|
||||
## 6.7.3 - 2018-05-28
|
||||
* [#479](https://github.com/stripe/stripe-php/pull/479) Fix unnecessary traits on `\Stripe\InvoiceLineItem`
|
||||
|
||||
## 6.7.2 - 2018-05-28
|
||||
* [#471](https://github.com/stripe/stripe-php/pull/471) Add `OBJECT_NAME` constant to all API resource classes, add `\Stripe\InvoiceLineItem` class
|
||||
|
||||
## 6.7.1 - 2018-05-13
|
||||
* [#468](https://github.com/stripe/stripe-php/pull/468) Update fields in PHP docs for accuracy
|
||||
|
||||
## 6.7.0 - 2018-05-09
|
||||
* [#466](https://github.com/stripe/stripe-php/pull/466) Add support for issuer fraud records
|
||||
|
||||
## 6.6.0 - 2018-04-11
|
||||
* [#460](https://github.com/stripe/stripe-php/pull/460) Add support for flexible billing primitives
|
||||
|
||||
## 6.5.0 - 2018-04-05
|
||||
* [#461](https://github.com/stripe/stripe-php/pull/461) Don't zero keys on non-`metadata` subobjects
|
||||
|
||||
## 6.4.2 - 2018-03-17
|
||||
* [#458](https://github.com/stripe/stripe-php/pull/458) Add PHPDoc for `account` on `\Stripe\Event`
|
||||
|
||||
## 6.4.1 - 2018-03-02
|
||||
* [#455](https://github.com/stripe/stripe-php/pull/455) Fix namespaces in PHPDoc
|
||||
* [#456](https://github.com/stripe/stripe-php/pull/456) Fix namespaces for some exceptions
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2010-2015 Stripe
|
||||
Copyright (c) 2010-2019 Stripe, Inc. (https://stripe.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -62,7 +62,7 @@ Please see https://stripe.com/docs/api for up-to-date documentation.
|
||||
|
||||
### PHP 5.3
|
||||
|
||||
If you are using PHP 5.3, you can download v5.8.0 ([zip](https://github.com/stripe/stripe-php/archive/v5.8.0.zip), [tar.gz](https://github.com/stripe/stripe-php/archive/v5.8.0.tar.gz)) from our [releases page](https://github.com/stripe/stripe-php/releases). This version will continue to work with new versions of the Stripe API for all common uses.
|
||||
If you are using PHP 5.3, you can download v5.9.2 ([zip](https://github.com/stripe/stripe-php/archive/v5.9.2.zip), [tar.gz](https://github.com/stripe/stripe-php/archive/v5.9.2.tar.gz)) from our [releases page](https://github.com/stripe/stripe-php/releases). This version will continue to work with new versions of the Stripe API for all common uses.
|
||||
|
||||
### PHP 5.2
|
||||
|
||||
@@ -181,9 +181,15 @@ retries are safe.
|
||||
|
||||
## Development
|
||||
|
||||
Get [Composer][composer]. For example, on Mac OS:
|
||||
|
||||
```bash
|
||||
brew install composer
|
||||
```
|
||||
|
||||
Install dependencies:
|
||||
|
||||
``` bash
|
||||
```bash
|
||||
composer install
|
||||
```
|
||||
|
||||
@@ -191,8 +197,10 @@ The test suite depends on [stripe-mock], so make sure to fetch and run it from a
|
||||
background terminal ([stripe-mock's README][stripe-mock] also contains
|
||||
instructions for installing via Homebrew and other methods):
|
||||
|
||||
go get -u github.com/stripe/stripe-mock
|
||||
stripe-mock
|
||||
```bash
|
||||
go get -u github.com/stripe/stripe-mock
|
||||
stripe-mock
|
||||
```
|
||||
|
||||
Install dependencies as mentioned above (which will resolve [PHPUnit](http://packagist.org/packages/phpunit/phpunit)), then you can run the test suite:
|
||||
|
||||
@@ -226,6 +234,7 @@ The method should be called once, before any request is sent to the API. The sec
|
||||
|
||||
See the "SSL / TLS compatibility issues" paragraph above for full context. If you want to ensure that your plugin can be used on all systems, you should add a configuration option to let your users choose between different values for `CURLOPT_SSLVERSION`: none (default), `CURL_SSLVERSION_TLSv1` and `CURL_SSLVERSION_TLSv1_2`.
|
||||
|
||||
[composer]: https://getcomposer.org/
|
||||
[connect]: https://stripe.com/connect
|
||||
[curl]: http://curl.haxx.se/docs/caextract.html
|
||||
[psr3]: http://www.php-fig.org/psr/psr-3/
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.4.1
|
||||
6.34.3
|
||||
|
||||
@@ -13,7 +13,7 @@ if (!$autoload) {
|
||||
file_put_contents('composer.json', json_encode($composer, JSON_PRETTY_PRINT));
|
||||
}
|
||||
|
||||
passthru('composer install', $returnStatus);
|
||||
passthru('composer update', $returnStatus);
|
||||
if ($returnStatus !== 0) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -22,8 +22,9 @@
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~4.0",
|
||||
"satooshi/php-coveralls": "~0.6.1",
|
||||
"squizlabs/php_codesniffer": "~2.0"
|
||||
"php-coveralls/php-coveralls": "1.*",
|
||||
"squizlabs/php_codesniffer": "~2.0",
|
||||
"symfony/process": "~2.8"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": { "Stripe\\" : "lib/" }
|
||||
|
||||
@@ -5,6 +5,7 @@ require(dirname(__FILE__) . '/lib/Stripe.php');
|
||||
|
||||
// Utilities
|
||||
require(dirname(__FILE__) . '/lib/Util/AutoPagingIterator.php');
|
||||
require(dirname(__FILE__) . '/lib/Util/CaseInsensitiveArray.php');
|
||||
require(dirname(__FILE__) . '/lib/Util/LoggerInterface.php');
|
||||
require(dirname(__FILE__) . '/lib/Util/DefaultLogger.php');
|
||||
require(dirname(__FILE__) . '/lib/Util/RandomGenerator.php');
|
||||
@@ -48,6 +49,7 @@ require(dirname(__FILE__) . '/lib/ApiOperations/Update.php');
|
||||
|
||||
// Plumbing
|
||||
require(dirname(__FILE__) . '/lib/ApiResponse.php');
|
||||
require(dirname(__FILE__) . '/lib/RequestTelemetry.php');
|
||||
require(dirname(__FILE__) . '/lib/StripeObject.php');
|
||||
require(dirname(__FILE__) . '/lib/ApiRequestor.php');
|
||||
require(dirname(__FILE__) . '/lib/ApiResource.php');
|
||||
@@ -55,6 +57,7 @@ require(dirname(__FILE__) . '/lib/SingletonApiResource.php');
|
||||
|
||||
// Stripe API Resources
|
||||
require(dirname(__FILE__) . '/lib/Account.php');
|
||||
require(dirname(__FILE__) . '/lib/AccountLink.php');
|
||||
require(dirname(__FILE__) . '/lib/AlipayAccount.php');
|
||||
require(dirname(__FILE__) . '/lib/ApplePayDomain.php');
|
||||
require(dirname(__FILE__) . '/lib/ApplicationFee.php');
|
||||
@@ -66,40 +69,73 @@ require(dirname(__FILE__) . '/lib/BitcoinReceiver.php');
|
||||
require(dirname(__FILE__) . '/lib/BitcoinTransaction.php');
|
||||
require(dirname(__FILE__) . '/lib/Card.php');
|
||||
require(dirname(__FILE__) . '/lib/Charge.php');
|
||||
require(dirname(__FILE__) . '/lib/Checkout/Session.php');
|
||||
require(dirname(__FILE__) . '/lib/Collection.php');
|
||||
require(dirname(__FILE__) . '/lib/CountrySpec.php');
|
||||
require(dirname(__FILE__) . '/lib/Coupon.php');
|
||||
require(dirname(__FILE__) . '/lib/CreditNote.php');
|
||||
require(dirname(__FILE__) . '/lib/Customer.php');
|
||||
require(dirname(__FILE__) . '/lib/Discount.php');
|
||||
require(dirname(__FILE__) . '/lib/Dispute.php');
|
||||
require(dirname(__FILE__) . '/lib/EphemeralKey.php');
|
||||
require(dirname(__FILE__) . '/lib/Event.php');
|
||||
require(dirname(__FILE__) . '/lib/ExchangeRate.php');
|
||||
require(dirname(__FILE__) . '/lib/File.php');
|
||||
require(dirname(__FILE__) . '/lib/FileLink.php');
|
||||
require(dirname(__FILE__) . '/lib/FileUpload.php');
|
||||
require(dirname(__FILE__) . '/lib/Invoice.php');
|
||||
require(dirname(__FILE__) . '/lib/InvoiceItem.php');
|
||||
require(dirname(__FILE__) . '/lib/InvoiceLineItem.php');
|
||||
require(dirname(__FILE__) . '/lib/IssuerFraudRecord.php');
|
||||
require(dirname(__FILE__) . '/lib/Issuing/Authorization.php');
|
||||
require(dirname(__FILE__) . '/lib/Issuing/Card.php');
|
||||
require(dirname(__FILE__) . '/lib/Issuing/CardDetails.php');
|
||||
require(dirname(__FILE__) . '/lib/Issuing/Cardholder.php');
|
||||
require(dirname(__FILE__) . '/lib/Issuing/Dispute.php');
|
||||
require(dirname(__FILE__) . '/lib/Issuing/Transaction.php');
|
||||
require(dirname(__FILE__) . '/lib/LoginLink.php');
|
||||
require(dirname(__FILE__) . '/lib/Order.php');
|
||||
require(dirname(__FILE__) . '/lib/OrderItem.php');
|
||||
require(dirname(__FILE__) . '/lib/OrderReturn.php');
|
||||
require(dirname(__FILE__) . '/lib/PaymentIntent.php');
|
||||
require(dirname(__FILE__) . '/lib/PaymentMethod.php');
|
||||
require(dirname(__FILE__) . '/lib/Payout.php');
|
||||
require(dirname(__FILE__) . '/lib/Person.php');
|
||||
require(dirname(__FILE__) . '/lib/Plan.php');
|
||||
require(dirname(__FILE__) . '/lib/Product.php');
|
||||
require(dirname(__FILE__) . '/lib/Radar/ValueList.php');
|
||||
require(dirname(__FILE__) . '/lib/Radar/ValueListItem.php');
|
||||
require(dirname(__FILE__) . '/lib/Recipient.php');
|
||||
require(dirname(__FILE__) . '/lib/RecipientTransfer.php');
|
||||
require(dirname(__FILE__) . '/lib/Refund.php');
|
||||
require(dirname(__FILE__) . '/lib/Reporting/ReportRun.php');
|
||||
require(dirname(__FILE__) . '/lib/Reporting/ReportType.php');
|
||||
require(dirname(__FILE__) . '/lib/Review.php');
|
||||
require(dirname(__FILE__) . '/lib/SKU.php');
|
||||
require(dirname(__FILE__) . '/lib/Sigma/ScheduledQueryRun.php');
|
||||
require(dirname(__FILE__) . '/lib/Source.php');
|
||||
require(dirname(__FILE__) . '/lib/SourceTransaction.php');
|
||||
require(dirname(__FILE__) . '/lib/Subscription.php');
|
||||
require(dirname(__FILE__) . '/lib/SubscriptionItem.php');
|
||||
require(dirname(__FILE__) . '/lib/SubscriptionSchedule.php');
|
||||
require(dirname(__FILE__) . '/lib/SubscriptionScheduleRevision.php');
|
||||
require(dirname(__FILE__) . '/lib/TaxId.php');
|
||||
require(dirname(__FILE__) . '/lib/TaxRate.php');
|
||||
require(dirname(__FILE__) . '/lib/Terminal/ConnectionToken.php');
|
||||
require(dirname(__FILE__) . '/lib/Terminal/Location.php');
|
||||
require(dirname(__FILE__) . '/lib/Terminal/Reader.php');
|
||||
require(dirname(__FILE__) . '/lib/ThreeDSecure.php');
|
||||
require(dirname(__FILE__) . '/lib/Token.php');
|
||||
require(dirname(__FILE__) . '/lib/Topup.php');
|
||||
require(dirname(__FILE__) . '/lib/Transfer.php');
|
||||
require(dirname(__FILE__) . '/lib/TransferReversal.php');
|
||||
require(dirname(__FILE__) . '/lib/UsageRecord.php');
|
||||
require(dirname(__FILE__) . '/lib/UsageRecordSummary.php');
|
||||
|
||||
// OAuth
|
||||
require(dirname(__FILE__) . '/lib/OAuth.php');
|
||||
|
||||
// Webhooks
|
||||
require(dirname(__FILE__) . '/lib/Webhook.php');
|
||||
require(dirname(__FILE__) . '/lib/WebhookEndpoint.php');
|
||||
require(dirname(__FILE__) . '/lib/WebhookSignature.php');
|
||||
|
||||
@@ -7,37 +7,32 @@ namespace Stripe;
|
||||
*
|
||||
* @property string $id
|
||||
* @property string $object
|
||||
* @property string $business_logo
|
||||
* @property string $business_name
|
||||
* @property string $business_primary_color
|
||||
* @property string $business_url
|
||||
* @property mixed $business_profile
|
||||
* @property string $business_type
|
||||
* @property mixed $capabilities
|
||||
* @property bool $charges_enabled
|
||||
* @property mixed $company
|
||||
* @property string $country
|
||||
* @property int $created
|
||||
* @property bool $debit_negative_balances
|
||||
* @property mixed $decline_charge_on
|
||||
* @property string $default_currency
|
||||
* @property bool $details_submitted
|
||||
* @property string $display_name
|
||||
* @property string $email
|
||||
* @property mixed $external_accounts
|
||||
* @property mixed $legal_entity
|
||||
* @property Collection $external_accounts
|
||||
* @property mixed $individual
|
||||
* @property StripeObject $metadata
|
||||
* @property mixed $payout_schedule
|
||||
* @property string $payout_statement_descriptor
|
||||
* @property bool $payouts_enabled
|
||||
* @property string $product_description
|
||||
* @property string $statement_descriptor
|
||||
* @property string $support_email
|
||||
* @property string $support_phone
|
||||
* @property string $timezone
|
||||
* @property mixed $requirements
|
||||
* @property mixed $settings
|
||||
* @property mixed $tos_acceptance
|
||||
* @property mixed $verification
|
||||
* @property string $type
|
||||
*
|
||||
* @package Stripe
|
||||
*/
|
||||
class Account extends ApiResource
|
||||
{
|
||||
|
||||
const OBJECT_NAME = "account";
|
||||
|
||||
use ApiOperations\All;
|
||||
use ApiOperations\Create;
|
||||
use ApiOperations\Delete;
|
||||
@@ -47,6 +42,37 @@ class Account extends ApiResource
|
||||
}
|
||||
use ApiOperations\Update;
|
||||
|
||||
/**
|
||||
* Possible string representations of an account's business type.
|
||||
* @link https://stripe.com/docs/api/accounts/object#account_object-business_type
|
||||
*/
|
||||
const BUSINESS_TYPE_COMPANY = 'company';
|
||||
const BUSINESS_TYPE_INDIVIDUAL = 'individual';
|
||||
|
||||
/**
|
||||
* Possible string representations of an account's capabilities.
|
||||
* @link https://stripe.com/docs/api/accounts/object#account_object-capabilities
|
||||
*/
|
||||
const CAPABILITY_CARD_PAYMENTS = 'card_payments';
|
||||
const CAPABILITY_LEGACY_PAYMENTS = 'legacy_payments';
|
||||
const CAPABILITY_PLATFORM_PAYMENTS = 'platform_payments';
|
||||
|
||||
/**
|
||||
* Possible string representations of an account's capability status.
|
||||
* @link https://stripe.com/docs/api/accounts/object#account_object-capabilities
|
||||
*/
|
||||
const CAPABILITY_STATUS_ACTIVE = 'active';
|
||||
const CAPABILITY_STATUS_INACTIVE = 'inactive';
|
||||
const CAPABILITY_STATUS_PENDING = 'pending';
|
||||
|
||||
/**
|
||||
* Possible string representations of an account's type.
|
||||
* @link https://stripe.com/docs/api/accounts/object#account_object-type
|
||||
*/
|
||||
const TYPE_CUSTOM = 'custom';
|
||||
const TYPE_EXPRESS = 'express';
|
||||
const TYPE_STANDARD = 'standard';
|
||||
|
||||
public static function getSavedNestedResources()
|
||||
{
|
||||
static $savedNestedResources = null;
|
||||
@@ -61,6 +87,7 @@ class Account extends ApiResource
|
||||
|
||||
const PATH_EXTERNAL_ACCOUNTS = '/external_accounts';
|
||||
const PATH_LOGIN_LINKS = '/login_links';
|
||||
const PATH_PERSONS = '/persons';
|
||||
|
||||
public function instanceUrl()
|
||||
{
|
||||
@@ -101,6 +128,21 @@ class Account extends ApiResource
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|null $params
|
||||
* @param array|string|null $options
|
||||
*
|
||||
* @return Collection The list of persons.
|
||||
*/
|
||||
public function persons($params = null, $options = null)
|
||||
{
|
||||
$url = $this->instanceUrl() . '/persons';
|
||||
list($response, $opts) = $this->_request('get', $url, $params, $options);
|
||||
$obj = Util\Util::convertToStripeObject($response, $opts);
|
||||
$obj->setLastResponse($response);
|
||||
return $obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|null $clientId
|
||||
* @param array|string|null $opts
|
||||
@@ -113,11 +155,11 @@ class Account extends ApiResource
|
||||
'client_id' => $clientId,
|
||||
'stripe_user_id' => $this->id,
|
||||
];
|
||||
OAuth::deauthorize($params, $opts);
|
||||
return OAuth::deauthorize($params, $opts);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|null $id The ID of the account on which to create the external account.
|
||||
* @param string|null $id The ID of the account on which to create the external account.
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
*
|
||||
@@ -129,7 +171,7 @@ class Account extends ApiResource
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|null $id The ID of the account to which the external account belongs.
|
||||
* @param string|null $id The ID of the account to which the external account belongs.
|
||||
* @param array|null $externalAccountId The ID of the external account to retrieve.
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
@@ -142,7 +184,7 @@ class Account extends ApiResource
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|null $id The ID of the account to which the external account belongs.
|
||||
* @param string|null $id The ID of the account to which the external account belongs.
|
||||
* @param array|null $externalAccountId The ID of the external account to update.
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
@@ -155,7 +197,7 @@ class Account extends ApiResource
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|null $id The ID of the account to which the external account belongs.
|
||||
* @param string|null $id The ID of the account to which the external account belongs.
|
||||
* @param array|null $externalAccountId The ID of the external account to delete.
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
@@ -168,11 +210,11 @@ class Account extends ApiResource
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|null $id The ID of the account on which to retrieve the external accounts.
|
||||
* @param string|null $id The ID of the account on which to retrieve the external accounts.
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
*
|
||||
* @return BankAccount|Card
|
||||
* @return Collection The list of external accounts (BankAccount or Card).
|
||||
*/
|
||||
public static function allExternalAccounts($id, $params = null, $opts = null)
|
||||
{
|
||||
@@ -180,7 +222,7 @@ class Account extends ApiResource
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|null $id The ID of the account on which to create the login link.
|
||||
* @param string|null $id The ID of the account on which to create the login link.
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
*
|
||||
@@ -191,6 +233,69 @@ class Account extends ApiResource
|
||||
return self::_createNestedResource($id, static::PATH_LOGIN_LINKS, $params, $opts);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $id The ID of the account on which to create the person.
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
*
|
||||
* @return Person
|
||||
*/
|
||||
public static function createPerson($id, $params = null, $opts = null)
|
||||
{
|
||||
return self::_createNestedResource($id, static::PATH_PERSONS, $params, $opts);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $id The ID of the account to which the person belongs.
|
||||
* @param string|null $personId The ID of the person to retrieve.
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
*
|
||||
* @return Person
|
||||
*/
|
||||
public static function retrievePerson($id, $personId, $params = null, $opts = null)
|
||||
{
|
||||
return self::_retrieveNestedResource($id, static::PATH_PERSONS, $personId, $params, $opts);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $id The ID of the account to which the person belongs.
|
||||
* @param string|null $personId The ID of the person to update.
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
*
|
||||
* @return Person
|
||||
*/
|
||||
public static function updatePerson($id, $personId, $params = null, $opts = null)
|
||||
{
|
||||
return self::_updateNestedResource($id, static::PATH_PERSONS, $personId, $params, $opts);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $id The ID of the account to which the person belongs.
|
||||
* @param string|null $personId The ID of the person to delete.
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
*
|
||||
* @return Person
|
||||
*/
|
||||
public static function deletePerson($id, $personId, $params = null, $opts = null)
|
||||
{
|
||||
return self::_deleteNestedResource($id, static::PATH_PERSONS, $personId, $params, $opts);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $id The ID of the account on which to retrieve the persons.
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
*
|
||||
* @return Collection The list of persons.
|
||||
*/
|
||||
public static function allPersons($id, $params = null, $opts = null)
|
||||
{
|
||||
return self::_allNestedResources($id, static::PATH_PERSONS, $params, $opts);
|
||||
}
|
||||
|
||||
public function serializeParameters($force = false)
|
||||
{
|
||||
$update = parent::serializeParameters($force);
|
||||
@@ -203,6 +308,12 @@ class Account extends ApiResource
|
||||
$update['legal_entity'] = $entityUpdate;
|
||||
}
|
||||
}
|
||||
if (isset($this->_values['individual'])) {
|
||||
$individual = $this['individual'];
|
||||
if (($individual instanceof Person) && !isset($update['individual'])) {
|
||||
$update['individual'] = $individual->serializeParameters($force);
|
||||
}
|
||||
}
|
||||
return $update;
|
||||
}
|
||||
|
||||
@@ -224,7 +335,9 @@ class Account extends ApiResource
|
||||
$update = ($v instanceof StripeObject) ? $v->serializeParameters() : $v;
|
||||
|
||||
if ($update !== []) {
|
||||
if (!$originalValue || ($update != $legalEntity->serializeParamsValue($originalValue[$i], null, false, true))) {
|
||||
if (!$originalValue ||
|
||||
!array_key_exists($i, $originalValue) ||
|
||||
($update != $legalEntity->serializeParamsValue($originalValue[$i], null, false, true))) {
|
||||
$updateArr[$i] = $update;
|
||||
}
|
||||
}
|
||||
|
||||
21
htdocs/includes/stripe/lib/AccountLink.php
Normal file
21
htdocs/includes/stripe/lib/AccountLink.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace Stripe;
|
||||
|
||||
/**
|
||||
* Class AccountLink
|
||||
*
|
||||
* @property string $object
|
||||
* @property int $created
|
||||
* @property int $expires_at
|
||||
* @property string $url
|
||||
*
|
||||
* @package Stripe
|
||||
*/
|
||||
class AccountLink extends ApiResource
|
||||
{
|
||||
|
||||
const OBJECT_NAME = "account_link";
|
||||
|
||||
use ApiOperations\Create;
|
||||
}
|
||||
@@ -12,6 +12,9 @@ namespace Stripe;
|
||||
*/
|
||||
class AlipayAccount extends ApiResource
|
||||
{
|
||||
|
||||
const OBJECT_NAME = "alipay_account";
|
||||
|
||||
use ApiOperations\Delete;
|
||||
use ApiOperations\Update;
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ trait All
|
||||
if (!is_a($obj, 'Stripe\\Collection')) {
|
||||
$class = get_class($obj);
|
||||
$message = "Expected type \"Stripe\\Collection\", got \"$class\" instead";
|
||||
throw new Error\Api($message);
|
||||
throw new \Stripe\Error\Api($message);
|
||||
}
|
||||
$obj->setLastResponse($response);
|
||||
$obj->setRequestParams($params);
|
||||
|
||||
@@ -60,6 +60,7 @@ trait NestedResource
|
||||
/**
|
||||
* @param string $id
|
||||
* @param string $nestedPath
|
||||
* @param string|null $nestedId
|
||||
* @param array|null $params
|
||||
* @param array|string|null $options
|
||||
*
|
||||
@@ -74,6 +75,7 @@ trait NestedResource
|
||||
/**
|
||||
* @param string $id
|
||||
* @param string $nestedPath
|
||||
* @param string|null $nestedId
|
||||
* @param array|null $params
|
||||
* @param array|string|null $options
|
||||
*
|
||||
@@ -88,6 +90,7 @@ trait NestedResource
|
||||
/**
|
||||
* @param string $id
|
||||
* @param string $nestedPath
|
||||
* @param string|null $nestedId
|
||||
* @param array|null $params
|
||||
* @param array|string|null $options
|
||||
*
|
||||
|
||||
@@ -52,7 +52,8 @@ trait Request
|
||||
protected static function _staticRequest($method, $url, $params, $options)
|
||||
{
|
||||
$opts = \Stripe\Util\RequestOptions::parse($options);
|
||||
$requestor = new \Stripe\ApiRequestor($opts->apiKey, static::baseUrl());
|
||||
$baseUrl = isset($opts->apiBase) ? $opts->apiBase : static::baseUrl();
|
||||
$requestor = new \Stripe\ApiRequestor($opts->apiKey, $baseUrl);
|
||||
list($response, $opts->apiKey) = $requestor->request($method, $url, $params, $opts->headers);
|
||||
$opts->discardNonPersistentHeaders();
|
||||
return [$response, $opts];
|
||||
|
||||
@@ -15,7 +15,7 @@ trait Retrieve
|
||||
* or an options array containing an `id` key.
|
||||
* @param array|string|null $opts
|
||||
*
|
||||
* @return \Stripe\StripeObject
|
||||
* @return static
|
||||
*/
|
||||
public static function retrieve($id, $opts = null)
|
||||
{
|
||||
|
||||
@@ -9,12 +9,32 @@ namespace Stripe;
|
||||
*/
|
||||
class ApiRequestor
|
||||
{
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
private $_apiKey;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $_apiBase;
|
||||
|
||||
/**
|
||||
* @var HttpClient\ClientInterface
|
||||
*/
|
||||
private static $_httpClient;
|
||||
|
||||
/**
|
||||
* @var RequestTelemetry
|
||||
*/
|
||||
private static $requestTelemetry;
|
||||
|
||||
/**
|
||||
* ApiRequestor constructor.
|
||||
*
|
||||
* @param string|null $apiKey
|
||||
* @param string|null $apiBase
|
||||
*/
|
||||
public function __construct($apiKey = null, $apiBase = null)
|
||||
{
|
||||
$this->_apiKey = $apiKey;
|
||||
@@ -24,6 +44,37 @@ class ApiRequestor
|
||||
$this->_apiBase = $apiBase;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a telemetry json blob for use in 'X-Stripe-Client-Telemetry' headers
|
||||
* @static
|
||||
*
|
||||
* @param RequestTelemetry $requestTelemetry
|
||||
* @return string
|
||||
*/
|
||||
private static function _telemetryJson($requestTelemetry)
|
||||
{
|
||||
$payload = array(
|
||||
'last_request_metrics' => array(
|
||||
'request_id' => $requestTelemetry->requestId,
|
||||
'request_duration_ms' => $requestTelemetry->requestDuration,
|
||||
));
|
||||
|
||||
$result = json_encode($payload);
|
||||
if ($result != false) {
|
||||
return $result;
|
||||
} else {
|
||||
Stripe::getLogger()->error("Serializing telemetry payload failed!");
|
||||
return "{}";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @static
|
||||
*
|
||||
* @param ApiResource|bool|array|mixed $d
|
||||
*
|
||||
* @return ApiResource|array|string|mixed
|
||||
*/
|
||||
private static function _encodeObjects($d)
|
||||
{
|
||||
if ($d instanceof ApiResource) {
|
||||
@@ -44,13 +95,27 @@ class ApiRequestor
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $method
|
||||
* @param string $url
|
||||
* @param string $method
|
||||
* @param string $url
|
||||
* @param array|null $params
|
||||
* @param array|null $headers
|
||||
*
|
||||
* @return array An array whose first element is an API response and second
|
||||
* element is the API key used to make the request.
|
||||
* @throws Error\Api
|
||||
* @throws Error\Authentication
|
||||
* @throws Error\Card
|
||||
* @throws Error\InvalidRequest
|
||||
* @throws Error\OAuth\InvalidClient
|
||||
* @throws Error\OAuth\InvalidGrant
|
||||
* @throws Error\OAuth\InvalidRequest
|
||||
* @throws Error\OAuth\InvalidScope
|
||||
* @throws Error\OAuth\UnsupportedGrantType
|
||||
* @throws Error\OAuth\UnsupportedResponseType
|
||||
* @throws Error\Permission
|
||||
* @throws Error\RateLimit
|
||||
* @throws Error\Idempotency
|
||||
* @throws Error\ApiConnection
|
||||
*/
|
||||
public function request($method, $url, $params = null, $headers = null)
|
||||
{
|
||||
@@ -70,13 +135,22 @@ class ApiRequestor
|
||||
* @param array $resp
|
||||
*
|
||||
* @throws Error\InvalidRequest if the error is caused by the user.
|
||||
* @throws Error\Idempotency if the error is caused by an idempotency key.
|
||||
* @throws Error\Authentication if the error is caused by a lack of
|
||||
* permissions.
|
||||
* @throws Error\Permission if the error is caused by insufficient
|
||||
* permissions.
|
||||
* @throws Error\Card if the error is the error code is 402 (payment
|
||||
* required)
|
||||
* @throws Error\InvalidRequest if the error is caused by the user.
|
||||
* @throws Error\Idempotency if the error is caused by an idempotency key.
|
||||
* @throws Error\OAuth\InvalidClient
|
||||
* @throws Error\OAuth\InvalidGrant
|
||||
* @throws Error\OAuth\InvalidRequest
|
||||
* @throws Error\OAuth\InvalidScope
|
||||
* @throws Error\OAuth\UnsupportedGrantType
|
||||
* @throws Error\OAuth\UnsupportedResponseType
|
||||
* @throws Error\Permission if the error is caused by insufficient
|
||||
* permissions.
|
||||
* @throws Error\RateLimit if the error is caused by too many requests
|
||||
* hitting the API.
|
||||
* @throws Error\Api otherwise.
|
||||
@@ -102,6 +176,17 @@ class ApiRequestor
|
||||
throw $error;
|
||||
}
|
||||
|
||||
/**
|
||||
* @static
|
||||
*
|
||||
* @param string $rbody
|
||||
* @param int $rcode
|
||||
* @param array $rheaders
|
||||
* @param array $resp
|
||||
* @param array $errorData
|
||||
*
|
||||
* @return Error\RateLimit|Error\Idempotency|Error\InvalidRequest|Error\Authentication|Error\Card|Error\Permission|Error\Api
|
||||
*/
|
||||
private static function _specificAPIError($rbody, $rcode, $rheaders, $resp, $errorData)
|
||||
{
|
||||
$msg = isset($errorData['message']) ? $errorData['message'] : null;
|
||||
@@ -136,6 +221,17 @@ class ApiRequestor
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @static
|
||||
*
|
||||
* @param string|bool $rbody
|
||||
* @param int $rcode
|
||||
* @param array $rheaders
|
||||
* @param array $resp
|
||||
* @param string $errorCode
|
||||
*
|
||||
* @return null|Error\OAuth\InvalidClient|Error\OAuth\InvalidGrant|Error\OAuth\InvalidRequest|Error\OAuth\InvalidScope|Error\OAuth\UnsupportedGrantType|Error\OAuth\UnsupportedResponseType
|
||||
*/
|
||||
private static function _specificOAuthError($rbody, $rcode, $rheaders, $resp, $errorCode)
|
||||
{
|
||||
$description = isset($resp['error_description']) ? $resp['error_description'] : $errorCode;
|
||||
@@ -158,6 +254,13 @@ class ApiRequestor
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @static
|
||||
*
|
||||
* @param null|array $appInfo
|
||||
*
|
||||
* @return null|string
|
||||
*/
|
||||
private static function _formatAppInfo($appInfo)
|
||||
{
|
||||
if ($appInfo !== null) {
|
||||
@@ -174,6 +277,14 @@ class ApiRequestor
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @static
|
||||
*
|
||||
* @param string $apiKey
|
||||
* @param null $clientInfo
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private static function _defaultHeaders($apiKey, $clientInfo = null)
|
||||
{
|
||||
$uaString = 'Stripe/v1 PhpBindings/' . Stripe::VERSION;
|
||||
@@ -205,6 +316,17 @@ class ApiRequestor
|
||||
return $defaultHeaders;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $method
|
||||
* @param string $url
|
||||
* @param array $params
|
||||
* @param array $headers
|
||||
*
|
||||
* @return array
|
||||
* @throws Error\Api
|
||||
* @throws Error\ApiConnection
|
||||
* @throws Error\Authentication
|
||||
*/
|
||||
private function _requestRaw($method, $url, $params, $headers)
|
||||
{
|
||||
$myApiKey = $this->_apiKey;
|
||||
@@ -239,6 +361,10 @@ class ApiRequestor
|
||||
$defaultHeaders['Stripe-Account'] = Stripe::$accountId;
|
||||
}
|
||||
|
||||
if (Stripe::$enableTelemetry && self::$requestTelemetry != null) {
|
||||
$defaultHeaders["X-Stripe-Client-Telemetry"] = self::_telemetryJson(self::$requestTelemetry);
|
||||
}
|
||||
|
||||
$hasFile = false;
|
||||
$hasCurlFile = class_exists('\CURLFile', false);
|
||||
foreach ($params as $k => $v) {
|
||||
@@ -263,6 +389,8 @@ class ApiRequestor
|
||||
$rawHeaders[] = $header . ': ' . $value;
|
||||
}
|
||||
|
||||
$requestStartMs = Util\Util::currentTimeMillis();
|
||||
|
||||
list($rbody, $rcode, $rheaders) = $this->httpClient()->request(
|
||||
$method,
|
||||
$absUrl,
|
||||
@@ -270,9 +398,24 @@ class ApiRequestor
|
||||
$params,
|
||||
$hasFile
|
||||
);
|
||||
|
||||
if (array_key_exists('request-id', $rheaders)) {
|
||||
self::$requestTelemetry = new RequestTelemetry(
|
||||
$rheaders['request-id'],
|
||||
Util\Util::currentTimeMillis() - $requestStartMs
|
||||
);
|
||||
}
|
||||
|
||||
return [$rbody, $rcode, $rheaders, $myApiKey];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param resource $resource
|
||||
* @param bool $hasCurlFile
|
||||
*
|
||||
* @return \CURLFile|string
|
||||
* @throws Error\Api
|
||||
*/
|
||||
private function _processResourceParam($resource, $hasCurlFile)
|
||||
{
|
||||
if (get_resource_type($resource) !== 'stream') {
|
||||
@@ -296,6 +439,26 @@ class ApiRequestor
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $rbody
|
||||
* @param int $rcode
|
||||
* @param array $rheaders
|
||||
*
|
||||
* @return mixed
|
||||
* @throws Error\Api
|
||||
* @throws Error\Authentication
|
||||
* @throws Error\Card
|
||||
* @throws Error\InvalidRequest
|
||||
* @throws Error\OAuth\InvalidClient
|
||||
* @throws Error\OAuth\InvalidGrant
|
||||
* @throws Error\OAuth\InvalidRequest
|
||||
* @throws Error\OAuth\InvalidScope
|
||||
* @throws Error\OAuth\UnsupportedGrantType
|
||||
* @throws Error\OAuth\UnsupportedResponseType
|
||||
* @throws Error\Permission
|
||||
* @throws Error\RateLimit
|
||||
* @throws Error\Idempotency
|
||||
*/
|
||||
private function _interpretResponse($rbody, $rcode, $rheaders)
|
||||
{
|
||||
$resp = json_decode($rbody, true);
|
||||
@@ -312,11 +475,29 @@ class ApiRequestor
|
||||
return $resp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @static
|
||||
*
|
||||
* @param HttpClient\ClientInterface $client
|
||||
*/
|
||||
public static function setHttpClient($client)
|
||||
{
|
||||
self::$_httpClient = $client;
|
||||
}
|
||||
|
||||
/**
|
||||
* @static
|
||||
*
|
||||
* Resets any stateful telemetry data
|
||||
*/
|
||||
public static function resetTelemetry()
|
||||
{
|
||||
self::$requestTelemetry = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return HttpClient\ClientInterface
|
||||
*/
|
||||
private function httpClient()
|
||||
{
|
||||
if (!self::$_httpClient) {
|
||||
|
||||
@@ -66,30 +66,6 @@ abstract class ApiResource extends StripeObject
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string The name of the class, with namespacing and underscores
|
||||
* stripped.
|
||||
*/
|
||||
public static function className()
|
||||
{
|
||||
$class = get_called_class();
|
||||
// Useful for namespaces: Foo\Charge
|
||||
if ($postfixNamespaces = strrchr($class, '\\')) {
|
||||
$class = substr($postfixNamespaces, 1);
|
||||
}
|
||||
// Useful for underscored 'namespaces': Foo_Charge
|
||||
if ($postfixFakeNamespaces = strrchr($class, '')) {
|
||||
$class = $postfixFakeNamespaces;
|
||||
}
|
||||
if (substr($class, 0, strlen('Stripe')) == 'Stripe') {
|
||||
$class = substr($class, strlen('Stripe'));
|
||||
}
|
||||
$class = str_replace('_', '', $class);
|
||||
$name = urlencode($class);
|
||||
$name = strtolower($name);
|
||||
return $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string The base URL for the given class.
|
||||
*/
|
||||
@@ -103,7 +79,9 @@ abstract class ApiResource extends StripeObject
|
||||
*/
|
||||
public static function classUrl()
|
||||
{
|
||||
$base = static::className();
|
||||
// Replace dots with slashes for namespaced resources, e.g. if the object's name is
|
||||
// "foo.bar", then its URL will be "/v1/foo/bars".
|
||||
$base = str_replace('.', '/', static::OBJECT_NAME);
|
||||
return "/v1/${base}s";
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,9 @@ namespace Stripe;
|
||||
*/
|
||||
class ApplePayDomain extends ApiResource
|
||||
{
|
||||
|
||||
const OBJECT_NAME = "apple_pay_domain";
|
||||
|
||||
use ApiOperations\All;
|
||||
use ApiOperations\Create;
|
||||
use ApiOperations\Delete;
|
||||
|
||||
@@ -24,23 +24,15 @@ namespace Stripe;
|
||||
*/
|
||||
class ApplicationFee extends ApiResource
|
||||
{
|
||||
|
||||
const OBJECT_NAME = "application_fee";
|
||||
|
||||
use ApiOperations\All;
|
||||
use ApiOperations\NestedResource;
|
||||
use ApiOperations\Retrieve;
|
||||
|
||||
const PATH_REFUNDS = '/refunds';
|
||||
|
||||
/**
|
||||
* This is a special case because the application fee endpoint has an
|
||||
* underscore in it. The parent `className` function strips underscores.
|
||||
*
|
||||
* @return string The name of the class.
|
||||
*/
|
||||
public static function className()
|
||||
{
|
||||
return 'application_fee';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
@@ -55,7 +47,7 @@ class ApplicationFee extends ApiResource
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|null $id The ID of the application fee on which to create the refund.
|
||||
* @param string|null $id The ID of the application fee on which to create the refund.
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
*
|
||||
@@ -67,7 +59,7 @@ class ApplicationFee extends ApiResource
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|null $id The ID of the application fee to which the refund belongs.
|
||||
* @param string|null $id The ID of the application fee to which the refund belongs.
|
||||
* @param array|null $refundId The ID of the refund to retrieve.
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
@@ -80,7 +72,7 @@ class ApplicationFee extends ApiResource
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|null $id The ID of the application fee to which the refund belongs.
|
||||
* @param string|null $id The ID of the application fee to which the refund belongs.
|
||||
* @param array|null $refundId The ID of the refund to update.
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
@@ -93,11 +85,11 @@ class ApplicationFee extends ApiResource
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|null $id The ID of the application fee on which to retrieve the refunds.
|
||||
* @param string|null $id The ID of the application fee on which to retrieve the refunds.
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
*
|
||||
* @return ApplicationFeeRefund
|
||||
* @return Collection The list of refunds.
|
||||
*/
|
||||
public static function allRefunds($id, $params = null, $opts = null)
|
||||
{
|
||||
|
||||
@@ -18,6 +18,9 @@ namespace Stripe;
|
||||
*/
|
||||
class ApplicationFeeRefund extends ApiResource
|
||||
{
|
||||
|
||||
const OBJECT_NAME = "fee_refund";
|
||||
|
||||
use ApiOperations\Update {
|
||||
save as protected _save;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ namespace Stripe;
|
||||
*
|
||||
* @property string $object
|
||||
* @property array $available
|
||||
* @property array $connect_reserved
|
||||
* @property bool $livemode
|
||||
* @property array $pending
|
||||
*
|
||||
@@ -14,6 +15,9 @@ namespace Stripe;
|
||||
*/
|
||||
class Balance extends SingletonApiResource
|
||||
{
|
||||
|
||||
const OBJECT_NAME = "balance";
|
||||
|
||||
/**
|
||||
* @param array|string|null $opts
|
||||
*
|
||||
|
||||
@@ -24,6 +24,9 @@ namespace Stripe;
|
||||
*/
|
||||
class BalanceTransaction extends ApiResource
|
||||
{
|
||||
|
||||
const OBJECT_NAME = "balance_transaction";
|
||||
|
||||
use ApiOperations\All;
|
||||
use ApiOperations\Retrieve;
|
||||
|
||||
|
||||
@@ -25,6 +25,9 @@ namespace Stripe;
|
||||
*/
|
||||
class BankAccount extends ApiResource
|
||||
{
|
||||
|
||||
const OBJECT_NAME = "bank_account";
|
||||
|
||||
use ApiOperations\Delete;
|
||||
use ApiOperations\Update;
|
||||
|
||||
|
||||
@@ -12,6 +12,9 @@ namespace Stripe;
|
||||
*/
|
||||
class BitcoinReceiver extends ApiResource
|
||||
{
|
||||
|
||||
const OBJECT_NAME = "bitcoin_receiver";
|
||||
|
||||
use ApiOperations\All;
|
||||
use ApiOperations\Retrieve;
|
||||
|
||||
|
||||
@@ -10,4 +10,5 @@ namespace Stripe;
|
||||
class BitcoinTransaction extends ApiResource
|
||||
{
|
||||
|
||||
const OBJECT_NAME = "bitcoin_transaction";
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ namespace Stripe;
|
||||
*
|
||||
* @property string $id
|
||||
* @property string $object
|
||||
* @property string $account
|
||||
* @property string $address_city
|
||||
* @property string $address_country
|
||||
* @property string $address_line1
|
||||
@@ -15,10 +16,13 @@ namespace Stripe;
|
||||
* @property string $address_state
|
||||
* @property string $address_zip
|
||||
* @property string $address_zip_check
|
||||
* @property string[] $available_payout_methods
|
||||
* @property string $brand
|
||||
* @property string $country
|
||||
* @property string $currency
|
||||
* @property string $customer
|
||||
* @property string $cvc_check
|
||||
* @property bool $default_for_currency
|
||||
* @property string $dynamic_last4
|
||||
* @property int $exp_month
|
||||
* @property int $exp_year
|
||||
@@ -27,15 +31,44 @@ namespace Stripe;
|
||||
* @property string $last4
|
||||
* @property StripeObject $metadata
|
||||
* @property string $name
|
||||
* @property string $recipient
|
||||
* @property string $tokenization_method
|
||||
*
|
||||
* @package Stripe
|
||||
*/
|
||||
class Card extends ApiResource
|
||||
{
|
||||
|
||||
const OBJECT_NAME = "card";
|
||||
|
||||
use ApiOperations\Delete;
|
||||
use ApiOperations\Update;
|
||||
|
||||
/**
|
||||
* Possible string representations of the CVC check status.
|
||||
* @link https://stripe.com/docs/api/cards/object#card_object-cvc_check
|
||||
*/
|
||||
const CVC_CHECK_FAIL = 'fail';
|
||||
const CVC_CHECK_PASS = 'pass';
|
||||
const CVC_CHECK_UNAVAILABLE = 'unavailable';
|
||||
const CVC_CHECK_UNCHECKED = 'unchecked';
|
||||
|
||||
/**
|
||||
* Possible string representations of the funding of the card.
|
||||
* @link https://stripe.com/docs/api/cards/object#card_object-funding
|
||||
*/
|
||||
const FUNDING_CREDIT = 'credit';
|
||||
const FUNDING_DEBIT = 'debit';
|
||||
const FUNDING_PREPAID = 'prepaid';
|
||||
const FUNDING_UNKNOWN = 'unknown';
|
||||
|
||||
/**
|
||||
* Possible string representations of the tokenization method when using Apple Pay or Google Pay.
|
||||
* @link https://stripe.com/docs/api/cards/object#card_object-tokenization_method
|
||||
*/
|
||||
const TOKENIZATION_METHOD_APPLE_PAY = 'apple_pay';
|
||||
const TOKENIZATION_METHOD_GOOGLE_PAY = 'google_pay';
|
||||
|
||||
/**
|
||||
* @return string The instance URL for this resource. It needs to be special
|
||||
* cased because cards are nested resources that may belong to different
|
||||
@@ -74,7 +107,7 @@ class Card extends ApiResource
|
||||
{
|
||||
$msg = "Cards cannot be accessed without a customer, recipient or account ID. " .
|
||||
"Retrieve a card using \$customer->sources->retrieve('card_id'), " .
|
||||
"\$recipient->cards->retrieve('card_id'), or";
|
||||
"\$recipient->cards->retrieve('card_id'), or " .
|
||||
"\$account->external_accounts->retrieve('card_id') instead.";
|
||||
throw new Error\InvalidRequest($msg, null);
|
||||
}
|
||||
@@ -90,7 +123,7 @@ class Card extends ApiResource
|
||||
{
|
||||
$msg = "Cards cannot be accessed without a customer, recipient or account ID. " .
|
||||
"Call save() on \$customer->sources->retrieve('card_id'), " .
|
||||
"\$recipient->cards->retrieve('card_id'), or";
|
||||
"\$recipient->cards->retrieve('card_id'), or " .
|
||||
"\$account->external_accounts->retrieve('card_id') instead.";
|
||||
throw new Error\InvalidRequest($msg, null);
|
||||
}
|
||||
|
||||
@@ -29,8 +29,10 @@ namespace Stripe;
|
||||
* @property string $order
|
||||
* @property mixed $outcome
|
||||
* @property bool $paid
|
||||
* @property string $payment_intent
|
||||
* @property string $receipt_email
|
||||
* @property string $receipt_number
|
||||
* @property string $receipt_url
|
||||
* @property bool $refunded
|
||||
* @property Collection $refunds
|
||||
* @property string $review
|
||||
@@ -40,17 +42,77 @@ namespace Stripe;
|
||||
* @property string $statement_descriptor
|
||||
* @property string $status
|
||||
* @property string $transfer
|
||||
* @property mixed $transfer_data
|
||||
* @property string $transfer_group
|
||||
*
|
||||
* @package Stripe
|
||||
*/
|
||||
class Charge extends ApiResource
|
||||
{
|
||||
|
||||
const OBJECT_NAME = "charge";
|
||||
|
||||
use ApiOperations\All;
|
||||
use ApiOperations\Create;
|
||||
use ApiOperations\Retrieve;
|
||||
use ApiOperations\Update;
|
||||
|
||||
/**
|
||||
* Possible string representations of decline codes.
|
||||
* These strings are applicable to the decline_code property of the \Stripe\Error\Card exception.
|
||||
* @link https://stripe.com/docs/declines/codes
|
||||
*/
|
||||
const DECLINED_APPROVE_WITH_ID = 'approve_with_id';
|
||||
const DECLINED_CALL_ISSUER = 'call_issuer';
|
||||
const DECLINED_CARD_NOT_SUPPORTED = 'card_not_supported';
|
||||
const DECLINED_CARD_VELOCITY_EXCEEDED = 'card_velocity_exceeded';
|
||||
const DECLINED_CURRENCY_NOT_SUPPORTED = 'currency_not_supported';
|
||||
const DECLINED_DO_NOT_HONOR = 'do_not_honor';
|
||||
const DECLINED_DO_NOT_TRY_AGAIN = 'do_not_try_again';
|
||||
const DECLINED_DUPLICATED_TRANSACTION = 'duplicate_transaction';
|
||||
const DECLINED_EXPIRED_CARD = 'expired_card';
|
||||
const DECLINED_FRAUDULENT = 'fraudulent';
|
||||
const DECLINED_GENERIC_DECLINE = 'generic_decline';
|
||||
const DECLINED_INCORRECT_NUMBER = 'incorrect_number';
|
||||
const DECLINED_INCORRECT_CVC = 'incorrect_cvc';
|
||||
const DECLINED_INCORRECT_PIN = 'incorrect_pin';
|
||||
const DECLINED_INCORRECT_ZIP = 'incorrect_zip';
|
||||
const DECLINED_INSUFFICIENT_FUNDS = 'insufficient_funds';
|
||||
const DECLINED_INVALID_ACCOUNT = 'invalid_account';
|
||||
const DECLINED_INVALID_AMOUNT = 'invalid_amount';
|
||||
const DECLINED_INVALID_CVC = 'invalid_cvc';
|
||||
const DECLINED_INVALID_EXPIRY_YEAR = 'invalid_expiry_year';
|
||||
const DECLINED_INVALID_NUMBER = 'invalid_number';
|
||||
const DECLINED_INVALID_PIN = 'invalid_pin';
|
||||
const DECLINED_ISSUER_NOT_AVAILABLE = 'issuer_not_available';
|
||||
const DECLINED_LOST_CARD = 'lost_card';
|
||||
const DECLINED_NEW_ACCOUNT_INFORMATION_AVAILABLE = 'new_account_information_available';
|
||||
const DECLINED_NO_ACTION_TAKEN = 'no_action_taken';
|
||||
const DECLINED_NOT_PERMITTED = 'not_permitted';
|
||||
const DECLINED_PICKUP_CARD = 'pickup_card';
|
||||
const DECLINED_PIN_TRY_EXCEEDED = 'pin_try_exceeded';
|
||||
const DECLINED_PROCESSING_ERROR = 'processing_error';
|
||||
const DECLINED_REENTER_TRANSACTION = 'reenter_transaction';
|
||||
const DECLINED_RESTRICTED_CARD = 'restricted_card';
|
||||
const DECLINED_REVOCATION_OF_ALL_AUTHORIZATIONS = 'revocation_of_all_authorizations';
|
||||
const DECLINED_REVOCATION_OF_AUTHORIZATION = 'revocation_of_authorization';
|
||||
const DECLINED_SECURITY_VIOLATION = 'security_violation';
|
||||
const DECLINED_SERVICE_NOT_ALLOWED = 'service_not_allowed';
|
||||
const DECLINED_STOLEN_CARD = 'stolen_card';
|
||||
const DECLINED_STOP_PAYMENT_ORDER = 'stop_payment_order';
|
||||
const DECLINED_TESTMODE_DECLINE = 'testmode_decline';
|
||||
const DECLINED_TRANSACTION_NOT_ALLOWED = 'transaction_not_allowed';
|
||||
const DECLINED_TRY_AGAIN_LATER = 'try_again_later';
|
||||
const DECLINED_WITHDRAWAL_COUNT_LIMIT_EXCEEDED = 'withdrawal_count_limit_exceeded';
|
||||
|
||||
/**
|
||||
* Possible string representations of the status of the charge.
|
||||
* @link https://stripe.com/docs/api/charges/object#charge_object-status
|
||||
*/
|
||||
const STATUS_FAILED = 'failed';
|
||||
const STATUS_PENDING = 'pending';
|
||||
const STATUS_SUCCEEDED = 'succeeded';
|
||||
|
||||
/**
|
||||
* @param array|null $params
|
||||
* @param array|string|null $options
|
||||
|
||||
30
htdocs/includes/stripe/lib/Checkout/Session.php
Normal file
30
htdocs/includes/stripe/lib/Checkout/Session.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Stripe\Checkout;
|
||||
|
||||
/**
|
||||
* Class Session
|
||||
*
|
||||
* @property string $id
|
||||
* @property string $object
|
||||
* @property string $cancel_url
|
||||
* @property string $client_reference_id
|
||||
* @property string $customer
|
||||
* @property string $customer_email
|
||||
* @property mixed $display_items
|
||||
* @property bool $livemode
|
||||
* @property string $payment_intent
|
||||
* @property string[] $payment_method_types
|
||||
* @property string $subscription
|
||||
* @property string $success_url
|
||||
*
|
||||
* @package Stripe
|
||||
*/
|
||||
class Session extends \Stripe\ApiResource
|
||||
{
|
||||
|
||||
const OBJECT_NAME = "checkout.session";
|
||||
|
||||
use \Stripe\ApiOperations\Create;
|
||||
use \Stripe\ApiOperations\Retrieve;
|
||||
}
|
||||
@@ -12,8 +12,11 @@ namespace Stripe;
|
||||
*
|
||||
* @package Stripe
|
||||
*/
|
||||
class Collection extends StripeObject
|
||||
class Collection extends StripeObject implements \IteratorAggregate
|
||||
{
|
||||
|
||||
const OBJECT_NAME = "list";
|
||||
|
||||
use ApiOperations\Request;
|
||||
|
||||
protected $_requestParams = [];
|
||||
@@ -65,6 +68,15 @@ class Collection extends StripeObject
|
||||
return Util\Util::convertToStripeObject($response, $opts);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \ArrayIterator An iterator that can be used to iterate
|
||||
* across objects in the current page.
|
||||
*/
|
||||
public function getIterator()
|
||||
{
|
||||
return new \ArrayIterator($this->data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Util\AutoPagingIterator An iterator that can be used to iterate
|
||||
* across all objects across all pages. As page boundaries are
|
||||
|
||||
@@ -11,23 +11,16 @@ namespace Stripe;
|
||||
* @property mixed $supported_bank_account_currencies
|
||||
* @property string[] $supported_payment_currencies
|
||||
* @property string[] $supported_payment_methods
|
||||
* @property string[] $supported_transfer_countries
|
||||
* @property mixed $verification_fields
|
||||
*
|
||||
* @package Stripe
|
||||
*/
|
||||
class CountrySpec extends ApiResource
|
||||
{
|
||||
|
||||
const OBJECT_NAME = "country_spec";
|
||||
|
||||
use ApiOperations\All;
|
||||
use ApiOperations\Retrieve;
|
||||
|
||||
/**
|
||||
* This is a special case because the country specs endpoint has an
|
||||
* underscore in it. The parent `className` function strips underscores.
|
||||
*
|
||||
* @return string The name of the class.
|
||||
*/
|
||||
public static function className()
|
||||
{
|
||||
return 'country_spec';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,8 @@ namespace Stripe;
|
||||
* @property bool $livemode
|
||||
* @property int $max_redemptions
|
||||
* @property StripeObject $metadata
|
||||
* @property int $percent_off
|
||||
* @property string $name
|
||||
* @property float $percent_off
|
||||
* @property int $redeem_by
|
||||
* @property int $times_redeemed
|
||||
* @property bool $valid
|
||||
@@ -24,6 +25,9 @@ namespace Stripe;
|
||||
*/
|
||||
class Coupon extends ApiResource
|
||||
{
|
||||
|
||||
const OBJECT_NAME = "coupon";
|
||||
|
||||
use ApiOperations\All;
|
||||
use ApiOperations\Create;
|
||||
use ApiOperations\Delete;
|
||||
|
||||
73
htdocs/includes/stripe/lib/CreditNote.php
Normal file
73
htdocs/includes/stripe/lib/CreditNote.php
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace Stripe;
|
||||
|
||||
/**
|
||||
* Class CreditNote
|
||||
*
|
||||
* @property string $id
|
||||
* @property string $object
|
||||
* @property int $amount
|
||||
* @property int $created
|
||||
* @property string $currency
|
||||
* @property string $customer
|
||||
* @property string $invoice
|
||||
* @property bool $livemode
|
||||
* @property string $memo
|
||||
* @property StripeObject $metadata
|
||||
* @property string $number
|
||||
* @property string $pdf
|
||||
* @property string $reason
|
||||
* @property string $refund
|
||||
* @property string $status
|
||||
* @property string $type
|
||||
*
|
||||
* @package Stripe
|
||||
*/
|
||||
class CreditNote extends ApiResource
|
||||
{
|
||||
|
||||
const OBJECT_NAME = "credit_note";
|
||||
|
||||
use ApiOperations\All;
|
||||
use ApiOperations\Create;
|
||||
use ApiOperations\Retrieve;
|
||||
use ApiOperations\Update;
|
||||
|
||||
/**
|
||||
* Possible string representations of the credit note reason.
|
||||
* @link https://stripe.com/docs/api/credit_notes/object#credit_note_object-reason
|
||||
*/
|
||||
const REASON_DUPLICATE = 'duplicate';
|
||||
const REASON_FRAUDULENT = 'fraudulent';
|
||||
const REASON_ORDER_CHANGE = 'order_change';
|
||||
const REASON_PRODUCT_UNSATISFACTORY = 'product_unsatisfactory';
|
||||
|
||||
/**
|
||||
* Possible string representations of the credit note status.
|
||||
* @link https://stripe.com/docs/api/credit_notes/object#credit_note_object-status
|
||||
*/
|
||||
const STATUS_ISSUED = 'issued';
|
||||
const STATUS_VOID = 'void';
|
||||
|
||||
/**
|
||||
* Possible string representations of the credit note type.
|
||||
* @link https://stripe.com/docs/api/credit_notes/object#credit_note_object-status
|
||||
*/
|
||||
const TYPE_POST_PAYMENT = 'post_payment';
|
||||
const TYPE_PRE_PAYMENT = 'pre_payment';
|
||||
|
||||
/**
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
*
|
||||
* @return CreditNote The voided credit note.
|
||||
*/
|
||||
public function voidCreditNote($params = null, $opts = null)
|
||||
{
|
||||
$url = $this->instanceUrl() . '/void';
|
||||
list($response, $opts) = $this->_request('post', $url, $params, $opts);
|
||||
$this->refreshFrom($response, $opts);
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -8,24 +8,33 @@ namespace Stripe;
|
||||
* @property string $id
|
||||
* @property string $object
|
||||
* @property int $account_balance
|
||||
* @property string $business_vat_id
|
||||
* @property mixed $address
|
||||
* @property string $created
|
||||
* @property string $currency
|
||||
* @property string $default_source
|
||||
* @property bool $delinquent
|
||||
* @property string $description
|
||||
* @property mixed $discount
|
||||
* @property Discount $discount
|
||||
* @property string $email
|
||||
* @property string $invoice_prefix
|
||||
* @property mixed $invoice_settings
|
||||
* @property bool $livemode
|
||||
* @property StripeObject $metadata
|
||||
* @property string $name
|
||||
* @property string $phone
|
||||
* @property string[] preferred_locales
|
||||
* @property mixed $shipping
|
||||
* @property Collection $sources
|
||||
* @property Collection $subscriptions
|
||||
* @property Collection $tax_ids
|
||||
*
|
||||
* @package Stripe
|
||||
*/
|
||||
class Customer extends ApiResource
|
||||
{
|
||||
|
||||
const OBJECT_NAME = "customer";
|
||||
|
||||
use ApiOperations\All;
|
||||
use ApiOperations\Create;
|
||||
use ApiOperations\Delete;
|
||||
@@ -33,6 +42,14 @@ class Customer extends ApiResource
|
||||
use ApiOperations\Retrieve;
|
||||
use ApiOperations\Update;
|
||||
|
||||
/**
|
||||
* Possible string representations of the customer's type of tax exemption.
|
||||
* @link https://stripe.com/docs/api/customers/object#customer_object-tax_exempt
|
||||
*/
|
||||
const TAX_EXEMPT_NONE = 'none';
|
||||
const TAX_EXEMPT_EXEMPT = 'exempt';
|
||||
const TAX_EXEMPT_REVERSE = 'reverse';
|
||||
|
||||
public static function getSavedNestedResources()
|
||||
{
|
||||
static $savedNestedResources = null;
|
||||
@@ -45,6 +62,7 @@ class Customer extends ApiResource
|
||||
}
|
||||
|
||||
const PATH_SOURCES = '/sources';
|
||||
const PATH_TAX_IDS = '/tax_ids';
|
||||
|
||||
/**
|
||||
* @param array|null $params
|
||||
@@ -135,7 +153,7 @@ class Customer extends ApiResource
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|null $id The ID of the customer on which to create the source.
|
||||
* @param string|null $id The ID of the customer on which to create the source.
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
*
|
||||
@@ -147,8 +165,8 @@ class Customer extends ApiResource
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|null $id The ID of the customer to which the source belongs.
|
||||
* @param array|null $sourceId The ID of the source to retrieve.
|
||||
* @param string|null $id The ID of the customer to which the source belongs.
|
||||
* @param string|null $sourceId The ID of the source to retrieve.
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
*
|
||||
@@ -160,8 +178,8 @@ class Customer extends ApiResource
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|null $id The ID of the customer to which the source belongs.
|
||||
* @param array|null $sourceId The ID of the source to update.
|
||||
* @param string|null $id The ID of the customer to which the source belongs.
|
||||
* @param string|null $sourceId The ID of the source to update.
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
*
|
||||
@@ -173,8 +191,8 @@ class Customer extends ApiResource
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|null $id The ID of the customer to which the source belongs.
|
||||
* @param array|null $sourceId The ID of the source to delete.
|
||||
* @param string|null $id The ID of the customer to which the source belongs.
|
||||
* @param string|null $sourceId The ID of the source to delete.
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
*
|
||||
@@ -186,14 +204,64 @@ class Customer extends ApiResource
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|null $id The ID of the customer on which to retrieve the sources.
|
||||
* @param string|null $id The ID of the customer on which to retrieve the sources.
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
*
|
||||
* @return ApiResource
|
||||
* @return Collection The list of sources.
|
||||
*/
|
||||
public static function allSources($id, $params = null, $opts = null)
|
||||
{
|
||||
return self::_allNestedResources($id, static::PATH_SOURCES, $params, $opts);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $id The ID of the customer on which to create the tax id.
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
*
|
||||
* @return ApiResource
|
||||
*/
|
||||
public static function createTaxId($id, $params = null, $opts = null)
|
||||
{
|
||||
return self::_createNestedResource($id, static::PATH_TAX_IDS, $params, $opts);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $id The ID of the customer to which the tax id belongs.
|
||||
* @param string|null $taxIdId The ID of the tax id to retrieve.
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
*
|
||||
* @return ApiResource
|
||||
*/
|
||||
public static function retrieveTaxId($id, $taxIdId, $params = null, $opts = null)
|
||||
{
|
||||
return self::_retrieveNestedResource($id, static::PATH_TAX_IDS, $taxIdId, $params, $opts);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $id The ID of the customer to which the tax id belongs.
|
||||
* @param string|null $taxIdId The ID of the tax id to delete.
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
*
|
||||
* @return ApiResource
|
||||
*/
|
||||
public static function deleteTaxId($id, $taxIdId, $params = null, $opts = null)
|
||||
{
|
||||
return self::_deleteNestedResource($id, static::PATH_TAX_IDS, $taxIdId, $params, $opts);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $id The ID of the customer on which to retrieve the tax ids.
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
*
|
||||
* @return Collection The list of tax ids.
|
||||
*/
|
||||
public static function allTaxIds($id, $params = null, $opts = null)
|
||||
{
|
||||
return self::_allNestedResources($id, static::PATH_TAX_IDS, $params, $opts);
|
||||
}
|
||||
}
|
||||
|
||||
21
htdocs/includes/stripe/lib/Discount.php
Normal file
21
htdocs/includes/stripe/lib/Discount.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace Stripe;
|
||||
|
||||
/**
|
||||
* Class Discount
|
||||
*
|
||||
* @property string $object
|
||||
* @property Coupon $coupon
|
||||
* @property string $customer
|
||||
* @property int $end
|
||||
* @property int $start
|
||||
* @property string $subscription
|
||||
*
|
||||
* @package Stripe
|
||||
*/
|
||||
class Discount extends StripeObject
|
||||
{
|
||||
|
||||
const OBJECT_NAME = "discount";
|
||||
}
|
||||
@@ -8,7 +8,7 @@ namespace Stripe;
|
||||
* @property string $id
|
||||
* @property string $object
|
||||
* @property int $amount
|
||||
* @property mixed $balance_transactions
|
||||
* @property BalanceTransaction[] $balance_transactions
|
||||
* @property string $charge
|
||||
* @property int $created
|
||||
* @property string $currency
|
||||
@@ -24,6 +24,9 @@ namespace Stripe;
|
||||
*/
|
||||
class Dispute extends ApiResource
|
||||
{
|
||||
|
||||
const OBJECT_NAME = "dispute";
|
||||
|
||||
use ApiOperations\All;
|
||||
use ApiOperations\Retrieve;
|
||||
use ApiOperations\Update;
|
||||
@@ -33,6 +36,7 @@ class Dispute extends ApiResource
|
||||
* @link https://stripe.com/docs/api#dispute_object
|
||||
*/
|
||||
const REASON_BANK_CANNOT_PROCESS = 'bank_cannot_process';
|
||||
const REASON_CHECK_RETURNED = 'check_returned';
|
||||
const REASON_CREDIT_NOT_PROCESSED = 'credit_not_processed';
|
||||
const REASON_CUSTOMER_INITIATED = 'customer_initiated';
|
||||
const REASON_DEBIT_NOT_AUTHORIZED = 'debit_not_authorized';
|
||||
|
||||
@@ -17,22 +17,14 @@ namespace Stripe;
|
||||
*/
|
||||
class EphemeralKey extends ApiResource
|
||||
{
|
||||
|
||||
const OBJECT_NAME = "ephemeral_key";
|
||||
|
||||
use ApiOperations\Create {
|
||||
create as protected _create;
|
||||
}
|
||||
use ApiOperations\Delete;
|
||||
|
||||
/**
|
||||
* This is a special case because the ephemeral key endpoint has an
|
||||
* underscore in it. The parent `className` function strips underscores.
|
||||
*
|
||||
* @return string The name of the class.
|
||||
*/
|
||||
public static function className()
|
||||
{
|
||||
return 'ephemeral_key';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
|
||||
@@ -13,11 +13,11 @@ class OAuthBase extends \Stripe\Error\Base
|
||||
$httpHeaders = null
|
||||
) {
|
||||
parent::__construct($description, $httpStatus, $httpBody, $jsonBody, $httpHeaders);
|
||||
$this->code = $code;
|
||||
$this->errorCode = $code;
|
||||
}
|
||||
|
||||
public function getErrorCode()
|
||||
{
|
||||
return $this->code;
|
||||
return $this->errorCode;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,107 +7,152 @@ namespace Stripe;
|
||||
*
|
||||
* @property string $id
|
||||
* @property string $object
|
||||
* @property string $account
|
||||
* @property string $api_version
|
||||
* @property int $created
|
||||
* @property mixed $data
|
||||
* @property bool $livemode
|
||||
* @property int $pending_webhooks
|
||||
* @property mixed $request
|
||||
* @property int $created
|
||||
* @property mixed $data
|
||||
* @property bool $livemode
|
||||
* @property int $pending_webhooks
|
||||
* @property mixed $request
|
||||
* @property string $type
|
||||
*
|
||||
* @package Stripe
|
||||
*/
|
||||
class Event extends ApiResource
|
||||
{
|
||||
/**
|
||||
|
||||
const OBJECT_NAME = "event";
|
||||
|
||||
/**
|
||||
* Possible string representations of event types.
|
||||
* @link https://stripe.com/docs/api#event_types
|
||||
*/
|
||||
const ACCOUNT_UPDATED = 'account.updated';
|
||||
const ACCOUNT_APPLICATION_DEAUTHORIZED = 'account.application.deauthorized';
|
||||
const ACCOUNT_EXTERNAL_ACCOUNT_CREATED = 'account.external_account.created';
|
||||
const ACCOUNT_EXTERNAL_ACCOUNT_DELETED = 'account.external_account.deleted';
|
||||
const ACCOUNT_EXTERNAL_ACCOUNT_UPDATED = 'account.external_account.updated';
|
||||
const APPLICATION_FEE_CREATED = 'application_fee.created';
|
||||
const APPLICATION_FEE_REFUNDED = 'application_fee.refunded';
|
||||
const APPLICATION_FEE_REFUND_UPDATED = 'application_fee.refund.updated';
|
||||
const BALANCE_AVAILABLE = 'balance.available';
|
||||
const CHARGE_CAPTURED = 'charge.captured';
|
||||
const CHARGE_FAILED = 'charge.failed';
|
||||
const CHARGE_PENDING = 'charge.pending';
|
||||
const CHARGE_REFUNDED = 'charge.refunded';
|
||||
const CHARGE_SUCCEEDED = 'charge.succeeded';
|
||||
const CHARGE_UPDATED = 'charge.updated';
|
||||
const CHARGE_DISPUTE_CLOSED = 'charge.dispute.closed';
|
||||
const CHARGE_DISPUTE_CREATED = 'charge.dispute.created';
|
||||
const CHARGE_DISPUTE_FUNDS_REINSTATED = 'charge.dispute.funds_reinstated';
|
||||
const CHARGE_DISPUTE_FUNDS_WITHDRAWN = 'charge.dispute.funds_withdrawn';
|
||||
const CHARGE_DISPUTE_UPDATED = 'charge.dispute.updated';
|
||||
const CHARGE_REFUND_UPDATED = 'charge.refund.updated';
|
||||
const COUPON_CREATED = 'coupon.created';
|
||||
const COUPON_DELETED = 'coupon.deleted';
|
||||
const COUPON_UPDATED = 'coupon.updated';
|
||||
const CUSTOMER_CREATED = 'customer.created';
|
||||
const CUSTOMER_DELETED = 'customer.deleted';
|
||||
const CUSTOMER_UPDATED = 'customer.updated';
|
||||
const CUSTOMER_DISCOUNT_CREATED = 'customer.discount.created';
|
||||
const CUSTOMER_DISCOUNT_DELETED = 'customer.discount.deleted';
|
||||
const CUSTOMER_DISCOUNT_UPDATED = 'customer.discount.updated';
|
||||
const CUSTOMER_SOURCE_CREATED = 'customer.source.created';
|
||||
const CUSTOMER_SOURCE_DELETED = 'customer.source.deleted';
|
||||
const CUSTOMER_SOURCE_EXPIRING = 'customer.source.expiring';
|
||||
const CUSTOMER_SOURCE_UPDATED = 'customer.source.updated';
|
||||
const CUSTOMER_SUBSCRIPTION_CREATED = 'customer.subscription.created';
|
||||
const CUSTOMER_SUBSCRIPTION_DELETED = 'customer.subscription.deleted';
|
||||
const CUSTOMER_SUBSCRIPTION_TRIAL_WILL_END = 'customer.subscription.trial_will_end';
|
||||
const CUSTOMER_SUBSCRIPTION_UPDATED = 'customer.subscription.updated';
|
||||
const FILE_CREATED = 'file.created';
|
||||
const INVOICE_CREATED = 'invoice.created';
|
||||
const INVOICE_PAYMENT_FAILED = 'invoice.payment_failed';
|
||||
const INVOICE_PAYMENT_SUCCEEDED = 'invoice.payment_succeeded';
|
||||
const INVOICE_SENT = 'invoice.sent';
|
||||
const INVOICE_UPCOMING = 'invoice.upcoming';
|
||||
const INVOICE_UPDATED = 'invoice.updated';
|
||||
const INVOICEITEM_CREATED = 'invoiceitem.created';
|
||||
const INVOICEITEM_DELETED = 'invoiceitem.deleted';
|
||||
const INVOICEITEM_UPDATED = 'invoiceitem.updated';
|
||||
const ORDER_CREATED = 'order.created';
|
||||
const ORDER_PAYMENT_FAILED = 'order.payment_failed';
|
||||
const ORDER_PAYMENT_SUCCEEDED = 'order.payment_succeeded';
|
||||
const ORDER_UPDATED = 'order.updated';
|
||||
const ORDER_RETURN_CREATED = 'order_return.created';
|
||||
const PAYOUT_CANCELED = 'payout.canceled';
|
||||
const PAYOUT_CREATED = 'payout.created';
|
||||
const PAYOUT_FAILED = 'payout.failed';
|
||||
const PAYOUT_PAID = 'payout.paid';
|
||||
const PAYOUT_UPDATED = 'payout.updated';
|
||||
const PING = 'ping';
|
||||
const PLAN_CREATED = 'plan.created';
|
||||
const PLAN_DELETED = 'plan.deleted';
|
||||
const PLAN_UPDATED = 'plan.updated';
|
||||
const PRODUCT_CREATED = 'product.created';
|
||||
const PRODUCT_DELETED = 'product.deleted';
|
||||
const PRODUCT_UPDATED = 'product.updated';
|
||||
const RECIPIENT_CREATED = 'recipient.created';
|
||||
const RECIPIENT_DELETED = 'recipient.deleted';
|
||||
const RECIPIENT_UPDATED = 'recipient.updated';
|
||||
const REVIEW_CLOSED = 'review.closed';
|
||||
const REVIEW_OPENED = 'review.opened';
|
||||
const SIGMA_SCHEDULED_QUERY_RUN_CREATED = 'sigma.scheduled_query_run.created';
|
||||
const SKU_CREATED = 'sku.created';
|
||||
const SKU_DELETED = 'sku.deleted';
|
||||
const SKU_UPDATED = 'sku.updated';
|
||||
const SOURCE_CANCELED = 'source.canceled';
|
||||
const SOURCE_CHARGEABLE = 'source.chargeable';
|
||||
const SOURCE_FAILED = 'source.failed';
|
||||
const SOURCE_MANDATE_NOTIFICATION = 'source.mandate_notification';
|
||||
const SOURCE_TRANSACTION_CREATED = 'source.transaction.created';
|
||||
const TOPUP_CREATED = 'topup.created';
|
||||
const TOPUP_FAILED = 'topup.failed';
|
||||
const TOPUP_SUCCEEDED = 'topup.succeeded';
|
||||
const TRANSFER_CREATED = 'transfer.created';
|
||||
const TRANSFER_REVERSED = 'transfer.reversed';
|
||||
const TRANSFER_UPDATED = 'transfer.updated';
|
||||
const ACCOUNT_UPDATED = 'account.updated';
|
||||
const ACCOUNT_APPLICATION_AUTHORIZED = 'account.application.authorized';
|
||||
const ACCOUNT_APPLICATION_DEAUTHORIZED = 'account.application.deauthorized';
|
||||
const ACCOUNT_EXTERNAL_ACCOUNT_CREATED = 'account.external_account.created';
|
||||
const ACCOUNT_EXTERNAL_ACCOUNT_DELETED = 'account.external_account.deleted';
|
||||
const ACCOUNT_EXTERNAL_ACCOUNT_UPDATED = 'account.external_account.updated';
|
||||
const APPLICATION_FEE_CREATED = 'application_fee.created';
|
||||
const APPLICATION_FEE_REFUNDED = 'application_fee.refunded';
|
||||
const APPLICATION_FEE_REFUND_UPDATED = 'application_fee.refund.updated';
|
||||
const BALANCE_AVAILABLE = 'balance.available';
|
||||
const CHARGE_CAPTURED = 'charge.captured';
|
||||
const CHARGE_EXPIRED = 'charge.expired';
|
||||
const CHARGE_FAILED = 'charge.failed';
|
||||
const CHARGE_PENDING = 'charge.pending';
|
||||
const CHARGE_REFUNDED = 'charge.refunded';
|
||||
const CHARGE_SUCCEEDED = 'charge.succeeded';
|
||||
const CHARGE_UPDATED = 'charge.updated';
|
||||
const CHARGE_DISPUTE_CLOSED = 'charge.dispute.closed';
|
||||
const CHARGE_DISPUTE_CREATED = 'charge.dispute.created';
|
||||
const CHARGE_DISPUTE_FUNDS_REINSTATED = 'charge.dispute.funds_reinstated';
|
||||
const CHARGE_DISPUTE_FUNDS_WITHDRAWN = 'charge.dispute.funds_withdrawn';
|
||||
const CHARGE_DISPUTE_UPDATED = 'charge.dispute.updated';
|
||||
const CHARGE_REFUND_UPDATED = 'charge.refund.updated';
|
||||
const COUPON_CREATED = 'coupon.created';
|
||||
const COUPON_DELETED = 'coupon.deleted';
|
||||
const COUPON_UPDATED = 'coupon.updated';
|
||||
const CREDIT_NOTE_CREATED = 'credit_note.created';
|
||||
const CREDIT_NOTE_UPDATED = 'credit_note.updated';
|
||||
const CREDIT_NOTE_VOIDED = 'credit_note.voided';
|
||||
const CUSTOMER_CREATED = 'customer.created';
|
||||
const CUSTOMER_DELETED = 'customer.deleted';
|
||||
const CUSTOMER_UPDATED = 'customer.updated';
|
||||
const CUSTOMER_DISCOUNT_CREATED = 'customer.discount.created';
|
||||
const CUSTOMER_DISCOUNT_DELETED = 'customer.discount.deleted';
|
||||
const CUSTOMER_DISCOUNT_UPDATED = 'customer.discount.updated';
|
||||
const CUSTOMER_SOURCE_CREATED = 'customer.source.created';
|
||||
const CUSTOMER_SOURCE_DELETED = 'customer.source.deleted';
|
||||
const CUSTOMER_SOURCE_EXPIRING = 'customer.source.expiring';
|
||||
const CUSTOMER_SOURCE_UPDATED = 'customer.source.updated';
|
||||
const CUSTOMER_SUBSCRIPTION_CREATED = 'customer.subscription.created';
|
||||
const CUSTOMER_SUBSCRIPTION_DELETED = 'customer.subscription.deleted';
|
||||
const CUSTOMER_SUBSCRIPTION_TRIAL_WILL_END = 'customer.subscription.trial_will_end';
|
||||
const CUSTOMER_SUBSCRIPTION_UPDATED = 'customer.subscription.updated';
|
||||
const FILE_CREATED = 'file.created';
|
||||
const INVOICE_CREATED = 'invoice.created';
|
||||
const INVOICE_DELETED = 'invoice.deleted';
|
||||
const INVOICE_FINALIZED = 'invoice.finalized';
|
||||
const INVOICE_MARKED_UNCOLLECTIBLE = 'invoice.marked_uncollectible';
|
||||
const INVOICE_PAYMENT_FAILED = 'invoice.payment_failed';
|
||||
const INVOICE_PAYMENT_SUCCEEDED = 'invoice.payment_succeeded';
|
||||
const INVOICE_SENT = 'invoice.sent';
|
||||
const INVOICE_UPCOMING = 'invoice.upcoming';
|
||||
const INVOICE_UPDATED = 'invoice.updated';
|
||||
const INVOICE_VOIDED = 'invoice.voided';
|
||||
const INVOICEITEM_CREATED = 'invoiceitem.created';
|
||||
const INVOICEITEM_DELETED = 'invoiceitem.deleted';
|
||||
const INVOICEITEM_UPDATED = 'invoiceitem.updated';
|
||||
const ISSUER_FRAUD_RECORD_CREATED = 'issuer_fraud_record.created';
|
||||
const ISSUING_AUTHORIZATION_CREATED = 'issuing_authorization.created';
|
||||
const ISSUING_AUTHORIZATION_UPDATED = 'issuing_authorization.updated';
|
||||
const ISSUING_CARD_CREATED = 'issuing_card.created';
|
||||
const ISSUING_CARD_UPDATED = 'issuing_card.updated';
|
||||
const ISSUING_CARDHOLDER_CREATED = 'issuing_cardholder.created';
|
||||
const ISSUING_CARDHOLDER_UPDATED = 'issuing_cardholder.updated';
|
||||
const ISSUING_TRANSACTION_CREATED = 'issuing_transaction.created';
|
||||
const ISSUING_TRANSACTION_UPDATED = 'issuing_transaction.updated';
|
||||
const ORDER_CREATED = 'order.created';
|
||||
const ORDER_PAYMENT_FAILED = 'order.payment_failed';
|
||||
const ORDER_PAYMENT_SUCCEEDED = 'order.payment_succeeded';
|
||||
const ORDER_UPDATED = 'order.updated';
|
||||
const ORDER_RETURN_CREATED = 'order_return.created';
|
||||
const PAYMENT_INTENT_AMOUNT_CAPTURABLE_UPDATED = 'payment_intent.amount_capturable_updated';
|
||||
const PAYMENT_INTENT_CREATED = 'payment_intent.created';
|
||||
const PAYMENT_INTENT_PAYMENT_FAILED = 'payment_intent.payment_failed';
|
||||
const PAYMENT_INTENT_SUCCEEDED = 'payment_intent.succeeded';
|
||||
const PAYOUT_CANCELED = 'payout.canceled';
|
||||
const PAYOUT_CREATED = 'payout.created';
|
||||
const PAYOUT_FAILED = 'payout.failed';
|
||||
const PAYOUT_PAID = 'payout.paid';
|
||||
const PAYOUT_UPDATED = 'payout.updated';
|
||||
const PERSON_CREATED = 'person.created';
|
||||
const PERSON_DELETED = 'person.deleted';
|
||||
const PERSON_UPDATED = 'person.updated';
|
||||
const PING = 'ping';
|
||||
const PLAN_CREATED = 'plan.created';
|
||||
const PLAN_DELETED = 'plan.deleted';
|
||||
const PLAN_UPDATED = 'plan.updated';
|
||||
const PRODUCT_CREATED = 'product.created';
|
||||
const PRODUCT_DELETED = 'product.deleted';
|
||||
const PRODUCT_UPDATED = 'product.updated';
|
||||
const RECIPIENT_CREATED = 'recipient.created';
|
||||
const RECIPIENT_DELETED = 'recipient.deleted';
|
||||
const RECIPIENT_UPDATED = 'recipient.updated';
|
||||
const REPORTING_REPORT_RUN_FAILED = 'reporting.report_run.failed';
|
||||
const REPORTING_REPORT_RUN_SUCCEEDED = 'reporting.report_run.succeeded';
|
||||
const REPORTING_REPORT_TYPE_UPDATED = 'reporting.report_type.updated';
|
||||
const REVIEW_CLOSED = 'review.closed';
|
||||
const REVIEW_OPENED = 'review.opened';
|
||||
const SIGMA_SCHEDULED_QUERY_RUN_CREATED = 'sigma.scheduled_query_run.created';
|
||||
const SKU_CREATED = 'sku.created';
|
||||
const SKU_DELETED = 'sku.deleted';
|
||||
const SKU_UPDATED = 'sku.updated';
|
||||
const SOURCE_CANCELED = 'source.canceled';
|
||||
const SOURCE_CHARGEABLE = 'source.chargeable';
|
||||
const SOURCE_FAILED = 'source.failed';
|
||||
const SOURCE_MANDATE_NOTIFICATION = 'source.mandate_notification';
|
||||
const SOURCE_REFUND_ATTRIBUTES_REQUIRED = 'source.refund_attributes_required';
|
||||
const SOURCE_TRANSACTION_CREATED = 'source.transaction.created';
|
||||
const SOURCE_TRANSACTION_UPDATED = 'source.transaction.updated';
|
||||
const SUBSCRIPTION_SCHEDULE_ABORTED = 'subscription_schedule.aborted';
|
||||
const SUBSCRIPTION_SCHEDULE_CANCELED = 'subscription_schedule.canceled';
|
||||
const SUBSCRIPTION_SCHEDULE_COMPLETED = 'subscription_schedule.completed';
|
||||
const SUBSCRIPTION_SCHEDULE_CREATED = 'subscription_schedule.created';
|
||||
const SUBSCRIPTION_SCHEDULE_EXPIRING = 'subscription_schedule.expiring';
|
||||
const SUBSCRIPTION_SCHEDULE_RELEASED = 'subscription_schedule.released';
|
||||
const SUBSCRIPTION_SCHEDULE_UPDATED = 'subscription_schedule.updated';
|
||||
const TAX_RATE_CREATED = 'tax_rate.created';
|
||||
const TAX_RATE_UPDATED = 'tax_rate.updated';
|
||||
const TOPUP_CANCELED = 'topup.canceled';
|
||||
const TOPUP_CREATED = 'topup.created';
|
||||
const TOPUP_FAILED = 'topup.failed';
|
||||
const TOPUP_REVERSED = 'topup.reversed';
|
||||
const TOPUP_SUCCEEDED = 'topup.succeeded';
|
||||
const TRANSFER_CREATED = 'transfer.created';
|
||||
const TRANSFER_REVERSED = 'transfer.reversed';
|
||||
const TRANSFER_UPDATED = 'transfer.updated';
|
||||
|
||||
use ApiOperations\All;
|
||||
use ApiOperations\Retrieve;
|
||||
|
||||
@@ -9,17 +9,9 @@ namespace Stripe;
|
||||
*/
|
||||
class ExchangeRate extends ApiResource
|
||||
{
|
||||
|
||||
const OBJECT_NAME = "exchange_rate";
|
||||
|
||||
use ApiOperations\All;
|
||||
use ApiOperations\Retrieve;
|
||||
|
||||
/**
|
||||
* This is a special case because the exchange rates endpoint has an
|
||||
* underscore in it. The parent `className` function strips underscores.
|
||||
*
|
||||
* @return string The name of the class.
|
||||
*/
|
||||
public static function className()
|
||||
{
|
||||
return 'exchange_rate';
|
||||
}
|
||||
}
|
||||
|
||||
62
htdocs/includes/stripe/lib/File.php
Normal file
62
htdocs/includes/stripe/lib/File.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace Stripe;
|
||||
|
||||
/**
|
||||
* Class File
|
||||
*
|
||||
* @property string $id
|
||||
* @property string $object
|
||||
* @property int $created
|
||||
* @property string $filename
|
||||
* @property Collection $links
|
||||
* @property string $purpose
|
||||
* @property int $size
|
||||
* @property string $title
|
||||
* @property string $type
|
||||
* @property string $url
|
||||
*
|
||||
* @package Stripe
|
||||
*/
|
||||
class File extends ApiResource
|
||||
{
|
||||
// This resource can have two different object names. In latter API
|
||||
// versions, only `file` is used, but since stripe-php may be used with
|
||||
// any API version, we need to support deserializing the older
|
||||
// `file_upload` object into the same class.
|
||||
const OBJECT_NAME = "file";
|
||||
const OBJECT_NAME_ALT = "file_upload";
|
||||
|
||||
use ApiOperations\All;
|
||||
use ApiOperations\Create {
|
||||
create as protected _create;
|
||||
}
|
||||
use ApiOperations\Retrieve;
|
||||
|
||||
public static function classUrl()
|
||||
{
|
||||
return '/v1/files';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|null $params
|
||||
* @param array|string|null $options
|
||||
*
|
||||
* @return \Stripe\File The created resource.
|
||||
*/
|
||||
public static function create($params = null, $options = null)
|
||||
{
|
||||
$opts = \Stripe\Util\RequestOptions::parse($options);
|
||||
if (is_null($opts->apiBase)) {
|
||||
$opts->apiBase = Stripe::$apiUploadBase;
|
||||
}
|
||||
// Manually flatten params, otherwise curl's multipart encoder will
|
||||
// choke on nested arrays.
|
||||
// TODO: use array_column() once we drop support for PHP 5.4
|
||||
$flatParams = [];
|
||||
foreach (\Stripe\Util\Util::flattenParams($params) as $pair) {
|
||||
$flatParams[$pair[0]] = $pair[1];
|
||||
}
|
||||
return static::_create($flatParams, $opts);
|
||||
}
|
||||
}
|
||||
29
htdocs/includes/stripe/lib/FileLink.php
Normal file
29
htdocs/includes/stripe/lib/FileLink.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace Stripe;
|
||||
|
||||
/**
|
||||
* Class FileLink
|
||||
*
|
||||
* @property string $id
|
||||
* @property string $object
|
||||
* @property int $created
|
||||
* @property bool $expired
|
||||
* @property int $expires_at
|
||||
* @property string $file
|
||||
* @property bool $livemode
|
||||
* @property StripeObject $metadata
|
||||
* @property string $url
|
||||
*
|
||||
* @package Stripe
|
||||
*/
|
||||
class FileLink extends ApiResource
|
||||
{
|
||||
|
||||
const OBJECT_NAME = "file_link";
|
||||
|
||||
use ApiOperations\All;
|
||||
use ApiOperations\Create;
|
||||
use ApiOperations\Retrieve;
|
||||
use ApiOperations\Update;
|
||||
}
|
||||
@@ -2,31 +2,5 @@
|
||||
|
||||
namespace Stripe;
|
||||
|
||||
/**
|
||||
* Class FileUpload
|
||||
*
|
||||
* @property string $id
|
||||
* @property string $object
|
||||
* @property int $created
|
||||
* @property string $purpose
|
||||
* @property int $size
|
||||
* @property string $type
|
||||
*
|
||||
* @package Stripe
|
||||
*/
|
||||
class FileUpload extends ApiResource
|
||||
{
|
||||
use ApiOperations\All;
|
||||
use ApiOperations\Create;
|
||||
use ApiOperations\Retrieve;
|
||||
|
||||
public static function baseUrl()
|
||||
{
|
||||
return Stripe::$apiUploadBase;
|
||||
}
|
||||
|
||||
public static function className()
|
||||
{
|
||||
return 'file';
|
||||
}
|
||||
}
|
||||
// For backwards compatibility, the `File` class is aliased to `FileUpload`.
|
||||
class_alias('Stripe\\File', 'Stripe\\FileUpload');
|
||||
|
||||
@@ -11,8 +11,11 @@ interface ClientInterface
|
||||
* @param array $params KV pairs for parameters. Can be nested for arrays and hashes
|
||||
* @param boolean $hasFile Whether or not $params references a file (via an @ prefix or
|
||||
* CurlFile)
|
||||
* @throws \Stripe\Error\Api & \Stripe\Error\ApiConnection
|
||||
* @return [$rawBody, $httpStatusCode, $httpHeader]
|
||||
*
|
||||
* @throws \Stripe\Error\Api
|
||||
* @throws \Stripe\Error\ApiConnection
|
||||
* @return array An array whose first element is raw request body, second
|
||||
* element is HTTP status code and third array of HTTP headers.
|
||||
*/
|
||||
public function request($method, $absUrl, $headers, $params, $hasFile);
|
||||
}
|
||||
|
||||
@@ -22,6 +22,10 @@ if (!defined('CURL_SSLVERSION_TLSv1_2')) {
|
||||
}
|
||||
// @codingStandardsIgnoreEnd
|
||||
|
||||
if (!defined('CURL_HTTP_VERSION_2TLS')) {
|
||||
define('CURL_HTTP_VERSION_2TLS', 4);
|
||||
}
|
||||
|
||||
class CurlClient implements ClientInterface
|
||||
{
|
||||
private static $instance;
|
||||
@@ -38,6 +42,12 @@ class CurlClient implements ClientInterface
|
||||
|
||||
protected $userAgentInfo;
|
||||
|
||||
protected $enablePersistentConnections = null;
|
||||
|
||||
protected $enableHttp2 = null;
|
||||
|
||||
protected $curlHandle = null;
|
||||
|
||||
/**
|
||||
* CurlClient constructor.
|
||||
*
|
||||
@@ -56,6 +66,17 @@ class CurlClient implements ClientInterface
|
||||
$this->defaultOptions = $defaultOptions;
|
||||
$this->randomGenerator = $randomGenerator ?: new Util\RandomGenerator();
|
||||
$this->initUserAgentInfo();
|
||||
|
||||
// TODO: curl_reset requires PHP >= 5.5.0. Once we drop support for PHP 5.4, we can simply
|
||||
// initialize this to true.
|
||||
$this->enablePersistentConnections = function_exists('curl_reset');
|
||||
|
||||
$this->enableHttp2 = $this->canSafelyUseHttp2();
|
||||
}
|
||||
|
||||
public function __destruct()
|
||||
{
|
||||
$this->closeCurlHandle();
|
||||
}
|
||||
|
||||
public function initUserAgentInfo()
|
||||
@@ -77,6 +98,38 @@ class CurlClient implements ClientInterface
|
||||
return $this->userAgentInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
*/
|
||||
public function getEnablePersistentConnections()
|
||||
{
|
||||
return $this->enablePersistentConnections;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param boolean $enable
|
||||
*/
|
||||
public function setEnablePersistentConnections($enable)
|
||||
{
|
||||
$this->enablePersistentConnections = $enable;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
*/
|
||||
public function getEnableHttp2()
|
||||
{
|
||||
return $this->enableHttp2;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param boolean $enable
|
||||
*/
|
||||
public function setEnableHttp2($enable)
|
||||
{
|
||||
$this->enableHttp2 = $enable;
|
||||
}
|
||||
|
||||
// USER DEFINED TIMEOUTS
|
||||
|
||||
const DEFAULT_TIMEOUT = 80;
|
||||
@@ -123,6 +176,8 @@ class CurlClient implements ClientInterface
|
||||
$opts = $this->defaultOptions;
|
||||
}
|
||||
|
||||
$params = Util\Util::objectsToIds($params);
|
||||
|
||||
if ($method == 'get') {
|
||||
if ($hasFile) {
|
||||
throw new Error\Api(
|
||||
@@ -131,16 +186,16 @@ class CurlClient implements ClientInterface
|
||||
}
|
||||
$opts[CURLOPT_HTTPGET] = 1;
|
||||
if (count($params) > 0) {
|
||||
$encoded = Util\Util::urlEncode($params);
|
||||
$encoded = Util\Util::encodeParameters($params);
|
||||
$absUrl = "$absUrl?$encoded";
|
||||
}
|
||||
} elseif ($method == 'post') {
|
||||
$opts[CURLOPT_POST] = 1;
|
||||
$opts[CURLOPT_POSTFIELDS] = $hasFile ? $params : Util\Util::urlEncode($params);
|
||||
$opts[CURLOPT_POSTFIELDS] = $hasFile ? $params : Util\Util::encodeParameters($params);
|
||||
} elseif ($method == 'delete') {
|
||||
$opts[CURLOPT_CUSTOMREQUEST] = 'DELETE';
|
||||
if (count($params) > 0) {
|
||||
$encoded = Util\Util::urlEncode($params);
|
||||
$encoded = Util\Util::encodeParameters($params);
|
||||
$absUrl = "$absUrl?$encoded";
|
||||
}
|
||||
} else {
|
||||
@@ -150,13 +205,13 @@ class CurlClient implements ClientInterface
|
||||
// It is only safe to retry network failures on POST requests if we
|
||||
// add an Idempotency-Key header
|
||||
if (($method == 'post') && (Stripe::$maxNetworkRetries > 0)) {
|
||||
if (!isset($headers['Idempotency-Key'])) {
|
||||
if (!$this->hasHeader($headers, "Idempotency-Key")) {
|
||||
array_push($headers, 'Idempotency-Key: ' . $this->randomGenerator->uuid());
|
||||
}
|
||||
}
|
||||
|
||||
// Create a callback to capture HTTP headers for the response
|
||||
$rheaders = [];
|
||||
$rheaders = new Util\CaseInsensitiveArray();
|
||||
$headerCallback = function ($curl, $header_line) use (&$rheaders) {
|
||||
// Ignore the HTTP request line (HTTP/1.1 200 OK)
|
||||
if (strpos($header_line, ":") === false) {
|
||||
@@ -193,6 +248,11 @@ class CurlClient implements ClientInterface
|
||||
$opts[CURLOPT_SSL_VERIFYPEER] = false;
|
||||
}
|
||||
|
||||
if (!isset($opts[CURLOPT_HTTP_VERSION]) && $this->getEnableHttp2()) {
|
||||
// For HTTPS requests, enable HTTP/2, if supported
|
||||
$opts[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_2TLS;
|
||||
}
|
||||
|
||||
list($rbody, $rcode) = $this->executeRequestWithRetries($opts, $absUrl);
|
||||
|
||||
return [$rbody, $rcode, $rheaders];
|
||||
@@ -209,17 +269,19 @@ class CurlClient implements ClientInterface
|
||||
$rcode = 0;
|
||||
$errno = 0;
|
||||
|
||||
$curl = curl_init();
|
||||
curl_setopt_array($curl, $opts);
|
||||
$rbody = curl_exec($curl);
|
||||
$this->resetCurlHandle();
|
||||
curl_setopt_array($this->curlHandle, $opts);
|
||||
$rbody = curl_exec($this->curlHandle);
|
||||
|
||||
if ($rbody === false) {
|
||||
$errno = curl_errno($curl);
|
||||
$message = curl_error($curl);
|
||||
$errno = curl_errno($this->curlHandle);
|
||||
$message = curl_error($this->curlHandle);
|
||||
} else {
|
||||
$rcode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
|
||||
$rcode = curl_getinfo($this->curlHandle, CURLINFO_HTTP_CODE);
|
||||
}
|
||||
if (!$this->getEnablePersistentConnections()) {
|
||||
$this->closeCurlHandle();
|
||||
}
|
||||
curl_close($curl);
|
||||
|
||||
if ($this->shouldRetry($errno, $rcode, $numRetries)) {
|
||||
$numRetries += 1;
|
||||
@@ -331,4 +393,68 @@ class CurlClient implements ClientInterface
|
||||
|
||||
return $sleepSeconds;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the curl handle. If already initialized, the handle is closed first.
|
||||
*/
|
||||
private function initCurlHandle()
|
||||
{
|
||||
$this->closeCurlHandle();
|
||||
$this->curlHandle = curl_init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the curl handle if initialized. Do nothing if already closed.
|
||||
*/
|
||||
private function closeCurlHandle()
|
||||
{
|
||||
if (!is_null($this->curlHandle)) {
|
||||
curl_close($this->curlHandle);
|
||||
$this->curlHandle = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the curl handle. If the handle is not already initialized, or if persistent
|
||||
* connections are disabled, the handle is reinitialized instead.
|
||||
*/
|
||||
private function resetCurlHandle()
|
||||
{
|
||||
if (!is_null($this->curlHandle) && $this->getEnablePersistentConnections()) {
|
||||
curl_reset($this->curlHandle);
|
||||
} else {
|
||||
$this->initCurlHandle();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether it is safe to use HTTP/2 or not.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
private function canSafelyUseHttp2()
|
||||
{
|
||||
// Versions of curl older than 7.60.0 don't respect GOAWAY frames
|
||||
// (cf. https://github.com/curl/curl/issues/2416), which Stripe use.
|
||||
$curlVersion = curl_version()['version'];
|
||||
return (version_compare($curlVersion, '7.60.0') >= 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a list of headers contains a specific header name.
|
||||
*
|
||||
* @param string[] $headers
|
||||
* @param string $name
|
||||
* @return boolean
|
||||
*/
|
||||
private function hasHeader($headers, $name)
|
||||
{
|
||||
foreach ($headers as $header) {
|
||||
if (strncasecmp($header, "{$name}: ", strlen($name) + 2) === 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,51 +7,161 @@ namespace Stripe;
|
||||
*
|
||||
* @property string $id
|
||||
* @property string $object
|
||||
* @property string $account_country
|
||||
* @property string $account_name
|
||||
* @property int $amount_due
|
||||
* @property int $amount_paid
|
||||
* @property int $amount_remaining
|
||||
* @property int $application_fee
|
||||
* @property int $application_fee_amount
|
||||
* @property int $attempt_count
|
||||
* @property bool $attempted
|
||||
* @property bool $auto_advance
|
||||
* @property string $billing
|
||||
* @property string $billing_reason
|
||||
* @property string $charge
|
||||
* @property bool $closed
|
||||
* @property int $created
|
||||
* @property string $currency
|
||||
* @property array $custom_fields
|
||||
* @property string $customer
|
||||
* @property int $date
|
||||
* @property mixed $customer_address
|
||||
* @property string $customer_email
|
||||
* @property string $customer_name
|
||||
* @property string $customer_phone
|
||||
* @property mixed $customer_shipping
|
||||
* @property array $customer_tax_ids
|
||||
* @property string $default_payment_method
|
||||
* @property string $default_source
|
||||
* @property array $default_tax_rates
|
||||
* @property string $description
|
||||
* @property mixed $discount
|
||||
* @property Discount $discount
|
||||
* @property int $due_date
|
||||
* @property int $ending_balance
|
||||
* @property bool $forgiven
|
||||
* @property string $footer
|
||||
* @property string $hosted_invoice_url
|
||||
* @property string $invoice_pdf
|
||||
* @property Collection $lines
|
||||
* @property bool $livemode
|
||||
* @property StripeObject $metadata
|
||||
* @property int $next_payment_attempt
|
||||
* @property string $number
|
||||
* @property bool $paid
|
||||
* @property string $payment_intent
|
||||
* @property int $period_end
|
||||
* @property int $period_start
|
||||
* @property int $post_payment_credit_notes_amount
|
||||
* @property int $pre_payment_credit_notes_amount
|
||||
* @property string $receipt_number
|
||||
* @property int $starting_balance
|
||||
* @property string $statement_descriptor
|
||||
* @property string $status
|
||||
* @property mixed $status_transitions
|
||||
* @property string $subscription
|
||||
* @property int $subscription_proration_date
|
||||
* @property int $subtotal
|
||||
* @property int $tax
|
||||
* @property float $tax_percent
|
||||
* @property mixed $threshold_reason
|
||||
* @property int $total
|
||||
* @property array $total_tax_amounts
|
||||
* @property int $webhooks_delivered_at
|
||||
*
|
||||
* @package Stripe
|
||||
*/
|
||||
class Invoice extends ApiResource
|
||||
{
|
||||
|
||||
const OBJECT_NAME = "invoice";
|
||||
|
||||
use ApiOperations\All;
|
||||
use ApiOperations\Create;
|
||||
use ApiOperations\Delete;
|
||||
use ApiOperations\Retrieve;
|
||||
use ApiOperations\Update;
|
||||
|
||||
/**
|
||||
* Possible string representations of the invoice status.
|
||||
* @link https://stripe.com/docs/api/invoices/object#invoice_object-status
|
||||
*/
|
||||
const STATUS_DRAFT = 'draft';
|
||||
const STATUS_OPEN = 'open';
|
||||
const STATUS_PAID = 'paid';
|
||||
const STATUS_UNCOLLECTIBLE = 'uncollectible';
|
||||
const STATUS_VOID = 'void';
|
||||
|
||||
/**
|
||||
* Possible string representations of the billing.
|
||||
* @link https://stripe.com/docs/api/invoices/object#invoice_object-billing
|
||||
*/
|
||||
const BILLING_SEND_INVOICE = 'send_invoice';
|
||||
const BILLING_CHARGE_AUTOMATICALLY = 'charge_automatically';
|
||||
|
||||
/**
|
||||
* Possible string representations of the billing reason.
|
||||
* @link https://stripe.com/docs/api/invoices/object#invoice_object-billing_reason
|
||||
*/
|
||||
const BILLING_REASON_SUBSCRIPTION = 'subscription';
|
||||
const BILLING_REASON_SUBSCRIPTION_CREATE = 'subscription_create';
|
||||
const BILLING_REASON_SUBSCRIPTION_CYCLE = 'subscription_cycle';
|
||||
const BILLING_REASON_SUBSCRIPTION_UPDATE = 'subscription_update';
|
||||
const BILLING_REASON_SUBSCRIPTION_THRESHOLD = 'subscription_threshold';
|
||||
const BILLING_REASON_MANUAL = 'manual';
|
||||
const BILLING_REASON_UPCOMING = 'upcoming';
|
||||
|
||||
/**
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
*
|
||||
* @return Invoice The finalized invoice.
|
||||
*/
|
||||
public function finalizeInvoice($params = null, $opts = null)
|
||||
{
|
||||
$url = $this->instanceUrl() . '/finalize';
|
||||
list($response, $opts) = $this->_request('post', $url, $params, $opts);
|
||||
$this->refreshFrom($response, $opts);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
*
|
||||
* @return Invoice The uncollectible invoice.
|
||||
*/
|
||||
public function markUncollectible($params = null, $opts = null)
|
||||
{
|
||||
$url = $this->instanceUrl() . '/mark_uncollectible';
|
||||
list($response, $opts) = $this->_request('post', $url, $params, $opts);
|
||||
$this->refreshFrom($response, $opts);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
*
|
||||
* @return Invoice The paid invoice.
|
||||
*/
|
||||
public function pay($params = null, $opts = null)
|
||||
{
|
||||
$url = $this->instanceUrl() . '/pay';
|
||||
list($response, $opts) = $this->_request('post', $url, $params, $opts);
|
||||
$this->refreshFrom($response, $opts);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
*
|
||||
* @return Invoice The sent invoice.
|
||||
*/
|
||||
public function sendInvoice($params = null, $opts = null)
|
||||
{
|
||||
$url = $this->instanceUrl() . '/send';
|
||||
list($response, $opts) = $this->_request('post', $url, $params, $opts);
|
||||
$this->refreshFrom($response, $opts);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
@@ -68,11 +178,14 @@ class Invoice extends ApiResource
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Invoice The paid invoice.
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
*
|
||||
* @return Invoice The voided invoice.
|
||||
*/
|
||||
public function pay($params = null, $opts = null)
|
||||
public function voidInvoice($params = null, $opts = null)
|
||||
{
|
||||
$url = $this->instanceUrl() . '/pay';
|
||||
$url = $this->instanceUrl() . '/void';
|
||||
list($response, $opts) = $this->_request('post', $url, $params, $opts);
|
||||
$this->refreshFrom($response, $opts);
|
||||
return $this;
|
||||
|
||||
@@ -22,11 +22,16 @@ namespace Stripe;
|
||||
* @property int $quantity
|
||||
* @property string $subscription
|
||||
* @property string $subscription_item
|
||||
* @property array $tax_rates
|
||||
* @property int $unit_amount
|
||||
*
|
||||
* @package Stripe
|
||||
*/
|
||||
class InvoiceItem extends ApiResource
|
||||
{
|
||||
|
||||
const OBJECT_NAME = "invoiceitem";
|
||||
|
||||
use ApiOperations\All;
|
||||
use ApiOperations\Create;
|
||||
use ApiOperations\Delete;
|
||||
|
||||
32
htdocs/includes/stripe/lib/InvoiceLineItem.php
Normal file
32
htdocs/includes/stripe/lib/InvoiceLineItem.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace Stripe;
|
||||
|
||||
/**
|
||||
* Class InvoiceLineItem
|
||||
*
|
||||
* @property string $id
|
||||
* @property string $object
|
||||
* @property int $amount
|
||||
* @property string $currency
|
||||
* @property string $description
|
||||
* @property bool $discountable
|
||||
* @property string $invoice_item
|
||||
* @property bool $livemode
|
||||
* @property StripeObject $metadata
|
||||
* @property mixed $period
|
||||
* @property Plan $plan
|
||||
* @property bool $proration
|
||||
* @property int $quantity
|
||||
* @property string $subscription
|
||||
* @property string $subscription_item
|
||||
* @property array $tax_amounts
|
||||
* @property array $tax_rates
|
||||
* @property string $type
|
||||
*
|
||||
* @package Stripe
|
||||
*/
|
||||
class InvoiceLineItem extends ApiResource
|
||||
{
|
||||
const OBJECT_NAME = "line_item";
|
||||
}
|
||||
25
htdocs/includes/stripe/lib/IssuerFraudRecord.php
Normal file
25
htdocs/includes/stripe/lib/IssuerFraudRecord.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace Stripe;
|
||||
|
||||
/**
|
||||
* Class IssuerFraudRecord
|
||||
*
|
||||
* @property string $id
|
||||
* @property string $object
|
||||
* @property string $charge
|
||||
* @property int $created
|
||||
* @property int $post_date
|
||||
* @property string $fraud_type
|
||||
* @property bool $livemode
|
||||
*
|
||||
* @package Stripe
|
||||
*/
|
||||
class IssuerFraudRecord extends ApiResource
|
||||
{
|
||||
|
||||
const OBJECT_NAME = "issuer_fraud_record";
|
||||
|
||||
use ApiOperations\All;
|
||||
use ApiOperations\Retrieve;
|
||||
}
|
||||
68
htdocs/includes/stripe/lib/Issuing/Authorization.php
Normal file
68
htdocs/includes/stripe/lib/Issuing/Authorization.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace Stripe\Issuing;
|
||||
|
||||
/**
|
||||
* Class Authorization
|
||||
*
|
||||
* @property string $id
|
||||
* @property string $object
|
||||
* @property bool $approved
|
||||
* @property string $authorization_method
|
||||
* @property int $authorized_amount
|
||||
* @property string $authorized_currency
|
||||
* @property \Stripe\Collection $balance_transactions
|
||||
* @property Card $card
|
||||
* @property Cardholder $cardholder
|
||||
* @property int $created
|
||||
* @property int $held_amount
|
||||
* @property string $held_currency
|
||||
* @property bool $is_held_amount_controllable
|
||||
* @property bool $livemode
|
||||
* @property mixed $merchant_data
|
||||
* @property \Stripe\StripeObject $metadata
|
||||
* @property int $pending_authorized_amount
|
||||
* @property int $pending_held_amount
|
||||
* @property mixed $request_history
|
||||
* @property string $status
|
||||
* @property \Stripe\Collection $transactions
|
||||
* @property mixed $verification_data
|
||||
*
|
||||
* @package Stripe\Issuing
|
||||
*/
|
||||
class Authorization extends \Stripe\ApiResource
|
||||
{
|
||||
const OBJECT_NAME = "issuing.authorization";
|
||||
|
||||
use \Stripe\ApiOperations\All;
|
||||
use \Stripe\ApiOperations\Retrieve;
|
||||
use \Stripe\ApiOperations\Update;
|
||||
|
||||
/**
|
||||
* @param array|null $params
|
||||
* @param array|string|null $options
|
||||
*
|
||||
* @return Authorization The approved authorization.
|
||||
*/
|
||||
public function approve($params = null, $options = null)
|
||||
{
|
||||
$url = $this->instanceUrl() . '/approve';
|
||||
list($response, $opts) = $this->_request('post', $url, $params, $options);
|
||||
$this->refreshFrom($response, $opts);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|null $params
|
||||
* @param array|string|null $options
|
||||
*
|
||||
* @return Authorization The declined authorization.
|
||||
*/
|
||||
public function decline($params = null, $options = null)
|
||||
{
|
||||
$url = $this->instanceUrl() . '/decline';
|
||||
list($response, $opts) = $this->_request('post', $url, $params, $options);
|
||||
$this->refreshFrom($response, $opts);
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
51
htdocs/includes/stripe/lib/Issuing/Card.php
Normal file
51
htdocs/includes/stripe/lib/Issuing/Card.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace Stripe\Issuing;
|
||||
|
||||
/**
|
||||
* Class Card
|
||||
*
|
||||
* @property string $id
|
||||
* @property string $object
|
||||
* @property mixed $authorization_controls
|
||||
* @property mixed $billing
|
||||
* @property string $brand
|
||||
* @property Cardholder $cardholder
|
||||
* @property int $created
|
||||
* @property string $currency
|
||||
* @property int $exp_month
|
||||
* @property int $exp_year
|
||||
* @property string $last4
|
||||
* @property bool $livemode
|
||||
* @property \Stripe\StripeObject $metadata
|
||||
* @property string $name
|
||||
* @property mixed $shipping
|
||||
* @property string $status
|
||||
* @property string $type
|
||||
*
|
||||
* @package Stripe\Issuing
|
||||
*/
|
||||
class Card extends \Stripe\ApiResource
|
||||
{
|
||||
const OBJECT_NAME = "issuing.card";
|
||||
|
||||
use \Stripe\ApiOperations\All;
|
||||
use \Stripe\ApiOperations\Create;
|
||||
use \Stripe\ApiOperations\Retrieve;
|
||||
use \Stripe\ApiOperations\Update;
|
||||
|
||||
/**
|
||||
* @param array|null $params
|
||||
* @param array|string|null $options
|
||||
*
|
||||
* @return CardDetails The card details associated with that issuing card.
|
||||
*/
|
||||
public function details($params = null, $options = null)
|
||||
{
|
||||
$url = $this->instanceUrl() . '/details';
|
||||
list($response, $opts) = $this->_request('get', $url, $params, $options);
|
||||
$obj = \Stripe\Util\Util::convertToStripeObject($response, $opts);
|
||||
$obj->setLastResponse($response);
|
||||
return $obj;
|
||||
}
|
||||
}
|
||||
21
htdocs/includes/stripe/lib/Issuing/CardDetails.php
Normal file
21
htdocs/includes/stripe/lib/Issuing/CardDetails.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace Stripe\Issuing;
|
||||
|
||||
/**
|
||||
* Class CardDetails
|
||||
*
|
||||
* @property string $id
|
||||
* @property string $object
|
||||
* @property Card $card
|
||||
* @property string $cvc
|
||||
* @property int $exp_month
|
||||
* @property int $exp_year
|
||||
* @property string $number
|
||||
*
|
||||
* @package Stripe\Issuing
|
||||
*/
|
||||
class CardDetails extends \Stripe\ApiResource
|
||||
{
|
||||
const OBJECT_NAME = "issuing.card_details";
|
||||
}
|
||||
30
htdocs/includes/stripe/lib/Issuing/Cardholder.php
Normal file
30
htdocs/includes/stripe/lib/Issuing/Cardholder.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Stripe\Issuing;
|
||||
|
||||
/**
|
||||
* Class Cardholder
|
||||
*
|
||||
* @property string $id
|
||||
* @property string $object
|
||||
* @property mixed $billing
|
||||
* @property int $created
|
||||
* @property string $email
|
||||
* @property bool $livemode
|
||||
* @property \Stripe\StripeObject $metadata
|
||||
* @property string $name
|
||||
* @property string $phone_number
|
||||
* @property string $status
|
||||
* @property string $type
|
||||
*
|
||||
* @package Stripe\Issuing
|
||||
*/
|
||||
class Cardholder extends \Stripe\ApiResource
|
||||
{
|
||||
const OBJECT_NAME = "issuing.cardholder";
|
||||
|
||||
use \Stripe\ApiOperations\All;
|
||||
use \Stripe\ApiOperations\Create;
|
||||
use \Stripe\ApiOperations\Retrieve;
|
||||
use \Stripe\ApiOperations\Update;
|
||||
}
|
||||
30
htdocs/includes/stripe/lib/Issuing/Dispute.php
Normal file
30
htdocs/includes/stripe/lib/Issuing/Dispute.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Stripe\Issuing;
|
||||
|
||||
/**
|
||||
* Class Dispute
|
||||
*
|
||||
* @property string $id
|
||||
* @property string $object
|
||||
* @property int $amount
|
||||
* @property int $created
|
||||
* @property string $currency
|
||||
* @property mixed $evidence
|
||||
* @property bool $livemode
|
||||
* @property \Stripe\StripeObject $metadata
|
||||
* @property string $reason
|
||||
* @property string $status
|
||||
* @property Transaction $transaction
|
||||
*
|
||||
* @package Stripe\Issuing
|
||||
*/
|
||||
class Dispute extends \Stripe\ApiResource
|
||||
{
|
||||
const OBJECT_NAME = "issuing.dispute";
|
||||
|
||||
use \Stripe\ApiOperations\All;
|
||||
use \Stripe\ApiOperations\Create;
|
||||
use \Stripe\ApiOperations\Retrieve;
|
||||
use \Stripe\ApiOperations\Update;
|
||||
}
|
||||
33
htdocs/includes/stripe/lib/Issuing/Transaction.php
Normal file
33
htdocs/includes/stripe/lib/Issuing/Transaction.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace Stripe\Issuing;
|
||||
|
||||
/**
|
||||
* Class Transaction
|
||||
*
|
||||
* @property string $id
|
||||
* @property string $object
|
||||
* @property int $amount
|
||||
* @property string $authorization
|
||||
* @property string $balance_transaction
|
||||
* @property string $card
|
||||
* @property string $cardholder
|
||||
* @property int $created
|
||||
* @property string $currency
|
||||
* @property string $dispute
|
||||
* @property bool $livemode
|
||||
* @property mixed $merchant_data
|
||||
* @property \Stripe\StripeObject $metadata
|
||||
* @property string $type
|
||||
*
|
||||
* @package Stripe\Issuing
|
||||
*/
|
||||
class Transaction extends \Stripe\ApiResource
|
||||
{
|
||||
const OBJECT_NAME = "issuing.transaction";
|
||||
|
||||
use \Stripe\ApiOperations\All;
|
||||
use \Stripe\ApiOperations\Create;
|
||||
use \Stripe\ApiOperations\Retrieve;
|
||||
use \Stripe\ApiOperations\Update;
|
||||
}
|
||||
@@ -5,9 +5,14 @@ namespace Stripe;
|
||||
/**
|
||||
* Class LoginLink
|
||||
*
|
||||
* @property string $object
|
||||
* @property int $created
|
||||
* @property string $url
|
||||
*
|
||||
* @package Stripe
|
||||
*/
|
||||
class LoginLink extends ApiResource
|
||||
{
|
||||
|
||||
const OBJECT_NAME = "login_link";
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ abstract class OAuth
|
||||
if (!array_key_exists('response_type', $params)) {
|
||||
$params['response_type'] = 'code';
|
||||
}
|
||||
$query = Util\Util::urlEncode($params);
|
||||
$query = Util\Util::encodeParameters($params);
|
||||
|
||||
return $base . '/oauth/authorize?' . $query;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Stripe;
|
||||
* @property string $customer
|
||||
* @property string $email
|
||||
* @property string $external_coupon_code
|
||||
* @property mixed $items
|
||||
* @property OrderItem[] $items
|
||||
* @property bool $livemode
|
||||
* @property StripeObject $metadata
|
||||
* @property Collection $returns
|
||||
@@ -33,6 +33,9 @@ namespace Stripe;
|
||||
*/
|
||||
class Order extends ApiResource
|
||||
{
|
||||
|
||||
const OBJECT_NAME = "order";
|
||||
|
||||
use ApiOperations\All;
|
||||
use ApiOperations\Create;
|
||||
use ApiOperations\Retrieve;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user