From b76620469002339d343cedb3357d7186062eb422 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 30 Jan 2019 22:53:47 +0100 Subject: [PATCH] wip --- .../sociales/class/chargesociales.class.php | 12 +-- htdocs/core/actions_massactions.inc.php | 96 +++++++++---------- htdocs/core/tpl/card_presend.tpl.php | 9 +- htdocs/product/card.php | 24 +++-- htdocs/stripe/payout.php | 50 +++++----- 5 files changed, 95 insertions(+), 96 deletions(-) diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index db5ce7a4dde..8600e21b2ea 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2004-2007 Laurent Destailleur - * Copyright (C) 2016 Frédéric France + * Copyright (C) 2016-2019 Frédéric France * Copyright (C) 2017 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify @@ -335,7 +335,7 @@ class ChargeSociales extends CommonObject if (! $notrigger) { // Call trigger - $result=$this->call_trigger('SOCIALCHARGES_MODIFY',$user); + $result=$this->call_trigger('SOCIALCHARGES_MODIFY', $user); if ($result < 0) $error++; // End call triggers } @@ -362,8 +362,8 @@ class ChargeSociales extends CommonObject /** * Calculate amount remaining to pay by year * - * @param int $year Year - * @return number + * @param int $year Year + * @return number */ function solde($year = 0) { @@ -403,8 +403,8 @@ class ChargeSociales extends CommonObject /** * Tag social contribution as payed completely * - * @param User $user Object user making change - * @return int <0 if KO, >0 if OK + * @param User $user Object user making change + * @return int <0 if KO, >0 if OK */ function set_paid($user) { diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index d99fbf46f72..13a2036a5d7 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -1,8 +1,9 @@ - * Copyright (C) 2018 Nicolas ZABOURI - * Copyright (C) 2018 Juanjo Menent - * Copyright (C) 2019 Ferran Marcet +/* Copyright (C) 2015-2017 Laurent Destailleur + * Copyright (C) 2018 Nicolas ZABOURI + * Copyright (C) 2018 Juanjo Menent + * Copyright (C) 2019 Ferran Marcet + * Copyright (C) 2019 Frédéric France * * 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 @@ -100,7 +101,7 @@ if (! $error && $massaction == 'confirm_presend') } // Check mandatory parameters - if (GETPOST('fromtype','alpha') === 'user' && empty($user->email)) + if (GETPOST('fromtype', 'alpha') === 'user' && empty($user->email)) { $error++; setEventMessages($langs->trans("NoSenderEmailDefined"), null, 'warnings'); @@ -120,7 +121,7 @@ if (! $error && $massaction == 'confirm_presend') $massaction='presend'; } - if (! GETPOST('subject','none')) + if (! GETPOST('subject', 'none')) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("MailTopic")), null, 'warnings'); @@ -162,12 +163,12 @@ if (! $error && $massaction == 'confirm_presend') } elseif ($val && method_exists($thirdparty, 'contact_get_property')) // Id of contact { - $tmparray[] = $thirdparty->contact_get_property((int) $val,'email'); + $tmparray[] = $thirdparty->contact_get_property((int) $val, 'email'); $sendtoid[] = $val; } } } - $sendto=implode(',',$tmparray); + $sendto=implode(',', $tmparray); // Define $sendtocc $receivercc=$_POST['receivercc']; @@ -192,12 +193,12 @@ if (! $error && $massaction == 'confirm_presend') } elseif ($val) // Id du contact { - $tmparray[] = $thirdparty->contact_get_property((int) $val,'email'); + $tmparray[] = $thirdparty->contact_get_property((int) $val, 'email'); //$sendtoid[] = $val; TODO Add also id of contact in CC ? } } } - $sendtocc=implode(',',$tmparray); + $sendtocc=implode(',', $tmparray); //var_dump($listofobjectref);exit; $attachedfiles=array('paths'=>array(), 'names'=>array(), 'mimes'=>array()); @@ -212,21 +213,21 @@ if (! $error && $massaction == 'confirm_presend') { $langs->load("errors"); $nbignored++; - $resaction.='
'.$langs->trans('ErrorOnlyProposalNotDraftCanBeSentInMassAction',$objectobj->ref).'

'; + $resaction.='
'.$langs->trans('ErrorOnlyProposalNotDraftCanBeSentInMassAction', $objectobj->ref).'

'; continue; // Payment done or started or canceled } if ($objectclass == 'Commande' && $objectoj->statut == Commande::STATUS_DRAFT) { $langs->load("errors"); $nbignored++; - $resaction.='
'.$langs->trans('ErrorOnlyOrderNotDraftCanBeSentInMassAction',$objectobj->ref).'

'; + $resaction.='
'.$langs->trans('ErrorOnlyOrderNotDraftCanBeSentInMassAction', $objectobj->ref).'

'; continue; } if ($objectclass == 'Facture' && $objectobj->statut == Facture::STATUS_DRAFT) { $langs->load("errors"); $nbignored++; - $resaction.='
'.$langs->trans('ErrorOnlyInvoiceValidatedCanBeSentInMassAction',$objectobj->ref).'

'; + $resaction.='
'.$langs->trans('ErrorOnlyInvoiceValidatedCanBeSentInMassAction', $objectobj->ref).'

'; continue; // Payment done or started or canceled } @@ -258,7 +259,7 @@ if (! $error && $massaction == 'confirm_presend') $nbignored++; if (empty($thirdpartywithoutemail[$objectobj->thirdparty->id])) { - $resaction.='
'.$langs->trans('NoRecipientEmail',$objectobj->thirdparty->name).'

'; + $resaction.='
'.$langs->trans('NoRecipientEmail', $objectobj->thirdparty->name).'

'; } dol_syslog('No recipient for thirdparty: '.$objectobj->thirdparty->name, LOG_WARNING); $thirdpartywithoutemail[$objectobj->thirdparty->id]=1; @@ -278,16 +279,16 @@ if (! $error && $massaction == 'confirm_presend') { // Create form object $attachedfiles=array( - 'paths'=>array_merge($attachedfiles['paths'],array($file)), - 'names'=>array_merge($attachedfiles['names'],array($filename)), - 'mimes'=>array_merge($attachedfiles['mimes'],array($mime)) + 'paths'=>array_merge($attachedfiles['paths'], array($file)), + 'names'=>array_merge($attachedfiles['names'], array($filename)), + 'mimes'=>array_merge($attachedfiles['mimes'], array($mime)) ); } else { $nbignored++; $langs->load("errors"); - $resaction.='
'.$langs->trans('ErrorCantReadFile',$file).'

'; + $resaction.='
'.$langs->trans('ErrorCantReadFile', $file).'

'; dol_syslog('Failed to read file: '.$file, LOG_WARNING); continue; } @@ -334,8 +335,8 @@ if (! $error && $massaction == 'confirm_presend') } $replyto = $from; - $subject = GETPOST('subject','none'); - $message = GETPOST('message','none'); + $subject = GETPOST('subject', 'none'); + $message = GETPOST('message', 'none'); $sendtobcc = GETPOST('sendtoccc'); if ($objectclass == 'Propal') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO)); @@ -347,7 +348,7 @@ if (! $error && $massaction == 'confirm_presend') // $listofqualifiedobj is array with key = object id and value is instance of qualified objects, for the current thirdparty (but thirdparty property is not loaded yet) // $looparray will be an array with number of email to send for the current thirdparty (so 1 or n if n object for same thirdparty) - $oneemailperrecipient=(GETPOST('oneemailperrecipient','alpha')=='on'?1:0); + $oneemailperrecipient=(GETPOST('oneemailperrecipient', 'alpha')=='on'?1:0); $looparray=array(); if (! $oneemailperrecipient) { @@ -370,8 +371,8 @@ if (! $error && $massaction == 'confirm_presend') { // Make substitution in email content $substitutionarray=getCommonSubstitutionArray($langs, 0, null, $objecttmp); - $substitutionarray['__ID__'] = ($oneemailperrecipient ? join(', ',array_keys($listofqualifiedobj)) : $objecttmp->id); - $substitutionarray['__REF__'] = ($oneemailperrecipient ? join(', ',$listofqualifiedref) : $objecttmp->ref); + $substitutionarray['__ID__'] = ($oneemailperrecipient ? join(', ', array_keys($listofqualifiedobj)) : $objecttmp->id); + $substitutionarray['__REF__'] = ($oneemailperrecipient ? join(', ', $listofqualifiedref) : $objecttmp->ref); $substitutionarray['__EMAIL__'] = $thirdparty->email; $substitutionarray['__CHECK_READ__'] = ''; @@ -418,7 +419,7 @@ if (! $error && $massaction == 'confirm_presend') // Send mail (substitutionarray must be done just before this) require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,$sendtobcc,$deliveryreceipt,-1,'','',$trackid); + $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, -1, '', '', $trackid); if ($mailfile->error) { $resaction.='
'.$mailfile->error.'
'; @@ -428,7 +429,7 @@ if (! $error && $massaction == 'confirm_presend') $result=$mailfile->sendfile(); if ($result) { - $resaction.=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)).'
'; // Must not contain " + $resaction.=$langs->trans('MailSuccessfulySent', $mailfile->getValidAddress($from, 2), $mailfile->getValidAddress($sendto, 2)).'
'; // Must not contain " $error=0; @@ -497,7 +498,7 @@ if (! $error && $massaction == 'confirm_presend') $langs->load("other"); if ($mailfile->error) { - $resaction.=$langs->trans('ErrorFailedToSendMail',$from,$sendto); + $resaction.=$langs->trans('ErrorFailedToSendMail', $from, $sendto); $resaction.='
'.$mailfile->error.'
'; } else @@ -536,7 +537,7 @@ if (! $error && $massaction == 'confirm_presend') if ($massaction == 'confirm_createbills') // Create bills from orders { - $orders = GETPOST('toselect','array'); + $orders = GETPOST('toselect', 'array'); $createbills_onebythird = GETPOST('createbills_onebythird', 'int'); $validate_invoices = GETPOST('valdate_invoices', 'int'); @@ -560,9 +561,9 @@ if ($massaction == 'confirm_createbills') // Create bills from orders $objecttmp->socid = $cmd->socid; $objecttmp->type = Facture::TYPE_STANDARD; - $objecttmp->cond_reglement_id = $cmd->cond_reglement_id; - $objecttmp->mode_reglement_id = $cmd->mode_reglement_id; - $objecttmp->fk_project = $cmd->fk_project; + $objecttmp->cond_reglement_id = $cmd->cond_reglement_id; + $objecttmp->mode_reglement_id = $cmd->mode_reglement_id; + $objecttmp->fk_project = $cmd->fk_project; $datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); if (empty($datefacture)) @@ -878,9 +879,9 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se } $arrayofinclusion=array(); - foreach($listofobjectref as $tmppdf) $arrayofinclusion[]='^'.preg_quote(dol_sanitizeFileName($tmppdf),'/').'\.pdf$'; - foreach($listofobjectref as $tmppdf) $arrayofinclusion[]='^'.preg_quote(dol_sanitizeFileName($tmppdf),'/').'_[a-zA-Z0-9-_]+\.pdf$'; // To include PDF generated from ODX files - $listoffiles = dol_dir_list($uploaddir,'all',1,implode('|',$arrayofinclusion),'\.meta$|\.png','date',SORT_DESC,0,true); + foreach($listofobjectref as $tmppdf) $arrayofinclusion[]='^'.preg_quote(dol_sanitizeFileName($tmppdf), '/').'\.pdf$'; + foreach($listofobjectref as $tmppdf) $arrayofinclusion[]='^'.preg_quote(dol_sanitizeFileName($tmppdf), '/').'_[a-zA-Z0-9-_]+\.pdf$'; // To include PDF generated from ODX files + $listoffiles = dol_dir_list($uploaddir, 'all', 1, implode('|', $arrayofinclusion), '\.meta$|\.png', 'date', SORT_DESC, 0, true); // build list of files with full path $files = array(); @@ -889,7 +890,7 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se $basename = dol_sanitizeFileName($basename); foreach($listoffiles as $filefound) { - if (strstr($filefound["name"],$basename)) + if (strstr($filefound["name"], $basename)) { $files[] = $uploaddir.'/'.$basename.'/'.$filefound["name"]; break; @@ -900,11 +901,10 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se // Define output language (Here it is not used because we do only merging existing PDF) $outputlangs = $langs; $newlang=''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang=GETPOST('lang_id','aZ09'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang=GETPOST('lang_id', 'aZ09'); if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$objecttmp->thirdparty->default_lang; - if (! empty($newlang)) - { - $outputlangs = new Translate("",$conf); + if (! empty($newlang)) { + $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); } @@ -915,7 +915,7 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se // Defined name of merged file $filename=strtolower(dol_sanitizeFileName($langs->transnoentities($objectlabel))); - $filename=preg_replace('/\s/','_',$filename); + $filename=preg_replace('/\s/', '_', $filename); // Save merged file if (in_array($objecttmp->element, array('facture', 'facture_fournisseur')) && $search_status == Facture::STATUS_VALIDATED) @@ -929,7 +929,7 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se if (count($files)>0) { $now=dol_now(); - $file=$diroutputmassaction.'/'.$filename.'_'.dol_print_date($now,'dayhourlog').'.pdf'; + $file=$diroutputmassaction.'/'.$filename.'_'.dol_print_date($now, 'dayhourlog').'.pdf'; $input_files = ''; foreach($files as $f) { @@ -943,7 +943,7 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se @chmod($file, octdec($conf->global->MAIN_UMASK)); $langs->load("exports"); - setEventMessages($langs->trans('FileSuccessfullyBuilt',$filename.'_'.dol_print_date($now,'dayhourlog')), null, 'mesgs'); + setEventMessages($langs->trans('FileSuccessfullyBuilt', $filename.'_'.dol_print_date($now, 'dayhourlog')), null, 'mesgs'); } else { @@ -987,7 +987,7 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se // Defined name of merged file $filename=strtolower(dol_sanitizeFileName($langs->transnoentities($objectlabel))); - $filename=preg_replace('/\s/','_',$filename); + $filename=preg_replace('/\s/', '_', $filename); // Save merged file if (in_array($objecttmp->element, array('facture', 'facture_fournisseur')) && $search_status == Facture::STATUS_VALIDATED) @@ -1000,13 +1000,13 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se if ($pagecount) { $now=dol_now(); - $file=$diroutputmassaction.'/'.$filename.'_'.dol_print_date($now,'dayhourlog').'.pdf'; - $pdf->Output($file,'F'); + $file=$diroutputmassaction.'/'.$filename.'_'.dol_print_date($now, 'dayhourlog').'.pdf'; + $pdf->Output($file, 'F'); if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); $langs->load("exports"); - setEventMessages($langs->trans('FileSuccessfullyBuilt',$filename.'_'.dol_print_date($now,'dayhourlog')), null, 'mesgs'); + setEventMessages($langs->trans('FileSuccessfullyBuilt', $filename.'_'.dol_print_date($now, 'dayhourlog')), null, 'mesgs'); } else { @@ -1147,7 +1147,7 @@ if (! $error && ($massaction == 'delete' || ($action == 'delete' && $confirm == { $langs->load("errors"); $nbignored++; - $resaction.='
'.$langs->trans('ErrorOnlyDraftStatusCanBeDeletedInMassAction',$objecttmp->ref).'

'; + $resaction.='
'.$langs->trans('ErrorOnlyDraftStatusCanBeDeletedInMassAction', $objecttmp->ref).'

'; continue; } @@ -1211,12 +1211,12 @@ if (! $error && $massaction == 'generate_doc' && $permtoread) $outputlangs = $langs; $newlang=''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang=GETPOST('lang_id','aZ09'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang=GETPOST('lang_id', 'aZ09'); if ($conf->global->MAIN_MULTILANGS && empty($newlang) && isset($objecttmp->thirdparty->default_lang)) $newlang=$objecttmp->thirdparty->default_lang; // for proposal, order, invoice, ... if ($conf->global->MAIN_MULTILANGS && empty($newlang) && isset($objecttmp->default_lang)) $newlang=$objecttmp->default_lang; // for thirdparty if (! empty($newlang)) { - $outputlangs = new Translate("",$conf); + $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); } diff --git a/htdocs/core/tpl/card_presend.tpl.php b/htdocs/core/tpl/card_presend.tpl.php index c93dd58c640..23cccf0dd47 100644 --- a/htdocs/core/tpl/card_presend.tpl.php +++ b/htdocs/core/tpl/card_presend.tpl.php @@ -27,10 +27,9 @@ */ // Protection to avoid direct call of template -if (empty($conf) || ! is_object($conf)) -{ - print "Error, template page can't be called as URL"; - exit; +if (empty($conf) || ! is_object($conf)) { + print "Error, template page can't be called as URL"; + exit; } @@ -103,7 +102,7 @@ if ($action == 'presend') } if ($object->element == 'invoice_supplier') { - $fileparams = dol_most_recent_file($diroutput . '/' . get_exdir($object->id,2,0,0,$object,$object->element).$ref, preg_quote($ref,'/').'([^\-])+'); + $fileparams = dol_most_recent_file($diroutput . '/' . get_exdir($object->id, 2, 0, 0, $object, $object->element).$ref, preg_quote($ref, '/').'([^\-])+'); } else { diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 004f9fc3c20..b56d96e0290 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -15,6 +15,7 @@ * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2016 Charlie Benke * Copyright (C) 2016 Meziane Sof + * Copyright (C) 2019 Frédéric France * * 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 @@ -1176,11 +1177,10 @@ else // Accountancy_code_sell print ''.$langs->trans("ProductAccountancySellCode").''; print ''; - if($type = 0) - { - $accountancy_code_sell = (GETPOST('accountancy_code_sell','alpha')?(GETPOST('accountancy_code_sell','alpha')):$conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT); + if($type = 0) { + $accountancy_code_sell = (GETPOST('accountancy_code_sell', 'alpha')?(GETPOST('accountancy_code_sell', 'alpha')):$conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT); } else { - $accountancy_code_sell = (GETPOST('accountancy_code_sell','alpha')?(GETPOST('accountancy_code_sell','alpha')):$conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT); + $accountancy_code_sell = (GETPOST('accountancy_code_sell', 'alpha')?(GETPOST('accountancy_code_sell', 'alpha')):$conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT); } print $formaccounting->select_account($accountancy_code_sell, 'accountancy_code_sell', 1, null, 1, 1, ''); print ''; @@ -1190,11 +1190,10 @@ else { print ''.$langs->trans("ProductAccountancySellIntraCode").''; print ''; - if($type = 0) - { - $accountancy_code_sell_intra = (GETPOST('accountancy_code_sell_intra','alpha')?(GETPOST('accountancy_code_sell_intra','alpha')):$conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT); + if($type = 0) { + $accountancy_code_sell_intra = (GETPOST('accountancy_code_sell_intra', 'alpha')?(GETPOST('accountancy_code_sell_intra', 'alpha')):$conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT); } else { - $accountancy_code_sell_intra = GETPOST('accountancy_code_sell_intra','alpha'); + $accountancy_code_sell_intra = GETPOST('accountancy_code_sell_intra', 'alpha'); } print $formaccounting->select_account($accountancy_code_sell_intra, 'accountancy_code_sell_intra', 1, null, 1, 1, ''); print ''; @@ -1205,9 +1204,9 @@ else print ''; if($type = 0) { - $accountancy_code_sell_export = (GETPOST('accountancy_code_sell_export','alpha')?(GETPOST('accountancy_code_sell_export','alpha')):$conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT); + $accountancy_code_sell_export = (GETPOST('accountancy_code_sell_export', 'alpha')?(GETPOST('accountancy_code_sell_export', 'alpha')):$conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT); } else { - $accountancy_code_sell_export = GETPOST('accountancy_code_sell_export','alpha'); + $accountancy_code_sell_export = GETPOST('accountancy_code_sell_export', 'alpha'); } print $formaccounting->select_account($accountancy_code_sell_export, 'accountancy_code_sell_export', 1, null, 1, 1, ''); print ''; @@ -1215,7 +1214,7 @@ else // Accountancy_code_buy print ''.$langs->trans("ProductAccountancyBuyCode").''; print ''; - print $formaccounting->select_account(GETPOST('accountancy_code_buy','alpha'), 'accountancy_code_buy', 1, null, 1, 1, ''); + print $formaccounting->select_account(GETPOST('accountancy_code_buy', 'alpha'), 'accountancy_code_buy', 1, null, 1, 1, ''); print ''; } else // For external software @@ -1228,8 +1227,7 @@ else if ($conf->global->MAIN_FEATURES_LEVEL) { // Accountancy_code_sell_intra - if ($mysoc->isInEEC()) - { + if ($mysoc->isInEEC()) { print ''.$langs->trans("ProductAccountancySellIntraCode").''; print ''; print ''; diff --git a/htdocs/stripe/payout.php b/htdocs/stripe/payout.php index 8989adba058..2fec924c2bf 100644 --- a/htdocs/stripe/payout.php +++ b/htdocs/stripe/payout.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2018-2019 Thibault FOUCART + * Copyright (C) 2019 Frédéric France * * 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 @@ -31,15 +32,15 @@ if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/acco $langs->loadLangs(array('compta', 'salaries', 'bills', 'hrm', 'stripe')); // Security check -$socid = GETPOST("socid","int"); +$socid = GETPOST("socid", "int"); if ($user->societe_id) $socid=$user->societe_id; //$result = restrictedArea($user, 'salaries', '', '', ''); -$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; -$rowid = GETPOST("rowid",'alpha'); -$sortfield = GETPOST("sortfield",'alpha'); -$sortorder = GETPOST("sortorder",'alpha'); -$page = GETPOST("page",'int'); +$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; +$rowid = GETPOST("rowid", 'alpha'); +$sortfield = GETPOST("sortfield", 'alpha'); +$sortorder = GETPOST("sortorder", 'alpha'); +$page = GETPOST("page", 'int'); if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 $offset = $conf->liste_limit * $page; $pageprev = $page - 1; @@ -59,8 +60,7 @@ $stripe = new Stripe($db); llxHeader('', $langs->trans("StripePayoutList")); -if (! empty($conf->stripe->enabled) && (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox','alpha'))) -{ +if (! empty($conf->stripe->enabled) && (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'alpha'))) { $service = 'StripeTest'; $servicestatus = '0'; dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), '', 'warning'); @@ -80,8 +80,9 @@ $stripeacc = $stripe->getStripeAccount($service); if (! $rowid) { print '
'; - if ($optioncss != '') - print ''; + if ($optioncss != '') { + print ''; + } print ''; print ''; print ''; @@ -103,7 +104,7 @@ if (! $rowid) { //print_liste_field_titre("CustomerId", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder); //print_liste_field_titre("Origin", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder); print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "", "", "", 'align="center"', $sortfield, $sortorder); - print_liste_field_titre("DateOperation", $_SERVER["PHP_SELF"], "", "", "", 'align="center"', $sortfield, $sortorder); + print_liste_field_titre("DateOperation", $_SERVER["PHP_SELF"], "", "", "", 'align="center"', $sortfield, $sortorder); print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "", "", "", 'align="left"', $sortfield, $sortorder); print_liste_field_titre("Paid", $_SERVER["PHP_SELF"], "", "", "", 'align="right"', $sortfield, $sortorder); print_liste_field_titre("Fee", $_SERVER["PHP_SELF"], "", "", "", 'align="right"', $sortfield, $sortorder); @@ -168,7 +169,7 @@ if (! $rowid) { $url='https://dashboard.stripe.com/'.$connect.'payouts/'.$payout->id; } - print "".img_picto($langs->trans('ShowInStripe'), 'object_globe')." " . $payout->id . "\n"; + print "".img_picto($langs->trans('ShowInStripe'), 'object_globe')." " . $payout->id . "\n"; // Stripe customer @@ -198,7 +199,7 @@ if (! $rowid) { //print "\n"; // Date payment print '' . dol_print_date($payout->created, '%d/%m/%Y %H:%M') . "\n"; - // Date payment + // Date payment print '' . dol_print_date($payout->arrival_date, '%d/%m/%Y %H:%M') . "\n"; // Type print '' . $payout->description . ''; @@ -207,16 +208,17 @@ if (! $rowid) { print "" . price(($payout->fee) / 100, 0, '', 1, - 1, - 1, strtoupper($payout->currency)) . ""; // Status print ""; - if ($payout->status=='paid') - {print img_picto($langs->trans("".$payout->status.""),'statut4');} - elseif ($payout->status=='pending') - {print img_picto($langs->trans("".$payout->status.""),'statut7');} - elseif ($payout->status=='in_transit') - {print img_picto($langs->trans("".$payout->status.""),'statut7');} - elseif ($payout->status=='failed') - {print img_picto($langs->trans("".$payout->status.""),'statut7');} - elseif ($payout->status=='canceled') - {print img_picto($langs->trans("".$payout->status.""),'statut8');} + if ($payout->status=='paid') { + print img_picto($langs->trans("".$payout->status.""), 'statut4'); + } elseif ($payout->status=='pending') { + print img_picto($langs->trans("".$payout->status.""), 'statut7'); + } elseif ($payout->status=='in_transit') { + print img_picto($langs->trans("".$payout->status.""), 'statut7'); + } elseif ($payout->status=='failed') { + print img_picto($langs->trans("".$payout->status.""), 'statut7'); + } elseif ($payout->status=='canceled') { + print img_picto($langs->trans("".$payout->status.""), 'statut8'); + } print ''; print "\n"; }