Fix php code

This commit is contained in:
Laurent Destailleur 2018-03-10 23:50:41 +01:00
parent 390618db47
commit 0389664b1e
2 changed files with 329 additions and 314 deletions

View File

@ -1,4 +1,19 @@
<?php <?php
/* Copyright (C) 2018
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
define("NOLOGIN",1); // This means this output page does not require to be logged. define("NOLOGIN",1); // This means this output page does not require to be logged.
define("NOCSRFCHECK",1); // We accept to go on this page from external web site. define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
@ -86,9 +101,11 @@ if (! empty($conf->multicompany->enabled) && ! empty($conf->stripeconnect->enabl
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
$key=$obj->entity; $key=$obj->entity;
} }
else {$key=1;} else {$key=1;
}
}
else {$key=1;
} }
else {$key=1;}
$ret=$mc->switchEntity($key); $ret=$mc->switchEntity($key);
if (! $res && file_exists("../../main.inc.php")) $res=@include("../../main.inc.php"); if (! $res && file_exists("../../main.inc.php")) $res=@include("../../main.inc.php");
if (! $res) die("Include of main fails"); if (! $res) die("Include of main fails");
@ -105,7 +122,7 @@ if ($event->type == 'payout.created') {
{ {
$body = "Un virement de ".price2num($event->data->object->amount/100)." ".$event->data->object->currency." est attendu sur votre compte le ".date('d-m-Y H:i:s',$event->data->object->arrival_date); $body = "Un virement de ".price2num($event->data->object->amount/100)." ".$event->data->object->currency." est attendu sur votre compte le ".date('d-m-Y H:i:s',$event->data->object->arrival_date);
$subject = '[NOTIFICATION] Virement programmée'; $subject = '[NOTIFICATION] Virement programmée';
$headers = 'From: "'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'" <'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'>'; TODO convert in dolibarr standard $headers = 'From: "'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'" <'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'>'; // TODO convert in dolibarr standard
mail(''.$conf->global->MAIN_INFO_SOCIETE_MAIL.'', $subject, $body, $headers); mail(''.$conf->global->MAIN_INFO_SOCIETE_MAIL.'', $subject, $body, $headers);
return 1; return 1;
} }
@ -165,7 +182,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$body = "Un virement de ".price2num($event->data->object->amount/100)." ".$event->data->object->currency." a ete effectue sur votre compte le ".date('d-m-Y H:i:s',$event->data->object->arrival_date); $body = "Un virement de ".price2num($event->data->object->amount/100)." ".$event->data->object->currency." a ete effectue sur votre compte le ".date('d-m-Y H:i:s',$event->data->object->arrival_date);
$subject = '[NOTIFICATION] Virement effectué'; $subject = '[NOTIFICATION] Virement effectué';
$headers = 'From: "'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'" <'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'>'; TODO convert in dolibarr standard $headers = 'From: "'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'" <'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'>'; // TODO convert in dolibarr standard
mail(''.$conf->global->MAIN_INFO_SOCIETE_MAIL.'', $subject, $body, $headers); mail(''.$conf->global->MAIN_INFO_SOCIETE_MAIL.'', $subject, $body, $headers);
return 1; return 1;
@ -272,7 +289,8 @@ if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE) && count($invoice->lines))
$model=$invoice->modelpdf; $model=$invoice->modelpdf;
$ret = $invoice->fetch($invoice->id); // Reload to get new records $ret = $invoice->fetch($invoice->id); // Reload to get new records
$invoice->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);} $invoice->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
if ($paiement_id < 0){ if ($paiement_id < 0){
$msg=$paiement->errors; $msg=$paiement->errors;
$error++; $error++;
@ -308,6 +326,3 @@ elseif ($event->type == 'customer.deleted') {
$db->commit(); $db->commit();
} }
?>