Merge branch 'develop' into ptibogxiv-stripe
This commit is contained in:
commit
936aef70a1
@ -1330,19 +1330,19 @@ class Adherent extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Do complementary actions after subscription recording.
|
* Do complementary actions after subscription recording.
|
||||||
*
|
*
|
||||||
* @param int $subscriptionid Id of created subscription
|
* @param int $subscriptionid Id of created subscription
|
||||||
* @param string $option Which action ('bankdirect', 'invoiceonly', ...)
|
* @param string $option Which action ('bankdirect', 'invoiceonly', ...)
|
||||||
* @param int $accountid Id bank account
|
* @param int $accountid Id bank account
|
||||||
* @param int $datesubscription Date of subscription
|
* @param int $datesubscription Date of subscription
|
||||||
* @param int $paymentdate Date of payment
|
* @param int $paymentdate Date of payment
|
||||||
* @param string $operation Code of type of operation (if Id bank account provided). Example 'CB', ...
|
* @param string $operation Code of type of operation (if Id bank account provided). Example 'CB', ...
|
||||||
* @param string $label Label operation (if Id bank account provided)
|
* @param string $label Label operation (if Id bank account provided)
|
||||||
* @param double $amount Amount of subscription (0 accepted for some members)
|
* @param double $amount Amount of subscription (0 accepted for some members)
|
||||||
* @param string $num_chq Numero cheque (if Id bank account provided)
|
* @param string $num_chq Numero cheque (if Id bank account provided)
|
||||||
* @param string $emetteur_nom Name of cheque writer
|
* @param string $emetteur_nom Name of cheque writer
|
||||||
* @param string $emetteur_banque Name of bank of cheque
|
* @param string $emetteur_banque Name of bank of cheque
|
||||||
* @param string $autocreatethirdparty Auto create new thirdparty if member not linked to a thirdparty.
|
* @param string $autocreatethirdparty Auto create new thirdparty if member not linked to a thirdparty.
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function subscriptionComplementaryActions($subscriptionid, $option, $accountid, $datesubscription, $paymentdate, $operation, $label, $amount, $num_chq, $emetteur_nom='', $emetteur_banque='', $autocreatethirdparty=0)
|
function subscriptionComplementaryActions($subscriptionid, $option, $accountid, $datesubscription, $paymentdate, $operation, $label, $amount, $num_chq, $emetteur_nom='', $emetteur_banque='', $autocreatethirdparty=0)
|
||||||
{
|
{
|
||||||
@ -1350,6 +1350,8 @@ class Adherent extends CommonObject
|
|||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
|
$this->invoice = null; // This will contains invoice if an invoice is created
|
||||||
|
|
||||||
// Insert into bank account directlty (if option choosed for) + link to llx_subscription if option is 'bankdirect'
|
// Insert into bank account directlty (if option choosed for) + link to llx_subscription if option is 'bankdirect'
|
||||||
if ($option == 'bankdirect' && $accountid)
|
if ($option == 'bankdirect' && $accountid)
|
||||||
{
|
{
|
||||||
@ -1489,6 +1491,10 @@ class Adherent extends CommonObject
|
|||||||
$this->errors=$invoice->errors;
|
$this->errors=$invoice->errors;
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->invoice = $invoice;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
@ -1524,6 +1530,11 @@ class Adherent extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
// TODO Link invoice with subscription ?
|
||||||
|
}
|
||||||
|
|
||||||
// Add payment onto invoice
|
// Add payment onto invoice
|
||||||
if (! $error && $option == 'bankviainvoice' && $accountid)
|
if (! $error && $option == 'bankviainvoice' && $accountid)
|
||||||
{
|
{
|
||||||
@ -1584,25 +1595,25 @@ class Adherent extends CommonObject
|
|||||||
// Set invoice as paid
|
// Set invoice as paid
|
||||||
$invoice->set_paid($user);
|
$invoice->set_paid($user);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
// Define output language
|
// Define output language
|
||||||
$outputlangs = $langs;
|
$outputlangs = $langs;
|
||||||
$newlang = '';
|
$newlang = '';
|
||||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id']))
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id']))
|
||||||
$newlang = $_REQUEST['lang_id'];
|
$newlang = $_REQUEST['lang_id'];
|
||||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang))
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang))
|
||||||
$newlang = $customer->default_lang;
|
$newlang = $customer->default_lang;
|
||||||
if (! empty($newlang)) {
|
if (! empty($newlang)) {
|
||||||
$outputlangs = new Translate("", $conf);
|
$outputlangs = new Translate("", $conf);
|
||||||
$outputlangs->setDefaultLang($newlang);
|
$outputlangs->setDefaultLang($newlang);
|
||||||
}
|
|
||||||
// Generate PDF (whatever is option MAIN_DISABLE_PDF_AUTOUPDATE) so we can include it into email
|
|
||||||
//if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
|
||||||
|
|
||||||
$invoice->generateDocument($invoice->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
|
||||||
}
|
}
|
||||||
|
// Generate PDF (whatever is option MAIN_DISABLE_PDF_AUTOUPDATE) so we can include it into email
|
||||||
|
//if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
||||||
|
|
||||||
|
$invoice->generateDocument($invoice->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -322,11 +322,15 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
|||||||
$error++;
|
$error++;
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// If an invoice was created, it is into $object->invoice
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$db->commit();
|
// $db->commit();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -334,6 +338,11 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
|||||||
$action = 'addsubscription';
|
$action = 'addsubscription';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
setEventMessages("SubscriptionRecorded", null, 'mesgs');
|
||||||
|
}
|
||||||
|
|
||||||
// Send email
|
// Send email
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
@ -343,12 +352,36 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
|||||||
$subjecttosend=$object->makeSubstitution($conf->global->ADHERENT_MAIL_COTIS_SUBJECT);
|
$subjecttosend=$object->makeSubstitution($conf->global->ADHERENT_MAIL_COTIS_SUBJECT);
|
||||||
$texttosend=$object->makeSubstitution($adht->getMailOnSubscription());
|
$texttosend=$object->makeSubstitution($adht->getMailOnSubscription());
|
||||||
|
|
||||||
$result=$object->send_an_email($texttosend,$subjecttosend,array(),array(),array(),"","",0,-1);
|
// Attach a file ?
|
||||||
|
$file='';
|
||||||
|
$listofpaths=array();
|
||||||
|
$listofnames=array();
|
||||||
|
$listofmimes=array();
|
||||||
|
if (is_object($object->invoice))
|
||||||
|
{
|
||||||
|
$invoicediroutput = $conf->facture->dir_output;
|
||||||
|
$fileparams = dol_most_recent_file($invoicediroutput . '/' . $object->invoice->ref, preg_quote($object->invoice->ref, '/').'[^\-]+');
|
||||||
|
$file = $fileparams['fullname'];
|
||||||
|
|
||||||
|
$listofpaths=array($file);
|
||||||
|
$listofnames=array(basename($file));
|
||||||
|
$listofmimes=array(dol_mimetype($file));
|
||||||
|
}
|
||||||
|
|
||||||
|
$result=$object->send_an_email($texttosend, $subjecttosend, $listofpaths, $listofnames, $listofmimes, "", "", 0, -1);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$errmsg=$object->error;
|
$errmsg=$object->error;
|
||||||
setEventMessages($errmsg, null, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setEventMessages($langs->trans("EmailSentToMember", $object->email), null, 'mesgs');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setEventMessages($langs->trans("NoEmailSentToMember"), null, 'mesgs');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -998,7 +1031,7 @@ if ($rowid > 0)
|
|||||||
$helpcontent.='<b>'.$langs->trans("MailText").'</b>:<br>';
|
$helpcontent.='<b>'.$langs->trans("MailText").'</b>:<br>';
|
||||||
$helpcontent.=dol_htmlentitiesbr($texttosend)."\n";
|
$helpcontent.=dol_htmlentitiesbr($texttosend)."\n";
|
||||||
|
|
||||||
print $form->textwithpicto($tmp,$helpcontent,1,'help');
|
print $form->textwithpicto($tmp, $helpcontent, 1, 'help', '', 0, 2, 'helpemailtosend');
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
print '</tbody>';
|
print '</tbody>';
|
||||||
|
|||||||
@ -383,8 +383,8 @@ $tabrowid[8] = "id";
|
|||||||
$tabrowid[9] = "code_iso";
|
$tabrowid[9] = "code_iso";
|
||||||
$tabrowid[10]= "";
|
$tabrowid[10]= "";
|
||||||
$tabrowid[11]= "rowid";
|
$tabrowid[11]= "rowid";
|
||||||
$tabrowid[12]= "rowid";
|
$tabrowid[12]= "";
|
||||||
$tabrowid[13]= "id";
|
$tabrowid[13]= "";
|
||||||
$tabrowid[14]= "";
|
$tabrowid[14]= "";
|
||||||
$tabrowid[15]= "";
|
$tabrowid[15]= "";
|
||||||
$tabrowid[16]= "code";
|
$tabrowid[16]= "code";
|
||||||
|
|||||||
@ -66,7 +66,8 @@ class Setup extends DolibarrApi
|
|||||||
|
|
||||||
$sql = "SELECT id, code, type, libelle as label, module";
|
$sql = "SELECT id, code, type, libelle as label, module";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_paiement as t";
|
$sql.= " FROM ".MAIN_DB_PREFIX."c_paiement as t";
|
||||||
$sql.= " WHERE t.active = ".$active;
|
$sql.= " WHERE t.entity IN (".getEntity('c_paiement').")";
|
||||||
|
$sql.= " AND t.active = ".$active;
|
||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters)
|
if ($sqlfilters)
|
||||||
{
|
{
|
||||||
@ -538,7 +539,8 @@ class Setup extends DolibarrApi
|
|||||||
|
|
||||||
$sql = "SELECT rowid as id, code, sortorder, libelle as label, libelle_facture as descr, type_cdr, nbjour, decalage, module";
|
$sql = "SELECT rowid as id, code, sortorder, libelle as label, libelle_facture as descr, type_cdr, nbjour, decalage, module";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_payment_term as t";
|
$sql.= " FROM ".MAIN_DB_PREFIX."c_payment_term as t";
|
||||||
$sql.= " WHERE t.active = ".$active;
|
$sql.= " WHERE t.entity IN (".getEntity('c_payment_term').")";
|
||||||
|
$sql.= " AND t.active = ".$active;
|
||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters)
|
if ($sqlfilters)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -196,7 +196,7 @@ else if (GETPOST('downloadcsv','alpha'))
|
|||||||
$block_static->user_fullname = $obj->user_fullname;
|
$block_static->user_fullname = $obj->user_fullname;
|
||||||
$block_static->fk_user = $obj->fk_user;
|
$block_static->fk_user = $obj->fk_user;
|
||||||
$block_static->signature = $obj->signature;
|
$block_static->signature = $obj->signature;
|
||||||
$block_static->object_data = unserialize($obj->object_data);
|
$block_static->object_data = $block_static->dolDecodeBlockedData($obj->object_data);
|
||||||
|
|
||||||
$checksignature = $block_static->checkSignature($previoushash); // If $previoushash is not defined, checkSignature will search it
|
$checksignature = $block_static->checkSignature($previoushash); // If $previoushash is not defined, checkSignature will search it
|
||||||
|
|
||||||
|
|||||||
@ -85,10 +85,16 @@ function formatObject($objtoshow, $prefix)
|
|||||||
{
|
{
|
||||||
if (! is_object($val) && ! is_array($val))
|
if (! is_object($val) && ! is_array($val))
|
||||||
{
|
{
|
||||||
|
// TODO $val can be '__PHP_Incomplete_Class', the is_object return false
|
||||||
$s.='<tr><td>'.($prefix?$prefix.' > ':'').$key.'</td>';
|
$s.='<tr><td>'.($prefix?$prefix.' > ':'').$key.'</td>';
|
||||||
$s.='<td>';
|
$s.='<td>';
|
||||||
if (in_array($key, array('date','datef','dateh','datec','datem','datep')))
|
if (in_array($key, array('date','datef','dateh','datec','datem','datep')))
|
||||||
{
|
{
|
||||||
|
/*var_dump(is_object($val));
|
||||||
|
var_dump(is_array($val));
|
||||||
|
var_dump(is_array($val));
|
||||||
|
var_dump(@get_class($val));
|
||||||
|
var_dump($val);*/
|
||||||
$s.=dol_print_date($val, 'dayhour');
|
$s.=dol_print_date($val, 'dayhour');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -18,10 +18,23 @@
|
|||||||
* See https://medium.com/@lhartikk/a-blockchain-in-200-lines-of-code-963cc1cc0e54
|
* See https://medium.com/@lhartikk/a-blockchain-in-200-lines-of-code-963cc1cc0e54
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*ini_set('unserialize_callback_func', 'mycallback');
|
||||||
|
|
||||||
|
function mycallback($classname)
|
||||||
|
{
|
||||||
|
//var_dump($classname);
|
||||||
|
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||||
|
|
||||||
|
}*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class to manage Blocked Log
|
* Class to manage Blocked Log
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class BlockedLog
|
class BlockedLog
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@ -636,7 +649,7 @@ class BlockedLog
|
|||||||
$this->fk_user = $obj->fk_user;
|
$this->fk_user = $obj->fk_user;
|
||||||
$this->user_fullname = $obj->user_fullname;
|
$this->user_fullname = $obj->user_fullname;
|
||||||
|
|
||||||
$this->object_data = unserialize($obj->object_data);
|
$this->object_data = $this->dolDecodeBlockedData($obj->object_data);
|
||||||
|
|
||||||
$this->signature = $obj->signature;
|
$this->signature = $obj->signature;
|
||||||
$this->signature_line = $obj->signature_line;
|
$this->signature_line = $obj->signature_line;
|
||||||
@ -658,6 +671,31 @@ class BlockedLog
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Decode data
|
||||||
|
*
|
||||||
|
* @param string $data Data to unserialize
|
||||||
|
* @param string $mode 0=unserialize, 1=json_decode
|
||||||
|
* @return string Value unserialized
|
||||||
|
*/
|
||||||
|
public function dolDecodeBlockedData($data, $mode=0)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||||
|
//include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||||
|
$aaa = unserialize($data);
|
||||||
|
//$aaa = unserialize($data);
|
||||||
|
}
|
||||||
|
catch(Exception $e)
|
||||||
|
{
|
||||||
|
//print $e->getErrs);
|
||||||
|
}
|
||||||
|
return $aaa;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set block certified by authority
|
* Set block certified by authority
|
||||||
*
|
*
|
||||||
|
|||||||
@ -1343,8 +1343,8 @@ class Propal extends CommonObject
|
|||||||
$sql.= ", cr.code as cond_reglement_code, cr.libelle as cond_reglement, cr.libelle_facture as cond_reglement_libelle_doc";
|
$sql.= ", cr.code as cond_reglement_code, cr.libelle as cond_reglement, cr.libelle_facture as cond_reglement_libelle_doc";
|
||||||
$sql.= ", cp.code as mode_reglement_code, cp.libelle as mode_reglement";
|
$sql.= ", cp.code as mode_reglement_code, cp.libelle as mode_reglement";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_propalst as c, ".MAIN_DB_PREFIX."propal as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."c_propalst as c, ".MAIN_DB_PREFIX."propal as p";
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as cp ON p.fk_mode_reglement = cp.id AND cp.entity IN ('.getEntity('c_paiement').')';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as cp ON p.fk_mode_reglement = cp.id';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as cr ON p.fk_cond_reglement = cr.rowid AND cr.entity IN ('.getEntity('c_payment_term').')';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as cr ON p.fk_cond_reglement = cr.rowid';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_availability as ca ON p.fk_availability = ca.rowid';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_availability as ca ON p.fk_availability = ca.rowid';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_input_reason as dr ON p.fk_input_reason = dr.rowid';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_input_reason as dr ON p.fk_input_reason = dr.rowid';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON p.fk_incoterms = i.rowid';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON p.fk_incoterms = i.rowid';
|
||||||
|
|||||||
@ -1584,8 +1584,8 @@ class Commande extends CommonOrder
|
|||||||
$sql.= ', ca.code as availability_code, ca.label as availability_label';
|
$sql.= ', ca.code as availability_code, ca.label as availability_label';
|
||||||
$sql.= ', dr.code as demand_reason_code';
|
$sql.= ', dr.code as demand_reason_code';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'commande as c';
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'commande as c';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as cr ON c.fk_cond_reglement = cr.rowid AND cr.entity IN ('.getEntity('c_payment_term').')';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as cr ON c.fk_cond_reglement = cr.rowid';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON c.fk_mode_reglement = p.id AND p.entity IN ('.getEntity('c_paiement').')';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON c.fk_mode_reglement = p.id';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_availability as ca ON c.fk_availability = ca.rowid';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_availability as ca ON c.fk_availability = ca.rowid';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_input_reason as dr ON c.fk_input_reason = ca.rowid';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_input_reason as dr ON c.fk_input_reason = ca.rowid';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON c.fk_incoterms = i.rowid';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON c.fk_incoterms = i.rowid';
|
||||||
|
|||||||
@ -670,7 +670,7 @@ if ($resql)
|
|||||||
// Status billed
|
// Status billed
|
||||||
if (! empty($arrayfields['c.facture']['checked']))
|
if (! empty($arrayfields['c.facture']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre maxwidthonsmartphone" align="right">';
|
print '<td class="liste_titre maxwidthonsmartphone" align="center">';
|
||||||
print $form->selectyesno('billed', $billed, 1, 0, 1);
|
print $form->selectyesno('billed', $billed, 1, 0, 1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -673,7 +673,7 @@ if ($resql)
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td> </td>';
|
print '<td> </td>';
|
||||||
print '<td class="nowrap">';
|
print '<td class="nowrap">';
|
||||||
$form->select_types_paiements((GETPOST('operation')?GETPOST('operation'):($object->courant == Account::TYPE_CASH ? 'LIQ' : '')),'operation','1,2',2,1);
|
$form->select_types_paiements((GETPOST('operation')?GETPOST('operation'):($object->courant == Account::TYPE_CASH ? 'LIQ' : '')), 'operation', '1,2', 2, 1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print '<input name="num_chq" class="flat" type="text" size="4" value="'.GETPOST("num_chq","alpha").'">';
|
print '<input name="num_chq" class="flat" type="text" size="4" value="'.GETPOST("num_chq","alpha").'">';
|
||||||
@ -852,7 +852,7 @@ if ($resql)
|
|||||||
if (! empty($arrayfields['type']['checked']))
|
if (! empty($arrayfields['type']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre" align="center">';
|
print '<td class="liste_titre" align="center">';
|
||||||
$form->select_types_paiements(empty($search_type)?'':$search_type, 'search_type', '', 2, 0, 1, 0, 1, 'maxwidth100');
|
$form->select_types_paiements(empty($search_type)?'':$search_type, 'search_type', '', 2, 1, 1, 0, 1, 'maxwidth100');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
if (! empty($arrayfields['b.num_chq']['checked']))
|
if (! empty($arrayfields['b.num_chq']['checked']))
|
||||||
|
|||||||
@ -102,7 +102,7 @@ $sql = "SELECT v.rowid, v.sens, v.amount, v.label, v.datep as datep, v.datev as
|
|||||||
$sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number as bank_account_number, ba.fk_accountancy_journal as accountancy_journal, ba.label as blabel,";
|
$sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number as bank_account_number, ba.fk_accountancy_journal as accountancy_journal, ba.label as blabel,";
|
||||||
$sql.= " pst.code as payment_code";
|
$sql.= " pst.code as payment_code";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."payment_various as v";
|
$sql.= " FROM ".MAIN_DB_PREFIX."payment_various as v";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON v.fk_typepayment = pst.id AND pst.entity IN (" . getEntity('c_paiement').")";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON v.fk_typepayment = pst.id";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON v.fk_bank = b.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON v.fk_bank = b.rowid";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
|
||||||
$sql.= " WHERE v.entity IN (".getEntity('payment_various').")";
|
$sql.= " WHERE v.entity IN (".getEntity('payment_various').")";
|
||||||
@ -187,7 +187,7 @@ if ($result)
|
|||||||
|
|
||||||
// Type
|
// Type
|
||||||
print '<td class="liste_titre" align="left">';
|
print '<td class="liste_titre" align="left">';
|
||||||
$form->select_types_paiements($typeid,'typeid','',0,0,1,16);
|
$form->select_types_paiements($typeid,'typeid','',0,1,1,16);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Account
|
// Account
|
||||||
|
|||||||
@ -139,7 +139,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
|
|||||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c,";
|
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c,";
|
||||||
$sql.= " ".MAIN_DB_PREFIX."chargesociales as cs";
|
$sql.= " ".MAIN_DB_PREFIX."chargesociales as cs";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiementcharge as pc ON pc.fk_charge = cs.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiementcharge as pc ON pc.fk_charge = cs.rowid";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON pc.fk_typepaiement = pct.id AND pct.entity IN (".getEntity('c_paiement').")";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON pc.fk_typepaiement = pct.id";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON pc.fk_bank = b.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON pc.fk_bank = b.rowid";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
|
||||||
$sql.= " WHERE cs.fk_type = c.id";
|
$sql.= " WHERE cs.fk_type = c.id";
|
||||||
@ -260,7 +260,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
|
|||||||
$sql.= " FROM ".MAIN_DB_PREFIX."tva as pv";
|
$sql.= " FROM ".MAIN_DB_PREFIX."tva as pv";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON pv.fk_bank = b.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON pv.fk_bank = b.rowid";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON pv.fk_typepayment = pct.id AND pct.entity IN (".getEntity('c_paiement').")";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON pv.fk_typepayment = pct.id";
|
||||||
$sql.= " WHERE pv.entity IN (".getEntity("tax").")";
|
$sql.= " WHERE pv.entity IN (".getEntity("tax").")";
|
||||||
if ($year > 0)
|
if ($year > 0)
|
||||||
{
|
{
|
||||||
@ -474,7 +474,7 @@ if (! empty($conf->salaries->enabled) && $user->rights->salaries->read)
|
|||||||
$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s";
|
$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON s.fk_bank = b.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON s.fk_bank = b.rowid";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON s.fk_typepayment = pct.id AND pct.entity IN (".getEntity('c_paiement').")";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON s.fk_typepayment = pct.id";
|
||||||
$sql.= " , ".MAIN_DB_PREFIX."user as u";
|
$sql.= " , ".MAIN_DB_PREFIX."user as u";
|
||||||
$sql.= " WHERE s.entity IN (".getEntity('user').")";
|
$sql.= " WHERE s.entity IN (".getEntity('user').")";
|
||||||
$sql.= " AND u.rowid = s.fk_user";
|
$sql.= " AND u.rowid = s.fk_user";
|
||||||
|
|||||||
@ -716,7 +716,7 @@ if (empty($reshook))
|
|||||||
|
|
||||||
$sql = 'SELECT SUM(pf.amount) as total_paiements';
|
$sql = 'SELECT SUM(pf.amount) as total_paiements';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiement_facture as pf, '.MAIN_DB_PREFIX.'paiement as p';
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiement_facture as pf, '.MAIN_DB_PREFIX.'paiement as p';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as c ON p.fk_paiement = c.id AND c.entity IN (' . getEntity('c_paiement') . ')';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as c ON p.fk_paiement = c.id';
|
||||||
$sql.= ' WHERE pf.fk_facture = '.$object->id;
|
$sql.= ' WHERE pf.fk_facture = '.$object->id;
|
||||||
$sql.= ' AND pf.fk_paiement = p.rowid';
|
$sql.= ' AND pf.fk_paiement = p.rowid';
|
||||||
$sql.= ' AND p.entity IN (' . getEntity('facture').')';
|
$sql.= ' AND p.entity IN (' . getEntity('facture').')';
|
||||||
|
|||||||
@ -304,8 +304,8 @@ class FactureRec extends CommonInvoice
|
|||||||
$sql.= ', c.code as cond_reglement_code, c.libelle as cond_reglement_libelle, c.libelle_facture as cond_reglement_libelle_doc';
|
$sql.= ', c.code as cond_reglement_code, c.libelle as cond_reglement_libelle, c.libelle_facture as cond_reglement_libelle_doc';
|
||||||
//$sql.= ', el.fk_source';
|
//$sql.= ', el.fk_source';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture_rec as f';
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture_rec as f';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as c ON f.fk_cond_reglement = c.rowid AND c.entity IN ('.getEntity('c_payment_term').')';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as c ON f.fk_cond_reglement = c.rowid';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON f.fk_mode_reglement = p.id AND p.entity IN ('.getEntity('c_paiement').')';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON f.fk_mode_reglement = p.id';
|
||||||
//$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = f.rowid AND el.targettype = 'facture'";
|
//$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = f.rowid AND el.targettype = 'facture'";
|
||||||
$sql.= ' WHERE f.entity IN ('.getEntity('facture').')';
|
$sql.= ' WHERE f.entity IN ('.getEntity('facture').')';
|
||||||
if ($rowid) $sql.= ' AND f.rowid='.$rowid;
|
if ($rowid) $sql.= ' AND f.rowid='.$rowid;
|
||||||
|
|||||||
@ -1256,8 +1256,8 @@ class Facture extends CommonInvoice
|
|||||||
$sql.= ', f.fk_incoterms, f.location_incoterms';
|
$sql.= ', f.fk_incoterms, f.location_incoterms';
|
||||||
$sql.= ", i.libelle as libelle_incoterms";
|
$sql.= ", i.libelle as libelle_incoterms";
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture as f';
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture as f';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as c ON f.fk_cond_reglement = c.rowid AND c.entity IN (' . getEntity('c_payment_term').')';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as c ON f.fk_cond_reglement = c.rowid';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON f.fk_mode_reglement = p.id AND p.entity IN ('.getEntity('c_paiement').')';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON f.fk_mode_reglement = p.id';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON f.fk_incoterms = i.rowid';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON f.fk_incoterms = i.rowid';
|
||||||
$sql.= ' WHERE f.entity IN ('.getEntity('facture').')';
|
$sql.= ' WHERE f.entity IN ('.getEntity('facture').')';
|
||||||
if ($rowid) $sql.= " AND f.rowid=".$rowid;
|
if ($rowid) $sql.= " AND f.rowid=".$rowid;
|
||||||
|
|||||||
@ -90,7 +90,6 @@ class PaymentTerm // extends CommonObject
|
|||||||
|
|
||||||
// Insert request
|
// Insert request
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."c_payment_term(";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."c_payment_term(";
|
||||||
$sql.= "rowid,";
|
|
||||||
$sql.= "entity,";
|
$sql.= "entity,";
|
||||||
$sql.= "code,";
|
$sql.= "code,";
|
||||||
$sql.= "sortorder,";
|
$sql.= "sortorder,";
|
||||||
@ -101,7 +100,6 @@ class PaymentTerm // extends CommonObject
|
|||||||
$sql.= "nbjour,";
|
$sql.= "nbjour,";
|
||||||
$sql.= "decalage";
|
$sql.= "decalage";
|
||||||
$sql.= ") VALUES (";
|
$sql.= ") VALUES (";
|
||||||
$sql.= " ".(! isset($this->rowid)?'NULL':"'".$this->db->escape($this->rowid)."'").",";
|
|
||||||
$sql.= " ".(! isset($this->entity)?getEntity('c_payment_term'):"'".$this->db->escape($this->entity)."'").",";
|
$sql.= " ".(! isset($this->entity)?getEntity('c_payment_term'):"'".$this->db->escape($this->entity)."'").",";
|
||||||
$sql.= " ".(! isset($this->code)?'NULL':"'".$this->db->escape($this->code)."'").",";
|
$sql.= " ".(! isset($this->code)?'NULL':"'".$this->db->escape($this->code)."'").",";
|
||||||
$sql.= " ".(! isset($this->sortorder)?'NULL':"'".$this->db->escape($this->sortorder)."'").",";
|
$sql.= " ".(! isset($this->sortorder)?'NULL':"'".$this->db->escape($this->sortorder)."'").",";
|
||||||
@ -181,7 +179,6 @@ class PaymentTerm // extends CommonObject
|
|||||||
|
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_payment_term as t";
|
$sql.= " FROM ".MAIN_DB_PREFIX."c_payment_term as t";
|
||||||
$sql.= " WHERE t.rowid = ".$id;
|
$sql.= " WHERE t.rowid = ".$id;
|
||||||
$sql.= " AND t.entity = " . getEntity('c_payment_term');
|
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
@ -221,36 +218,36 @@ class PaymentTerm // extends CommonObject
|
|||||||
*
|
*
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function getDefaultId()
|
function getDefaultId()
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$ret=0;
|
$ret=0;
|
||||||
|
|
||||||
$sql = "SELECT";
|
$sql = "SELECT";
|
||||||
$sql.= " t.rowid";
|
$sql.= " t.rowid";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_payment_term as t";
|
$sql.= " FROM ".MAIN_DB_PREFIX."c_payment_term as t";
|
||||||
$sql.= " WHERE t.code = 'RECEP'";
|
$sql.= " WHERE t.code = 'RECEP'";
|
||||||
$sql.= " AND t.entity = " . getEntity('c_payment_term');
|
$sql.= " AND t.entity IN (".getEntity('c_payment_term').")";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::getDefaultId", LOG_DEBUG);
|
dol_syslog(get_class($this)."::getDefaultId", LOG_DEBUG);
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
if ($this->db->num_rows($resql))
|
if ($this->db->num_rows($resql))
|
||||||
{
|
{
|
||||||
$obj = $this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
if ($obj) $ret=$obj->rowid;
|
if ($obj) $ret=$obj->rowid;
|
||||||
}
|
}
|
||||||
$this->db->free($resql);
|
$this->db->free($resql);
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error="Error ".$this->db->lasterror();
|
$this->error="Error ".$this->db->lasterror();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -293,7 +290,6 @@ class PaymentTerm // extends CommonObject
|
|||||||
$sql.= " nbjour=".(isset($this->nbjour)?$this->nbjour:"null").",";
|
$sql.= " nbjour=".(isset($this->nbjour)?$this->nbjour:"null").",";
|
||||||
$sql.= " decalage=".(isset($this->decalage)?$this->decalage:"null")."";
|
$sql.= " decalage=".(isset($this->decalage)?$this->decalage:"null")."";
|
||||||
$sql.= " WHERE rowid = " . $this->id;
|
$sql.= " WHERE rowid = " . $this->id;
|
||||||
$sql.= " AND entity = " . getEntity('c_payment_term');
|
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
@ -350,7 +346,6 @@ class PaymentTerm // extends CommonObject
|
|||||||
|
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."c_payment_term";
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."c_payment_term";
|
||||||
$sql.= " WHERE rowid = " . $this->id;
|
$sql.= " WHERE rowid = " . $this->id;
|
||||||
$sql.= " AND t.entity = " . getEntity('c_payment_term');
|
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
|
|||||||
@ -419,19 +419,19 @@ if ($resql)
|
|||||||
// Date invoice
|
// Date invoice
|
||||||
if (! empty($arrayfields['f.date_last_gen']['checked']))
|
if (! empty($arrayfields['f.date_last_gen']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre" align="center">';
|
print '<td class="liste_titre nowraponall" align="center">';
|
||||||
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="search_day" value="'.$search_day.'">';
|
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_day" value="'.$search_day.'">';
|
||||||
print '<input class="flat" type="text" size="1" maxlength="2" name="search_month" value="'.$search_month.'">';
|
print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_month" value="'.$search_month.'">';
|
||||||
$formother->select_year($search_year?$search_year:-1,'search_year',1, 20, 5);
|
$formother->select_year($search_year?$search_year:-1,'search_year',1, 20, 5, 0, 0, '', 'witdhauto valignmiddle');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
// Date next generation
|
// Date next generation
|
||||||
if (! empty($arrayfields['f.date_when']['checked']))
|
if (! empty($arrayfields['f.date_when']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre" align="center">';
|
print '<td class="liste_titre nowraponall" align="center">';
|
||||||
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="search_day_date_when" value="'.$search_day_date_when.'">';
|
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_day_date_when" value="'.$search_day_date_when.'">';
|
||||||
print '<input class="flat" type="text" size="1" maxlength="2" name="search_month_date_when" value="'.$search_month_date_when.'">';
|
print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_month_date_when" value="'.$search_month_date_when.'">';
|
||||||
$formother->select_year($search_year_date_when?$search_year_date_when:-1,'search_year_date_when',1, 20, 5);
|
$formother->select_year($search_year_date_when?$search_year_date_when:-1,'search_year_date_when',1, 20, 5, 0, 0, '', 'witdhauto valignmiddle');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
// Extra fields
|
// Extra fields
|
||||||
|
|||||||
@ -702,18 +702,18 @@ if ($resql)
|
|||||||
if (! empty($arrayfields['f.date']['checked']))
|
if (! empty($arrayfields['f.date']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre nowraponall" align="center">';
|
print '<td class="liste_titre nowraponall" align="center">';
|
||||||
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="day" value="'.dol_escape_htmltag($day).'">';
|
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="day" value="'.dol_escape_htmltag($day).'">';
|
||||||
print '<input class="flat" type="text" size="1" maxlength="2" name="month" value="'.dol_escape_htmltag($month).'">';
|
print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="month" value="'.dol_escape_htmltag($month).'">';
|
||||||
$formother->select_year($year?$year:-1,'year',1, 20, 5, 0, 0, '', 'width75');
|
$formother->select_year($year?$year:-1,'year',1, 20, 5, 0, 0, '', 'widthauto valignmiddle');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
// Date due
|
// Date due
|
||||||
if (! empty($arrayfields['f.date_lim_reglement']['checked']))
|
if (! empty($arrayfields['f.date_lim_reglement']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre nowraponall" align="center">';
|
print '<td class="liste_titre nowraponall" align="center">';
|
||||||
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="day_lim" value="'.dol_escape_htmltag($day_lim).'">';
|
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="day_lim" value="'.dol_escape_htmltag($day_lim).'">';
|
||||||
print '<input class="flat" type="text" size="1" maxlength="2" name="month_lim" value="'.dol_escape_htmltag($month_lim).'">';
|
print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="month_lim" value="'.dol_escape_htmltag($month_lim).'">';
|
||||||
$formother->select_year($year_lim?$year_lim:-1,'year_lim',1, 20, 5, 0, 0, '', 'width75');
|
$formother->select_year($year_lim?$year_lim:-1,'year_lim',1, 20, 5, 0, 0, '', 'widthauto valignmiddle');
|
||||||
print '<br><input type="checkbox" name="option" value="late"'.($option == 'late'?' checked':'').'> '.$langs->trans("Late");
|
print '<br><input type="checkbox" name="option" value="late"'.($option == 'late'?' checked':'').'> '.$langs->trans("Late");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
@ -756,7 +756,7 @@ if ($resql)
|
|||||||
if (! empty($arrayfields['f.fk_mode_reglement']['checked']))
|
if (! empty($arrayfields['f.fk_mode_reglement']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre" align="left">';
|
print '<td class="liste_titre" align="left">';
|
||||||
$form->select_types_paiements($search_paymentmode, 'search_paymentmode', '', 0, 0, 1, 10);
|
$form->select_types_paiements($search_paymentmode, 'search_paymentmode', '', 0, 1, 1, 10);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
if (! empty($arrayfields['f.total_ht']['checked']))
|
if (! empty($arrayfields['f.total_ht']['checked']))
|
||||||
@ -775,14 +775,14 @@ if ($resql)
|
|||||||
}
|
}
|
||||||
if (! empty($arrayfields['f.total_localtax1']['checked']))
|
if (! empty($arrayfields['f.total_localtax1']['checked']))
|
||||||
{
|
{
|
||||||
// Amount
|
// Localtax1
|
||||||
print '<td class="liste_titre" align="right">';
|
print '<td class="liste_titre" align="right">';
|
||||||
print '<input class="flat" type="text" size="5" name="search_montant_localtax1" value="'.$search_montant_localtax1.'">';
|
print '<input class="flat" type="text" size="5" name="search_montant_localtax1" value="'.$search_montant_localtax1.'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
if (! empty($arrayfields['f.total_localtax2']['checked']))
|
if (! empty($arrayfields['f.total_localtax2']['checked']))
|
||||||
{
|
{
|
||||||
// Amount
|
// Localtax2
|
||||||
print '<td class="liste_titre" align="right">';
|
print '<td class="liste_titre" align="right">';
|
||||||
print '<input class="flat" type="text" size="5" name="search_montant_localtax2" value="'.$search_montant_localtax2.'">';
|
print '<input class="flat" type="text" size="5" name="search_montant_localtax2" value="'.$search_montant_localtax2.'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|||||||
@ -827,7 +827,7 @@ if (! GETPOST('action','aZ09'))
|
|||||||
|
|
||||||
$sql = 'SELECT p.datep as dp, p.amount, f.amount as fa_amount, f.facnumber';
|
$sql = 'SELECT p.datep as dp, p.amount, f.amount as fa_amount, f.facnumber';
|
||||||
$sql.=', f.rowid as facid, c.libelle as paiement_type, p.num_paiement';
|
$sql.=', f.rowid as facid, c.libelle as paiement_type, p.num_paiement';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiement as p LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as c ON p.fk_paiement = c.id AND c.entity IN (' . getEntity('c_paiement').')';
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiement as p LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as c ON p.fk_paiement = c.id';
|
||||||
$sql.= ', '.MAIN_DB_PREFIX.'facture as f';
|
$sql.= ', '.MAIN_DB_PREFIX.'facture as f';
|
||||||
$sql.= ' WHERE p.fk_facture = f.rowid';
|
$sql.= ' WHERE p.fk_facture = f.rowid';
|
||||||
$sql.= ' AND f.entity IN (' . getEntity('facture').')';
|
$sql.= ' AND f.entity IN (' . getEntity('facture').')';
|
||||||
|
|||||||
@ -332,21 +332,22 @@ if ($resql)
|
|||||||
|
|
||||||
if ($num > 0)
|
if ($num > 0)
|
||||||
{
|
{
|
||||||
$var=True;
|
|
||||||
|
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object($resql);
|
$objp = $db->fetch_object($resql);
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
$thirdpartystatic->fetch($objp->socid);
|
||||||
|
|
||||||
$invoice=new Facture($db);
|
$invoice=new Facture($db);
|
||||||
$invoice->fetch($objp->facid);
|
$invoice->fetch($objp->facid);
|
||||||
$paiement = $invoice->getSommePaiement();
|
|
||||||
$creditnotes=$invoice->getSumCreditNotesUsed();
|
$paiement = $invoice->getSommePaiement();
|
||||||
$deposits=$invoice->getSumDepositsUsed();
|
$creditnotes=$invoice->getSumCreditNotesUsed();
|
||||||
$alreadypayed=price2num($paiement + $creditnotes + $deposits,'MT');
|
$deposits=$invoice->getSumDepositsUsed();
|
||||||
$remaintopay=price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits,'MT');
|
$alreadypayed=price2num($paiement + $creditnotes + $deposits,'MT');
|
||||||
|
$remaintopay=price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits,'MT');
|
||||||
|
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
|
||||||
// Invoice
|
// Invoice
|
||||||
print '<td>';
|
print '<td>';
|
||||||
@ -355,8 +356,6 @@ if ($resql)
|
|||||||
|
|
||||||
// Third party
|
// Third party
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$thirdpartystatic->id=$objp->socid;
|
|
||||||
$thirdpartystatic->name=$objp->name;
|
|
||||||
print $thirdpartystatic->getNomUrl(1);
|
print $thirdpartystatic->getNomUrl(1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
|
|||||||
@ -107,7 +107,7 @@ class Cpaiement
|
|||||||
// Insert request
|
// Insert request
|
||||||
$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . '(';
|
$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . '(';
|
||||||
|
|
||||||
$sql.= 'id,';
|
$sql.= 'entity,';
|
||||||
$sql.= 'code,';
|
$sql.= 'code,';
|
||||||
$sql.= 'libelle,';
|
$sql.= 'libelle,';
|
||||||
$sql.= 'type,';
|
$sql.= 'type,';
|
||||||
@ -118,7 +118,7 @@ class Cpaiement
|
|||||||
|
|
||||||
$sql .= ') VALUES (';
|
$sql .= ') VALUES (';
|
||||||
|
|
||||||
$sql .= ' '.(! isset($this->id)?'NULL':$this->id).',';
|
$sql .= ' '.(! isset($this->entity)?getEntity('c_paiement'):$this->entity).',';
|
||||||
$sql .= ' '.(! isset($this->code)?'NULL':"'".$this->db->escape($this->code)."'").',';
|
$sql .= ' '.(! isset($this->code)?'NULL':"'".$this->db->escape($this->code)."'").',';
|
||||||
$sql .= ' '.(! isset($this->libelle)?'NULL':"'".$this->db->escape($this->libelle)."'").',';
|
$sql .= ' '.(! isset($this->libelle)?'NULL':"'".$this->db->escape($this->libelle)."'").',';
|
||||||
$sql .= ' '.(! isset($this->type)?'NULL':$this->type).',';
|
$sql .= ' '.(! isset($this->type)?'NULL':$this->type).',';
|
||||||
@ -186,7 +186,8 @@ class Cpaiement
|
|||||||
$sql .= " t.module";
|
$sql .= " t.module";
|
||||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
|
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
|
||||||
if (null !== $ref) {
|
if (null !== $ref) {
|
||||||
$sql .= ' WHERE t.code = ' . '\'' . $ref . '\'';
|
$sql .= ' WHERE t.entity IN ('.getEntity('c_paiement').')';
|
||||||
|
$sql .= ' AND t.code = ' . '\'' . $ref . '\'';
|
||||||
} else {
|
} else {
|
||||||
$sql .= ' WHERE t.id = ' . $id;
|
$sql .= ' WHERE t.id = ' . $id;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -138,7 +138,7 @@ else
|
|||||||
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
|
||||||
$sql.=$hookmanager->resPrint;
|
$sql.=$hookmanager->resPrint;
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."paiement as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."paiement as p";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_paiement = c.id AND c.entity IN (" . getEntity('c_paiement') . ")";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_paiement = c.id";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON p.fk_bank = b.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON p.fk_bank = b.rowid";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON p.rowid = pf.fk_paiement";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON p.rowid = pf.fk_paiement";
|
||||||
|
|||||||
@ -822,7 +822,7 @@ else
|
|||||||
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as p";
|
||||||
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user_author";
|
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user_author";
|
||||||
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."payment_expensereport as pe ON pe.fk_expensereport = p.rowid";
|
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."payment_expensereport as pe ON pe.fk_expensereport = p.rowid";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id AND c.entity IN (".getEntity('c_paiement').")";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id";
|
||||||
$sql.= " WHERE p.entity IN (".getEntity('expensereport').")";
|
$sql.= " WHERE p.entity IN (".getEntity('expensereport').")";
|
||||||
$sql.= " AND p.fk_statut>=5";
|
$sql.= " AND p.fk_statut>=5";
|
||||||
|
|
||||||
@ -906,7 +906,7 @@ else
|
|||||||
$sql = "SELECT p.societe as nom, p.firstname, p.lastname, date_format(p.datedon,'%Y-%m') as dm, sum(p.amount) as amount";
|
$sql = "SELECT p.societe as nom, p.firstname, p.lastname, date_format(p.datedon,'%Y-%m') as dm, sum(p.amount) as amount";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."don as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."don as p";
|
||||||
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."payment_donation as pe ON pe.fk_donation = p.rowid";
|
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."payment_donation as pe ON pe.fk_donation = p.rowid";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id AND c.entity IN (".getEntity('c_paiement').")";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id";
|
||||||
$sql.= " WHERE p.entity IN (".getEntity('donation').")";
|
$sql.= " WHERE p.entity IN (".getEntity('donation').")";
|
||||||
$sql.= " AND fk_statut >= 2";
|
$sql.= " AND fk_statut >= 2";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -698,7 +698,7 @@ if (! empty($conf->expensereport->enabled) && ($modecompta == 'CREANCES-DETTES'
|
|||||||
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as p";
|
||||||
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user_author";
|
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user_author";
|
||||||
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."payment_expensereport as pe ON pe.fk_expensereport = p.rowid";
|
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."payment_expensereport as pe ON pe.fk_expensereport = p.rowid";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id AND c.entity IN (".getEntity('c_paiement').")";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id";
|
||||||
$sql.= " WHERE p.entity IN (".getEntity('expensereport').")";
|
$sql.= " WHERE p.entity IN (".getEntity('expensereport').")";
|
||||||
$sql.= " AND p.fk_statut>=5";
|
$sql.= " AND p.fk_statut>=5";
|
||||||
|
|
||||||
@ -761,7 +761,7 @@ if (! empty($conf->don->enabled) && ($modecompta == 'CREANCES-DETTES' || $modeco
|
|||||||
$sql = "SELECT p.societe as nom, p.firstname, p.lastname, date_format(pe.datep,'%Y-%m') as dm, sum(p.amount) as amount";
|
$sql = "SELECT p.societe as nom, p.firstname, p.lastname, date_format(pe.datep,'%Y-%m') as dm, sum(p.amount) as amount";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."don as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."don as p";
|
||||||
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."payment_donation as pe ON pe.fk_donation = p.rowid";
|
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."payment_donation as pe ON pe.fk_donation = p.rowid";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id AND c.entity IN (".getEntity('c_paiement').")";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id";
|
||||||
$sql.= " WHERE p.entity IN (".getEntity('donation').")";
|
$sql.= " WHERE p.entity IN (".getEntity('donation').")";
|
||||||
$sql.= " AND fk_statut >= 2";
|
$sql.= " AND fk_statut >= 2";
|
||||||
if (! empty($date_start) && ! empty($date_end))
|
if (! empty($date_start) && ! empty($date_end))
|
||||||
|
|||||||
@ -73,7 +73,7 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel"))
|
|||||||
$dateep=dol_mktime(12,0,0, $_POST["dateepmonth"], $_POST["dateepday"], $_POST["dateepyear"]);
|
$dateep=dol_mktime(12,0,0, $_POST["dateepmonth"], $_POST["dateepday"], $_POST["dateepyear"]);
|
||||||
if (empty($datev)) $datev=$datep;
|
if (empty($datev)) $datev=$datep;
|
||||||
|
|
||||||
$type_payment = dol_getIdFromCode($db, GETPOST("paymenttype", 'alpha'), 'c_paiement');
|
$type_payment = dol_getIdFromCode($db, GETPOST("paymenttype", 'alpha'), 'c_paiement', 'code', 'id', 1);
|
||||||
|
|
||||||
$object->accountid=GETPOST("accountid") > 0 ? GETPOST("accountid","int") : 0;
|
$object->accountid=GETPOST("accountid") > 0 ? GETPOST("accountid","int") : 0;
|
||||||
$object->fk_user=GETPOST("fk_user") > 0 ? GETPOST("fk_user","int") : 0;
|
$object->fk_user=GETPOST("fk_user") > 0 ? GETPOST("fk_user","int") : 0;
|
||||||
|
|||||||
@ -105,7 +105,7 @@ $sql.= " s.rowid, s.fk_user, s.amount, s.salary, s.label, s.datep as datep, s.da
|
|||||||
$sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel,";
|
$sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel,";
|
||||||
$sql.= " pst.code as payment_code";
|
$sql.= " pst.code as payment_code";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s";
|
$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON s.fk_typepayment = pst.id AND pst.entity IN (".getEntity('c_paiement').")";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON s.fk_typepayment = pst.id";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON s.fk_bank = b.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON s.fk_bank = b.rowid";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid,";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid,";
|
||||||
$sql.= " ".MAIN_DB_PREFIX."user as u";
|
$sql.= " ".MAIN_DB_PREFIX."user as u";
|
||||||
@ -179,7 +179,7 @@ if ($result)
|
|||||||
print '<td class="liste_titre"> </td>';
|
print '<td class="liste_titre"> </td>';
|
||||||
// Type
|
// Type
|
||||||
print '<td class="liste_titre" align="left">';
|
print '<td class="liste_titre" align="left">';
|
||||||
$form->select_types_paiements($typeid,'typeid','',0,0,1,16);
|
$form->select_types_paiements($typeid,'typeid','',0,1,1,16);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
// Account
|
// Account
|
||||||
if (! empty($conf->banque->enabled))
|
if (! empty($conf->banque->enabled))
|
||||||
|
|||||||
@ -586,7 +586,7 @@ if ($id > 0)
|
|||||||
$sql.= " FROM ".MAIN_DB_PREFIX."paiementcharge as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."paiementcharge as p";
|
||||||
$sql.= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'bank as b ON p.fk_bank = b.rowid';
|
$sql.= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'bank as b ON p.fk_bank = b.rowid';
|
||||||
$sql.= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'bank_account as ba ON b.fk_account = ba.rowid';
|
$sql.= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'bank_account as ba ON b.fk_account = ba.rowid';
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_typepaiement = c.id AND c.entity IN (" . getEntity('c_paiement').")";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_typepaiement = c.id";
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs";
|
$sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs";
|
||||||
$sql.= " WHERE p.fk_charge = ".$id;
|
$sql.= " WHERE p.fk_charge = ".$id;
|
||||||
$sql.= " AND p.fk_charge = cs.rowid";
|
$sql.= " AND p.fk_charge = cs.rowid";
|
||||||
|
|||||||
@ -83,7 +83,7 @@ class ChargeSociales extends CommonObject
|
|||||||
$sql.= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle';
|
$sql.= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle';
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."chargesociales as cs";
|
$sql.= " FROM ".MAIN_DB_PREFIX."chargesociales as cs";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_chargesociales as c ON cs.fk_type = c.id";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_chargesociales as c ON cs.fk_type = c.id";
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON cs.fk_mode_reglement = p.id AND p.entity IN ('.getEntity('c_paiement').')';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON cs.fk_mode_reglement = p.id';
|
||||||
$sql.= ' WHERE cs.entity IN ('.getEntity('tax').')';
|
$sql.= ' WHERE cs.entity IN ('.getEntity('tax').')';
|
||||||
if ($ref) $sql.= " AND cs.rowid = ".$ref;
|
if ($ref) $sql.= " AND cs.rowid = ".$ref;
|
||||||
else $sql.= " AND cs.rowid = ".$id;
|
else $sql.= " AND cs.rowid = ".$id;
|
||||||
|
|||||||
@ -203,7 +203,7 @@ class PaymentSocialContribution extends CommonObject
|
|||||||
$sql.= " t.fk_user_modif,";
|
$sql.= " t.fk_user_modif,";
|
||||||
$sql.= " pt.code as type_code, pt.libelle as type_libelle,";
|
$sql.= " pt.code as type_code, pt.libelle as type_libelle,";
|
||||||
$sql.= ' b.fk_account';
|
$sql.= ' b.fk_account';
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."paiementcharge as t LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pt ON t.fk_typepaiement = pt.id AND pt.entity IN (" . getEntity('c_paiement') . ")";
|
$sql.= " FROM ".MAIN_DB_PREFIX."paiementcharge as t LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pt ON t.fk_typepaiement = pt.id";
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON t.fk_bank = b.rowid';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON t.fk_bank = b.rowid';
|
||||||
$sql.= " WHERE t.rowid = ".$id;
|
$sql.= " WHERE t.rowid = ".$id;
|
||||||
// TODO link on entity of tax;
|
// TODO link on entity of tax;
|
||||||
|
|||||||
@ -133,7 +133,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
|
|||||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c,";
|
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c,";
|
||||||
$sql.= " ".MAIN_DB_PREFIX."chargesociales as cs,";
|
$sql.= " ".MAIN_DB_PREFIX."chargesociales as cs,";
|
||||||
$sql.= " ".MAIN_DB_PREFIX."paiementcharge as pc";
|
$sql.= " ".MAIN_DB_PREFIX."paiementcharge as pc";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON pc.fk_typepaiement = pct.id AND pct.entity IN (".getEntity('c_paiement').")";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON pc.fk_typepaiement = pct.id";
|
||||||
$sql.= " WHERE cs.fk_type = c.id AND pc.fk_charge = cs.rowid";
|
$sql.= " WHERE cs.fk_type = c.id AND pc.fk_charge = cs.rowid";
|
||||||
$sql.= " AND cs.entity = ".$conf->entity;
|
$sql.= " AND cs.entity = ".$conf->entity;
|
||||||
if ($year > 0)
|
if ($year > 0)
|
||||||
|
|||||||
@ -100,7 +100,7 @@ $bankstatic = new Account($db);
|
|||||||
$sql = "SELECT t.rowid, t.amount, t.label, t.datev, t.datep, t.fk_typepayment as type, t.num_payment, t.fk_bank, pst.code as payment_code,";
|
$sql = "SELECT t.rowid, t.amount, t.label, t.datev, t.datep, t.fk_typepayment as type, t.num_payment, t.fk_bank, pst.code as payment_code,";
|
||||||
$sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel";
|
$sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."tva as t";
|
$sql.= " FROM ".MAIN_DB_PREFIX."tva as t";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON t.fk_typepayment = pst.id AND pst.entity IN (".getEntity('c_paiement').")";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON t.fk_typepayment = pst.id";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON t.fk_bank = b.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON t.fk_bank = b.rowid";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
|
||||||
$sql.= " WHERE t.entity IN (".getEntity('tax').")";
|
$sql.= " WHERE t.entity IN (".getEntity('tax').")";
|
||||||
@ -173,7 +173,7 @@ if ($result)
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
// Type
|
// Type
|
||||||
print '<td class="liste_titre" align="left">';
|
print '<td class="liste_titre" align="left">';
|
||||||
$form->select_types_paiements($typeid,'typeid','',0,0,1,16);
|
$form->select_types_paiements($typeid,'typeid','',0,1,1,16);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
// Account
|
// Account
|
||||||
if (! empty($conf->banque->enabled))
|
if (! empty($conf->banque->enabled))
|
||||||
|
|||||||
@ -686,6 +686,35 @@ if ($massaction == 'confirm_createbills')
|
|||||||
{
|
{
|
||||||
$db->commit();
|
$db->commit();
|
||||||
setEventMessage($langs->trans('BillCreated', $nb_bills_created));
|
setEventMessage($langs->trans('BillCreated', $nb_bills_created));
|
||||||
|
|
||||||
|
// Make a redirect to avoid to bill twice if we make a refresh or back
|
||||||
|
$param='';
|
||||||
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
|
||||||
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
|
||||||
|
if ($sall) $param.='&sall='.urlencode($sall);
|
||||||
|
if ($socid > 0) $param.='&socid='.urlencode($socid);
|
||||||
|
if ($viewstatut != '') $param.='&viewstatut='.urlencode($viewstatut);
|
||||||
|
if ($search_orderday) $param.='&search_orderday='.urlencode($search_orderday);
|
||||||
|
if ($search_ordermonth) $param.='&search_ordermonth='.urlencode($search_ordermonth);
|
||||||
|
if ($search_orderyear) $param.='&search_orderyear='.urlencode($search_orderyear);
|
||||||
|
if ($search_deliveryday) $param.='&search_deliveryday='.urlencode($search_deliveryday);
|
||||||
|
if ($search_deliverymonth) $param.='&search_deliverymonth='.urlencode($search_deliverymonth);
|
||||||
|
if ($search_deliveryyear) $param.='&search_deliveryyear='.urlencode($search_deliveryyear);
|
||||||
|
if ($search_ref) $param.='&search_ref='.urlencode($search_ref);
|
||||||
|
if ($search_company) $param.='&search_company='.urlencode($search_company);
|
||||||
|
if ($search_ref_customer) $param.='&search_ref_customer='.urlencode($search_ref_customer);
|
||||||
|
if ($search_user > 0) $param.='&search_user='.urlencode($search_user);
|
||||||
|
if ($search_sale > 0) $param.='&search_sale='.urlencode($search_sale);
|
||||||
|
if ($search_total_ht != '') $param.='&search_total_ht='.urlencode($search_total_ht);
|
||||||
|
if ($search_total_vat != '') $param.='&search_total_vat='.urlencode($search_total_vat);
|
||||||
|
if ($search_total_ttc != '') $param.='&search_total_ttc='.urlencode($search_total_ttc);
|
||||||
|
if ($search_project_ref >= 0) $param.="&search_project_ref=".urlencode($search_project_ref);
|
||||||
|
if ($show_files) $param.='&show_files=' .urlencode($show_files);
|
||||||
|
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
||||||
|
if ($billed != '') $param.='&billed='.urlencode($billed);
|
||||||
|
|
||||||
|
header("Location: ".$_SERVER['PHP_SELF'].'?'.$param);
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -602,9 +602,11 @@ abstract class CommonInvoice extends CommonObject
|
|||||||
|
|
||||||
$sqltemp = 'SELECT c.type_cdr,c.nbjour,c.decalage';
|
$sqltemp = 'SELECT c.type_cdr,c.nbjour,c.decalage';
|
||||||
$sqltemp.= ' FROM '.MAIN_DB_PREFIX.'c_payment_term as c';
|
$sqltemp.= ' FROM '.MAIN_DB_PREFIX.'c_payment_term as c';
|
||||||
$sqltemp.= " WHERE c.entity IN (" . getEntity('c_payment_term').")";
|
if (is_numeric($cond_reglement)) $sqltemp.= " WHERE c.rowid=".$cond_reglement;
|
||||||
if (is_numeric($cond_reglement)) $sqltemp.= " AND c.rowid=".$cond_reglement;
|
else {
|
||||||
else $sqltemp.= " AND c.code='".$this->db->escape($cond_reglement)."'";
|
$sqltemp.= " WHERE c.entity IN (".getEntity('c_payment_term').")";
|
||||||
|
$sqltemp.= " AND c.code='".$this->db->escape($cond_reglement)."'";
|
||||||
|
}
|
||||||
|
|
||||||
dol_syslog(get_class($this).'::calculate_date_lim_reglement', LOG_DEBUG);
|
dol_syslog(get_class($this).'::calculate_date_lim_reglement', LOG_DEBUG);
|
||||||
$resqltemp=$this->db->query($sqltemp);
|
$resqltemp=$this->db->query($sqltemp);
|
||||||
|
|||||||
@ -2793,7 +2793,7 @@ class Form
|
|||||||
|
|
||||||
$sql = "SELECT rowid, code, libelle as label";
|
$sql = "SELECT rowid, code, libelle as label";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX.'c_payment_term';
|
$sql.= " FROM ".MAIN_DB_PREFIX.'c_payment_term';
|
||||||
$sql.= " WHERE entity = " . getEntity('c_payment_term');
|
$sql.= " WHERE entity IN (".getEntity('c_payment_term').")";
|
||||||
$sql.= " AND active > 0";
|
$sql.= " AND active > 0";
|
||||||
$sql.= " ORDER BY sortorder";
|
$sql.= " ORDER BY sortorder";
|
||||||
|
|
||||||
@ -3100,7 +3100,7 @@ class Form
|
|||||||
* @param string $morecss Add more CSS on select tag
|
* @param string $morecss Add more CSS on select tag
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function select_types_paiements($selected='', $htmlname='paiementtype', $filtertype='', $format=0, $empty=0, $noadmininfo=0, $maxlength=0, $active=1, $morecss='')
|
function select_types_paiements($selected='', $htmlname='paiementtype', $filtertype='', $format=0, $empty=1, $noadmininfo=0, $maxlength=0, $active=1, $morecss='')
|
||||||
{
|
{
|
||||||
global $langs,$user;
|
global $langs,$user;
|
||||||
|
|
||||||
|
|||||||
@ -148,16 +148,19 @@ class FormMail extends Form
|
|||||||
* Add a file into the list of attached files (stored in SECTION array)
|
* Add a file into the list of attached files (stored in SECTION array)
|
||||||
*
|
*
|
||||||
* @param string $path Full absolute path on filesystem of file, including file name
|
* @param string $path Full absolute path on filesystem of file, including file name
|
||||||
* @param string $file Only filename
|
* @param string $file Only filename (can be basename($path))
|
||||||
* @param string $type Mime type
|
* @param string $type Mime type (can be dol_mimetype($file))
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function add_attached_files($path,$file,$type)
|
function add_attached_files($path, $file='', $type='')
|
||||||
{
|
{
|
||||||
$listofpaths=array();
|
$listofpaths=array();
|
||||||
$listofnames=array();
|
$listofnames=array();
|
||||||
$listofmimes=array();
|
$listofmimes=array();
|
||||||
|
|
||||||
|
if (empty($file)) $file=basename($path);
|
||||||
|
if (empty($type)) $type=dol_mimetype($file);
|
||||||
|
|
||||||
$keytoavoidconflict = empty($this->trackid)?'':'-'.$this->trackid; // this->trackid must be defined
|
$keytoavoidconflict = empty($this->trackid)?'':'-'.$this->trackid; // this->trackid must be defined
|
||||||
if (! empty($_SESSION["listofpaths".$keytoavoidconflict])) $listofpaths=explode(';',$_SESSION["listofpaths".$keytoavoidconflict]);
|
if (! empty($_SESSION["listofpaths".$keytoavoidconflict])) $listofpaths=explode(';',$_SESSION["listofpaths".$keytoavoidconflict]);
|
||||||
if (! empty($_SESSION["listofnames".$keytoavoidconflict])) $listofnames=explode(';',$_SESSION["listofnames".$keytoavoidconflict]);
|
if (! empty($_SESSION["listofnames".$keytoavoidconflict])) $listofnames=explode(';',$_SESSION["listofnames".$keytoavoidconflict]);
|
||||||
|
|||||||
@ -175,14 +175,21 @@ function societe_prepare_head(Societe $object)
|
|||||||
$h++;
|
$h++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bank accounrs
|
// Bank accounts
|
||||||
if (empty($conf->global->SOCIETE_DISABLE_BANKACCOUNT))
|
if (empty($conf->global->SOCIETE_DISABLE_BANKACCOUNT))
|
||||||
{
|
{
|
||||||
$langs->load("banks");
|
$langs->load("banks");
|
||||||
|
|
||||||
|
$title = $langs->trans("BankAccounts");
|
||||||
|
if (! empty($conf->stripe->enabled))
|
||||||
|
{
|
||||||
|
$langs->load("stripe");
|
||||||
|
$title = $langs->trans("BankAccountsAndGateways");
|
||||||
|
}
|
||||||
|
|
||||||
$nbBankAccount=0;
|
$nbBankAccount=0;
|
||||||
$head[$h][0] = DOL_URL_ROOT .'/societe/gateway.php?socid='.$object->id;
|
$head[$h][0] = DOL_URL_ROOT .'/societe/paymentmodes.php?socid='.$object->id;
|
||||||
$head[$h][1] = $langs->trans("Gateways");
|
$head[$h][1] = $title;
|
||||||
$sql = "SELECT COUNT(n.rowid) as nb";
|
$sql = "SELECT COUNT(n.rowid) as nb";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe_rib as n";
|
$sql.= " FROM ".MAIN_DB_PREFIX."societe_rib as n";
|
||||||
$sql.= " WHERE fk_soc = ".$object->id;
|
$sql.= " WHERE fk_soc = ".$object->id;
|
||||||
|
|||||||
@ -121,11 +121,6 @@ function getEntity($element, $shared=1, $forceentity=null)
|
|||||||
{
|
{
|
||||||
global $conf, $mc;
|
global $conf, $mc;
|
||||||
|
|
||||||
// For backward compatibilty
|
|
||||||
if ($element == 'actioncomm') $element='agenda';
|
|
||||||
if ($element == 'fichinter') $element='intervention';
|
|
||||||
if ($element == 'categorie') $element='category';
|
|
||||||
|
|
||||||
if (is_object($mc))
|
if (is_object($mc))
|
||||||
{
|
{
|
||||||
return $mc->getEntity($element, $shared, $forceentity);
|
return $mc->getEntity($element, $shared, $forceentity);
|
||||||
|
|||||||
@ -828,7 +828,7 @@ class pdf_crabe extends ModelePDFFactures
|
|||||||
$sql = "SELECT p.datep as date, p.fk_paiement, p.num_paiement as num, pf.amount as amount, pf.multicurrency_amount,";
|
$sql = "SELECT p.datep as date, p.fk_paiement, p.num_paiement as num, pf.amount as amount, pf.multicurrency_amount,";
|
||||||
$sql.= " cp.code";
|
$sql.= " cp.code";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."paiement_facture as pf, ".MAIN_DB_PREFIX."paiement as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."paiement_facture as pf, ".MAIN_DB_PREFIX."paiement as p";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON p.fk_paiement = cp.id AND cp.entity IN (".getEntity('c_paiement').")";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON p.fk_paiement = cp.id";
|
||||||
$sql.= " WHERE pf.fk_paiement = p.rowid AND pf.fk_facture = ".$object->id;
|
$sql.= " WHERE pf.fk_paiement = p.rowid AND pf.fk_facture = ".$object->id;
|
||||||
//$sql.= " WHERE pf.fk_paiement = p.rowid AND pf.fk_facture = 1";
|
//$sql.= " WHERE pf.fk_paiement = p.rowid AND pf.fk_facture = 1";
|
||||||
$sql.= " ORDER BY p.datep";
|
$sql.= " ORDER BY p.datep";
|
||||||
@ -1688,7 +1688,7 @@ class pdf_crabe extends ModelePDFFactures
|
|||||||
{
|
{
|
||||||
$top_shift = $pdf->getY() - $current_y;
|
$top_shift = $pdf->getY() - $current_y;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($showaddress)
|
if ($showaddress)
|
||||||
{
|
{
|
||||||
// Sender properties
|
// Sender properties
|
||||||
|
|||||||
@ -259,7 +259,7 @@ class modFacture extends DolibarrModules
|
|||||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'facture_extrafields as extra ON f.rowid = extra.fk_object';
|
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'facture_extrafields as extra ON f.rowid = extra.fk_object';
|
||||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON pf.fk_facture = f.rowid';
|
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON pf.fk_facture = f.rowid';
|
||||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'paiement as p ON pf.fk_paiement = p.rowid';
|
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'paiement as p ON pf.fk_paiement = p.rowid';
|
||||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as pt ON pt.id = p.fk_paiement AND pt.entity IN ('.getEntity('c_paiement').')';
|
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as pt ON pt.id = p.fk_paiement';
|
||||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON b.rowid = p.fk_bank';
|
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON b.rowid = p.fk_bank';
|
||||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as ba ON ba.rowid = b.fk_account';
|
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as ba ON ba.rowid = b.fk_account';
|
||||||
$this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid';
|
$this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid';
|
||||||
|
|||||||
@ -59,7 +59,7 @@ class modMultiCurrency extends DolibarrModules
|
|||||||
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
|
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
|
||||||
$this->name = preg_replace('/^mod/i', '', get_class($this));
|
$this->name = preg_replace('/^mod/i', '', get_class($this));
|
||||||
// Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)
|
// Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)
|
||||||
$this->description = "Module to enter elements with a foreign currency";
|
$this->description = "Module to manage several foreign currencies in prices and documents";
|
||||||
|
|
||||||
// Possible values for version are: 'development', 'experimental', 'dolibarr' or 'dolibarr_deprecated' or version
|
// Possible values for version are: 'development', 'experimental', 'dolibarr' or 'dolibarr_deprecated' or version
|
||||||
$this->version = 'dolibarr';
|
$this->version = 'dolibarr';
|
||||||
|
|||||||
@ -165,7 +165,7 @@ class modSalaries extends DolibarrModules
|
|||||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'user as u';
|
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'user as u';
|
||||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'payment_salary as p ON p.fk_user = u.rowid';
|
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'payment_salary as p ON p.fk_user = u.rowid';
|
||||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as cp ON p.fk_typepayment = cp.id AND cp.entity IN ('.getEntity('c_paiement').')';
|
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as cp ON p.fk_typepayment = cp.id';
|
||||||
$this->export_sql_end[$r] .=' AND u.entity IN ('.getEntity('user').')';
|
$this->export_sql_end[$r] .=' AND u.entity IN ('.getEntity('user').')';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -283,8 +283,8 @@ class modSociete extends DolibarrModules
|
|||||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON s.fk_departement = d.rowid';
|
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON s.fk_departement = d.rowid';
|
||||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_stcomm as st ON s.fk_stcomm = st.id';
|
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_stcomm as st ON s.fk_stcomm = st.id';
|
||||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON sc.fk_user = u.rowid';
|
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON sc.fk_user = u.rowid';
|
||||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as payterm ON s.cond_reglement = payterm.rowid AND payterm.entity IN ('.getEntity('c_payment_term').')';
|
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as payterm ON s.cond_reglement = payterm.rowid';
|
||||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as paymode ON s.mode_reglement = paymode.id AND paymode.entity IN ('.getEntity('c_paiement').')';
|
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as paymode ON s.mode_reglement = paymode.id';
|
||||||
$this->export_sql_end[$r] .=' WHERE s.entity IN ('.getEntity('societe').')';
|
$this->export_sql_end[$r] .=' WHERE s.entity IN ('.getEntity('societe').')';
|
||||||
if (is_object($user) && empty($user->rights->societe->client->voir)) {
|
if (is_object($user) && empty($user->rights->societe->client->voir)) {
|
||||||
$this->export_sql_end[$r] .=' AND (sc.fk_user = '.$user->id.' ';
|
$this->export_sql_end[$r] .=' AND (sc.fk_user = '.$user->id.' ';
|
||||||
|
|||||||
@ -71,7 +71,7 @@ class modStripe extends DolibarrModules
|
|||||||
// Dependencies
|
// Dependencies
|
||||||
$this->depends = array(); // List of modules id that must be enabled if this module is enabled
|
$this->depends = array(); // List of modules id that must be enabled if this module is enabled
|
||||||
$this->requiredby = array(); // List of modules id to disable if this one is disabled
|
$this->requiredby = array(); // List of modules id to disable if this one is disabled
|
||||||
$this->phpmin = array(5,3); // Minimum version of PHP required by module
|
$this->phpmin = array(5,4); // Minimum version of PHP required by module
|
||||||
$this->need_dolibarr_version = array(5,0); // Minimum version of Dolibarr required by module
|
$this->need_dolibarr_version = array(5,0); // Minimum version of Dolibarr required by module
|
||||||
$this->langfiles = array("stripe");
|
$this->langfiles = array("stripe");
|
||||||
|
|
||||||
@ -107,6 +107,49 @@ class modStripe extends DolibarrModules
|
|||||||
); // 0=Menu for internal users, 1=external users, 2=both
|
); // 0=Menu for internal users, 1=external users, 2=both
|
||||||
$r++;
|
$r++;
|
||||||
|
|
||||||
|
$this->menu[$r] = array(
|
||||||
|
'fk_menu'=>'fk_mainmenu=bank',
|
||||||
|
'type'=>'left',
|
||||||
|
'titre'=>'StripeAccount',
|
||||||
|
'mainmenu'=>'bank',
|
||||||
|
'leftmenu'=>'stripe',
|
||||||
|
'url' => '/stripe/charge.php',
|
||||||
|
'langs' => 'stripe',
|
||||||
|
'position' => 100,
|
||||||
|
'enabled' => '$conf->global->MAIN_FEATURES_LEVEL >= 2',
|
||||||
|
'perms' => '$user->rights->banque->configurer',
|
||||||
|
'target' => '',
|
||||||
|
'user' => 0
|
||||||
|
);
|
||||||
|
|
||||||
|
$r++;
|
||||||
|
$this->menu[$r] = array(
|
||||||
|
'fk_menu' => 'fk_mainmenu=bank,fk_leftmenu=stripe',
|
||||||
|
'type' => 'left',
|
||||||
|
'titre' => 'StripeChargeList',
|
||||||
|
'url' => '/stripe/charge.php',
|
||||||
|
'langs' => 'stripe',
|
||||||
|
'position' => 102,
|
||||||
|
'enabled' => '$conf->stripe->enabled && $conf->banque->enabled && $conf->global->MAIN_FEATURES_LEVEL >= 2',
|
||||||
|
'perms' => '$user->rights->banque->configurer',
|
||||||
|
'target' => '',
|
||||||
|
'user' => 0
|
||||||
|
);
|
||||||
|
|
||||||
|
$r++;
|
||||||
|
$this->menu[$r] = array(
|
||||||
|
'fk_menu' => 'fk_mainmenu=bank,fk_leftmenu=stripe',
|
||||||
|
'type' => 'left',
|
||||||
|
'titre' => 'StripeTransactionList',
|
||||||
|
'url' => '/stripe/transaction.php',
|
||||||
|
'langs' => 'stripe',
|
||||||
|
'position' => 102,
|
||||||
|
'enabled' => '$conf->stripe->enabled && $conf->banque->enabled && $conf->global->MAIN_FEATURES_LEVEL >= 2',
|
||||||
|
'perms' => '$user->rights->banque->configurer',
|
||||||
|
'target' => '',
|
||||||
|
'user' => 0
|
||||||
|
);
|
||||||
|
|
||||||
// Exports
|
// Exports
|
||||||
$r=1;
|
$r=1;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -187,7 +187,7 @@ class pdf_paiement
|
|||||||
if (! empty($conf->banque->enabled))
|
if (! empty($conf->banque->enabled))
|
||||||
$sql.= ", ba.ref as bankaccount";
|
$sql.= ", ba.ref as bankaccount";
|
||||||
$sql.= ", p.rowid as prowid";
|
$sql.= ", p.rowid as prowid";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."paiement as p LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_paiement = c.id AND c.entity IN (" . getEntity('c_paiement').")";
|
$sql.= " FROM ".MAIN_DB_PREFIX."paiement as p LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_paiement = c.id";
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."facture as f,";
|
$sql.= ", ".MAIN_DB_PREFIX."facture as f,";
|
||||||
$sql.= " ".MAIN_DB_PREFIX."paiement_facture as pf,";
|
$sql.= " ".MAIN_DB_PREFIX."paiement_facture as pf,";
|
||||||
if (! empty($conf->banque->enabled))
|
if (! empty($conf->banque->enabled))
|
||||||
@ -218,7 +218,7 @@ class pdf_paiement
|
|||||||
if (! empty($conf->banque->enabled))
|
if (! empty($conf->banque->enabled))
|
||||||
$sql.= ", ba.ref as bankaccount";
|
$sql.= ", ba.ref as bankaccount";
|
||||||
$sql.= ", p.rowid as prowid";
|
$sql.= ", p.rowid as prowid";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."paiementfourn as p LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_paiement = c.id AND c.entity IN (".getEntity('c_paiement').")";
|
$sql.= " FROM ".MAIN_DB_PREFIX."paiementfourn as p LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_paiement = c.id";
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."facture_fourn as f,";
|
$sql.= ", ".MAIN_DB_PREFIX."facture_fourn as f,";
|
||||||
$sql.= " ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf,";
|
$sql.= " ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf,";
|
||||||
if (! empty($conf->banque->enabled))
|
if (! empty($conf->banque->enabled))
|
||||||
|
|||||||
@ -933,7 +933,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
|
|||||||
$sql = "SELECT p.datep as date, p.fk_paiement as type, p.num_paiement as num, pf.amount as amount, pf.multicurrency_amount,";
|
$sql = "SELECT p.datep as date, p.fk_paiement as type, p.num_paiement as num, pf.amount as amount, pf.multicurrency_amount,";
|
||||||
$sql.= " cp.code";
|
$sql.= " cp.code";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf, ".MAIN_DB_PREFIX."paiementfourn as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf, ".MAIN_DB_PREFIX."paiementfourn as p";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON p.fk_paiement = cp.id AND cp.entity IN (".getEntity('c_paiement').")";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON p.fk_paiement = cp.id";
|
||||||
$sql.= " WHERE pf.fk_paiementfourn = p.rowid and pf.fk_facturefourn = ".$object->id;
|
$sql.= " WHERE pf.fk_paiementfourn = p.rowid and pf.fk_facturefourn = ".$object->id;
|
||||||
$sql.= " ORDER BY p.datep";
|
$sql.= " ORDER BY p.datep";
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
|
|||||||
@ -643,8 +643,9 @@ if (! empty($id) && $action != 'edit')
|
|||||||
* Payments
|
* Payments
|
||||||
*/
|
*/
|
||||||
$sql = "SELECT p.rowid, p.num_payment, p.datep as dp, p.amount,";
|
$sql = "SELECT p.rowid, p.num_payment, p.datep as dp, p.amount,";
|
||||||
$sql.= " c.code as type_code,c.libelle as paiement_type";
|
$sql.= "c.code as type_code,c.libelle as paiement_type";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."payment_donation as p LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON c.entity IN (".getEntity('c_paiement').")";
|
$sql.= " FROM ".MAIN_DB_PREFIX."payment_donation as p";
|
||||||
|
$sql.= ", ".MAIN_DB_PREFIX."c_paiement as c ";
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."don as d";
|
$sql.= ", ".MAIN_DB_PREFIX."don as d";
|
||||||
$sql.= " WHERE d.rowid = '".$id."'";
|
$sql.= " WHERE d.rowid = '".$id."'";
|
||||||
$sql.= " AND p.fk_donation = d.rowid";
|
$sql.= " AND p.fk_donation = d.rowid";
|
||||||
|
|||||||
@ -611,7 +611,7 @@ class Don extends CommonObject
|
|||||||
$sql.= " c.code as country_code, c.label as country";
|
$sql.= " c.code as country_code, c.label as country";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."don as d";
|
$sql.= " FROM ".MAIN_DB_PREFIX."don as d";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = d.fk_projet";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = d.fk_projet";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON cp.id = d.fk_payment AND cp.entity IN (".getEntity('c_paiement').")";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON cp.id = d.fk_payment";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON d.fk_country = c.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON d.fk_country = c.rowid";
|
||||||
$sql.= " WHERE d.entity IN (".getEntity('donation').")";
|
$sql.= " WHERE d.entity IN (".getEntity('donation').")";
|
||||||
if (! empty($id))
|
if (! empty($id))
|
||||||
|
|||||||
@ -182,7 +182,7 @@ class PaymentDonation extends CommonObject
|
|||||||
$sql.= " pt.code as type_code, pt.libelle as type_libelle,";
|
$sql.= " pt.code as type_code, pt.libelle as type_libelle,";
|
||||||
$sql.= ' b.fk_account';
|
$sql.= ' b.fk_account';
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."payment_donation as t";
|
$sql.= " FROM ".MAIN_DB_PREFIX."payment_donation as t";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pt ON t.fk_typepayment = pt.id AND pt.entity IN (".getEntity('c_paiement').")";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pt ON t.fk_typepayment = pt.id";
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON t.fk_bank = b.rowid';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON t.fk_bank = b.rowid';
|
||||||
$sql.= " WHERE t.rowid = ".$id;
|
$sql.= " WHERE t.rowid = ".$id;
|
||||||
|
|
||||||
|
|||||||
@ -1880,7 +1880,7 @@ else
|
|||||||
$sql.= "c.code as p_code, c.libelle as payment_type,";
|
$sql.= "c.code as p_code, c.libelle as payment_type,";
|
||||||
$sql.= "ba.rowid as baid, ba.ref as baref, ba.label, ba.number as banumber, ba.account_number, ba.fk_accountancy_journal";
|
$sql.= "ba.rowid as baid, ba.ref as baref, ba.label, ba.number as banumber, ba.account_number, ba.fk_accountancy_journal";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as e, ".MAIN_DB_PREFIX."payment_expensereport as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as e, ".MAIN_DB_PREFIX."payment_expensereport as p";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_typepayment = c.id AND c.entity IN (".getEntity('c_paiement').")";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_typepayment = c.id";
|
||||||
$sql.= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'bank as b ON p.fk_bank = b.rowid';
|
$sql.= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'bank as b ON p.fk_bank = b.rowid';
|
||||||
$sql.= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'bank_account as ba ON b.fk_account = ba.rowid';
|
$sql.= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'bank_account as ba ON b.fk_account = ba.rowid';
|
||||||
$sql.= " WHERE e.rowid = '".$id."'";
|
$sql.= " WHERE e.rowid = '".$id."'";
|
||||||
|
|||||||
@ -450,7 +450,7 @@ class ExpenseReport extends CommonObject
|
|||||||
$sql.= " d.fk_statut as status, d.fk_c_paiement,";
|
$sql.= " d.fk_statut as status, d.fk_c_paiement,";
|
||||||
$sql.= " dp.libelle as libelle_paiement, dp.code as code_paiement"; // INNER JOIN paiement
|
$sql.= " dp.libelle as libelle_paiement, dp.code as code_paiement"; // INNER JOIN paiement
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element." as d";
|
$sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element." as d";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as dp ON d.fk_c_paiement = dp.id AND dp.entity IN (".getEntity('c_paiement').")";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as dp ON d.fk_c_paiement = dp.id";
|
||||||
if ($ref) $sql.= " WHERE d.ref = '".$this->db->escape($ref)."'";
|
if ($ref) $sql.= " WHERE d.ref = '".$this->db->escape($ref)."'";
|
||||||
else $sql.= " WHERE d.rowid = ".$id;
|
else $sql.= " WHERE d.rowid = ".$id;
|
||||||
//$sql.= $restrict;
|
//$sql.= $restrict;
|
||||||
|
|||||||
@ -166,7 +166,7 @@ class PaymentExpenseReport extends CommonObject
|
|||||||
$sql.= " pt.code as type_code, pt.libelle as type_libelle,";
|
$sql.= " pt.code as type_code, pt.libelle as type_libelle,";
|
||||||
$sql.= ' b.fk_account';
|
$sql.= ' b.fk_account';
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."payment_expensereport as t";
|
$sql.= " FROM ".MAIN_DB_PREFIX."payment_expensereport as t";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pt ON t.fk_typepayment = pt.id AND pt.entity IN (".getEntity('c_paiement').")";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pt ON t.fk_typepayment = pt.id";
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON t.fk_bank = b.rowid';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON t.fk_bank = b.rowid';
|
||||||
$sql.= " WHERE t.rowid = ".$id;
|
$sql.= " WHERE t.rowid = ".$id;
|
||||||
|
|
||||||
|
|||||||
@ -232,8 +232,8 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
$sql.= ', c.fk_incoterms, c.location_incoterms';
|
$sql.= ', c.fk_incoterms, c.location_incoterms';
|
||||||
$sql.= ', i.libelle as libelle_incoterms';
|
$sql.= ', i.libelle as libelle_incoterms';
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as c";
|
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as c";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_payment_term as cr ON c.fk_cond_reglement = cr.rowid AND cr.entity IN (".getEntity('c_payment_term').")";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_payment_term as cr ON c.fk_cond_reglement = cr.rowid";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as p ON c.fk_mode_reglement = p.id AND p.entity IN (".getEntity('c_paiement').")";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as p ON c.fk_mode_reglement = p.id";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_input_method as cm ON cm.rowid = c.fk_input_method";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_input_method as cm ON cm.rowid = c.fk_input_method";
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON c.fk_incoterms = i.rowid';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON c.fk_incoterms = i.rowid';
|
||||||
$sql.= " WHERE c.entity = ".$conf->entity;
|
$sql.= " WHERE c.entity = ".$conf->entity;
|
||||||
|
|||||||
@ -561,8 +561,8 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
$sql.= ' t.fk_multicurrency, t.multicurrency_code, t.multicurrency_tx, t.multicurrency_total_ht, t.multicurrency_total_tva, t.multicurrency_total_ttc';
|
$sql.= ' t.fk_multicurrency, t.multicurrency_code, t.multicurrency_tx, t.multicurrency_total_ht, t.multicurrency_total_tva, t.multicurrency_total_ttc';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as t';
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as t';
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON (t.fk_soc = s.rowid)";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON (t.fk_soc = s.rowid)";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_payment_term as cr ON t.fk_cond_reglement = cr.rowid AND cr.entity IN (".getEntity('c_payment_term').")";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_payment_term as cr ON t.fk_cond_reglement = cr.rowid";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as p ON t.fk_mode_reglement = p.id AND p.entity IN (".getEntity('c_paiement').")";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as p ON t.fk_mode_reglement = p.id";
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON t.fk_incoterms = i.rowid';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON t.fk_incoterms = i.rowid';
|
||||||
if ($id) $sql.= " WHERE t.rowid=".$id;
|
if ($id) $sql.= " WHERE t.rowid=".$id;
|
||||||
if ($ref) $sql.= " WHERE t.ref='".$this->db->escape($ref)."'";
|
if ($ref) $sql.= " WHERE t.ref='".$this->db->escape($ref)."'";
|
||||||
|
|||||||
@ -80,7 +80,7 @@ class PaiementFourn extends Paiement
|
|||||||
$sql.= ' c.code as paiement_code, c.libelle as paiement_type,';
|
$sql.= ' c.code as paiement_code, c.libelle as paiement_type,';
|
||||||
$sql.= ' p.num_paiement, p.note, b.fk_account';
|
$sql.= ' p.num_paiement, p.note, b.fk_account';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiementfourn as p';
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiementfourn as p';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as c ON p.fk_paiement = c.id AND c.entity IN ('.getEntity('c_paiement').')';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as c ON p.fk_paiement = c.id';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid ';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid ';
|
||||||
$sql.= ' WHERE p.entity IN ('.getEntity('facture_fourn').')';
|
$sql.= ' WHERE p.entity IN ('.getEntity('facture_fourn').')';
|
||||||
if ($id > 0)
|
if ($id > 0)
|
||||||
|
|||||||
@ -2433,7 +2433,7 @@ else
|
|||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiementfourn as p';
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiementfourn as p';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as ba ON b.fk_account = ba.rowid';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as ba ON b.fk_account = ba.rowid';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as c ON p.fk_paiement = c.id AND c.entity IN ('.getEntity('c_paiement').')';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as c ON p.fk_paiement = c.id';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf ON pf.fk_paiementfourn = p.rowid';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf ON pf.fk_paiementfourn = p.rowid';
|
||||||
$sql.= ' WHERE pf.fk_facturefourn = '.$object->id;
|
$sql.= ' WHERE pf.fk_facturefourn = '.$object->id;
|
||||||
$sql.= ' ORDER BY p.datep, p.tms';
|
$sql.= ' ORDER BY p.datep, p.tms';
|
||||||
|
|||||||
@ -655,7 +655,7 @@ if ($resql)
|
|||||||
if (! empty($arrayfields['f.fk_mode_reglement']['checked']))
|
if (! empty($arrayfields['f.fk_mode_reglement']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre" align="left">';
|
print '<td class="liste_titre" align="left">';
|
||||||
$form->select_types_paiements($search_paymentmode, 'search_paymentmode', '', 0, 0, 1, 10);
|
$form->select_types_paiements($search_paymentmode, 'search_paymentmode', '', 0, 1, 1, 10);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
if (! empty($arrayfields['f.total_ht']['checked']))
|
if (! empty($arrayfields['f.total_ht']['checked']))
|
||||||
|
|||||||
@ -745,7 +745,7 @@ if (empty($action))
|
|||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiementfourn AS p';
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiementfourn AS p';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn AS pf ON p.rowid=pf.fk_paiementfourn';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn AS pf ON p.rowid=pf.fk_paiementfourn';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'facture_fourn AS f ON f.rowid=pf.fk_facturefourn';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'facture_fourn AS f ON f.rowid=pf.fk_facturefourn';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement AS c ON p.fk_paiement = c.id AND c.entity IN ('.getEntity('c_paiement').')';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement AS c ON p.fk_paiement = c.id';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe AS s ON s.rowid = f.fk_soc';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe AS s ON s.rowid = f.fk_soc';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as ba ON b.fk_account = ba.rowid';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as ba ON b.fk_account = ba.rowid';
|
||||||
|
|||||||
@ -3,7 +3,6 @@ sudo: false
|
|||||||
language: php
|
language: php
|
||||||
|
|
||||||
php:
|
php:
|
||||||
- 5.3
|
|
||||||
- 5.4
|
- 5.4
|
||||||
- 5.5
|
- 5.5
|
||||||
- 5.6
|
- 5.6
|
||||||
|
|||||||
0
htdocs/includes/stripe/build.php
Executable file → Normal file
0
htdocs/includes/stripe/build.php
Executable file → Normal file
File diff suppressed because it is too large
Load Diff
34
htdocs/includes/stripe/lib/ApiOperations/All.php
Normal file
34
htdocs/includes/stripe/lib/ApiOperations/All.php
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Stripe\ApiOperations;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Trait for listable resources. Adds a `all()` static method to the class.
|
||||||
|
*
|
||||||
|
* This trait should only be applied to classes that derive from StripeObject.
|
||||||
|
*/
|
||||||
|
trait All
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param array|null $params
|
||||||
|
* @param array|string|null $opts
|
||||||
|
*
|
||||||
|
* @return \Stripe\Collection of ApiResources
|
||||||
|
*/
|
||||||
|
public static function all($params = null, $opts = null)
|
||||||
|
{
|
||||||
|
self::_validateParams($params);
|
||||||
|
$url = static::classUrl();
|
||||||
|
|
||||||
|
list($response, $opts) = static::_staticRequest('get', $url, $params, $opts);
|
||||||
|
$obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
|
||||||
|
if (!is_a($obj, 'Stripe\\Collection')) {
|
||||||
|
$class = get_class($obj);
|
||||||
|
$message = "Expected type \"Stripe\\Collection\", got \"$class\" instead";
|
||||||
|
throw new Error\Api($message);
|
||||||
|
}
|
||||||
|
$obj->setLastResponse($response);
|
||||||
|
$obj->setRequestParams($params);
|
||||||
|
return $obj;
|
||||||
|
}
|
||||||
|
}
|
||||||
28
htdocs/includes/stripe/lib/ApiOperations/Create.php
Normal file
28
htdocs/includes/stripe/lib/ApiOperations/Create.php
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Stripe\ApiOperations;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Trait for creatable resources. Adds a `create()` static method to the class.
|
||||||
|
*
|
||||||
|
* This trait should only be applied to classes that derive from StripeObject.
|
||||||
|
*/
|
||||||
|
trait Create
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param array|null $params
|
||||||
|
* @param array|string|null $options
|
||||||
|
*
|
||||||
|
* @return \Stripe\ApiResource The created resource.
|
||||||
|
*/
|
||||||
|
public static function create($params = null, $options = null)
|
||||||
|
{
|
||||||
|
self::_validateParams($params);
|
||||||
|
$url = static::classUrl();
|
||||||
|
|
||||||
|
list($response, $opts) = static::_staticRequest('post', $url, $params, $options);
|
||||||
|
$obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
|
||||||
|
$obj->setLastResponse($response);
|
||||||
|
return $obj;
|
||||||
|
}
|
||||||
|
}
|
||||||
27
htdocs/includes/stripe/lib/ApiOperations/Delete.php
Normal file
27
htdocs/includes/stripe/lib/ApiOperations/Delete.php
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Stripe\ApiOperations;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Trait for deletable resources. Adds a `delete()` method to the class.
|
||||||
|
*
|
||||||
|
* This trait should only be applied to classes that derive from StripeObject.
|
||||||
|
*/
|
||||||
|
trait Delete
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param array|null $params
|
||||||
|
* @param array|string|null $opts
|
||||||
|
*
|
||||||
|
* @return \Stripe\ApiResource The deleted resource.
|
||||||
|
*/
|
||||||
|
public function delete($params = null, $opts = null)
|
||||||
|
{
|
||||||
|
self::_validateParams($params);
|
||||||
|
|
||||||
|
$url = $this->instanceUrl();
|
||||||
|
list($response, $opts) = $this->_request('delete', $url, $params, $opts);
|
||||||
|
$this->refreshFrom($response, $opts);
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
||||||
115
htdocs/includes/stripe/lib/ApiOperations/NestedResource.php
Normal file
115
htdocs/includes/stripe/lib/ApiOperations/NestedResource.php
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Stripe\ApiOperations;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Trait for resources that have nested resources.
|
||||||
|
*
|
||||||
|
* This trait should only be applied to classes that derive from StripeObject.
|
||||||
|
*/
|
||||||
|
trait NestedResource
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param string $method
|
||||||
|
* @param string $url
|
||||||
|
* @param array|null $params
|
||||||
|
* @param array|string|null $options
|
||||||
|
*
|
||||||
|
* @return \Stripe\StripeObject
|
||||||
|
*/
|
||||||
|
protected static function _nestedResourceOperation($method, $url, $params = null, $options = null)
|
||||||
|
{
|
||||||
|
self::_validateParams($params);
|
||||||
|
|
||||||
|
list($response, $opts) = static::_staticRequest($method, $url, $params, $options);
|
||||||
|
$obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
|
||||||
|
$obj->setLastResponse($response);
|
||||||
|
return $obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $id
|
||||||
|
* @param string $nestedPath
|
||||||
|
* @param string|null $nestedId
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected static function _nestedResourceUrl($id, $nestedPath, $nestedId = null)
|
||||||
|
{
|
||||||
|
$url = static::resourceUrl($id) . $nestedPath;
|
||||||
|
if ($nestedId !== null) {
|
||||||
|
$url .= "/$nestedId";
|
||||||
|
}
|
||||||
|
return $url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $id
|
||||||
|
* @param string $nestedPath
|
||||||
|
* @param array|null $params
|
||||||
|
* @param array|string|null $options
|
||||||
|
*
|
||||||
|
* @return \Stripe\StripeObject
|
||||||
|
*/
|
||||||
|
protected static function _createNestedResource($id, $nestedPath, $params = null, $options = null)
|
||||||
|
{
|
||||||
|
$url = static::_nestedResourceUrl($id, $nestedPath);
|
||||||
|
return self::_nestedResourceOperation('post', $url, $params, $options);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $id
|
||||||
|
* @param string $nestedPath
|
||||||
|
* @param array|null $params
|
||||||
|
* @param array|string|null $options
|
||||||
|
*
|
||||||
|
* @return \Stripe\StripeObject
|
||||||
|
*/
|
||||||
|
protected static function _retrieveNestedResource($id, $nestedPath, $nestedId, $params = null, $options = null)
|
||||||
|
{
|
||||||
|
$url = static::_nestedResourceUrl($id, $nestedPath, $nestedId);
|
||||||
|
return self::_nestedResourceOperation('get', $url, $params, $options);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $id
|
||||||
|
* @param string $nestedPath
|
||||||
|
* @param array|null $params
|
||||||
|
* @param array|string|null $options
|
||||||
|
*
|
||||||
|
* @return \Stripe\StripeObject
|
||||||
|
*/
|
||||||
|
protected static function _updateNestedResource($id, $nestedPath, $nestedId, $params = null, $options = null)
|
||||||
|
{
|
||||||
|
$url = static::_nestedResourceUrl($id, $nestedPath, $nestedId);
|
||||||
|
return self::_nestedResourceOperation('post', $url, $params, $options);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $id
|
||||||
|
* @param string $nestedPath
|
||||||
|
* @param array|null $params
|
||||||
|
* @param array|string|null $options
|
||||||
|
*
|
||||||
|
* @return \Stripe\StripeObject
|
||||||
|
*/
|
||||||
|
protected static function _deleteNestedResource($id, $nestedPath, $nestedId, $params = null, $options = null)
|
||||||
|
{
|
||||||
|
$url = static::_nestedResourceUrl($id, $nestedPath, $nestedId);
|
||||||
|
return self::_nestedResourceOperation('delete', $url, $params, $options);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $id
|
||||||
|
* @param string $nestedPath
|
||||||
|
* @param array|null $params
|
||||||
|
* @param array|string|null $options
|
||||||
|
*
|
||||||
|
* @return \Stripe\StripeObject
|
||||||
|
*/
|
||||||
|
protected static function _allNestedResources($id, $nestedPath, $params = null, $options = null)
|
||||||
|
{
|
||||||
|
$url = static::_nestedResourceUrl($id, $nestedPath);
|
||||||
|
return self::_nestedResourceOperation('get', $url, $params, $options);
|
||||||
|
}
|
||||||
|
}
|
||||||
60
htdocs/includes/stripe/lib/ApiOperations/Request.php
Normal file
60
htdocs/includes/stripe/lib/ApiOperations/Request.php
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Stripe\ApiOperations;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Trait for resources that need to make API requests.
|
||||||
|
*
|
||||||
|
* This trait should only be applied to classes that derive from StripeObject.
|
||||||
|
*/
|
||||||
|
trait Request
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param array|null|mixed $params The list of parameters to validate
|
||||||
|
*
|
||||||
|
* @throws \Stripe\Error\Api if $params exists and is not an array
|
||||||
|
*/
|
||||||
|
protected static function _validateParams($params = null)
|
||||||
|
{
|
||||||
|
if ($params && !is_array($params)) {
|
||||||
|
$message = "You must pass an array as the first argument to Stripe API "
|
||||||
|
. "method calls. (HINT: an example call to create a charge "
|
||||||
|
. "would be: \"Stripe\\Charge::create(['amount' => 100, "
|
||||||
|
. "'currency' => 'usd', 'source' => 'tok_1234'])\")";
|
||||||
|
throw new \Stripe\Error\Api($message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $method HTTP method ('get', 'post', etc.)
|
||||||
|
* @param string $url URL for the request
|
||||||
|
* @param array $params list of parameters for the request
|
||||||
|
* @param array|string|null $options
|
||||||
|
*
|
||||||
|
* @return array tuple containing (the JSON response, $options)
|
||||||
|
*/
|
||||||
|
protected function _request($method, $url, $params = [], $options = null)
|
||||||
|
{
|
||||||
|
$opts = $this->_opts->merge($options);
|
||||||
|
list($resp, $options) = static::_staticRequest($method, $url, $params, $opts);
|
||||||
|
$this->setLastResponse($resp);
|
||||||
|
return [$resp->json, $options];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $method HTTP method ('get', 'post', etc.)
|
||||||
|
* @param string $url URL for the request
|
||||||
|
* @param array $params list of parameters for the request
|
||||||
|
* @param array|string|null $options
|
||||||
|
*
|
||||||
|
* @return array tuple containing (the JSON response, $options)
|
||||||
|
*/
|
||||||
|
protected static function _staticRequest($method, $url, $params, $options)
|
||||||
|
{
|
||||||
|
$opts = \Stripe\Util\RequestOptions::parse($options);
|
||||||
|
$requestor = new \Stripe\ApiRequestor($opts->apiKey, static::baseUrl());
|
||||||
|
list($response, $opts->apiKey) = $requestor->request($method, $url, $params, $opts->headers);
|
||||||
|
$opts->discardNonPersistentHeaders();
|
||||||
|
return [$response, $opts];
|
||||||
|
}
|
||||||
|
}
|
||||||
27
htdocs/includes/stripe/lib/ApiOperations/Retrieve.php
Normal file
27
htdocs/includes/stripe/lib/ApiOperations/Retrieve.php
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Stripe\ApiOperations;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Trait for retrievable resources. Adds a `retrieve()` static method to the
|
||||||
|
* class.
|
||||||
|
*
|
||||||
|
* This trait should only be applied to classes that derive from StripeObject.
|
||||||
|
*/
|
||||||
|
trait Retrieve
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param array|string $id The ID of the API resource to retrieve,
|
||||||
|
* or an options array containing an `id` key.
|
||||||
|
* @param array|string|null $opts
|
||||||
|
*
|
||||||
|
* @return \Stripe\StripeObject
|
||||||
|
*/
|
||||||
|
public static function retrieve($id, $opts = null)
|
||||||
|
{
|
||||||
|
$opts = \Stripe\Util\RequestOptions::parse($opts);
|
||||||
|
$instance = new static($id, $opts);
|
||||||
|
$instance->refresh();
|
||||||
|
return $instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
46
htdocs/includes/stripe/lib/ApiOperations/Update.php
Normal file
46
htdocs/includes/stripe/lib/ApiOperations/Update.php
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Stripe\ApiOperations;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Trait for updatable resources. Adds an `update()` static method and a
|
||||||
|
* `save()` method to the class.
|
||||||
|
*
|
||||||
|
* This trait should only be applied to classes that derive from StripeObject.
|
||||||
|
*/
|
||||||
|
trait Update
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param string $id The ID of the resource to update.
|
||||||
|
* @param array|null $params
|
||||||
|
* @param array|string|null $opts
|
||||||
|
*
|
||||||
|
* @return \Stripe\ApiResource The updated resource.
|
||||||
|
*/
|
||||||
|
public static function update($id, $params = null, $opts = null)
|
||||||
|
{
|
||||||
|
self::_validateParams($params);
|
||||||
|
$url = static::resourceUrl($id);
|
||||||
|
|
||||||
|
list($response, $opts) = static::_staticRequest('post', $url, $params, $opts);
|
||||||
|
$obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
|
||||||
|
$obj->setLastResponse($response);
|
||||||
|
return $obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array|string|null $opts
|
||||||
|
*
|
||||||
|
* @return \Stripe\ApiResource The saved resource.
|
||||||
|
*/
|
||||||
|
public function save($opts = null)
|
||||||
|
{
|
||||||
|
$params = $this->serializeParameters();
|
||||||
|
if (count($params) > 0) {
|
||||||
|
$url = $this->instanceUrl();
|
||||||
|
list($response, $opts) = $this->_request('post', $url, $params, $opts);
|
||||||
|
$this->refreshFrom($response, $opts);
|
||||||
|
}
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,43 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Stripe;
|
|
||||||
|
|
||||||
use Countable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class AttachedObject
|
|
||||||
*
|
|
||||||
* e.g. metadata on Stripe objects.
|
|
||||||
*
|
|
||||||
* @package Stripe
|
|
||||||
*/
|
|
||||||
class AttachedObject extends StripeObject implements Countable
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Updates this object.
|
|
||||||
*
|
|
||||||
* @param array $properties A mapping of properties to update on this object.
|
|
||||||
*/
|
|
||||||
public function replaceWith($properties)
|
|
||||||
{
|
|
||||||
$removed = array_diff(array_keys($this->_values), array_keys($properties));
|
|
||||||
// Don't unset, but rather set to null so we send up '' for deletion.
|
|
||||||
foreach ($removed as $k) {
|
|
||||||
$this->$k = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($properties as $k => $v) {
|
|
||||||
$this->$k = $v;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Counts the number of elements in the AttachedObject instance.
|
|
||||||
*
|
|
||||||
* @return int the number of elements
|
|
||||||
*/
|
|
||||||
public function count()
|
|
||||||
{
|
|
||||||
return count($this->_values);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -20,11 +20,20 @@ abstract class Base extends Exception
|
|||||||
$this->httpHeaders = $httpHeaders;
|
$this->httpHeaders = $httpHeaders;
|
||||||
$this->requestId = null;
|
$this->requestId = null;
|
||||||
|
|
||||||
|
// TODO: make this a proper constructor argument in the next major
|
||||||
|
// release.
|
||||||
|
$this->stripeCode = isset($jsonBody["error"]["code"]) ? $jsonBody["error"]["code"] : null;
|
||||||
|
|
||||||
if ($httpHeaders && isset($httpHeaders['Request-Id'])) {
|
if ($httpHeaders && isset($httpHeaders['Request-Id'])) {
|
||||||
$this->requestId = $httpHeaders['Request-Id'];
|
$this->requestId = $httpHeaders['Request-Id'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getStripeCode()
|
||||||
|
{
|
||||||
|
return $this->stripeCode;
|
||||||
|
}
|
||||||
|
|
||||||
public function getHttpStatus()
|
public function getHttpStatus()
|
||||||
{
|
{
|
||||||
return $this->httpStatus;
|
return $this->httpStatus;
|
||||||
|
|||||||
@ -15,12 +15,16 @@ class Card extends Base
|
|||||||
) {
|
) {
|
||||||
parent::__construct($message, $httpStatus, $httpBody, $jsonBody, $httpHeaders);
|
parent::__construct($message, $httpStatus, $httpBody, $jsonBody, $httpHeaders);
|
||||||
$this->stripeParam = $stripeParam;
|
$this->stripeParam = $stripeParam;
|
||||||
|
|
||||||
|
// TODO: once Error\Base accepts the error code as an argument, pass it
|
||||||
|
// in the call to parent::__construct() and stop setting it here.
|
||||||
$this->stripeCode = $stripeCode;
|
$this->stripeCode = $stripeCode;
|
||||||
|
|
||||||
// This one is not like the others because it was added later and we're
|
// This one is not like the others because it was added later and we're
|
||||||
// trying to do our best not to change the public interface of this class'
|
// trying to do our best not to change the public interface of this class'
|
||||||
// constructor. We should consider changing its implementation on the
|
// constructor.
|
||||||
// next major version bump of this library.
|
// TODO: make this a proper constructor argument in the next major
|
||||||
|
// release.
|
||||||
$this->declineCode = isset($jsonBody["error"]["decline_code"]) ? $jsonBody["error"]["decline_code"] : null;
|
$this->declineCode = isset($jsonBody["error"]["decline_code"]) ? $jsonBody["error"]["decline_code"] : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -29,11 +33,6 @@ class Card extends Base
|
|||||||
return $this->declineCode;
|
return $this->declineCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getStripeCode()
|
|
||||||
{
|
|
||||||
return $this->stripeCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getStripeParam()
|
public function getStripeParam()
|
||||||
{
|
{
|
||||||
return $this->stripeParam;
|
return $this->stripeParam;
|
||||||
|
|||||||
7
htdocs/includes/stripe/lib/Error/Idempotency.php
Normal file
7
htdocs/includes/stripe/lib/Error/Idempotency.php
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Stripe\Error;
|
||||||
|
|
||||||
|
class Idempotency extends Base
|
||||||
|
{
|
||||||
|
}
|
||||||
10
htdocs/includes/stripe/lib/Error/OAuth/InvalidClient.php
Normal file
10
htdocs/includes/stripe/lib/Error/OAuth/InvalidClient.php
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Stripe\Error\OAuth;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* InvalidClient is raised when authentication fails.
|
||||||
|
*/
|
||||||
|
class InvalidClient extends OAuthBase
|
||||||
|
{
|
||||||
|
}
|
||||||
13
htdocs/includes/stripe/lib/Error/OAuth/InvalidGrant.php
Normal file
13
htdocs/includes/stripe/lib/Error/OAuth/InvalidGrant.php
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Stripe\Error\OAuth;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* InvalidGrant is raised when a specified code doesn't exist, is
|
||||||
|
* expired, has been used, or doesn't belong to you; a refresh token doesn't
|
||||||
|
* exist, or doesn't belong to you; or if an API key's mode (live or test)
|
||||||
|
* doesn't match the mode of a code or refresh token.
|
||||||
|
*/
|
||||||
|
class InvalidGrant extends OAuthBase
|
||||||
|
{
|
||||||
|
}
|
||||||
11
htdocs/includes/stripe/lib/Error/OAuth/InvalidRequest.php
Normal file
11
htdocs/includes/stripe/lib/Error/OAuth/InvalidRequest.php
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Stripe\Error\OAuth;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* InvalidRequest is raised when a code, refresh token, or grant type
|
||||||
|
* parameter is not provided, but was required.
|
||||||
|
*/
|
||||||
|
class InvalidRequest extends OAuthBase
|
||||||
|
{
|
||||||
|
}
|
||||||
10
htdocs/includes/stripe/lib/Error/OAuth/InvalidScope.php
Normal file
10
htdocs/includes/stripe/lib/Error/OAuth/InvalidScope.php
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Stripe\Error\OAuth;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* InvalidScope is raised when an invalid scope parameter is provided.
|
||||||
|
*/
|
||||||
|
class InvalidScope extends OAuthBase
|
||||||
|
{
|
||||||
|
}
|
||||||
23
htdocs/includes/stripe/lib/Error/OAuth/OAuthBase.php
Normal file
23
htdocs/includes/stripe/lib/Error/OAuth/OAuthBase.php
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Stripe\Error\OAuth;
|
||||||
|
|
||||||
|
class OAuthBase extends \Stripe\Error\Base
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
$code,
|
||||||
|
$description,
|
||||||
|
$httpStatus = null,
|
||||||
|
$httpBody = null,
|
||||||
|
$jsonBody = null,
|
||||||
|
$httpHeaders = null
|
||||||
|
) {
|
||||||
|
parent::__construct($description, $httpStatus, $httpBody, $jsonBody, $httpHeaders);
|
||||||
|
$this->code = $code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getErrorCode()
|
||||||
|
{
|
||||||
|
return $this->code;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Stripe\Error\OAuth;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* UnsupportedGrantType is raised when an unuspported grant type
|
||||||
|
* parameter is specified.
|
||||||
|
*/
|
||||||
|
class UnsupportedGrantType extends OAuthBase
|
||||||
|
{
|
||||||
|
}
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Stripe\Error\OAuth;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* UnsupportedResponseType is raised when an unsupported response type
|
||||||
|
* parameter is specified.
|
||||||
|
*/
|
||||||
|
class UnsupportedResponseType extends OAuthBase
|
||||||
|
{
|
||||||
|
}
|
||||||
20
htdocs/includes/stripe/lib/Error/SignatureVerification.php
Normal file
20
htdocs/includes/stripe/lib/Error/SignatureVerification.php
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Stripe\Error;
|
||||||
|
|
||||||
|
class SignatureVerification extends Base
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
$message,
|
||||||
|
$sigHeader,
|
||||||
|
$httpBody = null
|
||||||
|
) {
|
||||||
|
parent::__construct($message, null, $httpBody, null, null);
|
||||||
|
$this->sigHeader = $sigHeader;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSigHeader()
|
||||||
|
{
|
||||||
|
return $this->sigHeader;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,92 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Stripe;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class ExternalAccount
|
|
||||||
*
|
|
||||||
* @property string $id
|
|
||||||
* @property string $object
|
|
||||||
*
|
|
||||||
* @package Stripe
|
|
||||||
*/
|
|
||||||
abstract class ExternalAccount extends ApiResource
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @return string The instance URL for this resource. It needs to be special
|
|
||||||
* cased because it doesn't fit into the standard resource pattern.
|
|
||||||
*/
|
|
||||||
public function instanceUrl()
|
|
||||||
{
|
|
||||||
$id = $this['id'];
|
|
||||||
if (!$id) {
|
|
||||||
$class = get_class($this);
|
|
||||||
$msg = "Could not determine which URL to request: $class instance "
|
|
||||||
. "has invalid ID: $id";
|
|
||||||
throw new Error\InvalidRequest($msg, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this['customer']) {
|
|
||||||
$parent = $this['customer'];
|
|
||||||
$base = Customer::classUrl();
|
|
||||||
$path = 'sources';
|
|
||||||
} elseif ($this['account']) {
|
|
||||||
$parent = $this['account'];
|
|
||||||
$base = Account::classUrl();
|
|
||||||
$path = 'external_accounts';
|
|
||||||
} elseif ($this['recipient']) {
|
|
||||||
$parent = $this['recipient'];
|
|
||||||
$base = Recipient::classUrl();
|
|
||||||
$path = 'cards';
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
$parent = Util\Util::utf8($parent);
|
|
||||||
$id = Util\Util::utf8($id);
|
|
||||||
|
|
||||||
$parentExtn = urlencode($parent);
|
|
||||||
$extn = urlencode($id);
|
|
||||||
return "$base/$parentExtn/$path/$extn";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param array|null $params
|
|
||||||
* @param array|string|null $opts
|
|
||||||
*
|
|
||||||
* @return ExternalAccount The deleted external account.
|
|
||||||
*/
|
|
||||||
public function delete($params = null, $opts = null)
|
|
||||||
{
|
|
||||||
return $this->_delete($params, $opts);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param array|string|null $opts
|
|
||||||
*
|
|
||||||
* @return ExternalAccount The saved external account.
|
|
||||||
*/
|
|
||||||
public function save($opts = null)
|
|
||||||
{
|
|
||||||
return $this->_save($opts);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param array|null $params
|
|
||||||
* @param array|string|null $opts
|
|
||||||
*
|
|
||||||
* @return ExternalAccount The verified (or not) external account.
|
|
||||||
*/
|
|
||||||
public function verify($params = null, $opts = null)
|
|
||||||
{
|
|
||||||
if ($this['customer']) {
|
|
||||||
$url = $this->instanceUrl() . '/verify';
|
|
||||||
list($response, $options) = $this->_request('post', $url, $params, $opts);
|
|
||||||
$this->refreshFrom($response, $options);
|
|
||||||
return $this;
|
|
||||||
} else {
|
|
||||||
$message = 'Only customer external accounts can be verified in this manner.';
|
|
||||||
throw new Error\Api($message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -11,8 +11,8 @@ interface ClientInterface
|
|||||||
* @param array $params KV pairs for parameters. Can be nested for arrays and hashes
|
* @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
|
* @param boolean $hasFile Whether or not $params references a file (via an @ prefix or
|
||||||
* CurlFile)
|
* CurlFile)
|
||||||
* @throws Error\Api & Error\ApiConnection
|
* @throws \Stripe\Error\Api & \Stripe\Error\ApiConnection
|
||||||
* @return array($rawBody, $httpStatusCode, $httpHeader)
|
* @return [$rawBody, $httpStatusCode, $httpHeader]
|
||||||
*/
|
*/
|
||||||
public function request($method, $absUrl, $headers, $params, $hasFile);
|
public function request($method, $absUrl, $headers, $params, $hasFile);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,6 +36,8 @@ class CurlClient implements ClientInterface
|
|||||||
|
|
||||||
protected $defaultOptions;
|
protected $defaultOptions;
|
||||||
|
|
||||||
|
protected $userAgentInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CurlClient constructor.
|
* CurlClient constructor.
|
||||||
*
|
*
|
||||||
@ -49,9 +51,20 @@ class CurlClient implements ClientInterface
|
|||||||
*
|
*
|
||||||
* @param array|callable|null $defaultOptions
|
* @param array|callable|null $defaultOptions
|
||||||
*/
|
*/
|
||||||
public function __construct($defaultOptions = null)
|
public function __construct($defaultOptions = null, $randomGenerator = null)
|
||||||
{
|
{
|
||||||
$this->defaultOptions = $defaultOptions;
|
$this->defaultOptions = $defaultOptions;
|
||||||
|
$this->randomGenerator = $randomGenerator ?: new Util\RandomGenerator();
|
||||||
|
$this->initUserAgentInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function initUserAgentInfo()
|
||||||
|
{
|
||||||
|
$curlVersion = curl_version();
|
||||||
|
$this->userAgentInfo = [
|
||||||
|
'httplib' => 'curl ' . $curlVersion['version'],
|
||||||
|
'ssllib' => $curlVersion['ssl_version'],
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDefaultOptions()
|
public function getDefaultOptions()
|
||||||
@ -59,6 +72,11 @@ class CurlClient implements ClientInterface
|
|||||||
return $this->defaultOptions;
|
return $this->defaultOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getUserAgentInfo()
|
||||||
|
{
|
||||||
|
return $this->userAgentInfo;
|
||||||
|
}
|
||||||
|
|
||||||
// USER DEFINED TIMEOUTS
|
// USER DEFINED TIMEOUTS
|
||||||
|
|
||||||
const DEFAULT_TIMEOUT = 80;
|
const DEFAULT_TIMEOUT = 80;
|
||||||
@ -93,10 +111,9 @@ class CurlClient implements ClientInterface
|
|||||||
|
|
||||||
public function request($method, $absUrl, $headers, $params, $hasFile)
|
public function request($method, $absUrl, $headers, $params, $hasFile)
|
||||||
{
|
{
|
||||||
$curl = curl_init();
|
|
||||||
$method = strtolower($method);
|
$method = strtolower($method);
|
||||||
|
|
||||||
$opts = array();
|
$opts = [];
|
||||||
if (is_callable($this->defaultOptions)) { // call defaultOptions callback, set options to return value
|
if (is_callable($this->defaultOptions)) { // call defaultOptions callback, set options to return value
|
||||||
$opts = call_user_func_array($this->defaultOptions, func_get_args());
|
$opts = call_user_func_array($this->defaultOptions, func_get_args());
|
||||||
if (!is_array($opts)) {
|
if (!is_array($opts)) {
|
||||||
@ -114,24 +131,32 @@ class CurlClient implements ClientInterface
|
|||||||
}
|
}
|
||||||
$opts[CURLOPT_HTTPGET] = 1;
|
$opts[CURLOPT_HTTPGET] = 1;
|
||||||
if (count($params) > 0) {
|
if (count($params) > 0) {
|
||||||
$encoded = self::encode($params);
|
$encoded = Util\Util::urlEncode($params);
|
||||||
$absUrl = "$absUrl?$encoded";
|
$absUrl = "$absUrl?$encoded";
|
||||||
}
|
}
|
||||||
} elseif ($method == 'post') {
|
} elseif ($method == 'post') {
|
||||||
$opts[CURLOPT_POST] = 1;
|
$opts[CURLOPT_POST] = 1;
|
||||||
$opts[CURLOPT_POSTFIELDS] = $hasFile ? $params : self::encode($params);
|
$opts[CURLOPT_POSTFIELDS] = $hasFile ? $params : Util\Util::urlEncode($params);
|
||||||
} elseif ($method == 'delete') {
|
} elseif ($method == 'delete') {
|
||||||
$opts[CURLOPT_CUSTOMREQUEST] = 'DELETE';
|
$opts[CURLOPT_CUSTOMREQUEST] = 'DELETE';
|
||||||
if (count($params) > 0) {
|
if (count($params) > 0) {
|
||||||
$encoded = self::encode($params);
|
$encoded = Util\Util::urlEncode($params);
|
||||||
$absUrl = "$absUrl?$encoded";
|
$absUrl = "$absUrl?$encoded";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new Error\Api("Unrecognized method $method");
|
throw new Error\Api("Unrecognized method $method");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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'])) {
|
||||||
|
array_push($headers, 'Idempotency-Key: ' . $this->randomGenerator->uuid());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Create a callback to capture HTTP headers for the response
|
// Create a callback to capture HTTP headers for the response
|
||||||
$rheaders = array();
|
$rheaders = [];
|
||||||
$headerCallback = function ($curl, $header_line) use (&$rheaders) {
|
$headerCallback = function ($curl, $header_line) use (&$rheaders) {
|
||||||
// Ignore the HTTP request line (HTTP/1.1 200 OK)
|
// Ignore the HTTP request line (HTTP/1.1 200 OK)
|
||||||
if (strpos($header_line, ":") === false) {
|
if (strpos($header_line, ":") === false) {
|
||||||
@ -163,50 +188,63 @@ class CurlClient implements ClientInterface
|
|||||||
$opts[CURLOPT_TIMEOUT] = $this->timeout;
|
$opts[CURLOPT_TIMEOUT] = $this->timeout;
|
||||||
$opts[CURLOPT_HEADERFUNCTION] = $headerCallback;
|
$opts[CURLOPT_HEADERFUNCTION] = $headerCallback;
|
||||||
$opts[CURLOPT_HTTPHEADER] = $headers;
|
$opts[CURLOPT_HTTPHEADER] = $headers;
|
||||||
if (!Stripe::$verifySslCerts) {
|
$opts[CURLOPT_CAINFO] = Stripe::getCABundlePath();
|
||||||
|
if (!Stripe::getVerifySslCerts()) {
|
||||||
$opts[CURLOPT_SSL_VERIFYPEER] = false;
|
$opts[CURLOPT_SSL_VERIFYPEER] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
curl_setopt_array($curl, $opts);
|
list($rbody, $rcode) = $this->executeRequestWithRetries($opts, $absUrl);
|
||||||
$rbody = curl_exec($curl);
|
|
||||||
|
|
||||||
if (!defined('CURLE_SSL_CACERT_BADFILE')) {
|
return [$rbody, $rcode, $rheaders];
|
||||||
define('CURLE_SSL_CACERT_BADFILE', 77); // constant not defined in PHP
|
|
||||||
}
|
|
||||||
|
|
||||||
$errno = curl_errno($curl);
|
|
||||||
if ($errno == CURLE_SSL_CACERT ||
|
|
||||||
$errno == CURLE_SSL_PEER_CERTIFICATE ||
|
|
||||||
$errno == CURLE_SSL_CACERT_BADFILE
|
|
||||||
) {
|
|
||||||
array_push(
|
|
||||||
$headers,
|
|
||||||
'X-Stripe-Client-Info: {"ca":"using Stripe-supplied CA bundle"}'
|
|
||||||
);
|
|
||||||
$cert = self::caBundle();
|
|
||||||
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
|
|
||||||
curl_setopt($curl, CURLOPT_CAINFO, $cert);
|
|
||||||
$rbody = curl_exec($curl);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($rbody === false) {
|
|
||||||
$errno = curl_errno($curl);
|
|
||||||
$message = curl_error($curl);
|
|
||||||
curl_close($curl);
|
|
||||||
$this->handleCurlError($absUrl, $errno, $message);
|
|
||||||
}
|
|
||||||
|
|
||||||
$rcode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
|
|
||||||
curl_close($curl);
|
|
||||||
return array($rbody, $rcode, $rheaders);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param number $errno
|
* @param array $opts cURL options
|
||||||
|
*/
|
||||||
|
private function executeRequestWithRetries($opts, $absUrl)
|
||||||
|
{
|
||||||
|
$numRetries = 0;
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
$rcode = 0;
|
||||||
|
$errno = 0;
|
||||||
|
|
||||||
|
$curl = curl_init();
|
||||||
|
curl_setopt_array($curl, $opts);
|
||||||
|
$rbody = curl_exec($curl);
|
||||||
|
|
||||||
|
if ($rbody === false) {
|
||||||
|
$errno = curl_errno($curl);
|
||||||
|
$message = curl_error($curl);
|
||||||
|
} else {
|
||||||
|
$rcode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
|
||||||
|
}
|
||||||
|
curl_close($curl);
|
||||||
|
|
||||||
|
if ($this->shouldRetry($errno, $rcode, $numRetries)) {
|
||||||
|
$numRetries += 1;
|
||||||
|
$sleepSeconds = $this->sleepTime($numRetries);
|
||||||
|
usleep(intval($sleepSeconds * 1000000));
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($rbody === false) {
|
||||||
|
$this->handleCurlError($absUrl, $errno, $message, $numRetries);
|
||||||
|
}
|
||||||
|
|
||||||
|
return [$rbody, $rcode];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $url
|
||||||
|
* @param int $errno
|
||||||
* @param string $message
|
* @param string $message
|
||||||
|
* @param int $numRetries
|
||||||
* @throws Error\ApiConnection
|
* @throws Error\ApiConnection
|
||||||
*/
|
*/
|
||||||
private function handleCurlError($url, $errno, $message)
|
private function handleCurlError($url, $errno, $message, $numRetries)
|
||||||
{
|
{
|
||||||
switch ($errno) {
|
switch ($errno) {
|
||||||
case CURLE_COULDNT_CONNECT:
|
case CURLE_COULDNT_CONNECT:
|
||||||
@ -231,52 +269,66 @@ class CurlClient implements ClientInterface
|
|||||||
$msg .= " let us know at support@stripe.com.";
|
$msg .= " let us know at support@stripe.com.";
|
||||||
|
|
||||||
$msg .= "\n\n(Network error [errno $errno]: $message)";
|
$msg .= "\n\n(Network error [errno $errno]: $message)";
|
||||||
|
|
||||||
|
if ($numRetries > 0) {
|
||||||
|
$msg .= "\n\nRequest was retried $numRetries times.";
|
||||||
|
}
|
||||||
|
|
||||||
throw new Error\ApiConnection($msg);
|
throw new Error\ApiConnection($msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function caBundle()
|
/**
|
||||||
|
* Checks if an error is a problem that we should retry on. This includes both
|
||||||
|
* socket errors that may represent an intermittent problem and some special
|
||||||
|
* HTTP statuses.
|
||||||
|
* @param int $errno
|
||||||
|
* @param int $rcode
|
||||||
|
* @param int $numRetries
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
private function shouldRetry($errno, $rcode, $numRetries)
|
||||||
{
|
{
|
||||||
return dirname(__FILE__) . '/../../data/ca-certificates.crt';
|
if ($numRetries >= Stripe::getMaxNetworkRetries()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Retry on timeout-related problems (either on open or read).
|
||||||
|
if ($errno === CURLE_OPERATION_TIMEOUTED) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Destination refused the connection, the connection was reset, or a
|
||||||
|
// variety of other connection failures. This could occur from a single
|
||||||
|
// saturated server, so retry in case it's intermittent.
|
||||||
|
if ($errno === CURLE_COULDNT_CONNECT) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 409 conflict
|
||||||
|
if ($rcode === 409) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private function sleepTime($numRetries)
|
||||||
* @param array $arr An map of param keys to values.
|
|
||||||
* @param string|null $prefix
|
|
||||||
*
|
|
||||||
* Only public for testability, should not be called outside of CurlClient
|
|
||||||
*
|
|
||||||
* @return string A querystring, essentially.
|
|
||||||
*/
|
|
||||||
public static function encode($arr, $prefix = null)
|
|
||||||
{
|
{
|
||||||
if (!is_array($arr)) {
|
// Apply exponential backoff with $initialNetworkRetryDelay on the
|
||||||
return $arr;
|
// number of $numRetries so far as inputs. Do not allow the number to exceed
|
||||||
}
|
// $maxNetworkRetryDelay.
|
||||||
|
$sleepSeconds = min(
|
||||||
|
Stripe::getInitialNetworkRetryDelay() * 1.0 * pow(2, $numRetries - 1),
|
||||||
|
Stripe::getMaxNetworkRetryDelay()
|
||||||
|
);
|
||||||
|
|
||||||
$r = array();
|
// Apply some jitter by randomizing the value in the range of
|
||||||
foreach ($arr as $k => $v) {
|
// ($sleepSeconds / 2) to ($sleepSeconds).
|
||||||
if (is_null($v)) {
|
$sleepSeconds *= 0.5 * (1 + $this->randomGenerator->randFloat());
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($prefix) {
|
// But never sleep less than the base sleep seconds.
|
||||||
if ($k !== null && (!is_int($k) || is_array($v))) {
|
$sleepSeconds = max(Stripe::getInitialNetworkRetryDelay(), $sleepSeconds);
|
||||||
$k = $prefix."[".$k."]";
|
|
||||||
} else {
|
|
||||||
$k = $prefix."[]";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_array($v)) {
|
return $sleepSeconds;
|
||||||
$enc = self::encode($v, $k);
|
|
||||||
if ($enc) {
|
|
||||||
$r[] = $enc;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$r[] = urlencode($k)."=".urlencode($v);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return implode("&", $r);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,18 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Stripe;
|
|
||||||
|
|
||||||
// JsonSerializable only exists in PHP 5.4+. Stub if out if it doesn't exist
|
|
||||||
if (interface_exists('\JsonSerializable', false)) {
|
|
||||||
interface JsonSerializable extends \JsonSerializable
|
|
||||||
{
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// PSR2 wants each interface to have its own file.
|
|
||||||
// @codingStandardsIgnoreStart
|
|
||||||
interface JsonSerializable
|
|
||||||
{
|
|
||||||
// @codingStandardsIgnoreEnd
|
|
||||||
public function jsonSerialize();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -7,7 +7,7 @@ class AutoPagingIterator implements \Iterator
|
|||||||
private $lastId = null;
|
private $lastId = null;
|
||||||
private $page = null;
|
private $page = null;
|
||||||
private $pageOffset = 0;
|
private $pageOffset = 0;
|
||||||
private $params = array();
|
private $params = [];
|
||||||
|
|
||||||
public function __construct($collection, $params)
|
public function __construct($collection, $params)
|
||||||
{
|
{
|
||||||
@ -42,8 +42,8 @@ class AutoPagingIterator implements \Iterator
|
|||||||
$this->pageOffset += count($this->page->data);
|
$this->pageOffset += count($this->page->data);
|
||||||
if ($this->page['has_more']) {
|
if ($this->page['has_more']) {
|
||||||
$this->params = array_merge(
|
$this->params = array_merge(
|
||||||
$this->params ? $this->params : array(),
|
$this->params ?: [],
|
||||||
array('starting_after' => $this->lastId)
|
['starting_after' => $this->lastId]
|
||||||
);
|
);
|
||||||
$this->page = $this->page->all($this->params);
|
$this->page = $this->page->all($this->params);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
18
htdocs/includes/stripe/lib/Util/DefaultLogger.php
Normal file
18
htdocs/includes/stripe/lib/Util/DefaultLogger.php
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Stripe\Util;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A very basic implementation of LoggerInterface that has just enough
|
||||||
|
* functionality that it can be the default for this library.
|
||||||
|
*/
|
||||||
|
class DefaultLogger implements LoggerInterface
|
||||||
|
{
|
||||||
|
public function error($message, array $context = [])
|
||||||
|
{
|
||||||
|
if (count($context) > 0) {
|
||||||
|
throw new \Exception('DefaultLogger does not currently implement context. Please implement if you need it.');
|
||||||
|
}
|
||||||
|
error_log($message);
|
||||||
|
}
|
||||||
|
}
|
||||||
36
htdocs/includes/stripe/lib/Util/LoggerInterface.php
Normal file
36
htdocs/includes/stripe/lib/Util/LoggerInterface.php
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Stripe\Util;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Describes a logger instance.
|
||||||
|
*
|
||||||
|
* This is a subset of the interface of the same name in the PSR-3 logger
|
||||||
|
* interface. We guarantee to keep it compatible, but we'd redefined it here so
|
||||||
|
* that we don't have to pull in the extra dependencies for users who don't want
|
||||||
|
* it.
|
||||||
|
*
|
||||||
|
* See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md
|
||||||
|
* for the full interface specification.
|
||||||
|
*
|
||||||
|
* The message MUST be a string or object implementing __toString().
|
||||||
|
*
|
||||||
|
* The message MAY contain placeholders in the form: {foo} where foo
|
||||||
|
* will be replaced by the context data in key "foo".
|
||||||
|
*
|
||||||
|
* The context array can contain arbitrary data, the only assumption that
|
||||||
|
* can be made by implementors is that if an Exception instance is given
|
||||||
|
* to produce a stack trace, it MUST be in a key named "exception".
|
||||||
|
*/
|
||||||
|
interface LoggerInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Runtime errors that do not require immediate action but should typically
|
||||||
|
* be logged and monitored.
|
||||||
|
*
|
||||||
|
* @param string $message
|
||||||
|
* @param array $context
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
|
public function error($message, array $context = []);
|
||||||
|
}
|
||||||
34
htdocs/includes/stripe/lib/Util/RandomGenerator.php
Normal file
34
htdocs/includes/stripe/lib/Util/RandomGenerator.php
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Stripe\Util;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A basic random generator. This is in a separate class so we the generator
|
||||||
|
* can be injected as a dependency and replaced with a mock in tests.
|
||||||
|
*/
|
||||||
|
class RandomGenerator
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Returns a random value between 0 and $max.
|
||||||
|
*
|
||||||
|
* @param float $max (optional)
|
||||||
|
* @return float
|
||||||
|
*/
|
||||||
|
public function randFloat($max = 1.0)
|
||||||
|
{
|
||||||
|
return mt_rand() / mt_getrandmax() * $max;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a v4 UUID.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function uuid()
|
||||||
|
{
|
||||||
|
$arr = array_values(unpack('N1a/n4b/N1c', openssl_random_pseudo_bytes(16)));
|
||||||
|
$arr[2] = ($arr[2] & 0x0fff) | 0x4000;
|
||||||
|
$arr[3] = ($arr[3] & 0x3fff) | 0x8000;
|
||||||
|
return vsprintf('%08x-%04x-%04x-%04x-%04x%08x', $arr);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -6,10 +6,18 @@ use Stripe\Error;
|
|||||||
|
|
||||||
class RequestOptions
|
class RequestOptions
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @var array A list of headers that should be persisted across requests.
|
||||||
|
*/
|
||||||
|
public static $HEADERS_TO_PERSIST = [
|
||||||
|
'Stripe-Account',
|
||||||
|
'Stripe-Version',
|
||||||
|
];
|
||||||
|
|
||||||
public $headers;
|
public $headers;
|
||||||
public $apiKey;
|
public $apiKey;
|
||||||
|
|
||||||
public function __construct($key = null, $headers = array())
|
public function __construct($key = null, $headers = [])
|
||||||
{
|
{
|
||||||
$this->apiKey = $key;
|
$this->apiKey = $key;
|
||||||
$this->headers = $headers;
|
$this->headers = $headers;
|
||||||
@ -32,6 +40,18 @@ class RequestOptions
|
|||||||
return $other_options;
|
return $other_options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Discards all headers that we don't want to persist across requests.
|
||||||
|
*/
|
||||||
|
public function discardNonPersistentHeaders()
|
||||||
|
{
|
||||||
|
foreach ($this->headers as $k => $v) {
|
||||||
|
if (!in_array($k, self::$HEADERS_TO_PERSIST)) {
|
||||||
|
unset($this->headers[$k]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unpacks an options array into an RequestOptions object
|
* Unpacks an options array into an RequestOptions object
|
||||||
* @param array|string|null $options a key => value array
|
* @param array|string|null $options a key => value array
|
||||||
@ -45,15 +65,15 @@ class RequestOptions
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (is_null($options)) {
|
if (is_null($options)) {
|
||||||
return new RequestOptions(null, array());
|
return new RequestOptions(null, []);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_string($options)) {
|
if (is_string($options)) {
|
||||||
return new RequestOptions($options, array());
|
return new RequestOptions($options, []);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_array($options)) {
|
if (is_array($options)) {
|
||||||
$headers = array();
|
$headers = [];
|
||||||
$key = null;
|
$key = null;
|
||||||
if (array_key_exists('api_key', $options)) {
|
if (array_key_exists('api_key', $options)) {
|
||||||
$key = $options['api_key'];
|
$key = $options['api_key'];
|
||||||
|
|||||||
@ -9,9 +9,9 @@ class Set implements IteratorAggregate
|
|||||||
{
|
{
|
||||||
private $_elts;
|
private $_elts;
|
||||||
|
|
||||||
public function __construct($members = array())
|
public function __construct($members = [])
|
||||||
{
|
{
|
||||||
$this->_elts = array();
|
$this->_elts = [];
|
||||||
foreach ($members as $item) {
|
foreach ($members as $item) {
|
||||||
$this->_elts[$item] = true;
|
$this->_elts[$item] = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,24 +7,26 @@ use Stripe\StripeObject;
|
|||||||
abstract class Util
|
abstract class Util
|
||||||
{
|
{
|
||||||
private static $isMbstringAvailable = null;
|
private static $isMbstringAvailable = null;
|
||||||
|
private static $isHashEqualsAvailable = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether the provided array (or other) is a list rather than a dictionary.
|
* Whether the provided array (or other) is a list rather than a dictionary.
|
||||||
|
* A list is defined as an array for which all the keys are consecutive
|
||||||
|
* integers starting at 0. Empty arrays are considered to be lists.
|
||||||
*
|
*
|
||||||
* @param array|mixed $array
|
* @param array|mixed $array
|
||||||
* @return boolean True if the given object is a list.
|
* @return boolean true if the given object is a list.
|
||||||
*/
|
*/
|
||||||
public static function isList($array)
|
public static function isList($array)
|
||||||
{
|
{
|
||||||
if (!is_array($array)) {
|
if (!is_array($array)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if ($array === []) {
|
||||||
// TODO: generally incorrect, but it's correct given Stripe's response
|
return true;
|
||||||
foreach (array_keys($array) as $k) {
|
}
|
||||||
if (!is_numeric($k)) {
|
if (array_keys($array) !== range(0, count($array) - 1)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -37,7 +39,7 @@ abstract class Util
|
|||||||
*/
|
*/
|
||||||
public static function convertStripeObjectToArray($values)
|
public static function convertStripeObjectToArray($values)
|
||||||
{
|
{
|
||||||
$results = array();
|
$results = [];
|
||||||
foreach ($values as $k => $v) {
|
foreach ($values as $k => $v) {
|
||||||
// FIXME: this is an encapsulation violation
|
// FIXME: this is an encapsulation violation
|
||||||
if ($k[0] == '_') {
|
if ($k[0] == '_') {
|
||||||
@ -63,26 +65,34 @@ abstract class Util
|
|||||||
*/
|
*/
|
||||||
public static function convertToStripeObject($resp, $opts)
|
public static function convertToStripeObject($resp, $opts)
|
||||||
{
|
{
|
||||||
$types = array(
|
$types = [
|
||||||
|
// data structures
|
||||||
|
'list' => 'Stripe\\Collection',
|
||||||
|
|
||||||
|
// business objects
|
||||||
'account' => 'Stripe\\Account',
|
'account' => 'Stripe\\Account',
|
||||||
'alipay_account' => 'Stripe\\AlipayAccount',
|
'alipay_account' => 'Stripe\\AlipayAccount',
|
||||||
'apple_pay_domain' => 'Stripe\\ApplePayDomain',
|
'apple_pay_domain' => 'Stripe\\ApplePayDomain',
|
||||||
'bank_account' => 'Stripe\\BankAccount',
|
'application_fee' => 'Stripe\\ApplicationFee',
|
||||||
|
'balance' => 'Stripe\\Balance',
|
||||||
'balance_transaction' => 'Stripe\\BalanceTransaction',
|
'balance_transaction' => 'Stripe\\BalanceTransaction',
|
||||||
|
'bank_account' => 'Stripe\\BankAccount',
|
||||||
|
'bitcoin_receiver' => 'Stripe\\BitcoinReceiver',
|
||||||
|
'bitcoin_transaction' => 'Stripe\\BitcoinTransaction',
|
||||||
'card' => 'Stripe\\Card',
|
'card' => 'Stripe\\Card',
|
||||||
'charge' => 'Stripe\\Charge',
|
'charge' => 'Stripe\\Charge',
|
||||||
'country_spec' => 'Stripe\\CountrySpec',
|
'country_spec' => 'Stripe\\CountrySpec',
|
||||||
'coupon' => 'Stripe\\Coupon',
|
'coupon' => 'Stripe\\Coupon',
|
||||||
'customer' => 'Stripe\\Customer',
|
'customer' => 'Stripe\\Customer',
|
||||||
'dispute' => 'Stripe\\Dispute',
|
'dispute' => 'Stripe\\Dispute',
|
||||||
'list' => 'Stripe\\Collection',
|
'ephemeral_key' => 'Stripe\\EphemeralKey',
|
||||||
|
'event' => 'Stripe\\Event',
|
||||||
|
'exchange_rate' => 'Stripe\\ExchangeRate',
|
||||||
|
'fee_refund' => 'Stripe\\ApplicationFeeRefund',
|
||||||
|
'file_upload' => 'Stripe\\FileUpload',
|
||||||
'invoice' => 'Stripe\\Invoice',
|
'invoice' => 'Stripe\\Invoice',
|
||||||
'invoiceitem' => 'Stripe\\InvoiceItem',
|
'invoiceitem' => 'Stripe\\InvoiceItem',
|
||||||
'event' => 'Stripe\\Event',
|
'login_link' => 'Stripe\\LoginLink',
|
||||||
'file' => 'Stripe\\FileUpload',
|
|
||||||
'token' => 'Stripe\\Token',
|
|
||||||
'transfer' => 'Stripe\\Transfer',
|
|
||||||
'transfer_reversal' => 'Stripe\\TransferReversal',
|
|
||||||
'order' => 'Stripe\\Order',
|
'order' => 'Stripe\\Order',
|
||||||
'order_return' => 'Stripe\\OrderReturn',
|
'order_return' => 'Stripe\\OrderReturn',
|
||||||
'payout' => 'Stripe\\Payout',
|
'payout' => 'Stripe\\Payout',
|
||||||
@ -93,15 +103,17 @@ abstract class Util
|
|||||||
'refund' => 'Stripe\\Refund',
|
'refund' => 'Stripe\\Refund',
|
||||||
'sku' => 'Stripe\\SKU',
|
'sku' => 'Stripe\\SKU',
|
||||||
'source' => 'Stripe\\Source',
|
'source' => 'Stripe\\Source',
|
||||||
|
'source_transaction' => 'Stripe\\SourceTransaction',
|
||||||
'subscription' => 'Stripe\\Subscription',
|
'subscription' => 'Stripe\\Subscription',
|
||||||
'subscription_item' => 'Stripe\\SubscriptionItem',
|
'subscription_item' => 'Stripe\\SubscriptionItem',
|
||||||
'three_d_secure' => 'Stripe\\ThreeDSecure',
|
'three_d_secure' => 'Stripe\\ThreeDSecure',
|
||||||
'fee_refund' => 'Stripe\\ApplicationFeeRefund',
|
'token' => 'Stripe\\Token',
|
||||||
'bitcoin_receiver' => 'Stripe\\BitcoinReceiver',
|
'topup' => 'Stripe\\Topup',
|
||||||
'bitcoin_transaction' => 'Stripe\\BitcoinTransaction',
|
'transfer' => 'Stripe\\Transfer',
|
||||||
);
|
'transfer_reversal' => 'Stripe\\TransferReversal',
|
||||||
|
];
|
||||||
if (self::isList($resp)) {
|
if (self::isList($resp)) {
|
||||||
$mapped = array();
|
$mapped = [];
|
||||||
foreach ($resp as $i) {
|
foreach ($resp as $i) {
|
||||||
array_push($mapped, self::convertToStripeObject($i, $opts));
|
array_push($mapped, self::convertToStripeObject($i, $opts));
|
||||||
}
|
}
|
||||||
@ -143,4 +155,84 @@ abstract class Util
|
|||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compares two strings for equality. The time taken is independent of the
|
||||||
|
* number of characters that match.
|
||||||
|
*
|
||||||
|
* @param string $a one of the strings to compare.
|
||||||
|
* @param string $b the other string to compare.
|
||||||
|
* @return bool true if the strings are equal, false otherwise.
|
||||||
|
*/
|
||||||
|
public static function secureCompare($a, $b)
|
||||||
|
{
|
||||||
|
if (self::$isHashEqualsAvailable === null) {
|
||||||
|
self::$isHashEqualsAvailable = function_exists('hash_equals');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (self::$isHashEqualsAvailable) {
|
||||||
|
return hash_equals($a, $b);
|
||||||
|
} else {
|
||||||
|
if (strlen($a) != strlen($b)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = 0;
|
||||||
|
for ($i = 0; $i < strlen($a); $i++) {
|
||||||
|
$result |= ord($a[$i]) ^ ord($b[$i]);
|
||||||
|
}
|
||||||
|
return ($result == 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array $arr A map of param keys to values.
|
||||||
|
* @param string|null $prefix
|
||||||
|
*
|
||||||
|
* @return string A querystring, essentially.
|
||||||
|
*/
|
||||||
|
public static function urlEncode($arr, $prefix = null)
|
||||||
|
{
|
||||||
|
if (!is_array($arr)) {
|
||||||
|
return $arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
$r = [];
|
||||||
|
foreach ($arr as $k => $v) {
|
||||||
|
if (is_null($v)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($prefix) {
|
||||||
|
if ($k !== null && (!is_int($k) || is_array($v))) {
|
||||||
|
$k = $prefix."[".$k."]";
|
||||||
|
} else {
|
||||||
|
$k = $prefix."[]";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_array($v)) {
|
||||||
|
$enc = self::urlEncode($v, $k);
|
||||||
|
if ($enc) {
|
||||||
|
$r[] = $enc;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$r[] = urlencode($k)."=".urlencode($v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return implode("&", $r);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function normalizeId($id)
|
||||||
|
{
|
||||||
|
if (is_array($id)) {
|
||||||
|
$params = $id;
|
||||||
|
$id = $params['id'];
|
||||||
|
unset($params['id']);
|
||||||
|
} else {
|
||||||
|
$params = [];
|
||||||
|
}
|
||||||
|
return [$id, $params];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,300 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Stripe;
|
|
||||||
|
|
||||||
class AccountTest extends TestCase
|
|
||||||
{
|
|
||||||
private function managedAccountResponse($id)
|
|
||||||
{
|
|
||||||
return array(
|
|
||||||
'id' => $id,
|
|
||||||
'currencies_supported' => array('usd', 'aed', 'afn', '...'),
|
|
||||||
'object' => 'account',
|
|
||||||
'business_name' => 'Stripe.com',
|
|
||||||
'bank_accounts' => array(
|
|
||||||
'object' => 'list',
|
|
||||||
'total_count' => 0,
|
|
||||||
'has_more' => false,
|
|
||||||
'url' => '/v1/accounts/' . $id . '/bank_accounts',
|
|
||||||
'data' => array()
|
|
||||||
),
|
|
||||||
'verification' => array(
|
|
||||||
'fields_needed' => array(
|
|
||||||
'product_description',
|
|
||||||
'business_url',
|
|
||||||
'support_phone',
|
|
||||||
'bank_account',
|
|
||||||
'tos_acceptance.ip',
|
|
||||||
'tos_acceptance.date'
|
|
||||||
),
|
|
||||||
'due_by' => null,
|
|
||||||
'contacted' => false
|
|
||||||
),
|
|
||||||
'tos_acceptance' => array(
|
|
||||||
'ip' => null,
|
|
||||||
'date' => null,
|
|
||||||
'user_agent' => null
|
|
||||||
),
|
|
||||||
'legal_entity' => array(
|
|
||||||
'type' => null,
|
|
||||||
'business_name' => null,
|
|
||||||
'address' => array(
|
|
||||||
'line1' => null,
|
|
||||||
'line2' => null,
|
|
||||||
'city' => null,
|
|
||||||
'state' => null,
|
|
||||||
'postal_code' => null,
|
|
||||||
'country' => 'US'
|
|
||||||
),
|
|
||||||
'first_name' => null,
|
|
||||||
'last_name' => null,
|
|
||||||
'additional_owners' => null,
|
|
||||||
'verification' => array(
|
|
||||||
'status' => 'unverified',
|
|
||||||
'document' => null,
|
|
||||||
'details' => null
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
private function deletedAccountResponse($id)
|
|
||||||
{
|
|
||||||
return array(
|
|
||||||
'id' => $id,
|
|
||||||
'deleted' => true
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testBasicRetrieve()
|
|
||||||
{
|
|
||||||
$this->mockRequest('GET', '/v1/account', array(), $this->managedAccountResponse('acct_ABC'));
|
|
||||||
$account = Account::retrieve();
|
|
||||||
$this->assertSame($account->id, 'acct_ABC');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testIDRetrieve()
|
|
||||||
{
|
|
||||||
$this->mockRequest('GET', '/v1/accounts/acct_DEF', array(), $this->managedAccountResponse('acct_DEF'));
|
|
||||||
$account = Account::retrieve('acct_DEF');
|
|
||||||
$this->assertSame($account->id, 'acct_DEF');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testCreate()
|
|
||||||
{
|
|
||||||
$this->mockRequest(
|
|
||||||
'POST',
|
|
||||||
'/v1/accounts',
|
|
||||||
array('managed' => 'true'),
|
|
||||||
$this->managedAccountResponse('acct_ABC')
|
|
||||||
);
|
|
||||||
$account = Account::create(array(
|
|
||||||
'managed' => true
|
|
||||||
));
|
|
||||||
$this->assertSame($account->id, 'acct_ABC');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testDelete()
|
|
||||||
{
|
|
||||||
$account = self::createTestAccount();
|
|
||||||
|
|
||||||
$this->mockRequest(
|
|
||||||
'DELETE',
|
|
||||||
'/v1/accounts/' . $account->id,
|
|
||||||
array(),
|
|
||||||
$this->deletedAccountResponse('acct_ABC')
|
|
||||||
);
|
|
||||||
$deleted = $account->delete();
|
|
||||||
$this->assertSame($deleted->id, $account->id);
|
|
||||||
$this->assertTrue($deleted->deleted);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testReject()
|
|
||||||
{
|
|
||||||
$account = self::createTestAccount();
|
|
||||||
|
|
||||||
$this->mockRequest(
|
|
||||||
'POST',
|
|
||||||
'/v1/accounts/' . $account->id . '/reject',
|
|
||||||
array('reason' => 'fraud'),
|
|
||||||
$this->deletedAccountResponse('acct_ABC')
|
|
||||||
);
|
|
||||||
$rejected = $account->reject(array('reason' => 'fraud'));
|
|
||||||
$this->assertSame($rejected->id, $account->id);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testSaveLegalEntity()
|
|
||||||
{
|
|
||||||
$response = $this->managedAccountResponse('acct_ABC');
|
|
||||||
$this->mockRequest('POST', '/v1/accounts', array('managed' => 'true'), $response);
|
|
||||||
|
|
||||||
$response['legal_entity']['first_name'] = 'Bob';
|
|
||||||
$this->mockRequest(
|
|
||||||
'POST',
|
|
||||||
'/v1/accounts/acct_ABC',
|
|
||||||
array('legal_entity' => array('first_name' => 'Bob')),
|
|
||||||
$response
|
|
||||||
);
|
|
||||||
|
|
||||||
$account = Account::create(array('managed' => true));
|
|
||||||
$account->legal_entity->first_name = 'Bob';
|
|
||||||
$account->save();
|
|
||||||
|
|
||||||
$this->assertSame('Bob', $account->legal_entity->first_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testUpdateLegalEntity()
|
|
||||||
{
|
|
||||||
$response = $this->managedAccountResponse('acct_ABC');
|
|
||||||
$this->mockRequest('POST', '/v1/accounts', array('managed' => 'true'), $response);
|
|
||||||
|
|
||||||
$response['legal_entity']['first_name'] = 'Bob';
|
|
||||||
$this->mockRequest(
|
|
||||||
'POST',
|
|
||||||
'/v1/accounts/acct_ABC',
|
|
||||||
array('legal_entity' => array('first_name' => 'Bob')),
|
|
||||||
$response
|
|
||||||
);
|
|
||||||
|
|
||||||
$account = Account::create(array('managed' => true));
|
|
||||||
$account = Account::update($account['id'], array(
|
|
||||||
'legal_entity' => array(
|
|
||||||
'first_name' => 'Bob'
|
|
||||||
)
|
|
||||||
));
|
|
||||||
|
|
||||||
$this->assertSame('Bob', $account->legal_entity->first_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testCreateAdditionalOwners()
|
|
||||||
{
|
|
||||||
$request = array(
|
|
||||||
'managed' => true,
|
|
||||||
'country' => 'GB',
|
|
||||||
'legal_entity' => array(
|
|
||||||
'additional_owners' => array(
|
|
||||||
0 => array(
|
|
||||||
'dob' => array(
|
|
||||||
'day' => 12,
|
|
||||||
'month' => 5,
|
|
||||||
'year' => 1970,
|
|
||||||
),
|
|
||||||
'first_name' => 'xgvukvfrde',
|
|
||||||
'last_name' => 'rtcyvubhy',
|
|
||||||
),
|
|
||||||
1 => array(
|
|
||||||
'dob' => array(
|
|
||||||
'day' => 8,
|
|
||||||
'month' => 4,
|
|
||||||
'year' => 1979,
|
|
||||||
),
|
|
||||||
'first_name' => 'yutreuk',
|
|
||||||
'last_name' => 'dfcgvhbjihmv',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
$acct = Account::create($request);
|
|
||||||
$response = $acct->__toArray(true);
|
|
||||||
|
|
||||||
$req_ao = $request['legal_entity']['additional_owners'];
|
|
||||||
$resp_ao = $response['legal_entity']['additional_owners'];
|
|
||||||
|
|
||||||
$this->assertSame($req_ao[0]['dob'], $resp_ao[0]['dob']);
|
|
||||||
$this->assertSame($req_ao[1]['dob'], $resp_ao[1]['dob']);
|
|
||||||
|
|
||||||
$this->assertSame($req_ao[0]['first_name'], $resp_ao[0]['first_name']);
|
|
||||||
$this->assertSame($req_ao[1]['first_name'], $resp_ao[1]['first_name']);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testUpdateAdditionalOwners()
|
|
||||||
{
|
|
||||||
$response = $this->managedAccountResponse('acct_ABC');
|
|
||||||
$this->mockRequest('POST', '/v1/accounts', array('managed' => 'true'), $response);
|
|
||||||
|
|
||||||
$response['legal_entity']['additional_owners'] = array(array(
|
|
||||||
'first_name' => 'Bob',
|
|
||||||
'last_name' => null,
|
|
||||||
'address' => array(
|
|
||||||
'line1' => null,
|
|
||||||
'line2' => null,
|
|
||||||
'city' => null,
|
|
||||||
'state' => null,
|
|
||||||
'postal_code' => null,
|
|
||||||
'country' => null
|
|
||||||
),
|
|
||||||
'verification' => array(
|
|
||||||
'status' => 'unverified',
|
|
||||||
'document' => null,
|
|
||||||
'details' => null
|
|
||||||
)
|
|
||||||
));
|
|
||||||
|
|
||||||
$this->mockRequest(
|
|
||||||
'POST',
|
|
||||||
'/v1/accounts/acct_ABC',
|
|
||||||
array('legal_entity' => array('additional_owners' => array(array('first_name' => 'Bob')))),
|
|
||||||
$response
|
|
||||||
);
|
|
||||||
|
|
||||||
$response['legal_entity']['additional_owners'][0]['last_name'] = 'Smith';
|
|
||||||
$this->mockRequest(
|
|
||||||
'POST',
|
|
||||||
'/v1/accounts/acct_ABC',
|
|
||||||
array('legal_entity' => array('additional_owners' => array(array('last_name' => 'Smith')))),
|
|
||||||
$response
|
|
||||||
);
|
|
||||||
|
|
||||||
$response['legal_entity']['additional_owners'][0]['last_name'] = 'Johnson';
|
|
||||||
$this->mockRequest(
|
|
||||||
'POST',
|
|
||||||
'/v1/accounts/acct_ABC',
|
|
||||||
array('legal_entity' => array('additional_owners' => array(array('last_name' => 'Johnson')))),
|
|
||||||
$response
|
|
||||||
);
|
|
||||||
|
|
||||||
$response['legal_entity']['additional_owners'][0]['verification']['document'] = 'file_123';
|
|
||||||
$this->mockRequest(
|
|
||||||
'POST',
|
|
||||||
'/v1/accounts/acct_ABC',
|
|
||||||
array('legal_entity' => array('additional_owners' => array(array('verification' => array('document' => 'file_123'))))),
|
|
||||||
$response
|
|
||||||
);
|
|
||||||
|
|
||||||
$response['legal_entity']['additional_owners'][1] = array(
|
|
||||||
'first_name' => 'Jane',
|
|
||||||
'last_name' => 'Doe'
|
|
||||||
);
|
|
||||||
$this->mockRequest(
|
|
||||||
'POST',
|
|
||||||
'/v1/accounts/acct_ABC',
|
|
||||||
array('legal_entity' => array('additional_owners' => array(1 => array('first_name' => 'Jane')))),
|
|
||||||
$response
|
|
||||||
);
|
|
||||||
|
|
||||||
$account = Account::create(array('managed' => true));
|
|
||||||
$account->legal_entity->additional_owners = array(array('first_name' => 'Bob'));
|
|
||||||
$account->save();
|
|
||||||
$this->assertSame(1, count($account->legal_entity->additional_owners));
|
|
||||||
$this->assertSame('Bob', $account->legal_entity->additional_owners[0]->first_name);
|
|
||||||
|
|
||||||
$account->legal_entity->additional_owners[0]->last_name = 'Smith';
|
|
||||||
$account->save();
|
|
||||||
$this->assertSame(1, count($account->legal_entity->additional_owners));
|
|
||||||
$this->assertSame('Smith', $account->legal_entity->additional_owners[0]->last_name);
|
|
||||||
|
|
||||||
$account['legal_entity']['additional_owners'][0]['last_name'] = 'Johnson';
|
|
||||||
$account->save();
|
|
||||||
$this->assertSame(1, count($account->legal_entity->additional_owners));
|
|
||||||
$this->assertSame('Johnson', $account->legal_entity->additional_owners[0]->last_name);
|
|
||||||
|
|
||||||
$account->legal_entity->additional_owners[0]->verification->document = 'file_123';
|
|
||||||
$account->save();
|
|
||||||
$this->assertSame('file_123', $account->legal_entity->additional_owners[0]->verification->document);
|
|
||||||
|
|
||||||
$account->legal_entity->additional_owners[1] = array('first_name' => 'Jane');
|
|
||||||
$account->save();
|
|
||||||
$this->assertSame('Jane', $account->legal_entity->additional_owners[1]->first_name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,68 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Stripe;
|
|
||||||
|
|
||||||
use Stripe\HttpClient\CurlClient;
|
|
||||||
|
|
||||||
class ApiRequestorTest extends TestCase
|
|
||||||
{
|
|
||||||
public function testEncodeObjects()
|
|
||||||
{
|
|
||||||
$reflector = new \ReflectionClass('Stripe\\ApiRequestor');
|
|
||||||
$method = $reflector->getMethod('_encodeObjects');
|
|
||||||
$method->setAccessible(true);
|
|
||||||
|
|
||||||
$a = array('customer' => new Customer('abcd'));
|
|
||||||
$enc = $method->invoke(null, $a);
|
|
||||||
$this->assertSame($enc, array('customer' => 'abcd'));
|
|
||||||
|
|
||||||
// Preserves UTF-8
|
|
||||||
$v = array('customer' => "☃");
|
|
||||||
$enc = $method->invoke(null, $v);
|
|
||||||
$this->assertSame($enc, $v);
|
|
||||||
|
|
||||||
// Encodes latin-1 -> UTF-8
|
|
||||||
$v = array('customer' => "\xe9");
|
|
||||||
$enc = $method->invoke(null, $v);
|
|
||||||
$this->assertSame($enc, array('customer' => "\xc3\xa9"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testHttpClientInjection()
|
|
||||||
{
|
|
||||||
$reflector = new \ReflectionClass('Stripe\\ApiRequestor');
|
|
||||||
$method = $reflector->getMethod('httpClient');
|
|
||||||
$method->setAccessible(true);
|
|
||||||
|
|
||||||
$curl = new CurlClient();
|
|
||||||
$curl->setTimeout(10);
|
|
||||||
ApiRequestor::setHttpClient($curl);
|
|
||||||
|
|
||||||
$injectedCurl = $method->invoke(new ApiRequestor());
|
|
||||||
$this->assertSame($injectedCurl, $curl);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testDefaultHeaders()
|
|
||||||
{
|
|
||||||
$reflector = new \ReflectionClass('Stripe\\ApiRequestor');
|
|
||||||
$method = $reflector->getMethod('_defaultHeaders');
|
|
||||||
$method->setAccessible(true);
|
|
||||||
|
|
||||||
// no way to stub static methods with PHPUnit 4.x :(
|
|
||||||
Stripe::setAppInfo('MyTestApp', '1.2.34', 'https://mytestapp.example');
|
|
||||||
$apiKey = 'sk_test_notarealkey';
|
|
||||||
|
|
||||||
$headers = $method->invoke(null, $apiKey);
|
|
||||||
|
|
||||||
$ua = json_decode($headers['X-Stripe-Client-User-Agent']);
|
|
||||||
$this->assertSame($ua->application->name, 'MyTestApp');
|
|
||||||
$this->assertSame($ua->application->version, '1.2.34');
|
|
||||||
$this->assertSame($ua->application->url, 'https://mytestapp.example');
|
|
||||||
|
|
||||||
$this->assertSame(
|
|
||||||
$headers['User-Agent'],
|
|
||||||
'Stripe/v1 PhpBindings/' . Stripe::VERSION . ' MyTestApp/1.2.34 (https://mytestapp.example)'
|
|
||||||
);
|
|
||||||
|
|
||||||
$this->assertSame($headers['Authorization'], 'Bearer ' . $apiKey);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,72 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Stripe;
|
|
||||||
|
|
||||||
class ApplePayDomainTest extends TestCase
|
|
||||||
{
|
|
||||||
public function testCreation()
|
|
||||||
{
|
|
||||||
$this->mockRequest(
|
|
||||||
'POST',
|
|
||||||
'/v1/apple_pay/domains',
|
|
||||||
array('domain_name' => 'test.com'),
|
|
||||||
array(
|
|
||||||
'id' => 'apwc_create',
|
|
||||||
'object' => 'apple_pay_domain'
|
|
||||||
)
|
|
||||||
);
|
|
||||||
$d = ApplePayDomain::create(array(
|
|
||||||
'domain_name' => 'test.com'
|
|
||||||
));
|
|
||||||
$this->assertSame('apwc_create', $d->id);
|
|
||||||
$this->assertInstanceOf('Stripe\\ApplePayDomain', $d);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testRetrieve()
|
|
||||||
{
|
|
||||||
$this->mockRequest(
|
|
||||||
'GET',
|
|
||||||
'/v1/apple_pay/domains/apwc_retrieve',
|
|
||||||
array(),
|
|
||||||
array(
|
|
||||||
'id' => 'apwc_retrieve',
|
|
||||||
'object' => 'apple_pay_domain'
|
|
||||||
)
|
|
||||||
);
|
|
||||||
$d = ApplePayDomain::retrieve('apwc_retrieve');
|
|
||||||
$this->assertSame('apwc_retrieve', $d->id);
|
|
||||||
$this->assertInstanceOf('Stripe\\ApplePayDomain', $d);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testDeletion()
|
|
||||||
{
|
|
||||||
self::authorizeFromEnv();
|
|
||||||
$d = ApplePayDomain::create(array(
|
|
||||||
'domain_name' => 'jackshack.website'
|
|
||||||
));
|
|
||||||
$this->assertInstanceOf('Stripe\\ApplePayDomain', $d);
|
|
||||||
$this->mockRequest(
|
|
||||||
'DELETE',
|
|
||||||
'/v1/apple_pay/domains/' . $d->id,
|
|
||||||
array(),
|
|
||||||
array('deleted' => true)
|
|
||||||
);
|
|
||||||
$d->delete();
|
|
||||||
$this->assertTrue($d->deleted);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testList()
|
|
||||||
{
|
|
||||||
$this->mockRequest(
|
|
||||||
'GET',
|
|
||||||
'/v1/apple_pay/domains',
|
|
||||||
array(),
|
|
||||||
array(
|
|
||||||
'url' => '/v1/apple_pay/domains',
|
|
||||||
'object' => 'list'
|
|
||||||
)
|
|
||||||
);
|
|
||||||
$all = ApplePayDomain::all();
|
|
||||||
$this->assertSame($all->url, '/v1/apple_pay/domains');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,18 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Stripe;
|
|
||||||
|
|
||||||
class ApplicationFeeRefundTest extends TestCase
|
|
||||||
{
|
|
||||||
public function testUrls()
|
|
||||||
{
|
|
||||||
$refund = new ApplicationFeeRefund();
|
|
||||||
$refund->id = 'refund_id';
|
|
||||||
$refund->fee = 'fee_id';
|
|
||||||
|
|
||||||
$this->assertSame(
|
|
||||||
$refund->instanceUrl(),
|
|
||||||
'/v1/application_fees/fee_id/refunds/refund_id'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,22 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Stripe;
|
|
||||||
|
|
||||||
class ApplicationFeeTest extends TestCase
|
|
||||||
{
|
|
||||||
public function testUrls()
|
|
||||||
{
|
|
||||||
$applicationFee = new ApplicationFee('abcd/efgh');
|
|
||||||
$this->assertSame(
|
|
||||||
$applicationFee->instanceUrl(),
|
|
||||||
'/v1/application_fees/abcd%2Fefgh'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testList()
|
|
||||||
{
|
|
||||||
self::authorizeFromEnv();
|
|
||||||
$d = ApplicationFee::all();
|
|
||||||
$this->assertSame($d->url, '/v1/application_fees');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,16 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Stripe;
|
|
||||||
|
|
||||||
class AuthenticationErrorTest extends TestCase
|
|
||||||
{
|
|
||||||
public function testInvalidCredentials()
|
|
||||||
{
|
|
||||||
Stripe::setApiKey('invalid');
|
|
||||||
try {
|
|
||||||
Customer::create();
|
|
||||||
} catch (Error\Authentication $e) {
|
|
||||||
$this->assertSame(401, $e->getHttpStatus());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,15 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Stripe;
|
|
||||||
|
|
||||||
class BalanceTest extends TestCase
|
|
||||||
{
|
|
||||||
public function testRetrieve()
|
|
||||||
{
|
|
||||||
self::authorizeFromEnv();
|
|
||||||
$d = Balance::retrieve();
|
|
||||||
$this->assertSame($d->object, "balance");
|
|
||||||
$this->assertTrue(Util\Util::isList($d->available));
|
|
||||||
$this->assertTrue(Util\Util::isList($d->pending));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Stripe;
|
|
||||||
|
|
||||||
class BalanceTransactionTest extends TestCase
|
|
||||||
{
|
|
||||||
public function testList()
|
|
||||||
{
|
|
||||||
self::authorizeFromEnv();
|
|
||||||
$d = BalanceTransaction::all();
|
|
||||||
$this->assertSame($d->url, '/v1/balance/history');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,32 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Stripe;
|
|
||||||
|
|
||||||
class BankAccountTest extends TestCase
|
|
||||||
{
|
|
||||||
public function testVerify()
|
|
||||||
{
|
|
||||||
self::authorizeFromEnv();
|
|
||||||
|
|
||||||
$customer = self::createTestCustomer();
|
|
||||||
|
|
||||||
$bankAccount = $customer->sources->create(array(
|
|
||||||
'source' => array(
|
|
||||||
'object' => 'bank_account',
|
|
||||||
'account_holder_type' => 'individual',
|
|
||||||
'account_number' => '000123456789',
|
|
||||||
'account_holder_name' => 'John Doe',
|
|
||||||
'routing_number' => '110000000',
|
|
||||||
'country' => 'US'
|
|
||||||
)
|
|
||||||
));
|
|
||||||
|
|
||||||
$this->assertSame($bankAccount->status, 'new');
|
|
||||||
|
|
||||||
$bankAccount = $bankAccount->verify(array(
|
|
||||||
'amounts' => array(32, 45)
|
|
||||||
));
|
|
||||||
|
|
||||||
$this->assertSame($bankAccount->status, 'verified');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user