wip
This commit is contained in:
parent
f83ee43a19
commit
b766204690
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2016 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2016-2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
*
|
||||
* 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)
|
||||
{
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
<?php
|
||||
/* Copyright (C) 2015-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
* Copyright (C) 2018 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2019 Ferran Marcet <fmarcet@2byte.es>
|
||||
/* Copyright (C) 2015-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
* Copyright (C) 2018 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2019 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -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.='<div class="error">'.$langs->trans('ErrorOnlyProposalNotDraftCanBeSentInMassAction',$objectobj->ref).'</div><br>';
|
||||
$resaction.='<div class="error">'.$langs->trans('ErrorOnlyProposalNotDraftCanBeSentInMassAction', $objectobj->ref).'</div><br>';
|
||||
continue; // Payment done or started or canceled
|
||||
}
|
||||
if ($objectclass == 'Commande' && $objectoj->statut == Commande::STATUS_DRAFT)
|
||||
{
|
||||
$langs->load("errors");
|
||||
$nbignored++;
|
||||
$resaction.='<div class="error">'.$langs->trans('ErrorOnlyOrderNotDraftCanBeSentInMassAction',$objectobj->ref).'</div><br>';
|
||||
$resaction.='<div class="error">'.$langs->trans('ErrorOnlyOrderNotDraftCanBeSentInMassAction', $objectobj->ref).'</div><br>';
|
||||
continue;
|
||||
}
|
||||
if ($objectclass == 'Facture' && $objectobj->statut == Facture::STATUS_DRAFT)
|
||||
{
|
||||
$langs->load("errors");
|
||||
$nbignored++;
|
||||
$resaction.='<div class="error">'.$langs->trans('ErrorOnlyInvoiceValidatedCanBeSentInMassAction',$objectobj->ref).'</div><br>';
|
||||
$resaction.='<div class="error">'.$langs->trans('ErrorOnlyInvoiceValidatedCanBeSentInMassAction', $objectobj->ref).'</div><br>';
|
||||
continue; // Payment done or started or canceled
|
||||
}
|
||||
|
||||
@ -258,7 +259,7 @@ if (! $error && $massaction == 'confirm_presend')
|
||||
$nbignored++;
|
||||
if (empty($thirdpartywithoutemail[$objectobj->thirdparty->id]))
|
||||
{
|
||||
$resaction.='<div class="error">'.$langs->trans('NoRecipientEmail',$objectobj->thirdparty->name).'</div><br>';
|
||||
$resaction.='<div class="error">'.$langs->trans('NoRecipientEmail', $objectobj->thirdparty->name).'</div><br>';
|
||||
}
|
||||
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.='<div class="error">'.$langs->trans('ErrorCantReadFile',$file).'</div><br>';
|
||||
$resaction.='<div class="error">'.$langs->trans('ErrorCantReadFile', $file).'</div><br>';
|
||||
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__'] = '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$thirdparty->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>';
|
||||
|
||||
@ -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.='<div class="error">'.$mailfile->error.'</div>';
|
||||
@ -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)).'<br>'; // Must not contain "
|
||||
$resaction.=$langs->trans('MailSuccessfulySent', $mailfile->getValidAddress($from, 2), $mailfile->getValidAddress($sendto, 2)).'<br>'; // 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.='<br><div class="error">'.$mailfile->error.'</div>';
|
||||
}
|
||||
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.='<div class="error">'.$langs->trans('ErrorOnlyDraftStatusCanBeDeletedInMassAction',$objecttmp->ref).'</div><br>';
|
||||
$resaction.='<div class="error">'.$langs->trans('ErrorOnlyDraftStatusCanBeDeletedInMassAction', $objecttmp->ref).'</div><br>';
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
{
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
|
||||
* Copyright (C) 2016 Meziane Sof <virtualsof@yahoo.fr>
|
||||
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -1176,11 +1177,10 @@ else
|
||||
// Accountancy_code_sell
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancySellCode").'</td>';
|
||||
print '<td>';
|
||||
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 '</td></tr>';
|
||||
@ -1190,11 +1190,10 @@ else
|
||||
{
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancySellIntraCode").'</td>';
|
||||
print '<td>';
|
||||
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 '</td></tr>';
|
||||
@ -1205,9 +1204,9 @@ else
|
||||
print '<td>';
|
||||
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 '</td></tr>';
|
||||
@ -1215,7 +1214,7 @@ else
|
||||
// Accountancy_code_buy
|
||||
print '<tr><td>'.$langs->trans("ProductAccountancyBuyCode").'</td>';
|
||||
print '<td>';
|
||||
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 '</td></tr>';
|
||||
}
|
||||
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 '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancySellIntraCode").'</td>';
|
||||
print '<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code_sell_intra" value="'.$object->accountancy_code_sell_intra.'">';
|
||||
print '</td></tr>';
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2018-2019 Thibault FOUCART <support@ptibogxiv.net>
|
||||
/* Copyright (C) 2018-2019 Thibault FOUCART <support@ptibogxiv.net>
|
||||
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -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 '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">';
|
||||
if ($optioncss != '')
|
||||
print '<input type="hidden" name="optioncss" value="' . $optioncss . '">';
|
||||
if ($optioncss != '') {
|
||||
print '<input type="hidden" name="optioncss" value="' . $optioncss . '">';
|
||||
}
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
@ -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 "<td><a href='".$url."' target='_stripe'>".img_picto($langs->trans('ShowInStripe'), 'object_globe')." " . $payout->id . "</a></td>\n";
|
||||
print "<td><a href='".$url."' target='_stripe'>".img_picto($langs->trans('ShowInStripe'), 'object_globe')." " . $payout->id . "</a></td>\n";
|
||||
|
||||
|
||||
// Stripe customer
|
||||
@ -198,7 +199,7 @@ if (! $rowid) {
|
||||
//print "</td>\n";
|
||||
// Date payment
|
||||
print '<td align="center">' . dol_print_date($payout->created, '%d/%m/%Y %H:%M') . "</td>\n";
|
||||
// Date payment
|
||||
// Date payment
|
||||
print '<td align="center">' . dol_print_date($payout->arrival_date, '%d/%m/%Y %H:%M') . "</td>\n";
|
||||
// Type
|
||||
print '<td>' . $payout->description . '</td>';
|
||||
@ -207,16 +208,17 @@ if (! $rowid) {
|
||||
print "<td align=\"right\">" . price(($payout->fee) / 100, 0, '', 1, - 1, - 1, strtoupper($payout->currency)) . "</td>";
|
||||
// Status
|
||||
print "<td align='right'>";
|
||||
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 '</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user