Merge remote-tracking branch 'upstream/develop' into new_branch_20_04_2018

This commit is contained in:
Philippe GRAND 2018-04-21 11:46:03 +02:00
commit 4e9c77a738
7 changed files with 133 additions and 120 deletions

View File

@ -1984,6 +1984,7 @@ class Facture extends CommonInvoice
$this->db->begin(); $this->db->begin();
dol_syslog(get_class($this)."::set_paid rowid=".$this->id, LOG_DEBUG); dol_syslog(get_class($this)."::set_paid rowid=".$this->id, LOG_DEBUG);
$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture SET'; $sql = 'UPDATE '.MAIN_DB_PREFIX.'facture SET';
$sql.= ' fk_statut='.self::STATUS_CLOSED; $sql.= ' fk_statut='.self::STATUS_CLOSED;
if (! $close_code) $sql.= ', paye=1'; if (! $close_code) $sql.= ', paye=1';
@ -1991,7 +1992,6 @@ class Facture extends CommonInvoice
if ($close_note) $sql.= ", close_note='".$this->db->escape($close_note)."'"; if ($close_note) $sql.= ", close_note='".$this->db->escape($close_note)."'";
$sql.= ' WHERE rowid = '.$this->id; $sql.= ' WHERE rowid = '.$this->id;
dol_syslog(get_class($this)."::set_paid", LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {

View File

@ -77,6 +77,10 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode
$texte.= '<tr><td>'; $texte.= '<tr><td>';
$texte.=$langs->trans("ModuleCompanyCodeCustomer".$this->name,$s2)."<br>\n"; $texte.=$langs->trans("ModuleCompanyCodeCustomer".$this->name,$s2)."<br>\n";
$texte.=$langs->trans("ModuleCompanyCodeSupplier".$this->name,$s1)."<br>\n"; $texte.=$langs->trans("ModuleCompanyCodeSupplier".$this->name,$s1)."<br>\n";
$texte.="<br>\n";
if (! isset($conf->global->COMPANY_AQUARIUM_REMOVE_SPECIAL) || ! empty($conf->global->$conf->global->COMPANY_AQUARIUM_REMOVE_SPECIAL)) $texte.=$langs->trans('COMPANY_AQUARIUM_REMOVE_SPECIAL').' = '.yn(1)."<br>\n";
//if (! empty($conf->global->COMPANY_AQUARIUM_REMOVE_ALPHA)) $texte.=$langs->trans('COMPANY_AQUARIUM_REMOVE_ALPHA').' = '.yn($conf->global->COMPANY_AQUARIUM_REMOVE_ALPHA)."<br>\n";
if (! empty($conf->global->COMPANY_AQUARIUM_CLEAN_REGEX)) $texte.=$langs->trans('COMPANY_AQUARIUM_CLEAN_REGEX').' = '.$conf->global->COMPANY_AQUARIUM_CLEAN_REGEX."<br>\n";
$texte.= '</td>'; $texte.= '</td>';
$texte.= '<td align="left">&nbsp; <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>'; $texte.= '<td align="left">&nbsp; <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
$texte.= '</tr></table>'; $texte.= '</tr></table>';

View File

@ -1785,6 +1785,8 @@ SetToYesIfGroupIsComputationOfOtherGroups=Set this to yes if this group is a com
EnterCalculationRuleIfPreviousFieldIsYes=Enter calculcation rule if previous field was set to Yes (For example 'CODEGRP1+CODEGRP2') EnterCalculationRuleIfPreviousFieldIsYes=Enter calculcation rule if previous field was set to Yes (For example 'CODEGRP1+CODEGRP2')
SeveralLangugeVariatFound=Several language variants found SeveralLangugeVariatFound=Several language variants found
WebDavServer=URL of %s server : %s WebDavServer=URL of %s server : %s
COMPANY_AQUARIUM_REMOVE_SPECIAL=Remove special characters
COMPANY_AQUARIUM_CLEAN_REGEX=Regex filter to clean value (COMPANY_AQUARIUM_CLEAN_REGEX)
##### Resource #### ##### Resource ####
ResourceSetup=Configuration du module Resource ResourceSetup=Configuration du module Resource
UseSearchToSelectResource=Use a search form to choose a resource (rather than a drop-down list). UseSearchToSelectResource=Use a search form to choose a resource (rather than a drop-down list).

View File

@ -217,7 +217,7 @@ class Stripe extends CommonObject
//$sql.= " AND sa.entity IN (".getEntity('societe').")"; //$sql.= " AND sa.entity IN (".getEntity('societe').")";
$sql.= " AND sa.type = 'card'"; $sql.= " AND sa.type = 'card'";
dol_syslog(get_class($this) . "::fetch search stripe card id for paymentmode id=".$object->id, LOG_DEBUG); dol_syslog(get_class($this) . "::fetch search stripe card id for paymentmode id=".$object->id.", stripeacc=".$stripeacc, LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { if ($resql) {
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
@ -225,13 +225,15 @@ class Stripe extends CommonObject
{ {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$cardref = $obj->stripe_card_ref; $cardref = $obj->stripe_card_ref;
dol_syslog("*************".$cardref);
if ($cardref) if ($cardref)
{ {
try { try {
if (empty($stripeacc)) { // If the Stripe connect account not set, we use common API usage if (empty($stripeacc)) { // If the Stripe connect account not set, we use common API usage
$card = $cu->sources->retrieve($cardref); $card = $cu->sources->retrieve($cardref);
} else { } else {
$card = $cu->sources->retrieve($cardref, array("stripe_account" => $stripeacc)); //$card = $cu->sources->retrieve($cardref, array("stripe_account" => $stripeacc)); // this API fails when array stripe_account is provided
$card = $cu->sources->retrieve($cardref);
} }
} }
catch(Exception $e) catch(Exception $e)

View File

@ -271,9 +271,10 @@ if (empty($reshook))
$error++; $error++;
} }
} }
$facture = new Facture($db);
$facture->fetch($facid); $facture = new Facture($db);
$facture->fetch_thirdparty(); $facture->fetch($facid);
$facture->fetch_thirdparty();
$error = 0; $error = 0;
@ -286,33 +287,37 @@ $facture->fetch_thirdparty();
} }
} }
$stripeamount=0; $stripeamount=0;
foreach ($amounts as $key => $value) // How payment is dispatch foreach ($amounts as $key => $value) // How payment is dispatch
{ {
$stripeamount+=price2num($value,'MT'); $stripeamount+=price2num($value,'MT');
} }
if (preg_match('/acct_/i',$source)) if (preg_match('/acct_/i',$source))
{ {
$paiementcode ="VIR"; $paiementcode ="VIR";
} }
elseif (preg_match('/card_/i',$source)) elseif (preg_match('/card_/i',$source))
{ {
$paiementcode ="CB"; $paiementcode ="CB";
} }
elseif (preg_match('/src_/i',$source)) elseif (preg_match('/src_/i',$source))
{ {
$customer2 = \Stripe\Customer::retrieve($customer->id,array("stripe_account" => $stripe->getStripeAccount($entity))); $stripeacc = $stripe->getStripeAccount($entity);
$src = $customer2->sources->retrieve("$source"); $customer2 = \Stripe\Customer::retrieve($customer->id, array("stripe_account" => $stripeacc));
if ($src->type=='card'){ //$src = $customer2->sources->retrieve("$source", array("stripe_account" => $stripeacc)); // this API fails when array stripe_account is provided
$paiementcode ="CB"; $src = $customer2->sources->retrieve("$source");
} if ($src->type=='card')
} {
$societe = new Societe($db); $paiementcode ="CB";
$societe->fetch($facture->socid); }
}
$societe = new Societe($db);
$societe->fetch($facture->socid);
dol_syslog("Create charge", LOG_DEBUG, 0, '_stripe'); dol_syslog("Create charge", LOG_DEBUG, 0, '_stripe');
$charge=$stripe->CreatePaymentStripe($stripeamount,"EUR","invoice",$facid,$source,$customer->id,$stripe->getStripeAccount($conf->entity)); $charge=$stripe->CreatePaymentStripe($stripeamount,"EUR","invoice",$facid,$source,$customer->id,$stripe->getStripeAccount($conf->entity));
if (!$error) if (!$error)
{ {
@ -349,7 +354,6 @@ $charge=$stripe->CreatePaymentStripe($stripeamount,"EUR","invoice",$facid,$sourc
$ret = $facture->fetch($facid); // Reload to get new records $ret = $facture->fetch($facid); // Reload to get new records
$facture->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); $facture->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
} }
} }
@ -393,9 +397,10 @@ $charge=$stripe->CreatePaymentStripe($stripeamount,"EUR","invoice",$facid,$sourc
{ {
$loc = dol_buildpath('/stripeconnect/payment.php?facid='.$facid.'&action=create&error='.$e->getMessage().'', 1); $loc = dol_buildpath('/stripeconnect/payment.php?facid='.$facid.'&action=create&error='.$e->getMessage().'', 1);
$db->rollback(); $db->rollback();
header('Location: '.$loc);
}
header('Location: '.$loc);
exit;
}
} }
} }

View File

@ -3720,7 +3720,7 @@ table.dp {
border-style:none; border-style:none;
background-color:transparent; background-color:transparent;
padding:0px; padding:0px;
font-size:9px; font-size: 0.85em;
border-width:0px; border-width:0px;
color:#0B63A2; color:#0B63A2;
vertical-align:middle; vertical-align:middle;

View File

@ -3659,7 +3659,7 @@ table.dp {
border-style:none; border-style:none;
background-color:transparent; background-color:transparent;
padding:0px; padding:0px;
font-size:9px; font-size: 0.85em;
border-width:0px; border-width:0px;
color: #eee; color: #eee;
vertical-align:middle; vertical-align:middle;