From 0e7ba927849d51e787dd9ae3b9c3c3598a512b52 Mon Sep 17 00:00:00 2001 From: patrick Delcroix Date: Thu, 5 Jul 2018 21:34:36 +0200 Subject: [PATCH 01/51] New: Accounting dossier file checks page Page to check to attachement of those operation invoice, invoicesupplier, salary, donation, Expense, tax --- htdocs/compta/compta-files.php | 341 +++++++++++++++++++++++ htdocs/core/tpl/extrafields_view.tpl.php | 182 ------------ 2 files changed, 341 insertions(+), 182 deletions(-) create mode 100644 htdocs/compta/compta-files.php delete mode 100644 htdocs/core/tpl/extrafields_view.tpl.php diff --git a/htdocs/compta/compta-files.php b/htdocs/compta/compta-files.php new file mode 100644 index 00000000000..d48679c5291 --- /dev/null +++ b/htdocs/compta/compta-files.php @@ -0,0 +1,341 @@ + + * Copyright (C) 2004-2017 Laurent Destailleur + * Copyright (C) 2017 Pierre-Henry Favre + * + * 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 . + */ + +/** + * \file htdocs/compta/recap-compta.php + * \ingroup compta + * \brief Page de fiche recap customer + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'; +restrictedArea($user,'banque'); + +$langs->load("companies"); +if (! empty($conf->facture->enabled)) $langs->load("bills"); + +$date_start =GETPOST('date_start','alpha'); +$date_startDay= GETPOST('date_startday','int'); +$date_startMonth= GETPOST('date_startmonth','int'); +$date_startYear= GETPOST('date_startyear','int'); +$date_start=($date_startDay)?dol_mktime(0,0,0,$date_startMonth,$date_startDay,$date_startYear):strtotime($date_start); + +$date_stop =GETPOST('date_stop','alpha'); +$date_stopDay= GETPOST('date_stopday','int'); +$date_stopMonth= GETPOST('date_stopmonth','int'); +$date_stopYear= GETPOST('date_stopyear','int'); +//FIXME doldate +$date_stop=($date_stopDay)?dol_mktime(0,0,0,$date_stopMonth,$date_stopDay,$date_stopYear):strtotime($date_stop); + +$action =GETPOST('action','alpha'); +// Security check +//if ($user->societe_id) $id=$user->societe_id; +//$result = restrictedArea($user, 'societe', $id, '&societe'); + +//$object = new Societe($db); +//if ($id > 0) $object->fetch($id); + + +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('comptafilescard','globalcard')); + +// Load variable for pagination +$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; +$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 = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; +if (! $sortfield) $sortfield="f.datef,f.rowid"; // Set here default search field +if (! $sortorder) $sortorder="DESC"; + + +$arrayfields=array( + 'date'=>array('label'=>"Date", 'checked'=>1), + //... +); + +/* + * Actions + */ +//$parameters = array('socid' => $id); +//$reshook = $hookmanager->executeHooks('doActions', $parameters, $object); // Note that $object may have been modified by some hooks +//if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + +/* + * Fetch the lines/files from db / + */ +$filesarray=array(); +$result=false; +if(($action=="searchfiles"||$action=="dl" ) && $date_start && $date_stop){ + $wheretail=" '".$db->idate($date_start)."' AND '".$db->idate($date_stop)."'"; + $sql="SELECT rowid, facnumber as ref,paye as paid,total_ttc,fk_soc,datef as date, 'Invoice' as item FROM ".MAIN_DB_PREFIX."facture"; + $sql.=" WHERE datef between ".$wheretail; + $sql.=" UNION ALL"; + $sql.=" SELECT rowid,ref, paye as paid, total_ttc, fk_soc,datef as date, 'InvoiceSupplier' as item FROM ".MAIN_DB_PREFIX."facture_fourn"; + $sql.=" WHERE datef between ".$wheretail; + $sql.=" UNION ALL"; + $sql.=" SELECT rowid,ref,paid,total_ttc,fk_user_author as fk_soc,date_fin as date,'Expense' as item FROM ".MAIN_DB_PREFIX."expensereport"; + $sql.=" WHERE date_fin between ".$wheretail; + $sql.=" UNION ALL"; + $sql.=" SELECT rowid,ref,paid,amount as total_ttc,CONCAT(firstname,' ',lastname) as fk_soc,datedon as date,'Donation' as item FROM ".MAIN_DB_PREFIX."don"; + $sql.=" WHERE datedon between ".$wheretail; + $sql.=" UNION ALL"; + $sql.=" SELECT rowid,label as ref,1 as paid,amount as total_ttc,fk_user as fk_soc,datep as date,'Salary' as item FROM ".MAIN_DB_PREFIX."payment_salary"; + $sql.=" WHERE datep between ".$wheretail; + $sql.=" UNION ALL"; + $sql.=" SELECT rowid,num_paiement as ref,1 as paid,amount as total_ttc,fk_charge as fk_soc,datep as date,'Charge' as item FROM ".MAIN_DB_PREFIX."paiementcharge"; + $sql.=" WHERE datep between ".$wheretail; + $resd = $db->query($sql); + $files=array(); + $link=''; + + if ($resd) + { + $numd = $db->num_rows($resd); + + $upload_dir =''; + $i=0; + while($i<$numd) + { + + + $objd = $db->fetch_object($resd); + + switch($objd->item){ + case "Invoice": + $subdir=dol_sanitizeFileName($objd->ref); + $upload_dir = $conf->facture->dir_output.'/'.$subdir; + $link="../../document.php?modulepart=facture&file=".str_replace('/','%2F',$subdir).'%2F'; + break; + case "InvoiceSupplier": + $subdir=get_exdir($objd->id,2,0,0,$objd,'invoice_supplier').$objd->ref; + $upload_dir = $conf->fournisseur->facture->dir_output.'/'.$subdir; + $link="../../document.php?modulepart=facture_fournisseur&file=".str_replace('/','%2F',$subdir).'%2F'; + break; + case "Expense": + $subdir=dol_sanitizeFileName($objd->ref); + $upload_dir = $conf->expensereport->dir_output.'/'.$subdir; + $link="../../document.php?modulepart=expensereport&file=".str_replace('/','%2F',$subdir).'%2F'; + break; + case "Salary": + $subdir=dol_sanitizeFileName($objd->rowid); + $upload_dir = $conf->salaries->dir_output.'/'.$subdir; + $link="../../document.php?modulepart=salaries&file=".str_replace('/','%2F',$subdir).'%2F'; + break; + case "Donation": + $subdir=get_exdir(null,2,0,1,$objd,'donation'). '/'. dol_sanitizeFileName($objd->idd); + $upload_dir = $conf->don->dir_output . '/' . $subdir; + $link="../../document.php?modulepart=don&file=".str_replace('/','%2F',$subdir).'%2F'; + break; + case "Charge": + $subdir=dol_sanitizeFileName($objd->rowid); + $upload_dir = $conf->tax->dir_output . '/' . $subdir; + $link="../../document.php?modulepart=tax&file=".str_replace('/','%2F',$subdir).'%2F'; + break; + default: + break; + } + + if(!empty($upload_dir)){ + $result=true; + $files=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$','',SORT_ASC,1); + foreach ($files as $key => $file){ + $file['date']=$db->idate($objd->date); + $file['paid']=$objd->paid; + $file['amount']=$objd->total_ttc; + $file['ref']=$objd->ref; + $file['fk']=$objd->fk_soc; + $file['item']=$objd->item; + $file['link']=$link.$file['name']; + $out.= '
'.$file['name'].''; + $filesarray[]=$file; + } + if(count($files)<1){ + $nofile['date']=$db->idate($objd->date); + $nofile['paid']=$objd->paid; + $nofile['amount']=$objd->total_ttc; + $nofile['ref']=$objd->ref; + $nofile['fk']=$objd->fk_soc; + $nofile['item']=$objd->item; + + $filesarray[]=$nofile; + } + } + $i++; + } + } + $db->free($resd); + +} +/* + * cleanup of old ZIP + */ +//FIXME + + +/* +*ZIP creation +*/ +if($result & $action=="dl"){ + unset($zip); + $log='date,type,ref,total,paid,filename,item_id'."\n"; + $zipname = 'export.zip'; + $zip = new ZipArchive; + $res = $zip->open($zipname, ZipArchive::OVERWRITE|ZipArchive::CREATE); + if ($res){ + foreach ($filesarray as $key=> $file) { + + if(file_exists($file["fullname"])) $zip->addFile($file["fullname"],$file["name"]);// + $log.=$file['date'].','.$file['item'].','.$file['ref'].','.$file['amount'].','.$file['paid'].','.$file["name"].','.$file['fk']."\n"; + } + + + $zip->addFromString('log.csv', $log); + $zip->close(); + ///Then download the zipped file. + header('Content-Type: application/zip'); + header('Content-disposition: attachment; filename='.$zipname); + header('Content-Length: ' . filesize($zipname)); + readfile($zipname); + exit(); + } +} + + +// None + + +/* + * View + */ + +$form = new Form($db); +$userstatic=new User($db); + +$title=$langs->trans("ComptaFiles").' - '.$langs->trans("List"); +//if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name.' - '.$langs->trans("Symmary"); +$help_url='EN:Module_Accounting|FR:Module_Compatibilite'; //FIXME + +llxHeader('',$title,$help_url); + +print '
'."\n\t\t\t"; +print ''.$langs->trans("dateStart").': '.$form->select_date($date_start,'date_start',0,0,0,"",1,1,1)."\n"; +print ''.$langs->trans("dateStop").': '.$form->select_date($date_stop,'date_stop',0,0,0,"",1,1,1)."\n"; + +print '
'."\n\t\t"; + +if (!empty($date_start) && !empty($date_stop))echo dol_print_date($date_start)." - ".dol_print_date($date_stop); +print ''; +print ''; +//if (! empty($arrayfields['f.datef']['checked'])) +print_liste_field_titre($arrayfields['date']['label'],$_SERVER["PHP_SELF"],"date","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; + +print ''; + +if ($result) +{ + $TData = dol_sort_array($filesarray, 'date', 'ASC'); + if(empty($TData)) { + print ''; + } else { + + // Sort array by date ASC to calucalte balance + + $totalDebit = 0; + $totalCredit = 0; + // Balance calculation + $balance = 0; + foreach($TData as &$data1) { + if($data1['item']=='Invoice'||$data1['item']=='Donation' ){ + $balance += $data1['amount']; + $totalCredit+=$data1['amount']; + }else{ + $balance -= $data1['amount']; + $totalDebit+=$data1['amount']; + } + $data1['balance'] = $balance; + } + + + + // Display array + foreach($TData as $data) { + + $html_class = ''; + //if (!empty($data['fk_facture'])) $html_class = 'facid-'.$data['fk_facture']; + //elseif (!empty($data['fk_paiement'])) $html_class = 'payid-'.$data['fk_paiement']; + + print ''; + + print "\n"; + print ''; + print ''; + print '\n"; + + print ''; + print '\n"; + $totalDebit += ($data['amount'] > 0) ? abs($data['amount']) : 0; + print '\n"; + $totalCredit += ($data['amount'] > 0) ? 0 : abs($data['amount']); + // Balance + print '\n"; + + + + print "\n"; + } + + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print "\n"; + } + + + } +print "
'.$langs->trans("Type").''.$langs->trans("Ref").''.$langs->trans("File").''.$langs->trans("Paid").''.$langs->trans("Debit").''.$langs->trans("Credit").''.$langs->trans("Balance").'
'.$langs->trans("NoItem").'
"; + print dol_print_date($data['date'],'day'); + print "'.$data['item'].''.$data['ref'].' ".$data['name']."'.$data['paid'].''.(($data['amount'] > 0) ? price(abs($data['amount'])) : '')."'.(($data['amount'] > 0) ? '' : price(abs($data['amount'])))."'.price($data['balance'])."
 '.price($totalDebit).''.price($totalCredit).''.price(price2num($totalDebit - $totalCredit, 'MT')).'
"; +print '
'."\n\t\t\t"; +print ''; +print ''; +print '
'."\n\t\t\n\t\t\n\t\t\t"; + +llxFooter(); + +$db->close(); diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php deleted file mode 100644 index 3559df44c9c..00000000000 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ /dev/null @@ -1,182 +0,0 @@ - - * Copyright (C) 2014 Juanjo Menent - * - * 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 . - * - * Need to have following variables defined: - * $object (invoice, order, ...) - * $action - * $conf - * $langs - * - * $parameters - * $cols - */ - -// Protection to avoid direct call of template -if (empty($object) || ! is_object($object)) -{ - print "Error, template page can't be called as URL"; - exit; -} - -?> - -fk_soc)) $parameters['socid'] = $object->fk_soc; - -$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); -print $hookmanager->resPrint; -if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - -//var_dump($extrafields->attributes); -if (empty($reshook) && ! empty($extrafields->attributes[$object->table_element]['label'])) -{ - foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $label) - { - // Discard if extrafield is a hidden field on form - if (empty($extrafields->attributes[$object->table_element]['list'][$key])) continue; // 0 = Never visible field - if (abs($extrafields->attributes[$object->table_element]['list'][$key]) != 1 && abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3) continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list - - // Load language if required - if (! empty($extrafields->attributes[$object->table_element]['langfile'][$key])) $langs->load($extrafields->attributes[$object->table_element]['langfile'][$key]); - - if ($action == 'edit_extras') - { - $value = (isset($_POST["options_" . $key]) ? $_POST["options_" . $key] : $object->array_options["options_" . $key]); - } - else - { - $value = $object->array_options["options_" . $key]; - } - if ($extrafields->attributes[$object->table_element]['type'][$key] == 'separate') - { - print $extrafields->showSeparator($key); - } - else - { - print ''; - print ''; - print ''; - print 'attributes[$object->table_element]['required'][$key])) print ' class="fieldrequired"'; - print '>' . $langs->trans($label) . ''; - - //TODO Improve element and rights detection - //var_dump($user->rights); - $permok=false; - - $keyforperm=$object->element; - if ($object->element == 'fichinter') $keyforperm='ficheinter'; - if (isset($user->rights->$keyforperm)) $permok=$user->rights->$keyforperm->creer||$user->rights->$keyforperm->create||$user->rights->$keyforperm->write; - - if ($object->element=='order_supplier') $permok=$user->rights->fournisseur->commande->creer; - if ($object->element=='invoice_supplier') $permok=$user->rights->fournisseur->facture->creer; - if ($object->element=='shipping') $permok=$user->rights->expedition->creer; - if ($object->element=='delivery') $permok=$user->rights->expedition->livraison->creer; - if ($object->element=='productlot') $permok=$user->rights->stock->creer; - if ($object->element=='facturerec') $permok=$user->rights->facture->creer; - - if (($object->statut == 0 || ! empty($extrafields->attributes[$object->table_element]['alwayseditable'][$key])) - && $permok && ($action != 'edit_extras' || GETPOST('attribute') != $key) - && empty($extrafields->attributes[$object->table_element]['computed'][$key])) - { - $fieldid='id'; - if ($object->table_element == 'societe') $fieldid='socid'; - print ''; - } - print '
' . img_edit().'
'; - $html_id = !empty($object->id) ? $object->element.'_extras_'.$key.'_'.$object->id : ''; - print ''; - - // Convert date into timestamp format - if (in_array($extrafields->attributes[$object->table_element]['type'][$key], array('date','datetime'))) - { - $datenotinstring = $object->array_options['options_' . $key]; - // print 'X'.$object->array_options['options_' . $key].'-'.$datenotinstring.'x'; - if (! is_numeric($object->array_options['options_' . $key])) // For backward compatibility - { - $datenotinstring = $db->jdate($datenotinstring); - } - //print 'x'.$object->array_options['options_' . $key].'-'.$datenotinstring.' - '.dol_print_date($datenotinstring, 'dayhour'); - $value = isset($_POST["options_" . $key]) ? dol_mktime($_POST["options_" . $key . "hour"], $_POST["options_" . $key . "min"], 0, $_POST["options_" . $key . "month"], $_POST["options_" . $key . "day"], $_POST["options_" . $key . "year"]) : $datenotinstring; - } - - //TODO Improve element and rights detection - if ($action == 'edit_extras' && $permok && GETPOST('attribute') == $key) - { - $fieldid='id'; - if ($object->table_element == 'societe') $fieldid='socid'; - - print '
'; - print ''; - print ''; - print ''; - print ''; - - print $extrafields->showInputField($key, $value, '', '', '', 0, $object->id); - - print ''; - - print '
'; - } - else - { - print $extrafields->showOutputField($key, $value, '', (empty($extrafieldsobjectkey)?'':$extrafieldsobjectkey)); - } - print '' . "\n"; - - print "\n"; - // Add code to manage list depending on others - if (! empty($conf->use_javascript_ajax)) - print ' - '."\n"; - } - } -} -?> - \ No newline at end of file From e88dd77ea557afd6c507cd6cc52a93bec59a7e1e Mon Sep 17 00:00:00 2001 From: delcroix Patrick Date: Thu, 5 Jul 2018 21:42:34 +0200 Subject: [PATCH 02/51] no change --- htdocs/core/tpl/extrafields_view.tpl.php | 163 +++++++++++++++++++++++ 1 file changed, 163 insertions(+) create mode 100644 htdocs/core/tpl/extrafields_view.tpl.php diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php new file mode 100644 index 00000000000..f88a9d1bdf7 --- /dev/null +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -0,0 +1,163 @@ + + * Copyright (C) 2014 Juanjo Menent + * + * 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 . + * + * Need to have following variables defined: + * $object (invoice, order, ...) + * $action + * $conf + * $langs + * + * $parameters + * $cols + */ +// Protection to avoid direct call of template +if (empty($object) || ! is_object($object)) +{ + print "Error, template page can't be called as URL"; + exit; +} +?> + +fk_soc)) $parameters['socid'] = $object->fk_soc; +$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); +print $hookmanager->resPrint; +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); +//var_dump($extrafields->attributes); +if (empty($reshook) && ! empty($extrafields->attributes[$object->table_element]['label'])) +{ + foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $label) + { + // Discard if extrafield is a hidden field on form + if (empty($extrafields->attributes[$object->table_element]['list'][$key])) continue; // 0 = Never visible field + if (abs($extrafields->attributes[$object->table_element]['list'][$key]) != 1 && abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3) continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list + // Load language if required + if (! empty($extrafields->attributes[$object->table_element]['langfile'][$key])) $langs->load($extrafields->attributes[$object->table_element]['langfile'][$key]); + if ($action == 'edit_extras') + { + $value = (isset($_POST["options_" . $key]) ? $_POST["options_" . $key] : $object->array_options["options_" . $key]); + } + else + { + $value = $object->array_options["options_" . $key]; + } + if ($extrafields->attributes[$object->table_element]['type'][$key] == 'separate') + { + print $extrafields->showSeparator($key); + } + else + { + print ''; + print ''; + print ''; + print 'attributes[$object->table_element]['required'][$key])) print ' class="fieldrequired"'; + print '>' . $langs->trans($label) . ''; + //TODO Improve element and rights detection + //var_dump($user->rights); + $permok=false; + $keyforperm=$object->element; + if ($object->element == 'fichinter') $keyforperm='ficheinter'; + if (isset($user->rights->$keyforperm)) $permok=$user->rights->$keyforperm->creer||$user->rights->$keyforperm->create||$user->rights->$keyforperm->write; + if ($object->element=='order_supplier') $permok=$user->rights->fournisseur->commande->creer; + if ($object->element=='invoice_supplier') $permok=$user->rights->fournisseur->facture->creer; + if ($object->element=='shipping') $permok=$user->rights->expedition->creer; + if ($object->element=='delivery') $permok=$user->rights->expedition->livraison->creer; + if ($object->element=='productlot') $permok=$user->rights->stock->creer; + if ($object->element=='facturerec') $permok=$user->rights->facture->creer; + if (($object->statut == 0 || ! empty($extrafields->attributes[$object->table_element]['alwayseditable'][$key])) + && $permok && ($action != 'edit_extras' || GETPOST('attribute') != $key) + && empty($extrafields->attributes[$object->table_element]['computed'][$key])) + { + $fieldid='id'; + if ($object->table_element == 'societe') $fieldid='socid'; + print ''; + } + print '
' . img_edit().'
'; + $html_id = !empty($object->id) ? $object->element.'_extras_'.$key.'_'.$object->id : ''; + print ''; + // Convert date into timestamp format + if (in_array($extrafields->attributes[$object->table_element]['type'][$key], array('date','datetime'))) + { + $datenotinstring = $object->array_options['options_' . $key]; + // print 'X'.$object->array_options['options_' . $key].'-'.$datenotinstring.'x'; + if (! is_numeric($object->array_options['options_' . $key])) // For backward compatibility + { + $datenotinstring = $db->jdate($datenotinstring); + } + //print 'x'.$object->array_options['options_' . $key].'-'.$datenotinstring.' - '.dol_print_date($datenotinstring, 'dayhour'); + $value = isset($_POST["options_" . $key]) ? dol_mktime($_POST["options_" . $key . "hour"], $_POST["options_" . $key . "min"], 0, $_POST["options_" . $key . "month"], $_POST["options_" . $key . "day"], $_POST["options_" . $key . "year"]) : $datenotinstring; + } + //TODO Improve element and rights detection + if ($action == 'edit_extras' && $permok && GETPOST('attribute') == $key) + { + $fieldid='id'; + if ($object->table_element == 'societe') $fieldid='socid'; + print '
'; + print ''; + print ''; + print ''; + print ''; + print $extrafields->showInputField($key, $value, '', '', '', 0, $object->id); + print ''; + print '
'; + } + else + { + print $extrafields->showOutputField($key, $value, '', (empty($extrafieldsobjectkey)?'':$extrafieldsobjectkey)); + } + print '' . "\n"; + print "\n"; + // Add code to manage list depending on others + if (! empty($conf->use_javascript_ajax)) + print ' + '."\n"; + } + } +} +?> + From a90974378e1c540643515a8e478bd9a115abc168 Mon Sep 17 00:00:00 2001 From: patrick Delcroix Date: Thu, 5 Jul 2018 22:31:29 +0200 Subject: [PATCH 03/51] FIX: credit / debit --- htdocs/compta/compta-files.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/compta-files.php b/htdocs/compta/compta-files.php index d48679c5291..a04cd2a7c66 100644 --- a/htdocs/compta/compta-files.php +++ b/htdocs/compta/compta-files.php @@ -278,13 +278,15 @@ if ($result) // Balance calculation $balance = 0; foreach($TData as &$data1) { - if($data1['item']=='Invoice'||$data1['item']=='Donation' ){ - $balance += $data1['amount']; - $totalCredit+=$data1['amount']; + if($data1['item']!='Invoice'&& $data1['item']!='Donation' ){ + $data1['amount']=-$data1['amount']; + } + if ($data1['amount']>0){ + }else{ - $balance -= $data1['amount']; - $totalDebit+=$data1['amount']; + } + $balance += $data1['amount']; $data1['balance'] = $balance; } @@ -320,7 +322,7 @@ if ($result) } print ''; - print ' '; + print ' '; print ''.price($totalDebit).''; print ''.price($totalCredit).''; print ''.price(price2num($totalDebit - $totalCredit, 'MT')).''; From 09dfcc601638c06a47a9d0f4c50af20705642105 Mon Sep 17 00:00:00 2001 From: atm-quentin Date: Fri, 3 Aug 2018 14:54:21 +0200 Subject: [PATCH 04/51] FIX exclude element of the select --- htdocs/projet/element.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index dd19ceeb263..5952be3264d 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -697,7 +697,9 @@ foreach ($listofreferent as $key => $value) $urlnew=$value['urlnew']; $buttonnew=$value['buttonnew']; $testnew=$value['testnew']; + $exclude_select_element=array('payment_various',$value['exclude_select_element']); + if ($qualified) { // If we want the project task array to have details of users @@ -717,7 +719,7 @@ foreach ($listofreferent as $key => $value) if (! empty($conf->global->PROJECT_OTHER_THIRDPARTY_ID_TO_ADD_ELEMENTS)) $idtofilterthirdparty.=','.$conf->global->PROJECT_OTHER_THIRDPARTY_ID_TO_ADD_ELEMENTS; } - if (empty($conf->global->PROJECT_LINK_ON_OVERWIEW_DISABLED) && $idtofilterthirdparty && !in_array($tablename, array('payment_various'))) + if (empty($conf->global->PROJECT_LINK_ON_OVERWIEW_DISABLED) && $idtofilterthirdparty && !in_array($tablename,$exclude_select_element)) { $selectList=$formproject->select_element($tablename, $idtofilterthirdparty, 'minwidth300'); if (! $selectList || ($selectList<0)) From ec9eeb5201c9c7bc3dfbb85e82a57c2f85f15920 Mon Sep 17 00:00:00 2001 From: atm-quentin Date: Mon, 27 Aug 2018 10:17:18 +0200 Subject: [PATCH 05/51] FIX check !empty exclude select element --- htdocs/projet/element.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 5952be3264d..03a5bfc0880 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -697,9 +697,10 @@ foreach ($listofreferent as $key => $value) $urlnew=$value['urlnew']; $buttonnew=$value['buttonnew']; $testnew=$value['testnew']; - $exclude_select_element=array('payment_various',$value['exclude_select_element']); + $exclude_select_element = array('payment_various'); + if (!empty($value['exclude_select_element'])) $exclude_select_element[] = $value['exclude_select_element']; + - if ($qualified) { // If we want the project task array to have details of users From e3920edb79b1c5778668c5169c09f9c6cfacb585 Mon Sep 17 00:00:00 2001 From: delcroix Patrick Date: Tue, 11 Sep 2018 21:53:47 +0200 Subject: [PATCH 06/51] correct for invoice supplier links --- htdocs/compta/compta-files.php | 166 +++++++++++++-------------------- 1 file changed, 64 insertions(+), 102 deletions(-) diff --git a/htdocs/compta/compta-files.php b/htdocs/compta/compta-files.php index a04cd2a7c66..679d21c000f 100644 --- a/htdocs/compta/compta-files.php +++ b/htdocs/compta/compta-files.php @@ -16,13 +16,11 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - /** * \file htdocs/compta/recap-compta.php - * \ingroup compta + * \ingroup compta * \brief Page de fiche recap customer */ - require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -32,35 +30,27 @@ require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'; restrictedArea($user,'banque'); - $langs->load("companies"); if (! empty($conf->facture->enabled)) $langs->load("bills"); - -$date_start =GETPOST('date_start','alpha'); +$date_start =GETPOST('date_start','alpha'); $date_startDay= GETPOST('date_startday','int'); $date_startMonth= GETPOST('date_startmonth','int'); $date_startYear= GETPOST('date_startyear','int'); $date_start=($date_startDay)?dol_mktime(0,0,0,$date_startMonth,$date_startDay,$date_startYear):strtotime($date_start); - -$date_stop =GETPOST('date_stop','alpha'); +$date_stop =GETPOST('date_stop','alpha'); $date_stopDay= GETPOST('date_stopday','int'); $date_stopMonth= GETPOST('date_stopmonth','int'); $date_stopYear= GETPOST('date_stopyear','int'); -//FIXME doldate +//FIXME doldate $date_stop=($date_stopDay)?dol_mktime(0,0,0,$date_stopMonth,$date_stopDay,$date_stopYear):strtotime($date_stop); - -$action =GETPOST('action','alpha'); +$action =GETPOST('action','alpha'); // Security check //if ($user->societe_id) $id=$user->societe_id; //$result = restrictedArea($user, 'societe', $id, '&societe'); - //$object = new Societe($db); //if ($id > 0) $object->fetch($id); - - // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('comptafilescard','globalcard')); - // Load variable for pagination $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; $sortfield = GETPOST('sortfield','alpha'); @@ -72,95 +62,91 @@ $pageprev = $page - 1; $pagenext = $page + 1; if (! $sortfield) $sortfield="f.datef,f.rowid"; // Set here default search field if (! $sortorder) $sortorder="DESC"; - - $arrayfields=array( 'date'=>array('label'=>"Date", 'checked'=>1), //... ); - /* * Actions */ //$parameters = array('socid' => $id); //$reshook = $hookmanager->executeHooks('doActions', $parameters, $object); // Note that $object may have been modified by some hooks //if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - /* - * Fetch the lines/files from db / + * Fetch the lines/files from db / */ $filesarray=array(); $result=false; if(($action=="searchfiles"||$action=="dl" ) && $date_start && $date_stop){ $wheretail=" '".$db->idate($date_start)."' AND '".$db->idate($date_stop)."'"; - $sql="SELECT rowid, facnumber as ref,paye as paid,total_ttc,fk_soc,datef as date, 'Invoice' as item FROM ".MAIN_DB_PREFIX."facture"; + $sql="SELECT rowid as id, facnumber as ref,paye as paid,total_ttc,fk_soc,datef as date, 'Invoice' as item FROM ".MAIN_DB_PREFIX."facture"; $sql.=" WHERE datef between ".$wheretail; $sql.=" UNION ALL"; - $sql.=" SELECT rowid,ref, paye as paid, total_ttc, fk_soc,datef as date, 'InvoiceSupplier' as item FROM ".MAIN_DB_PREFIX."facture_fourn"; + $sql.=" SELECT rowid as id,ref, paye as paid, total_ttc, fk_soc,datef as date, 'InvoiceSupplier' as item FROM ".MAIN_DB_PREFIX."facture_fourn"; $sql.=" WHERE datef between ".$wheretail; $sql.=" UNION ALL"; - $sql.=" SELECT rowid,ref,paid,total_ttc,fk_user_author as fk_soc,date_fin as date,'Expense' as item FROM ".MAIN_DB_PREFIX."expensereport"; + $sql.=" SELECT rowid as id,ref,paid,total_ttc,fk_user_author as fk_soc,date_fin as date,'Expense' as item FROM ".MAIN_DB_PREFIX."expensereport"; $sql.=" WHERE date_fin between ".$wheretail; $sql.=" UNION ALL"; - $sql.=" SELECT rowid,ref,paid,amount as total_ttc,CONCAT(firstname,' ',lastname) as fk_soc,datedon as date,'Donation' as item FROM ".MAIN_DB_PREFIX."don"; + $sql.=" SELECT rowid as id,ref,paid,amount as total_ttc,CONCAT(firstname,' ',lastname) as fk_soc,datedon as date,'Donation' as item FROM ".MAIN_DB_PREFIX."don"; $sql.=" WHERE datedon between ".$wheretail; $sql.=" UNION ALL"; - $sql.=" SELECT rowid,label as ref,1 as paid,amount as total_ttc,fk_user as fk_soc,datep as date,'Salary' as item FROM ".MAIN_DB_PREFIX."payment_salary"; + $sql.=" SELECT rowid as id,label as ref,1 as paid,amount as total_ttc,fk_user as fk_soc,datep as date,'Salary' as item FROM ".MAIN_DB_PREFIX."payment_salary"; $sql.=" WHERE datep between ".$wheretail; $sql.=" UNION ALL"; - $sql.=" SELECT rowid,num_paiement as ref,1 as paid,amount as total_ttc,fk_charge as fk_soc,datep as date,'Charge' as item FROM ".MAIN_DB_PREFIX."paiementcharge"; + $sql.=" SELECT rowid as id,num_paiement as ref,1 as paid,amount as total_ttc,fk_charge as fk_soc,datep as date,'Charge' as item FROM ".MAIN_DB_PREFIX."paiementcharge"; $sql.=" WHERE datep between ".$wheretail; $resd = $db->query($sql); - $files=array(); + $files=array(); $link=''; - + if ($resd) { $numd = $db->num_rows($resd); - + $upload_dir =''; $i=0; while($i<$numd) { - - + + $objd = $db->fetch_object($resd); - + switch($objd->item){ - case "Invoice": + case "Invoice": $subdir=dol_sanitizeFileName($objd->ref); $upload_dir = $conf->facture->dir_output.'/'.$subdir; $link="../../document.php?modulepart=facture&file=".str_replace('/','%2F',$subdir).'%2F'; - break; - case "InvoiceSupplier": - $subdir=get_exdir($objd->id,2,0,0,$objd,'invoice_supplier').$objd->ref; + break; + case "InvoiceSupplier": + $subdir=get_exdir($objd->id,2,0,0,$objd,'invoice_supplier').dol_sanitizeFileName($objd->ref); $upload_dir = $conf->fournisseur->facture->dir_output.'/'.$subdir; $link="../../document.php?modulepart=facture_fournisseur&file=".str_replace('/','%2F',$subdir).'%2F'; - break; + break; case "Expense": $subdir=dol_sanitizeFileName($objd->ref); $upload_dir = $conf->expensereport->dir_output.'/'.$subdir; $link="../../document.php?modulepart=expensereport&file=".str_replace('/','%2F',$subdir).'%2F'; break; case "Salary": - $subdir=dol_sanitizeFileName($objd->rowid); + $subdir=dol_sanitizeFileName($objd->id); $upload_dir = $conf->salaries->dir_output.'/'.$subdir; $link="../../document.php?modulepart=salaries&file=".str_replace('/','%2F',$subdir).'%2F'; break; case "Donation": - $subdir=get_exdir(null,2,0,1,$objd,'donation'). '/'. dol_sanitizeFileName($objd->idd); + $subdir=get_exdir(null,2,0,1,$objd,'donation'). '/'. dol_sanitizeFileName($objd->id); $upload_dir = $conf->don->dir_output . '/' . $subdir; $link="../../document.php?modulepart=don&file=".str_replace('/','%2F',$subdir).'%2F'; break; case "Charge": - $subdir=dol_sanitizeFileName($objd->rowid); + $subdir=dol_sanitizeFileName($objd->id); $upload_dir = $conf->tax->dir_output . '/' . $subdir; $link="../../document.php?modulepart=tax&file=".str_replace('/','%2F',$subdir).'%2F'; break; default: break; } - + if(!empty($upload_dir)){ $result=true; $files=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$','',SORT_ASC,1); @@ -182,39 +168,33 @@ if(($action=="searchfiles"||$action=="dl" ) && $date_start && $date_stop){ $nofile['ref']=$objd->ref; $nofile['fk']=$objd->fk_soc; $nofile['item']=$objd->item; - $filesarray[]=$nofile; } } - $i++; + $i++; } - } + } $db->free($resd); - + } /* * cleanup of old ZIP */ //FIXME - - /* *ZIP creation */ if($result & $action=="dl"){ - unset($zip); + unset($zip); $log='date,type,ref,total,paid,filename,item_id'."\n"; $zipname = 'export.zip'; $zip = new ZipArchive; $res = $zip->open($zipname, ZipArchive::OVERWRITE|ZipArchive::CREATE); - if ($res){ - foreach ($filesarray as $key=> $file) { - + if ($res){ + foreach ($filesarray as $key=> $file) { if(file_exists($file["fullname"])) $zip->addFile($file["fullname"],$file["name"]);// $log.=$file['date'].','.$file['item'].','.$file['ref'].','.$file['amount'].','.$file['paid'].','.$file["name"].','.$file['fk']."\n"; } - - $zip->addFromString('log.csv', $log); $zip->close(); ///Then download the zipped file. @@ -222,37 +202,27 @@ if($result & $action=="dl"){ header('Content-disposition: attachment; filename='.$zipname); header('Content-Length: ' . filesize($zipname)); readfile($zipname); - exit(); - } + exit(); + } } - - // None - - /* - * View + * View */ - $form = new Form($db); $userstatic=new User($db); - $title=$langs->trans("ComptaFiles").' - '.$langs->trans("List"); //if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name.' - '.$langs->trans("Symmary"); $help_url='EN:Module_Accounting|FR:Module_Compatibilite'; //FIXME - llxHeader('',$title,$help_url); - print ''."\n\t\t"; - if (!empty($date_start) && !empty($date_stop))echo dol_print_date($date_start)." - ".dol_print_date($date_stop); print ''; print ''; -//if (! empty($arrayfields['f.datef']['checked'])) +//if (! empty($arrayfields['f.datef']['checked'])) print_liste_field_titre($arrayfields['date']['label'],$_SERVER["PHP_SELF"],"date","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); print ''; print ''; @@ -261,53 +231,41 @@ print ''; print ''; print ''; print ''; - print ''; - if ($result) { $TData = dol_sort_array($filesarray, 'date', 'ASC'); - if(empty($TData)) { - print ''; - } else { + if(empty($TData)) { + print ''; + } else { + // Sort array by date ASC to calucalte balance - // Sort array by date ASC to calucalte balance - - $totalDebit = 0; - $totalCredit = 0; - // Balance calculation - $balance = 0; - foreach($TData as &$data1) { - if($data1['item']!='Invoice'&& $data1['item']!='Donation' ){ + $totalDebit = 0; + $totalCredit = 0; + // Balance calculation + $balance = 0; + foreach($TData as &$data1) { + if($data1['item']!='Invoice'&& $data1['item']!='Donation' ){ $data1['amount']=-$data1['amount']; } if ($data1['amount']>0){ - - }else{ - + }else{ } $balance += $data1['amount']; - $data1['balance'] = $balance; - } - - - + $data1['balance'] = $balance; + } // Display array foreach($TData as $data) { - $html_class = ''; //if (!empty($data['fk_facture'])) $html_class = 'facid-'.$data['fk_facture']; //elseif (!empty($data['fk_paiement'])) $html_class = 'payid-'.$data['fk_paiement']; - print ''; - print "\n"; print ''; print ''; print '\n"; - print ''; print '\n"; $totalDebit += ($data['amount'] > 0) ? abs($data['amount']) : 0; @@ -315,12 +273,8 @@ if ($result) $totalCredit += ($data['amount'] > 0) ? 0 : abs($data['amount']); // Balance print '\n"; - - - print "\n"; } - print ''; print ''; print ''; @@ -328,16 +282,24 @@ if ($result) print ''; print ''; print "\n"; - } + } - - } + } print "
'.$langs->trans("Type").''.$langs->trans("Ref").''.$langs->trans("Paid").''.$langs->trans("Debit").''.$langs->trans("Credit").''.$langs->trans("Balance").'
'.$langs->trans("NoItem").'
'.$langs->trans("NoItem").'
"; print dol_print_date($data['date'],'day'); print "'.$data['item'].''.$data['ref'].' ".$data['name']."'.$data['paid'].''.(($data['amount'] > 0) ? price(abs($data['amount'])) : '')."'.price($data['balance'])."
 '.price($totalDebit).''.price(price2num($totalDebit - $totalCredit, 'MT')).'
"; print '
'."\n\t\t\t"; -print ''; -print ''; +print ''; +print ''; + +print ''; +print ''; +print ''; + + + + print '
'."\n\t\t\n\t\t\n\t\t\t"; -llxFooter(); + +llxFooter(); $db->close(); From e36bc24dee44d25646a31a3a38f247a150414265 Mon Sep 17 00:00:00 2001 From: delcroix Patrick Date: Tue, 11 Sep 2018 21:55:05 +0200 Subject: [PATCH 07/51] fix:copyrights --- htdocs/compta/compta-files.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/compta/compta-files.php b/htdocs/compta/compta-files.php index 679d21c000f..ef8c612ed84 100644 --- a/htdocs/compta/compta-files.php +++ b/htdocs/compta/compta-files.php @@ -1,7 +1,5 @@ - * Copyright (C) 2004-2017 Laurent Destailleur - * Copyright (C) 2017 Pierre-Henry Favre +/* Copyright (C) 2018 Patrick Delcroix * * 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 From 2a4c65726c0d0ab1f893e6aaedda268133a69ac0 Mon Sep 17 00:00:00 2001 From: delcroix Patrick Date: Tue, 11 Sep 2018 22:14:58 +0200 Subject: [PATCH 08/51] new: delete zip after download and correct date 2.0 --- htdocs/compta/compta-files.php | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/htdocs/compta/compta-files.php b/htdocs/compta/compta-files.php index ef8c612ed84..2a4af918234 100644 --- a/htdocs/compta/compta-files.php +++ b/htdocs/compta/compta-files.php @@ -1,5 +1,8 @@ + +/* Copyright (C) 2001-2006 Rodolphe Quiedeville + * Copyright (C) 2004-2017 Laurent Destailleur + * Copyright (C) 2017 Pierre-Henry Favre * * 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 @@ -185,7 +188,7 @@ if(($action=="searchfiles"||$action=="dl" ) && $date_start && $date_stop){ if($result & $action=="dl"){ unset($zip); $log='date,type,ref,total,paid,filename,item_id'."\n"; - $zipname = 'export.zip'; + $zipname = ($date_start)."-".($date_stop).'_export.zip'; $zip = new ZipArchive; $res = $zip->open($zipname, ZipArchive::OVERWRITE|ZipArchive::CREATE); if ($res){ @@ -200,6 +203,7 @@ if($result & $action=="dl"){ header('Content-disposition: attachment; filename='.$zipname); header('Content-Length: ' . filesize($zipname)); readfile($zipname); + unlink($zipname); exit(); } } @@ -285,14 +289,17 @@ if ($result) } print ""; print '
'."\n\t\t\t"; -print ''; -print ''; -print ''; -print ''; -print ''; +print ''; +print ''; +//print ''; +//print ''; +//print ''; +//print ''; +//print ''; +//print ''; print '
'."\n\t\t\n\t\t\n\t\t\t"; From 7f4378870c08bf661b685863265888588a286251 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 16 Sep 2018 22:39:38 +0200 Subject: [PATCH 09/51] Fix link display --- htdocs/stripe/transaction.php | 65 ++++++++++++++++++++++------------- 1 file changed, 41 insertions(+), 24 deletions(-) diff --git a/htdocs/stripe/transaction.php b/htdocs/stripe/transaction.php index cbc6013644d..9d4a5ea90fa 100644 --- a/htdocs/stripe/transaction.php +++ b/htdocs/stripe/transaction.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2018 Thibault FOUCART * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -65,11 +65,13 @@ llxHeader('', $langs->trans("StripeTransactionList")); 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'); } else { - $service = 'StripeLive'; + $service = 'StripeLive'; + $servicestatus = '1'; } $stripeaccount = $stripe->getStripeAccount($service); @@ -80,26 +82,25 @@ $stripeaccount = $stripe->getStripeAccount($service); if (! $rowid) { - print '
'; - if ($optioncss != '') { - print ''; - } - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + if ($optioncss != '') + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; $title=$langs->trans("StripeTransactionList"); $title.=($stripeaccount?' (Stripe connection with Stripe OAuth Connect account '.$stripeaccount.')':' (Stripe connection with keys from Stripe module setup)'); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $totalnboflines, 'title_accountancy.png', 0, '', '', $limit); - print '
'; - print '' . "\n"; + print '
'; + print '
' . "\n"; - print ''; + print ''; print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder); //print_liste_field_titre("StripeCustomerId",$_SERVER["PHP_SELF"],"","","","",$sortfield,$sortorder); //print_liste_field_titre("CustomerId", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder); @@ -109,9 +110,9 @@ if (! $rowid) { print_liste_field_titre("Paid", $_SERVER["PHP_SELF"], "", "", "", 'align="right"', $sortfield, $sortorder); print_liste_field_titre("Fee", $_SERVER["PHP_SELF"], "", "", "", 'align="right"', $sortfield, $sortorder); print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "", "", "", 'align="right"'); - print "\n"; + print "\n"; - print "\n"; + print "\n"; if ($stripeaccount) { @@ -122,14 +123,14 @@ if (! $rowid) { $txn = \Stripe\BalanceTransaction::all(array("limit" => $limit)); } - foreach ($txn->data as $txn) + foreach ($txn->data as $txn) { //$charge = $txn; //var_dump($txn); - + // The metadata FULLTAG is defined by the online payment page /*$FULLTAG=$charge->metadata->FULLTAG; - + // Save into $tmparray all metadata $tmparray = dolExplodeIntoArray($FULLTAG,'.','='); // Load origin object according to metadata @@ -149,7 +150,7 @@ if (! $rowid) { { $memberstatic->id = 0; }*/ - + $societestatic->fetch($charge->metadata->idcustomer); $societestatic->id = $charge->metadata->idcustomer; $societestatic->lastname = $obj->lastname; @@ -159,10 +160,26 @@ if (! $rowid) { $societestatic->email = $obj->email; $societestatic->societe_id = $obj->fk_soc; - print ''; - + print ''; + // Ref - print "\n"; + if (! empty($conf->stripe->enabled) && !empty($stripeacc)) $connect=$stripeacc.'/'; + + // Ref + if (preg_match('/po_/i', $txn->source)){ + $origin="payouts"; + } elseif (preg_match('/fee_/i', $txn->source)) { + $origin="connect/application_fees"; + } else { + $origin="payments"; + } + + $url='https://dashboard.stripe.com/'.$connect.'test/'.$origin.'/'.$txn->source; + if ($servicestatus) + { + $url='https://dashboard.stripe.com/'.$connect.$origin.'/'.$txn->source; + } + print "\n"; // Stripe customer //print "\n"; // Link From 35f2f5f48c5685b24f31d724e34a786674008556 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 16 Sep 2018 22:41:17 +0200 Subject: [PATCH 10/51] Update transaction.php --- htdocs/stripe/transaction.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/stripe/transaction.php b/htdocs/stripe/transaction.php index 9d4a5ea90fa..6ff4eab44a0 100644 --- a/htdocs/stripe/transaction.php +++ b/htdocs/stripe/transaction.php @@ -65,13 +65,13 @@ llxHeader('', $langs->trans("StripeTransactionList")); if (! empty($conf->stripe->enabled) && (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox','alpha'))) { $service = 'StripeTest'; - $servicestatus = '0'; + $servicestatus = '0'; dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), '', 'warning'); } else { - $service = 'StripeLive'; - $servicestatus = '1'; + $service = 'StripeLive'; + $servicestatus = '1'; } $stripeaccount = $stripe->getStripeAccount($service); @@ -127,7 +127,7 @@ if (! $rowid) { { //$charge = $txn; //var_dump($txn); - + // The metadata FULLTAG is defined by the online payment page /*$FULLTAG=$charge->metadata->FULLTAG; @@ -150,7 +150,7 @@ if (! $rowid) { { $memberstatic->id = 0; }*/ - + $societestatic->fetch($charge->metadata->idcustomer); $societestatic->id = $charge->metadata->idcustomer; $societestatic->lastname = $obj->lastname; From 3c5a9326e17595d874e9a87c958e2e20747076d2 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 16 Sep 2018 23:13:24 +0200 Subject: [PATCH 11/51] Update transaction.php --- htdocs/stripe/transaction.php | 67 +++++++++++++++++------------------ 1 file changed, 33 insertions(+), 34 deletions(-) diff --git a/htdocs/stripe/transaction.php b/htdocs/stripe/transaction.php index 6ff4eab44a0..b20f66090e4 100644 --- a/htdocs/stripe/transaction.php +++ b/htdocs/stripe/transaction.php @@ -26,9 +26,7 @@ require_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; -if (! empty($conf->accounting->enabled)) { - require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php'; -} +if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php'; // Load translation files required by the page $langs->loadLangs(array('compta', 'salaries', 'bills', 'hrm', 'stripe')); @@ -65,13 +63,13 @@ llxHeader('', $langs->trans("StripeTransactionList")); if (! empty($conf->stripe->enabled) && (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox','alpha'))) { $service = 'StripeTest'; - $servicestatus = '0'; + $servicestatus = '0'; dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), '', 'warning'); } else { - $service = 'StripeLive'; - $servicestatus = '1'; + $service = 'StripeLive'; + $servicestatus = '1'; } $stripeaccount = $stripe->getStripeAccount($service); @@ -82,25 +80,25 @@ $stripeaccount = $stripe->getStripeAccount($service); if (! $rowid) { - print ''; + print ''; if ($optioncss != '') - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; $title=$langs->trans("StripeTransactionList"); $title.=($stripeaccount?' (Stripe connection with Stripe OAuth Connect account '.$stripeaccount.')':' (Stripe connection with keys from Stripe module setup)'); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $totalnboflines, 'title_accountancy.png', 0, '', '', $limit); - print '
'; - print '
" . $txn->source . "".img_picto($langs->trans('ShowInStripe'), 'object_globe')." " . $txn->source . "".$charge->customer."
' . "\n"; + print '
'; + print '
' . "\n"; - print ''; + print ''; print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder); //print_liste_field_titre("StripeCustomerId",$_SERVER["PHP_SELF"],"","","","",$sortfield,$sortorder); //print_liste_field_titre("CustomerId", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder); @@ -110,9 +108,9 @@ if (! $rowid) { print_liste_field_titre("Paid", $_SERVER["PHP_SELF"], "", "", "", 'align="right"', $sortfield, $sortorder); print_liste_field_titre("Fee", $_SERVER["PHP_SELF"], "", "", "", 'align="right"', $sortfield, $sortorder); print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "", "", "", 'align="right"'); - print "\n"; + print "\n"; - print "\n"; + print "\n"; if ($stripeaccount) { @@ -123,11 +121,11 @@ if (! $rowid) { $txn = \Stripe\BalanceTransaction::all(array("limit" => $limit)); } - foreach ($txn->data as $txn) + foreach ($txn->data as $txn) { //$charge = $txn; //var_dump($txn); - + // The metadata FULLTAG is defined by the online payment page /*$FULLTAG=$charge->metadata->FULLTAG; @@ -150,7 +148,7 @@ if (! $rowid) { { $memberstatic->id = 0; }*/ - + $societestatic->fetch($charge->metadata->idcustomer); $societestatic->id = $charge->metadata->idcustomer; $societestatic->lastname = $obj->lastname; @@ -160,7 +158,7 @@ if (! $rowid) { $societestatic->email = $obj->email; $societestatic->societe_id = $obj->fk_soc; - print ''; + print ''; // Ref if (! empty($conf->stripe->enabled) && !empty($stripeacc)) $connect=$stripeacc.'/'; @@ -179,7 +177,10 @@ if (! $rowid) { { $url='https://dashboard.stripe.com/'.$connect.$origin.'/'.$txn->source; } - print "\n"; + if ($txn->type == 'stripe_fee' || $txn->type == 'reserve_transaction') { + print ""; + } else print "\n"; + // Stripe customer //print "\n"; // Link @@ -194,16 +195,15 @@ if (! $rowid) { } print "\n";*/ // Origine - //print "\n"; // Date payment @@ -215,13 +215,12 @@ if (! $rowid) { print ""; // Status print "'; print "\n"; } From 0770d8e56ed3d5cbf6a610210876f9053cd69a72 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 16 Sep 2018 23:14:22 +0200 Subject: [PATCH 12/51] Update transaction.php --- htdocs/stripe/transaction.php | 57 ++--------------------------------- 1 file changed, 3 insertions(+), 54 deletions(-) diff --git a/htdocs/stripe/transaction.php b/htdocs/stripe/transaction.php index b20f66090e4..219846d151d 100644 --- a/htdocs/stripe/transaction.php +++ b/htdocs/stripe/transaction.php @@ -123,32 +123,6 @@ if (! $rowid) { foreach ($txn->data as $txn) { - //$charge = $txn; - //var_dump($txn); - - // The metadata FULLTAG is defined by the online payment page - /*$FULLTAG=$charge->metadata->FULLTAG; - - // Save into $tmparray all metadata - $tmparray = dolExplodeIntoArray($FULLTAG,'.','='); - // Load origin object according to metadata - if (! empty($tmparray['CUS'])) - { - $societestatic->fetch($tmparray['CUS']); - } - else - { - $societestatic->id = 0; - } - if (! empty($tmparray['MEM'])) - { - $memberstatic->fetch($tmparray['MEM']); - } - else - { - $memberstatic->id = 0; - }*/ - $societestatic->fetch($charge->metadata->idcustomer); $societestatic->id = $charge->metadata->idcustomer; $societestatic->lastname = $obj->lastname; @@ -159,7 +133,7 @@ if (! $rowid) { $societestatic->societe_id = $obj->fk_soc; print ''; - + // Ref if (! empty($conf->stripe->enabled) && !empty($stripeacc)) $connect=$stripeacc.'/'; @@ -171,41 +145,16 @@ if (! $rowid) { } else { $origin="payments"; } - + $url='https://dashboard.stripe.com/'.$connect.'test/'.$origin.'/'.$txn->source; if ($servicestatus) { - $url='https://dashboard.stripe.com/'.$connect.$origin.'/'.$txn->source; + $url='https://dashboard.stripe.com/'.$connect.$origin.'/'.$txn->source; } if ($txn->type == 'stripe_fee' || $txn->type == 'reserve_transaction') { print ""; } else print "\n"; - // Stripe customer - //print "\n"; - // Link - /*print "\n";*/ - // Origine - //print "\n"; // Date payment print '\n"; // Type From 85bed00474c8ade3b8663064540d9775386479e2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Sep 2018 11:50:04 +0200 Subject: [PATCH 13/51] Fix default fields --- htdocs/accountancy/admin/account.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index 82b02a847de..da05246b05b 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -63,9 +63,9 @@ if (! $sortorder) $sortorder = "ASC"; $arrayfields=array( 'aa.account_number'=>array('label'=>$langs->trans("AccountNumber"), 'checked'=>1), 'aa.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1), - 'aa.account_parent'=>array('label'=>$langs->trans("Accountparent"), 'checked'=>0), + 'aa.account_parent'=>array('label'=>$langs->trans("Accountparent"), 'checked'=>1), 'aa.pcg_type'=>array('label'=>$langs->trans("Pcgtype"), 'checked'=>1, 'help'=>'PcgtypeDesc'), - 'aa.pcg_subtype'=>array('label'=>$langs->trans("Pcgsubtype"), 'checked'=>1, 'help'=>'PcgtypeDesc'), + 'aa.pcg_subtype'=>array('label'=>$langs->trans("Pcgsubtype"), 'checked'=>0, 'help'=>'PcgtypeDesc'), 'aa.active'=>array('label'=>$langs->trans("Activated"), 'checked'=>1) ); From 4580ed0b09b5de51c7add0e91ff591fa2454ded1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Sep 2018 15:31:25 +0200 Subject: [PATCH 14/51] Fix bad link --- htdocs/core/class/html.formmail.class.php | 2 +- htdocs/core/lib/functions.lib.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 8ec31ec77bf..117bfb13769 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -940,7 +940,7 @@ class FormMail extends Form if (count($validpaymentmethod) > 0 && $paymenturl) { $langs->load('other'); - $this->substit['__ONLINE_PAYMENT_TEXT_AND_URL__']=str_replace('\n',"\n",$langs->transnoentities("PredefinedMailContentLink", $paymenturl)); + $this->substit['__ONLINE_PAYMENT_TEXT_AND_URL__']=str_replace('\n', "\n", $langs->transnoentities("PredefinedMailContentLink", $paymenturl)); $this->substit['__ONLINE_PAYMENT_URL__']=$paymenturl; } else diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index c67596fde09..af0d7219ddc 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -6073,7 +6073,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob $paymenturl=$url; } - $substitutionarray['__ONLINE_PAYMENT_TEXT_AND_URL__']=($paymenturl?$outputlangs->trans("PredefinedMailContentLink", $paymenturl):''); + $substitutionarray['__ONLINE_PAYMENT_TEXT_AND_URL__']=($paymenturl?str_replace('\n', "\n", $outputlangs->trans("PredefinedMailContentLink", $paymenturl)):''); $substitutionarray['__ONLINE_PAYMENT_URL__']=$paymenturl; } } From 99d214abd562208fae060edab5b325f2d36f6b3e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Sep 2018 16:38:51 +0200 Subject: [PATCH 15/51] Fix family of module Payment of employee salaries --- htdocs/admin/modules.php | 2 ++ htdocs/core/modules/modSalaries.class.php | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 5ba261b619e..68f7c3a29a7 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -833,6 +833,8 @@ if ($mode == 'common') dol_fiche_end(); + print '
'; + // Show warning about external users print info_admin(showModulesExludedForExternal($modules))."\n"; diff --git a/htdocs/core/modules/modSalaries.class.php b/htdocs/core/modules/modSalaries.class.php index 2c93c45f9f6..52c417c0848 100644 --- a/htdocs/core/modules/modSalaries.class.php +++ b/htdocs/core/modules/modSalaries.class.php @@ -50,7 +50,9 @@ class modSalaries extends DolibarrModules $this->db = $db; $this->numero = 510; // Perms from 501..519 - $this->family = "compta"; + // Family can be 'base' (core modules),'crm','financial','hr','projects','products','ecm','technic' (transverse modules),'interface' (link with external tools),'other','...' + // It is used to group modules by family in module setup page + $this->family = "financial"; // 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)); // Module description used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) From 58e82008acec43fa6ab390ce6e2e7d8851f6c4eb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Sep 2018 16:45:08 +0200 Subject: [PATCH 16/51] Prepare 8.0.2 --- ChangeLog | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/ChangeLog b/ChangeLog index c379f2dfeff..0d1bbfbf379 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,41 @@ English Dolibarr ChangeLog -------------------------------------------------------------- + +***** ChangeLog for 8.0.2 compared to 8.0.1 ***** +FIX: #8452 +FIX: #9043 +FIX: #9316 Error when listing invoices +FIX: #9317 +FIX: #9353 Bug: html error - div inside span on graphs +FIX: #9355 +FIX: #9393 inconsistency behaviour. option FACTURE_ENABLE_NEGATIVE_LINES +FIX: #9394 +FIX: #9396 +FIX: #9403 +FIX: #9412 +FIX: #9497 +FIX: Add paypal error message in alert email when online payment fails. +FIX: better compatibility with multicompany +FIX: capital must be empty and not 0 if undefined +FIX: character making error on bill list +FIX: Entering negative price on order. +FIX: Expedition not showing extrafields on creation. +FIX: Homepage links were using wrong topmenus +FIX: inconsistency behaviour on option FACTURE_ENABLE_NEGATIVE_LINES +FIX: invert mime type and name. +FIX: invoice popup hide localtax2 and 3 if not defined. +FIX: Lose filter on payment type or category after a sort on invoice list. +FIX: Maxi debug to allow to load chart of account with multicompany. +FIX: Missing translation in predefined email to membership renewal. +FIX: Mixing tickets of different thirdparties. +FIX: "Other ..." link so the "Back to" link works. +FIX: PDF address: handle when contact thirdparty is different from thirdparty of document +FIX: Problems with permissions of module to record payment of salaries +FIX: remove debug +FIX: Several fixes on the management of minimal amount for orders +FIX: wrong var name + ***** ChangeLog for 8.0.1 compared to 8.0.0 ***** FIX: #9258 FIX: #9328 From 014da6c22c0c4df136a345d8ed0cf7548c0795a1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Sep 2018 18:11:07 +0200 Subject: [PATCH 17/51] Fix translation --- htdocs/langs/en_US/main.lang | 2 +- htdocs/langs/fr_FR/main.lang | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index dcc47afa3ee..7136b15dc59 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -328,7 +328,7 @@ Copy=Copy Paste=Paste Default=Default DefaultValue=Default value -DefaultValues=Default values +DefaultValues=Default values/filters/sorting Price=Price PriceCurrency=Price (currency) UnitPrice=Unit price diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index 6fba0af2b64..b68102ef90d 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -327,7 +327,7 @@ Copy=Copier Paste=Coller Default=Défaut DefaultValue=Valeur par défaut -DefaultValues=Valeurs par défaut +DefaultValues=Valeurs/Filtres/Tri par défaut Price=Prix PriceCurrency=Prix ​​(devise) UnitPrice=Prix unitaire From 79b248fc67d7c33de207681da928b2586bdaf2f9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Sep 2018 23:25:38 +0200 Subject: [PATCH 18/51] FIX warning picto when next run date passed --- htdocs/cron/card.php | 4 ++-- htdocs/cron/list.php | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/htdocs/cron/card.php b/htdocs/cron/card.php index 855620756a7..35935be009d 100644 --- a/htdocs/cron/card.php +++ b/htdocs/cron/card.php @@ -684,8 +684,8 @@ else elseif (!empty($object->datenextrun)) { print img_picto('','object_calendarday').' '.dol_print_date($object->datenextrun,'dayhoursec');} else {print $langs->trans('CronNone');} //print ''; - if ($object->maxnbrun && $object->nbrun >= $object->maxrun) print img_warning($langs->trans("Finished")); - if ($object->datenextrun && $object->datenextrun < $now) print img_warning($langs->trans("Late")); + if ($object->maxrun && $object->nbrun >= $object->maxrun) print img_warning($langs->trans("MaxRunReached")); + elseif ($object->datenextrun && $object->datenextrun < $now) print img_warning($langs->trans("Late")); print "
"; print '
".img_picto($langs->trans('ShowInStripe'), 'object_globe')." " . $txn->source . "".$txn->type."".img_picto($langs->trans('ShowInStripe'), 'object_globe')." " . $txn->source . "".$charge->customer.""; ////if ($charge->metadata->dol_type=="order"){ // $object = new Commande($db); // $object->fetch($charge->metadata->dol_id); - // print "".img_picto('', 'object_order')." ".$object->ref.""; + // print "".img_picto('', 'object_order')." ".$object->ref.""; //} elseif ($charge->metadata->dol_type=="invoice"){ // $object = new Facture($db); // $object->fetch($charge->metadata->dol_id); - // print "".img_picto('', 'object_invoice')." ".$object->ref.""; + // print "".img_picto('', 'object_invoice')." ".$object->ref.""; //} //print "" . price(($txn->fee) / 100, 0, '', 1, - 1, - 1, strtoupper($txn->currency)) . ""; - if ($txn->status=='available') { - print img_picto($langs->trans("".$txn->status.""),'statut4'); - } elseif ($txn->status=='pending') { - print img_picto($langs->trans("".$txn->status.""),'statut7'); - } elseif ($txn->status=='failed') { - print img_picto($langs->trans("".$txn->status.""),'statut8'); - } +if ($txn->status=='available') + {print img_picto($langs->trans("".$txn->status.""),'statut4');} +elseif ($txn->status=='pending') + {print img_picto($langs->trans("".$txn->status.""),'statut7');} +elseif ($txn->status=='failed') + {print img_picto($langs->trans("".$txn->status.""),'statut8');} print '
".$txn->type."".img_picto($langs->trans('ShowInStripe'), 'object_globe')." " . $txn->source . "".$charge->customer.""; - if ($societestatic->id > 0) - { - print $societestatic->getNomUrl(1); - } - if ($memberstatic->id > 0) - { - print $memberstatic->getNomUrl(1); - } - print ""; - ////if ($charge->metadata->dol_type=="order"){ - // $object = new Commande($db); - // $object->fetch($charge->metadata->dol_id); - // print "".img_picto('', 'object_order')." ".$object->ref.""; - //} elseif ($charge->metadata->dol_type=="invoice"){ - // $object = new Facture($db); - // $object->fetch($charge->metadata->dol_id); - // print "".img_picto('', 'object_invoice')." ".$object->ref.""; - //} - //print "' . dol_print_date($txn->created, '%d/%m/%Y %H:%M') . "
'; diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index eb326673d25..a8f4ade8b4d 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -242,6 +242,7 @@ $sql.= " t.status,"; $sql.= " t.fk_user_author,"; $sql.= " t.fk_user_mod,"; $sql.= " t.note,"; +$sql.= " t.maxrun,"; $sql.= " t.nbrun,"; $sql.= " t.libname,"; $sql.= " t.test"; @@ -252,12 +253,12 @@ if ($search_status == 2) $sql.= " AND t.status = 2"; //Manage filter if (is_array($filter) && count($filter)>0) { foreach($filter as $key => $value) { - $sql.= ' AND '.$key.' LIKE \'%'.$value.'%\''; + $sql.= ' AND '.$key.' LIKE \'%'.$db->escape($value).'%\''; } } $sqlwhere = array(); if (!empty($module_name)) { - $sqlwhere[]='(t.module_name='.$module_name.')'; + $sqlwhere[]='(t.module_name='.$db->escape($module_name).')'; } if (count($sqlwhere)>0) { $sql.= " WHERE ".implode(' AND ',$sqlwhere); @@ -523,6 +524,8 @@ if ($num > 0) if (empty($obj->status)) print ''; print dol_print_date($db->jdate($obj->datenextrun),'dayhour'); if (empty($obj->status)) print ''; + if ($obj->maxrun && $obj->nbrun >= $obj->maxrun) print img_warning($langs->trans("MaxRunReached")); + elseif ($obj->datenextrun && $obj->datenextrun < $now) print img_warning($langs->trans("Late")); } print ''; From c56b02c1c497aa6510156303e7cd020778859d20 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Sep 2018 23:39:49 +0200 Subject: [PATCH 19/51] Fix warning --- htdocs/cron/list.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index a8f4ade8b4d..d556804e317 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -520,12 +520,13 @@ if ($num > 0) print ''; print ''; - if(!empty($obj->datenextrun)) { + if (!empty($obj->datenextrun)) { + $datenextrun = $db->jdate($obj->datenextrun); if (empty($obj->status)) print ''; - print dol_print_date($db->jdate($obj->datenextrun),'dayhour'); - if (empty($obj->status)) print ''; + print dol_print_date($datenextrun,'dayhour'); if ($obj->maxrun && $obj->nbrun >= $obj->maxrun) print img_warning($langs->trans("MaxRunReached")); - elseif ($obj->datenextrun && $obj->datenextrun < $now) print img_warning($langs->trans("Late")); + elseif ($datenextrun && $datenextrun < $now) print img_warning($langs->trans("Late")); + if (empty($obj->status)) print ''; } print ''; From 85180b117c86ca8a3a2639e5d484711d7c76b494 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Sep 2018 23:45:22 +0200 Subject: [PATCH 20/51] Fix warnings --- htdocs/cron/card.php | 11 ++++++----- htdocs/cron/list.php | 9 ++++++--- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/htdocs/cron/card.php b/htdocs/cron/card.php index 35935be009d..bdbab5e30b0 100644 --- a/htdocs/cron/card.php +++ b/htdocs/cron/card.php @@ -679,13 +679,14 @@ else print $langs->trans('CronDtNextLaunch'); print ' ('.$langs->trans('CronFrom').')'; print ""; - //print ''; if (! $object->status) print $langs->trans("Disabled"); elseif (!empty($object->datenextrun)) { print img_picto('','object_calendarday').' '.dol_print_date($object->datenextrun,'dayhoursec');} - else {print $langs->trans('CronNone');} - //print ''; - if ($object->maxrun && $object->nbrun >= $object->maxrun) print img_warning($langs->trans("MaxRunReached")); - elseif ($object->datenextrun && $object->datenextrun < $now) print img_warning($langs->trans("Late")); + else { print $langs->trans('CronNone'); } + if ($object->status == Cronjob::STATUS_ENABLED) + { + if ($object->maxrun && $object->nbrun >= $object->maxrun) print img_warning($langs->trans("MaxRunReached")); + elseif ($object->datenextrun && $object->datenextrun < $now) print img_warning($langs->trans("Late")); + } print ""; print ''; diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index d556804e317..1f810132223 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -523,9 +523,12 @@ if ($num > 0) if (!empty($obj->datenextrun)) { $datenextrun = $db->jdate($obj->datenextrun); if (empty($obj->status)) print ''; - print dol_print_date($datenextrun,'dayhour'); - if ($obj->maxrun && $obj->nbrun >= $obj->maxrun) print img_warning($langs->trans("MaxRunReached")); - elseif ($datenextrun && $datenextrun < $now) print img_warning($langs->trans("Late")); + print dol_print_date($datenextrun,'dayhoursec'); + if ($obj->status == Cronjob::STATUS_ENABLED) + { + if ($obj->maxrun && $obj->nbrun >= $obj->maxrun) print img_warning($langs->trans("MaxRunReached")); + elseif ($datenextrun && $datenextrun < $now) print img_warning($langs->trans("Late")); + } if (empty($obj->status)) print ''; } print ''; From cdbb79a26c579fcf694965a54eb5f3dcb46022ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 19 Sep 2018 09:26:56 +0200 Subject: [PATCH 21/51] correct typo in multicurrency doc pdf --- .gitignore | 1 + htdocs/core/modules/commande/doc/pdf_einstein.modules.php | 6 +++--- htdocs/core/modules/facture/doc/pdf_crabe.modules.php | 6 +++--- htdocs/core/modules/propale/doc/pdf_azur.modules.php | 6 +++--- .../modules/supplier_invoice/pdf/pdf_canelle.modules.php | 6 +++--- .../modules/supplier_order/pdf/pdf_muscadet.modules.php | 6 +++--- 6 files changed, 16 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index 1efe4f4bb82..a0fbe7489df 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ dolibarr_install.log upgrade.log doxygen_warnings.log /.project +/.vscode .DS_Store .idea *.iml diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 9fecdc277b5..9dc2b770222 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -7,6 +7,7 @@ * Copyright (C) 2012 Cedric Salvador * Copyright (C) 2015 Marcos García * Copyright (C) 2017 Ferran Marcet + * Copyright (C) 2018 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 @@ -856,7 +857,7 @@ class pdf_einstein extends ModelePDFCommandes $pdf->SetXY($col1x, $tab2_top + 0); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); - $total_ht = ($conf->multicurrency->enabled && $object->mylticurrency_tx != 1 ? $object->multicurrency_total_ht : $object->total_ht); + $total_ht = ($conf->multicurrency->enabled && $object->multicurrency_tx != 1 ? $object->multicurrency_total_ht : $object->total_ht); $pdf->SetXY($col2x, $tab2_top + 0); $pdf->MultiCell($largcol2, $tab2_hl, price($total_ht + (! empty($object->remise)?$object->remise:0), 0, $outputlangs), 0, 'R', 1); @@ -1307,7 +1308,7 @@ class pdf_einstein extends ModelePDFCommandes { $top_shift = $pdf->getY() - $current_y; } - + if ($showaddress) { // Sender properties @@ -1421,4 +1422,3 @@ class pdf_einstein extends ModelePDFCommandes } } - diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 88a47095b8c..804eb8885db 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -8,6 +8,7 @@ * Copyright (C) 2012-2014 Raphaël Doursenaud * Copyright (C) 2015 Marcos García * Copyright (C) 2017 Ferran Marcet + * Copyright (C) 2018 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 @@ -1054,7 +1055,7 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetXY($col1x, $tab2_top + 0); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); - $total_ht = ($conf->multicurrency->enabled && $object->mylticurrency_tx != 1 ? $object->multicurrency_total_ht : $object->total_ht); + $total_ht = ($conf->multicurrency->enabled && $object->multicurrency_tx != 1 ? $object->multicurrency_total_ht : $object->total_ht); $pdf->SetXY($col2x, $tab2_top + 0); $pdf->MultiCell($largcol2, $tab2_hl, price($sign * ($total_ht + (! empty($object->remise)?$object->remise:0)), 0, $outputlangs), 0, 'R', 1); @@ -1679,7 +1680,7 @@ class pdf_crabe extends ModelePDFFactures { $top_shift = $pdf->getY() - $current_y; } - + if ($showaddress) { // Sender properties @@ -1788,4 +1789,3 @@ class pdf_crabe extends ModelePDFFactures } } - diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 03d0db86d8f..17b99fb8b36 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -7,6 +7,7 @@ * Copyright (C) 2012 Cedric Salvador * Copyright (C) 2015 Marcos García * Copyright (C) 2017 Ferran Marcet + * Copyright (C) 2018 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 @@ -1004,7 +1005,7 @@ class pdf_azur extends ModelePDFPropales $pdf->SetXY($col1x, $tab2_top + 0); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); - $total_ht = ($conf->multicurrency->enabled && $object->mylticurrency_tx != 1 ? $object->multicurrency_total_ht : $object->total_ht); + $total_ht = ($conf->multicurrency->enabled && $object->multicurrency_tx != 1 ? $object->multicurrency_total_ht : $object->total_ht); $pdf->SetXY($col2x, $tab2_top + 0); $pdf->MultiCell($largcol2, $tab2_hl, price($total_ht + (! empty($object->remise)?$object->remise:0), 0, $outputlangs), 0, 'R', 1); @@ -1493,7 +1494,7 @@ class pdf_azur extends ModelePDFPropales { $top_shift = $pdf->getY() - $current_y; } - + if ($showaddress) { // Sender properties @@ -1636,4 +1637,3 @@ class pdf_azur extends ModelePDFPropales return ($tab_hl*7); } } - diff --git a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php index 11951e90207..9cfc1be320b 100644 --- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -2,6 +2,7 @@ /* Copyright (C) 2010-2011 Juanjo Menent * Copyright (C) 2010-2014 Laurent Destailleur * Copyright (C) 2015 Marcos García + * Copyright (C) 2018 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 @@ -598,7 +599,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $pdf->SetXY($col1x, $tab2_top + 0); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); - $total_ht = ($conf->multicurrency->enabled && $object->mylticurrency_tx != 1 ? $object->multicurrency_total_ht : $object->total_ht); + $total_ht = ($conf->multicurrency->enabled && $object->multicurrency_tx != 1 ? $object->multicurrency_total_ht : $object->total_ht); $pdf->SetXY($col2x, $tab2_top + 0); $pdf->MultiCell($largcol2, $tab2_hl, price($total_ht + $object->remise), 0, 'R', 1); @@ -1094,7 +1095,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $object->fetch_user($arrayidcontact[0]); $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n"; } - + $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty); // Show sender @@ -1192,4 +1193,3 @@ class pdf_canelle extends ModelePDFSuppliersInvoices } } - diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php index 196d1f0c6a2..23a06264778 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -5,6 +5,7 @@ * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2015 Marcos García * Copyright (C) 2017 Ferran Marcet + * Copyright (C) 2018 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 @@ -695,7 +696,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->SetXY($col1x, $tab2_top + 0); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); - $total_ht = ($conf->multicurrency->enabled && $object->mylticurrency_tx != 1 ? $object->multicurrency_total_ht : $object->total_ht); + $total_ht = ($conf->multicurrency->enabled && $object->multicurrency_tx != 1 ? $object->multicurrency_total_ht : $object->total_ht); $pdf->SetXY($col2x, $tab2_top + 0); $pdf->MultiCell($largcol2, $tab2_hl, price($total_ht + (! empty($object->remise)?$object->remise:0)), 0, 'R', 1); @@ -1144,7 +1145,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $object->fetch_user($arrayidcontact[0]); $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n"; } - + $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty); // Show sender @@ -1242,4 +1243,3 @@ class pdf_muscadet extends ModelePDFSuppliersOrders } } - From 1d43c6bc3a0b058ef65b27026c8aa8e9b56adf1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 19 Sep 2018 10:57:59 +0200 Subject: [PATCH 22/51] call to deprecated add_object_linked was present two times --- htdocs/comm/propal/class/propal.class.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index a9782d21dac..2b3ae7834e1 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -12,6 +12,7 @@ * Copyright (C) 2012 Cedric Salvador * Copyright (C) 2013 Florian Henry * Copyright (C) 2014-2015 Marcos García + * Copyright (C) 2018 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 @@ -1018,6 +1019,7 @@ class Propal extends CommonObject // Add linked object (deprecated, use ->linkedObjectsIds instead) if (! $error && $this->origin && $this->origin_id) { + dol_syslog('Deprecated use of linked object, use ->linkedObjectsIds instead', LOG_WARNING); $ret = $this->add_object_linked(); if (! $ret) dol_print_error($this->db); } @@ -1090,13 +1092,6 @@ class Propal extends CommonObject } } - // Add linked object - if (! $error && $this->origin && $this->origin_id) - { - $ret = $this->add_object_linked(); - if (! $ret) dol_print_error($this->db); - } - // Set delivery address if (! $error && $this->fk_delivery_address) { From dc7c27b16225911f026012a65fc5eb3bf5f27993 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Sep 2018 14:53:39 +0200 Subject: [PATCH 23/51] Release 8.0.2 --- htdocs/filefunc.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index a13100038ac..24c0de121db 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -31,7 +31,7 @@ */ if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE','Dolibarr'); -if (! defined('DOL_VERSION')) define('DOL_VERSION','8.0.2'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c +if (! defined('DOL_VERSION')) define('DOL_VERSION','8.0.3'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c if (! defined('EURO')) define('EURO',chr(128)); From c9b8da8acbc15c1b56129e3fe40ef5fa8dd7324e Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 19 Sep 2018 16:06:39 +0200 Subject: [PATCH 24/51] Missing translation --- htdocs/expedition/shipment.php | 5 +++-- htdocs/langs/en_US/deliveries.lang | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index 24ccda21579..33e1dd97f7b 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2012-2015 Juanjo Menent * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018 Philippe Grand * * 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 @@ -921,8 +922,8 @@ if ($id > 0 || ! empty($ref)) } else { - /* Commande non trouvee */ - print "Commande inexistante"; + /* Order not found */ + setEventMessages($langs->trans("NonExistentOrder"), null, 'errors'); } } diff --git a/htdocs/langs/en_US/deliveries.lang b/htdocs/langs/en_US/deliveries.lang index 7e39f48ea55..1c9cb791900 100644 --- a/htdocs/langs/en_US/deliveries.lang +++ b/htdocs/langs/en_US/deliveries.lang @@ -28,3 +28,4 @@ ErrorStockIsNotEnough=There's not enough stock Shippable=Shippable NonShippable=Not Shippable ShowReceiving=Show delivery receipt +NonExistentOrder=Non-existent order From 30e426e4872e2c9412d01299b0dce4211c12a55b Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 19 Sep 2018 16:21:52 +0200 Subject: [PATCH 25/51] Standardize and update code --- .../commande/doc/doc_generic_order_odt.modules.php | 7 ++++++- .../core/modules/commande/doc/pdf_einstein.modules.php | 6 +++--- .../contract/doc/doc_generic_contract_odt.modules.php | 7 ++++++- .../doc/doc_generic_shipment_odt.modules.php | 7 ++++++- .../facture/doc/doc_generic_invoice_odt.modules.php | 5 +++++ .../product/doc/doc_generic_product_odt.modules.php | 7 ++++++- .../core/modules/product/doc/pdf_standard.modules.php | 10 +++++++--- 7 files changed, 39 insertions(+), 10 deletions(-) diff --git a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php index ba9a9490daa..1230bcad52d 100644 --- a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php +++ b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php @@ -38,9 +38,14 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php'; */ class doc_generic_order_odt extends ModelePDFCommandes { - public $emetteur; // Objet societe qui emet + /** + * Issuer + * @var Societe + */ + public $emetteur; public $phpmin = array(5,4,0); // Minimum version of PHP required by module + public $version = 'dolibarr'; diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 1bae075142f..cba8ed016b9 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -114,9 +114,9 @@ class pdf_einstein extends ModelePDFCommandes public $marge_basse; /** - * Issuer - * @var Societe - */ + * Issuer + * @var Societe + */ public $emetteur; // Objet societe qui emet diff --git a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php index f8940dd95ef..ab43829a305 100644 --- a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php +++ b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php @@ -37,9 +37,14 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php'; */ class doc_generic_contract_odt extends ModelePDFContract { - public $emetteur; // Objet societe qui emet + /** + * Issuer + * @var Societe + */ + public $emetteur; public $phpmin = array(5,4,0); // Minimum version of PHP required by module + public $version = 'dolibarr'; diff --git a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php index f5e2b182a73..6e058f4a92d 100644 --- a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php +++ b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php @@ -39,9 +39,14 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php'; */ class doc_generic_shipment_odt extends ModelePdfExpedition { - public $emetteur; // Objet societe qui emet + /** + * Issuer + * @var Societe + */ + public $emetteur; public $phpmin = array(5,4,0); // Minimum version of PHP required by module + public $version = 'dolibarr'; diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php index ddd2df87b93..fb34a3da1f9 100644 --- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php +++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php @@ -38,9 +38,14 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php'; */ class doc_generic_invoice_odt extends ModelePDFFactures { + /** + * Issuer + * @var Societe + */ public $emetteur; // Objet societe qui emet public $phpmin = array(5,4,0); // Minimum version of PHP required by module + public $version = 'dolibarr'; diff --git a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php index ca50317fe81..f4a829dcc51 100644 --- a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php +++ b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php @@ -36,9 +36,14 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php'; */ class doc_generic_product_odt extends ModelePDFProduct { - public $emetteur; // Objet societe qui emet + /** + * Issuer + * @var Societe + */ + public $emetteur; public $phpmin = array(5,4,0); // Minimum version of PHP required by module + public $version = 'dolibarr'; diff --git a/htdocs/core/modules/product/doc/pdf_standard.modules.php b/htdocs/core/modules/product/doc/pdf_standard.modules.php index 16efd190836..b163e22c712 100644 --- a/htdocs/core/modules/product/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/product/doc/pdf_standard.modules.php @@ -58,9 +58,9 @@ class pdf_standard extends ModelePDFProduct /** * @var array() Minimum version of PHP required by module. - * e.g.: PHP ≥ 5.3 = array(5, 3) + * e.g.: PHP ≥ 5.4 = array(5, 4) */ - public $phpmin = array(5, 2); + public $phpmin = array(5, 4); /** * Dolibarr version of the loaded document @@ -76,7 +76,11 @@ class pdf_standard extends ModelePDFProduct public $marge_haute; public $marge_basse; - public $emetteur; // Objet societe qui emet + /** + * Issuer + * @var Societe + */ + public $emetteur; /** From 57fc8cf06fccbc51f1bc446dc9b2176cce54759d Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 19 Sep 2018 16:31:36 +0200 Subject: [PATCH 26/51] Standardize and update code --- .../project/task/doc/doc_generic_task_odt.modules.php | 5 +++++ .../propale/doc/doc_generic_proposal_odt.modules.php | 5 +++++ .../stock/doc/doc_generic_stock_odt.modules.php | 7 ++++++- htdocs/core/modules/stock/doc/pdf_standard.modules.php | 10 +++++++--- .../core/modules/stock/doc/pdf_stdmovement.modules.php | 10 +++++++--- .../doc/doc_generic_supplier_proposal_odt.modules.php | 7 ++++++- .../modules/user/doc/doc_generic_user_odt.modules.php | 7 ++++++- .../doc/doc_generic_usergroup_odt.modules.php | 7 ++++++- 8 files changed, 48 insertions(+), 10 deletions(-) diff --git a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php index 7846c68af7a..b7500731ab9 100644 --- a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php +++ b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php @@ -54,9 +54,14 @@ if (! empty($conf->agenda->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/ */ class doc_generic_task_odt extends ModelePDFTask { + /** + * Issuer + * @var Societe + */ public $emetteur; // Objet societe qui emet public $phpmin = array(5,4,0); // Minimum version of PHP required by module + public $version = 'dolibarr'; diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php index 7483c2a9623..03a555435c4 100644 --- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php +++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php @@ -37,9 +37,14 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php'; */ class doc_generic_proposal_odt extends ModelePDFPropales { + /** + * Issuer + * @var Societe + */ public $emetteur; // Objet societe qui emet public $phpmin = array(5,4,0); // Minimum version of PHP required by module + public $version = 'dolibarr'; diff --git a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php index d5e0f1ba984..a433287a63c 100644 --- a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php +++ b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php @@ -36,9 +36,14 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php'; */ class doc_generic_stock_odt extends ModelePDFStock { - public $emetteur; // Objet societe qui emet + /** + * Issuer + * @var Societe + */ + public $emetteur; public $phpmin = array(5,4,0); // Minimum version of PHP required by module + public $version = 'dolibarr'; diff --git a/htdocs/core/modules/stock/doc/pdf_standard.modules.php b/htdocs/core/modules/stock/doc/pdf_standard.modules.php index 66799612d8f..957a4fc2e32 100644 --- a/htdocs/core/modules/stock/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/stock/doc/pdf_standard.modules.php @@ -58,9 +58,9 @@ class pdf_standard extends ModelePDFStock /** * @var array() Minimum version of PHP required by module. - * e.g.: PHP ≥ 5.3 = array(5, 3) + * e.g.: PHP ≥ 5.4 = array(5, 4) */ - public $phpmin = array(5, 2); + public $phpmin = array(5, 4); /** * Dolibarr version of the loaded document @@ -76,7 +76,11 @@ class pdf_standard extends ModelePDFStock public $marge_haute; public $marge_basse; - public $emetteur; // Objet societe qui emet + /** + * Issuer + * @var Societe + */ + public $emetteur; /** diff --git a/htdocs/core/modules/stock/doc/pdf_stdmovement.modules.php b/htdocs/core/modules/stock/doc/pdf_stdmovement.modules.php index a4795926cc4..0c9c55b5e7f 100644 --- a/htdocs/core/modules/stock/doc/pdf_stdmovement.modules.php +++ b/htdocs/core/modules/stock/doc/pdf_stdmovement.modules.php @@ -59,9 +59,9 @@ class pdf_stdmovement extends ModelePDFMovement /** * @var array() Minimum version of PHP required by module. - * e.g.: PHP ≥ 5.3 = array(5, 3) + * e.g.: PHP ≥ 5.4 = array(5, 4) */ - public $phpmin = array(5, 2); + public $phpmin = array(5, 4); /** * Dolibarr version of the loaded document @@ -77,7 +77,11 @@ class pdf_stdmovement extends ModelePDFMovement public $marge_haute; public $marge_basse; - public $emetteur; // Objet societe qui emet + /** + * Issuer + * @var Societe + */ + public $emetteur; /** diff --git a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php index 5a318a3a6b3..423804b284c 100644 --- a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php @@ -37,9 +37,14 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php'; */ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal { - public $emetteur; // Objet societe qui emet + /** + * Issuer + * @var Societe + */ + public $emetteur; public $phpmin = array(5,4,0); // Minimum version of PHP required by module + public $version = 'dolibarr'; diff --git a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php index e3d44050149..1f993bfcd86 100644 --- a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php +++ b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php @@ -35,9 +35,14 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php'; */ class doc_generic_user_odt extends ModelePDFUser { - public $emetteur; // Objet societe qui emet + /** + * Issuer + * @var Societe + */ + public $emetteur; public $phpmin = array(5,4,0); // Minimum version of PHP required by module + public $version = 'dolibarr'; diff --git a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php index 76cc423eb32..ffb356cbb9b 100644 --- a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php +++ b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php @@ -37,9 +37,14 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php'; */ class doc_generic_usergroup_odt extends ModelePDFUserGroup { - public $emetteur; // Objet societe qui emet + /** + * Issuer + * @var Societe + */ + public $emetteur; public $phpmin = array(5,4,0); // Minimum version of PHP required by module + public $version = 'dolibarr'; From bd3ba04e2401e912ac7fcc80ef739fd2631733b8 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 19 Sep 2018 16:36:08 +0200 Subject: [PATCH 27/51] Standardize and update code --- .../modules/commande/doc/doc_generic_order_odt.modules.php | 4 ++++ .../modules/contract/doc/doc_generic_contract_odt.modules.php | 4 ++++ .../expedition/doc/doc_generic_shipment_odt.modules.php | 4 ++++ .../modules/facture/doc/doc_generic_invoice_odt.modules.php | 4 ++++ .../modules/product/doc/doc_generic_product_odt.modules.php | 4 ++++ .../modules/project/task/doc/doc_generic_task_odt.modules.php | 4 ++++ .../modules/propale/doc/doc_generic_proposal_odt.modules.php | 4 ++++ .../core/modules/stock/doc/doc_generic_stock_odt.modules.php | 4 ++++ 8 files changed, 32 insertions(+) diff --git a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php index 1230bcad52d..7c3ca5bd2e6 100644 --- a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php +++ b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php @@ -46,6 +46,10 @@ class doc_generic_order_odt extends ModelePDFCommandes public $phpmin = array(5,4,0); // Minimum version of PHP required by module + /** + * Dolibarr version of the loaded document + * @public string + */ public $version = 'dolibarr'; diff --git a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php index ab43829a305..eca3f13d57f 100644 --- a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php +++ b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php @@ -45,6 +45,10 @@ class doc_generic_contract_odt extends ModelePDFContract public $phpmin = array(5,4,0); // Minimum version of PHP required by module + /** + * Dolibarr version of the loaded document + * @public string + */ public $version = 'dolibarr'; diff --git a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php index 6e058f4a92d..729663bf625 100644 --- a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php +++ b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php @@ -47,6 +47,10 @@ class doc_generic_shipment_odt extends ModelePdfExpedition public $phpmin = array(5,4,0); // Minimum version of PHP required by module + /** + * Dolibarr version of the loaded document + * @public string + */ public $version = 'dolibarr'; diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php index fb34a3da1f9..77824b75c8c 100644 --- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php +++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php @@ -46,6 +46,10 @@ class doc_generic_invoice_odt extends ModelePDFFactures public $phpmin = array(5,4,0); // Minimum version of PHP required by module + /** + * Dolibarr version of the loaded document + * @public string + */ public $version = 'dolibarr'; diff --git a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php index f4a829dcc51..b11e17a6623 100644 --- a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php +++ b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php @@ -44,6 +44,10 @@ class doc_generic_product_odt extends ModelePDFProduct public $phpmin = array(5,4,0); // Minimum version of PHP required by module + /** + * Dolibarr version of the loaded document + * @public string + */ public $version = 'dolibarr'; diff --git a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php index b7500731ab9..c881c6c5b46 100644 --- a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php +++ b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php @@ -62,6 +62,10 @@ class doc_generic_task_odt extends ModelePDFTask public $phpmin = array(5,4,0); // Minimum version of PHP required by module + /** + * Dolibarr version of the loaded document + * @public string + */ public $version = 'dolibarr'; diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php index 03a555435c4..469d154ddc5 100644 --- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php +++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php @@ -45,6 +45,10 @@ class doc_generic_proposal_odt extends ModelePDFPropales public $phpmin = array(5,4,0); // Minimum version of PHP required by module + /** + * Dolibarr version of the loaded document + * @public string + */ public $version = 'dolibarr'; diff --git a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php index a433287a63c..4f9de22f975 100644 --- a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php +++ b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php @@ -44,6 +44,10 @@ class doc_generic_stock_odt extends ModelePDFStock public $phpmin = array(5,4,0); // Minimum version of PHP required by module + /** + * Dolibarr version of the loaded document + * @public string + */ public $version = 'dolibarr'; From 52533a0210dbd4c2be0e2987e109c04019fd67d3 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 19 Sep 2018 16:43:37 +0200 Subject: [PATCH 28/51] Standardize and update code --- .../doc/doc_generic_supplier_proposal_odt.modules.php | 4 ++++ htdocs/core/modules/ticket/mod_ticket_simple.php | 7 ++++++- htdocs/core/modules/ticket/mod_ticket_universal.php | 7 ++++++- .../core/modules/user/doc/doc_generic_user_odt.modules.php | 4 ++++ .../usergroup/doc/doc_generic_usergroup_odt.modules.php | 4 ++++ 5 files changed, 24 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php index 423804b284c..a259fbbe7ee 100644 --- a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php @@ -45,6 +45,10 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal public $phpmin = array(5,4,0); // Minimum version of PHP required by module + /** + * Dolibarr version of the loaded document + * @public string + */ public $version = 'dolibarr'; diff --git a/htdocs/core/modules/ticket/mod_ticket_simple.php b/htdocs/core/modules/ticket/mod_ticket_simple.php index aa8b4c4e3f5..a2201208534 100644 --- a/htdocs/core/modules/ticket/mod_ticket_simple.php +++ b/htdocs/core/modules/ticket/mod_ticket_simple.php @@ -30,7 +30,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/ticket/modules_ticket.php'; */ class mod_ticket_simple extends ModeleNumRefTicket { - public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' + /** + * Dolibarr version of the loaded document + * @public string + */ + public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' + public $prefix = 'TS'; public $error = ''; public $nom = "Simple"; diff --git a/htdocs/core/modules/ticket/mod_ticket_universal.php b/htdocs/core/modules/ticket/mod_ticket_universal.php index c3dad0aa482..ee201740eed 100644 --- a/htdocs/core/modules/ticket/mod_ticket_universal.php +++ b/htdocs/core/modules/ticket/mod_ticket_universal.php @@ -29,7 +29,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/ticket/modules_ticket.php'; */ class mod_ticket_universal extends ModeleNumRefTicket { - public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' + /** + * Dolibarr version of the loaded document + * @public string + */ + public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' + public $error = ''; public $nom = 'Universal'; public $name = 'Universal'; diff --git a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php index 1f993bfcd86..41fb48ecec5 100644 --- a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php +++ b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php @@ -43,6 +43,10 @@ class doc_generic_user_odt extends ModelePDFUser public $phpmin = array(5,4,0); // Minimum version of PHP required by module + /** + * Dolibarr version of the loaded document + * @public string + */ public $version = 'dolibarr'; diff --git a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php index ffb356cbb9b..571a12aaf7b 100644 --- a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php +++ b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php @@ -45,6 +45,10 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup public $phpmin = array(5,4,0); // Minimum version of PHP required by module + /** + * Dolibarr version of the loaded document + * @public string + */ public $version = 'dolibarr'; From 55e3d97842d9122f3adc3c6b0cb3cfa8005b2d6a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Sep 2018 17:56:51 +0200 Subject: [PATCH 29/51] Trans --- htdocs/langs/en_US/boxes.lang | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/langs/en_US/boxes.lang b/htdocs/langs/en_US/boxes.lang index 22c9a4b069f..20cabb9e418 100644 --- a/htdocs/langs/en_US/boxes.lang +++ b/htdocs/langs/en_US/boxes.lang @@ -73,10 +73,10 @@ BoxProposalsPerMonth=Proposals per month NoTooLowStockProducts=No products are under the low stock limit BoxProductDistribution=Products/Services Distribution BoxProductDistributionFor=Distribution of %s by %s -BoxTitleLastModifiedSupplierBills=Supplier Invoices: last %s modified -BoxTitleLatestModifiedSupplierOrders=Supplier Orders: last %s modified -BoxTitleLastModifiedCustomerBills=Customer Invoices: last %s modified -BoxTitleLastModifiedCustomerOrders=Customer Orders: last %s modified +BoxTitleLastModifiedSupplierBills=Latest %s modified vendors invoices +BoxTitleLatestModifiedSupplierOrders=Last %s modified purchase orders +BoxTitleLastModifiedCustomerBills=Latest %s modified customers invoices +BoxTitleLastModifiedCustomerOrders=Latest %s modified customer orders BoxTitleLastModifiedPropals=Latest %s modified proposals ForCustomersInvoices=Customers invoices ForCustomersOrders=Customers orders From 7e0bad97ebbcc5a74c2b71e7b9dfceee97b8adea Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 19 Sep 2018 18:59:32 +0200 Subject: [PATCH 30/51] Update transaction.php --- htdocs/stripe/transaction.php | 112 +++++++++++++++++++++++++--------- 1 file changed, 84 insertions(+), 28 deletions(-) diff --git a/htdocs/stripe/transaction.php b/htdocs/stripe/transaction.php index 219846d151d..964d0463f55 100644 --- a/htdocs/stripe/transaction.php +++ b/htdocs/stripe/transaction.php @@ -26,7 +26,9 @@ require_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; -if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php'; +if (! empty($conf->accounting->enabled)) { + require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php'; +} // Load translation files required by the page $langs->loadLangs(array('compta', 'salaries', 'bills', 'hrm', 'stripe')); @@ -68,7 +70,7 @@ if (! empty($conf->stripe->enabled) && (empty($conf->global->STRIPE_LIVE) || GET } else { - $service = 'StripeLive'; + $service = 'StripeLive'; $servicestatus = '1'; } @@ -81,8 +83,9 @@ $stripeaccount = $stripe->getStripeAccount($service); if (! $rowid) { print ''; - if ($optioncss != '') - print ''; + if ($optioncss != '') { + print ''; + } print ''; print ''; print ''; @@ -123,6 +126,32 @@ if (! $rowid) { foreach ($txn->data as $txn) { + //$charge = $txn; + //var_dump($txn); + + // The metadata FULLTAG is defined by the online payment page + /*$FULLTAG=$charge->metadata->FULLTAG; + + // Save into $tmparray all metadata + $tmparray = dolExplodeIntoArray($FULLTAG,'.','='); + // Load origin object according to metadata + if (! empty($tmparray['CUS'])) + { + $societestatic->fetch($tmparray['CUS']); + } + else + { + $societestatic->id = 0; + } + if (! empty($tmparray['MEM'])) + { + $memberstatic->fetch($tmparray['MEM']); + } + else + { + $memberstatic->id = 0; + }*/ + $societestatic->fetch($charge->metadata->idcustomer); $societestatic->id = $charge->metadata->idcustomer; $societestatic->lastname = $obj->lastname; @@ -135,26 +164,52 @@ if (! $rowid) { print ''; // Ref - if (! empty($conf->stripe->enabled) && !empty($stripeacc)) $connect=$stripeacc.'/'; - - // Ref - if (preg_match('/po_/i', $txn->source)){ - $origin="payouts"; - } elseif (preg_match('/fee_/i', $txn->source)) { - $origin="connect/application_fees"; - } else { - $origin="payments"; - } + if (! empty($conf->stripe->enabled) && !empty($stripeacc)) $connect=$stripeacc.'/'; - $url='https://dashboard.stripe.com/'.$connect.'test/'.$origin.'/'.$txn->source; - if ($servicestatus) - { - $url='https://dashboard.stripe.com/'.$connect.$origin.'/'.$txn->source; - } - if ($txn->type == 'stripe_fee' || $txn->type == 'reserve_transaction') { - print "".$txn->type.""; - } else print "".img_picto($langs->trans('ShowInStripe'), 'object_globe')." " . $txn->source . "\n"; + if (preg_match('/po_/i', $txn->source)){ + $origin="payouts"; + } elseif (preg_match('/fee_/i', $txn->source)) { + $origin="connect/application_fees"; + } else { + $origin="payments"; + } + $url='https://dashboard.stripe.com/'.$connect.'test/'.$origin.'/'.$txn->source; + + if ($servicestatus) + { + $url='https://dashboard.stripe.com/'.$connect.$origin.'/'.$txn->source; + } + + if ($txn->type == 'stripe_fee' || $txn->type == 'reserve_transaction') { + print "".$txn->type.""; + } else print "".img_picto($langs->trans('ShowInStripe'), 'object_globe')." " . $txn->source . "\n"; + // Stripe customer + //print "".$charge->customer."\n"; + // Link + /*print ""; + if ($societestatic->id > 0) + { + print $societestatic->getNomUrl(1); + } + if ($memberstatic->id > 0) + { + print $memberstatic->getNomUrl(1); + } + print "\n";*/ + // Origine + + //print ""; + ////if ($charge->metadata->dol_type=="order"){ + // $object = new Commande($db); + // $object->fetch($charge->metadata->dol_id); + // print "".img_picto('', 'object_order')." ".$object->ref.""; + //} elseif ($charge->metadata->dol_type=="invoice"){ + // $object = new Facture($db); + // $object->fetch($charge->metadata->dol_id); + // print "".img_picto('', 'object_invoice')." ".$object->ref.""; + //} + //print "\n"; // Date payment print '' . dol_print_date($txn->created, '%d/%m/%Y %H:%M') . "\n"; // Type @@ -164,12 +219,13 @@ if (! $rowid) { print "" . price(($txn->fee) / 100, 0, '', 1, - 1, - 1, strtoupper($txn->currency)) . ""; // Status print ""; -if ($txn->status=='available') - {print img_picto($langs->trans("".$txn->status.""),'statut4');} -elseif ($txn->status=='pending') - {print img_picto($langs->trans("".$txn->status.""),'statut7');} -elseif ($txn->status=='failed') - {print img_picto($langs->trans("".$txn->status.""),'statut8');} + if ($txn->status=='available') { + print img_picto($langs->trans("".$txn->status.""),'statut4'); + } elseif ($txn->status=='pending') { + print img_picto($langs->trans("".$txn->status.""),'statut7'); + } elseif ($txn->status=='failed') { + print img_picto($langs->trans("".$txn->status.""),'statut8'); + } print ''; print "\n"; } From 203a2291bae40ffec9a1016bb395b1b355a32f39 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 19 Sep 2018 19:05:46 +0200 Subject: [PATCH 31/51] Update transaction.php --- htdocs/stripe/transaction.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/stripe/transaction.php b/htdocs/stripe/transaction.php index 964d0463f55..996a80cb132 100644 --- a/htdocs/stripe/transaction.php +++ b/htdocs/stripe/transaction.php @@ -164,25 +164,25 @@ if (! $rowid) { print ''; // Ref - if (! empty($conf->stripe->enabled) && !empty($stripeacc)) $connect=$stripeacc.'/'; + if (! empty($conf->stripe->enabled) && !empty($stripeacc)) $connect=$stripeacc.'/'; - if (preg_match('/po_/i', $txn->source)){ + if (preg_match('/po_/i', $txn->source)){ $origin="payouts"; - } elseif (preg_match('/fee_/i', $txn->source)) { - $origin="connect/application_fees"; - } else { - $origin="payments"; - } + } elseif (preg_match('/fee_/i', $txn->source)) { + $origin="connect/application_fees"; + } else { + $origin="payments"; + } - $url='https://dashboard.stripe.com/'.$connect.'test/'.$origin.'/'.$txn->source; + $url='https://dashboard.stripe.com/'.$connect.'test/'.$origin.'/'.$txn->source; - if ($servicestatus) + if ($servicestatus) { - $url='https://dashboard.stripe.com/'.$connect.$origin.'/'.$txn->source; + $url='https://dashboard.stripe.com/'.$connect.$origin.'/'.$txn->source; } - if ($txn->type == 'stripe_fee' || $txn->type == 'reserve_transaction') { - print "".$txn->type.""; + if ($txn->type == 'stripe_fee' || $txn->type == 'reserve_transaction') { + print "".$txn->type.""; } else print "".img_picto($langs->trans('ShowInStripe'), 'object_globe')." " . $txn->source . "\n"; // Stripe customer //print "".$charge->customer."\n"; From 1a841b48ae96f48a4fd2fcf154f510def908e2f5 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 19 Sep 2018 20:15:12 +0200 Subject: [PATCH 32/51] Update transaction.php --- htdocs/stripe/transaction.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/stripe/transaction.php b/htdocs/stripe/transaction.php index 996a80cb132..9d9a1c84597 100644 --- a/htdocs/stripe/transaction.php +++ b/htdocs/stripe/transaction.php @@ -167,9 +167,9 @@ if (! $rowid) { if (! empty($conf->stripe->enabled) && !empty($stripeacc)) $connect=$stripeacc.'/'; if (preg_match('/po_/i', $txn->source)){ - $origin="payouts"; + $origin="payouts"; } elseif (preg_match('/fee_/i', $txn->source)) { - $origin="connect/application_fees"; + $origin="connect/application_fees"; } else { $origin="payments"; } @@ -177,13 +177,13 @@ if (! $rowid) { $url='https://dashboard.stripe.com/'.$connect.'test/'.$origin.'/'.$txn->source; if ($servicestatus) - { + { $url='https://dashboard.stripe.com/'.$connect.$origin.'/'.$txn->source; - } + } if ($txn->type == 'stripe_fee' || $txn->type == 'reserve_transaction') { print "".$txn->type.""; - } else print "".img_picto($langs->trans('ShowInStripe'), 'object_globe')." " . $txn->source . "\n"; + } else print "".img_picto($langs->trans('ShowInStripe'), 'object_globe')." " . $txn->source . "\n"; // Stripe customer //print "".$charge->customer."\n"; // Link From 83d3e5ec398012874a6a8ba1f9e0f5a0e0febeae Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Thu, 20 Sep 2018 10:08:40 +0200 Subject: [PATCH 33/51] NEW : can add project's task to agenda on create event card --- htdocs/comm/action/card.php | 84 ++++++++++++++++++++++++++++++++++--- 1 file changed, 78 insertions(+), 6 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 8fd1f1b0030..f968f9800e9 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -40,6 +40,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; +require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; @@ -251,6 +252,19 @@ if ($action == 'add') } } $object->fk_project = isset($_POST["projectid"])?$_POST["projectid"]:0; + + $taskid = GETPOST('taskid','int'); + if(!empty($taskid)){ + + $taskProject = new Task($db); + if($taskProject->fetch($taskid)>0){ + $object->fk_project = $taskProject->fk_project; + } + + $object->fk_element = $taskid; + $object->elementtype = 'task'; + } + $object->datep = $datep; $object->datef = $datef; $object->percentage = $percentage; @@ -876,11 +890,38 @@ if ($action == 'create') { // Projet associe $langs->load("projects"); + + $projectid = GETPOST('projectid', 'int'); - print ''.$langs->trans("Project").''; + print ''.$langs->trans("Project").''; - $numproject=$formproject->select_projects((! empty($societe->id)?$societe->id:-1), GETPOST("projectid")?GETPOST("projectid"):'', 'projectid', 0, 0, 1, 1); + $numproject=$formproject->select_projects((! empty($societe->id)?$societe->id:-1), $projectid, 'projectid', 0, 0, 1, 1); + print '   '.$langs->trans("AddProject").''; + $urloption='?action=create'; + $url = dol_buildpath('comm/action/card.php',2).$urloption; + + // update task list + print "\n".''."\n"; + + print ''; + + print ''.$langs->trans("Task").''; + + $projectsListId=false; + if(!empty($projectid)){ $projectsListId=$projectid; } + $tid=GETPOST("projecttaskid")?GETPOST("projecttaskid"):''; + $formproject->selectTasks((! empty($societe->id)?$societe->id:-1), $tid, 'taskid', 24, 0, '1', 1, 0, 0, 'maxwidth500',$projectsListId); print ''; } if (!empty($origin) && !empty($originid)) @@ -1270,10 +1311,41 @@ if ($id > 0) include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; print ''; print ''.$langs->trans("LinkedObject").''; - print ''.dolGetElementUrl($object->fk_element,$object->elementtype,1); - print ''; - print ''; - print ''; + + if ($object->elementtype == 'task' && ! empty($conf->projet->enabled)) + { + print ''; + + $urloption='?action=create'; // we use create not edit for more flexibility + $url = DOL_URL_ROOT.'/comm/action/card.php'.$urloption; + + // update task list + print "\n".''."\n"; + + $formproject->selectTasks((! empty($societe->id)?$societe->id:-1), $object->fk_element, 'fk_element', 24, 0, 0, 1, 0, 0, 'maxwidth500',$object->fk_project); + print ''; + + print ''; + } + else + { + print ''; + print dolGetElementUrl($object->fk_element,$object->elementtype,1); + print ''; + print ''; + print ''; + } + print ''; } From 75104999d3155af66ae5970f09303a5896f99a9b Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Thu, 20 Sep 2018 15:04:00 +0200 Subject: [PATCH 34/51] NEW PHPUnitTest on Loan class #3163 --- htdocs/loan/class/loan.class.php | 30 +++++ test/phpunit/LoanTest.php | 218 +++++++++++++++++++++++++++++++ 2 files changed, 248 insertions(+) create mode 100644 test/phpunit/LoanTest.php diff --git a/htdocs/loan/class/loan.class.php b/htdocs/loan/class/loan.class.php index 7843694585f..a4518960839 100644 --- a/htdocs/loan/class/loan.class.php +++ b/htdocs/loan/class/loan.class.php @@ -445,6 +445,36 @@ class Loan extends CommonObject return $result; } + + /** + * Initialise an instance with random values. + * Used to build previews or test instances. + * id must be 0 if object instance is a specimen. + * + * @return void + */ + function initAsSpecimen() + { + global $user, $langs, $conf; + + $now=dol_now(); + + // Initialise parameters + $this->id = 0; + $this->fk_bank = 1; + $this->label = 'SPECIMEN'; + $this->specimen = 1; + $this->socid = 1; + $this->account_capital = 16; + $this->account_insurance = 616; + $this->account_interest = 518; + $this->datestart = $now; + $this->dateend = $now + (3600 * 24 * 365); + $this->note_public = 'SPECIMEN'; + $this->capital = 20000; + $this->nbterm = 48; + $this->rate = 4.3; + } /** * Return amount of payments already done diff --git a/test/phpunit/LoanTest.php b/test/phpunit/LoanTest.php new file mode 100644 index 00000000000..8341f788ede --- /dev/null +++ b/test/phpunit/LoanTest.php @@ -0,0 +1,218 @@ + + * + * 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 . + * or see http://www.gnu.org/ + */ + +/** + * \file test/phpunit/LoanTest.php + * \ingroup test + * \brief PHPUnit test + * \remarks To run this script as CLI: phpunit filename.php + */ + +global $conf,$user,$langs,$db; +//define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver +//require_once 'PHPUnit/Autoload.php'; +require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; +require_once dirname(__FILE__).'/../../htdocs/loan/class/loan.class.php'; + +if (empty($user->id)) +{ + print "Load permissions for admin user nb 1\n"; + $user->fetch(1); + $user->getrights(); +} +$conf->global->MAIN_DISABLE_ALL_MAILS=1; + + +/** + * Class for PHPUnit tests + * + * @backupGlobals disabled + * @backupStaticAttributes enabled + * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. + */ +class LoanTest extends PHPUnit_Framework_TestCase +{ + protected $savconf; + protected $savuser; + protected $savlangs; + protected $savdb; + + /** + * Constructor + * We save global variables into local variables + * + * @return LoanTest + */ + function __construct() + { + parent::__construct(); + + //$this->sharedFixture + global $conf,$user,$langs,$db; + $this->savconf=$conf; + $this->savuser=$user; + $this->savlangs=$langs; + $this->savdb=$db; + + print __METHOD__." db->type=".$db->type." user->id=".$user->id; + //print " - db ".$db->db; + print "\n"; + } + + // Static methods + public static function setUpBeforeClass() + { + global $conf,$user,$langs,$db; + $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + + print __METHOD__."\n"; + } + + // tear down after class + public static function tearDownAfterClass() + { + global $conf,$user,$langs,$db; + $db->rollback(); + + print __METHOD__."\n"; + } + + /** + * Init phpunit tests + * + * @return void + */ + protected function setUp() + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + print __METHOD__."\n"; + //print $db->getVersion()."\n"; + } + /** + * End phpunit tests + * + * @return void + */ + protected function tearDown() + { + print __METHOD__."\n"; + } + + /** + * testLoanCreate + * + * @return void + */ + public function testLoanCreate() + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + $localobject=new Loan($this->savdb); + $localobject->initAsSpecimen(); + $result=$localobject->create($user); + + $this->assertLessThan($result, 0); + print __METHOD__." result=".$result."\n"; + return $result; + } + + /** + * testLoanFetch + * + * @param int $id Id of object + * @return void + * + * @depends testLoanCreate + * The depends says test is run only if previous is ok + */ + public function testLoanFetch($id) + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + $localobject=new Loan($this->savdb); + $result=$localobject->fetch($id); + + $this->assertLessThan($result, 0); + print __METHOD__." id=".$id." result=".$result."\n"; + return $localobject; + } + + /** + * testLoanOther + * + * @param Loan $localobject Loan + * @return int + * + * @depends testLoanFetch + * The depends says test is run only if previous is ok + */ + public function testLoanOther($localobject) + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + $result=$localobject->set_paid($user); + + print __METHOD__." id=".$localobject->id." result=".$result."\n"; + $this->assertLessThan($result, 0); + return $localobject->id; + } + + /** + * testLoanDelete + * + * @param int $id Id of loan + * @return void + * + * @depends testLoanCreate + * The depends says test is run only if previous is ok + */ + public function testLoanDelete($id) + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + $localobject=new Loan($this->savdb); + $result=$localobject->fetch($id); + $result=$localobject->delete($user); + + print __METHOD__." id=".$id." result=".$result."\n"; + $this->assertLessThan($result, 0); + return $result; + } + +} From b59b0b0cc308e994ab0c0db704143e478d34cdfb Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Thu, 20 Sep 2018 16:13:22 +0200 Subject: [PATCH 35/51] FIX attribute closing --- htdocs/core/tpl/objectline_view.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 848ac6dbf21..776506bdaee 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -66,7 +66,7 @@ $domData .= ' data-product_type="'.$line->product_type.'"'; ?> - > + > global->MAIN_VIEW_LINE_NUMBER)) { ?> From e0dfab4c7125dcb3f5fddfb2ce34cad09219e906 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Sep 2018 16:21:08 +0200 Subject: [PATCH 36/51] FIX The max size for upload file was not corectly shown --- htdocs/core/class/html.formfile.class.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 117ec484c15..f80c6942d8c 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -122,11 +122,12 @@ class FormFile if (preg_match('/g$/i',$maxphp)) $maxphp=$maxphp*1024*1024; if (preg_match('/t$/i',$maxphp)) $maxphp=$maxphp*1024*1024*1024; // Now $max and $maxphp are in Kb - if ($maxphp > 0) $max=min($max,$maxphp); + $maxmin = $max; + if ($maxphp > 0) $maxmin=min($max,$maxphp); - if ($max > 0) + if ($maxmin > 0) { - $out .= ''; + $out .= ''; } $out .= ' Date: Thu, 20 Sep 2018 19:06:12 +0200 Subject: [PATCH 37/51] Include PHP unit of Loan class into Travis --- test/phpunit/AllTests.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/phpunit/AllTests.php b/test/phpunit/AllTests.php index 66636ad7619..6aacecc6a00 100644 --- a/test/phpunit/AllTests.php +++ b/test/phpunit/AllTests.php @@ -195,6 +195,8 @@ class AllTests $suite->addTestSuite('HolidayTest'); require_once dirname(__FILE__).'/ExpenseReportTest.php'; $suite->addTestSuite('ExpenseReportTest'); + require_once dirname(__FILE__).'/LoadnTest.php'; + $suite->addTestSuite('LoanTest'); require_once dirname(__FILE__).'/EntrepotTest.php'; $suite->addTestSuite('EntrepotTest'); From df395847d3922f55040d26e9a468c076494adf85 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Sep 2018 19:14:32 +0200 Subject: [PATCH 38/51] FIX #9567 --- htdocs/core/lib/functions.lib.php | 6 +++--- htdocs/theme/eldy/style.css.php | 2 +- htdocs/theme/md/style.css.php | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index af0d7219ddc..23bde56dff9 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4137,13 +4137,13 @@ function print_fiche_titre($title, $mesg='', $picto='title_generic.png', $pictoi * @param string $morehtmlright Added message to show on right * @param string $picto Icon to use before title (should be a 32x32 transparent png file) * @param int $pictoisfullpath 1=Icon name is a full absolute url of image - * @param int $id To force an id on html objects + * @param string $id To force an id on html objects * @param string $morecssontable More css on table * @param string $morehtmlcenter Added message to show on center * @return string * @see print_barre_liste */ -function load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png', $pictoisfullpath=0, $id=0, $morecssontable='', $morehtmlcenter='') +function load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='') { global $conf; @@ -4153,7 +4153,7 @@ function load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png', $return.= "\n"; $return.= ''; - if ($picto) $return.= ''; + if ($picto) $return.= ''; $return.= ''; diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 21ca0e5e586..cc1da092523 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -1369,7 +1369,7 @@ div.nopadding { margin : 0px auto; } -#pictotitle { +.pictotitle { margin-: 8px; margin-bottom: 4px; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 58a34ce1873..f568d411335 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1363,7 +1363,7 @@ table.noborder tr.liste_titre td { margin : 0px auto; } -#pictotitle { +.pictotitle { margin-: 8px; margin-bottom: 4px; } From b421c29ea7a68238f2af4f149127083fc77018a9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Sep 2018 19:20:15 +0200 Subject: [PATCH 39/51] FIX #9510 --- htdocs/admin/system/dolibarr.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/system/dolibarr.php b/htdocs/admin/system/dolibarr.php index 4b02e7941d2..b2000b65c5b 100644 --- a/htdocs/admin/system/dolibarr.php +++ b/htdocs/admin/system/dolibarr.php @@ -157,7 +157,8 @@ $i=0; foreach($_SESSION as $key => $val) { if ($i > 0) print ', '; - print $key.' => '.dol_escape_htmltag($val); + if (is_array($val)) print $key.' => array(...)'; + else print $key.' => '.dol_escape_htmltag($val); $i++; } print ''."\n"; From 36b8958c59e12a0cfb0732823b02a9b962820fd4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Sep 2018 19:35:13 +0200 Subject: [PATCH 40/51] Move Stripe menu transactions and charges from develop to experimental --- htdocs/core/modules/modBanque.class.php | 14 +++++++------- htdocs/core/modules/modStripe.class.php | 14 +++++++------- htdocs/langs/en_US/main.lang | 1 + htdocs/langs/en_US/paypal.lang | 1 - 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/htdocs/core/modules/modBanque.class.php b/htdocs/core/modules/modBanque.class.php index 3ca1a082580..aebc570ab36 100644 --- a/htdocs/core/modules/modBanque.class.php +++ b/htdocs/core/modules/modBanque.class.php @@ -86,49 +86,49 @@ class modBanque extends DolibarrModules $r++; $this->rights[$r][0] = 111; // id de la permission - $this->rights[$r][1] = 'Lire les comptes bancaires'; // libelle de la permission + $this->rights[$r][1] = 'Read bank account and transactions'; $this->rights[$r][2] = 'r'; $this->rights[$r][3] = 0; $this->rights[$r][4] = 'lire'; $r++; $this->rights[$r][0] = 112; // id de la permission - $this->rights[$r][1] = 'Creer/modifier montant/supprimer ecriture bancaire'; // libelle de la permission + $this->rights[$r][1] = 'Creer/modifier montant/supprimer ecriture bancaire'; $this->rights[$r][2] = 'w'; $this->rights[$r][3] = 0; $this->rights[$r][4] = 'modifier'; $r++; $this->rights[$r][0] = 113; // id de la permission - $this->rights[$r][1] = 'Configurer les comptes bancaires (creer, gerer categories)'; // libelle de la permission + $this->rights[$r][1] = 'Configurer les comptes bancaires (creer, gerer categories)'; $this->rights[$r][2] = 'a'; $this->rights[$r][3] = 0; $this->rights[$r][4] = 'configurer'; $r++; $this->rights[$r][0] = 114; // id de la permission - $this->rights[$r][1] = 'Rapprocher les ecritures bancaires'; // libelle de la permission + $this->rights[$r][1] = 'Rapprocher les ecritures bancaires'; $this->rights[$r][2] = 'w'; $this->rights[$r][3] = 0; $this->rights[$r][4] = 'consolidate'; $r++; $this->rights[$r][0] = 115; // id de la permission - $this->rights[$r][1] = 'Exporter transactions et releves'; // libelle de la permission + $this->rights[$r][1] = 'Exporter transactions et releves'; $this->rights[$r][2] = 'r'; $this->rights[$r][3] = 0; $this->rights[$r][4] = 'export'; $r++; $this->rights[$r][0] = 116; // id de la permission - $this->rights[$r][1] = 'Virements entre comptes'; // libelle de la permission + $this->rights[$r][1] = 'Virements entre comptes'; $this->rights[$r][2] = 'w'; $this->rights[$r][3] = 0; $this->rights[$r][4] = 'transfer'; $r++; $this->rights[$r][0] = 117; // id de la permission - $this->rights[$r][1] = 'Gerer les envois de cheques'; // libelle de la permission + $this->rights[$r][1] = 'Gerer les envois de cheques'; $this->rights[$r][2] = 'w'; $this->rights[$r][3] = 0; $this->rights[$r][4] = 'cheque'; diff --git a/htdocs/core/modules/modStripe.class.php b/htdocs/core/modules/modStripe.class.php index 1f6f1e92f05..348b44aaa1d 100644 --- a/htdocs/core/modules/modStripe.class.php +++ b/htdocs/core/modules/modStripe.class.php @@ -102,7 +102,7 @@ class modStripe extends DolibarrModules 'langs'=>'stripe', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. 'position'=>500, 'enabled'=>'$conf->stripe->enabled && $conf->banque->enabled && $conf->global->MAIN_FEATURES_LEVEL >= 2', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. - 'perms'=>'$user->rights->banque->consolidate', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules + 'perms'=>'$user->rights->banque->modifier', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules 'target'=>'', 'user'=>2 ); // 0=Menu for internal users, 1=external users, 2=both @@ -117,8 +117,8 @@ class modStripe extends DolibarrModules 'url' => '', 'langs' => 'stripe', 'position' => 100, - 'enabled' => '$conf->global->MAIN_FEATURES_LEVEL >= 1', - 'perms' => '$user->rights->banque->configurer', + 'enabled' => '$conf->stripe->enabled && $conf->banque->enabled && $conf->global->MAIN_FEATURES_LEVEL >= 1', + 'perms' => '$user->rights->banque->lire', 'target' => '', 'user' => 0 ); @@ -131,8 +131,8 @@ class modStripe extends DolibarrModules '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', + 'enabled' => '$conf->stripe->enabled && $conf->banque->enabled && $conf->global->MAIN_FEATURES_LEVEL >= 1', + 'perms' => '$user->rights->banque->lire', 'target' => '', 'user' => 0 ); @@ -145,8 +145,8 @@ class modStripe extends DolibarrModules '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', + 'enabled' => '$conf->stripe->enabled && $conf->banque->enabled && $conf->global->MAIN_FEATURES_LEVEL >= 1', + 'perms' => '$user->rights->banque->lire', 'target' => '', 'user' => 0 ); diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 5e8e9ff62da..a3cc816f7fa 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -951,3 +951,4 @@ Deletedraft=Delete draft ConfirmMassDraftDeletion=Draft mass delete confirmation FileSharedViaALink=File shared via a link SelectAThirdPartyFirst=Select a third party first... +YouAreCurrentlyInSandboxMode=You are currently in the %s "sandbox" mode diff --git a/htdocs/langs/en_US/paypal.lang b/htdocs/langs/en_US/paypal.lang index 724a3bbd813..c088debc518 100644 --- a/htdocs/langs/en_US/paypal.lang +++ b/htdocs/langs/en_US/paypal.lang @@ -14,7 +14,6 @@ PaypalModeOnlyPaypal=PayPal only ONLINE_PAYMENT_CSS_URL=Optional URL of CSS stylesheet on online payment page ThisIsTransactionId=This is id of transaction: %s PAYPAL_ADD_PAYMENT_URL=Add the url of PayPal payment when you send a document by mail -YouAreCurrentlyInSandboxMode=You are currently in the %s "sandbox" mode NewOnlinePaymentReceived=New online payment received NewOnlinePaymentFailed=New online payment tried but failed ONLINE_PAYMENT_SENDEMAIL=EMail to warn after a payment (success or not) From 4ba057528fa20a21d07d1c064cded2846a7b48e2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Sep 2018 19:37:28 +0200 Subject: [PATCH 41/51] Fix permissionss --- htdocs/core/modules/modStripe.class.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/modules/modStripe.class.php b/htdocs/core/modules/modStripe.class.php index e5b481f4daa..ac11e53e733 100644 --- a/htdocs/core/modules/modStripe.class.php +++ b/htdocs/core/modules/modStripe.class.php @@ -101,7 +101,7 @@ class modStripe extends DolibarrModules 'langs'=>'stripe', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. 'position'=>500, 'enabled'=>'$conf->stripe->enabled && $conf->banque->enabled && $conf->global->MAIN_FEATURES_LEVEL >= 2', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. - 'perms'=>'$user->rights->banque->consolidate', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules + 'perms'=>'$user->rights->banque->modifier', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules 'target'=>'', 'user'=>2 ); // 0=Menu for internal users, 1=external users, 2=both @@ -116,8 +116,8 @@ class modStripe extends DolibarrModules 'url' => '', 'langs' => 'stripe', 'position' => 100, - 'enabled' => '$conf->global->MAIN_FEATURES_LEVEL >= 1', - 'perms' => '$user->rights->banque->configurer', + 'enabled' => '$conf->stripe->enabled && $conf->banque->enabled && $conf->global->MAIN_FEATURES_LEVEL >= 1', + 'perms' => '$user->rights->banque->lire', 'target' => '', 'user' => 0 ); @@ -131,7 +131,7 @@ class modStripe extends DolibarrModules 'langs' => 'stripe', 'position' => 102, 'enabled' => '$conf->stripe->enabled && $conf->banque->enabled && $conf->global->MAIN_FEATURES_LEVEL >= 2', - 'perms' => '$user->rights->banque->configurer', + 'perms' => '$user->rights->banque->lire', 'target' => '', 'user' => 0 ); @@ -145,7 +145,7 @@ class modStripe extends DolibarrModules 'langs' => 'stripe', 'position' => 102, 'enabled' => '$conf->stripe->enabled && $conf->banque->enabled && $conf->global->MAIN_FEATURES_LEVEL >= 2', - 'perms' => '$user->rights->banque->configurer', + 'perms' => '$user->rights->banque->lire', 'target' => '', 'user' => 0 ); From eb80c5c338fdee4a1b37b5d416e28b79ca9e23de Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Sep 2018 19:45:13 +0200 Subject: [PATCH 42/51] Fix translation not loaded and test on multicompany --- htdocs/comm/card.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index bc7ea0cd67d..f552382bcce 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -666,6 +666,8 @@ if ($object->id > 0) */ if (! empty($conf->propal->enabled) && $user->rights->propal->lire) { + $langs->load("propal"); + $sql = "SELECT s.nom, s.rowid, p.rowid as propalid, p.fk_statut, p.total_ht"; $sql.= ", p.tva as total_tva"; $sql.= ", p.total as total_ttc"; @@ -674,7 +676,7 @@ if ($object->id > 0) $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."c_propalst as c"; $sql.= " WHERE p.fk_soc = s.rowid AND p.fk_statut = c.id"; $sql.= " AND s.rowid = ".$object->id; - $sql.= " AND p.entity = ".$conf->entity; + $sql.= " AND p.entity IN (".getEntity('propal').")"; $sql.= " ORDER BY p.datep DESC"; $resql=$db->query($sql); From 042555e716c80ed9897e2368821dc140a5c6d342 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 20 Sep 2018 20:44:17 +0200 Subject: [PATCH 43/51] remove warning Line exceeds 500 characters --- htdocs/core/modules/modSyslog.class.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/modSyslog.class.php b/htdocs/core/modules/modSyslog.class.php index d401b2f1621..7166a787809 100644 --- a/htdocs/core/modules/modSyslog.class.php +++ b/htdocs/core/modules/modSyslog.class.php @@ -85,7 +85,20 @@ class modSyslog extends DolibarrModules // Cronjobs $this->cronjobs = array( - 0=>array('label'=>'CompressSyslogs', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'compressSyslogs', 'parameters'=>'', 'comment'=>'Compress and archive log files. Warning: batch must be run with same account than your web server to avoid to get log files with different owner than required by web server. Another solution is to set web server Operating System group as the group of directory documents and set GROUP permission "rws" on this directory so log files will always have the group and permissions of the web server Operating System group', 'frequency'=>1, 'unitfrequency'=> 3600 * 24, 'priority'=>50, 'status'=>0, 'test'=>true), + 0 => array( + 'label' => 'CompressSyslogs', + 'jobtype' => 'method', + 'class' => 'core/class/utils.class.php', + 'objectname' => 'Utils', + 'method' => 'compressSyslogs', + 'parameters' => '', + 'comment' => 'Compress and archive log files. Warning: batch must be run with same account than your web server to avoid to get log files with different owner than required by web server. Another solution is to set web server Operating System group as the group of directory documents and set GROUP permission "rws" on this directory so log files will always have the group and permissions of the web server Operating System group', + 'frequency' => 1, + 'unitfrequency' => 3600 * 24, + 'priority' => 50, + 'status' => 0, + 'test' => true, + ), ); } } From 37dcb33661183c6e9dde6c385516d4d91a28c186 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Sep 2018 23:41:04 +0200 Subject: [PATCH 44/51] phpunit for Loan --- test/phpunit/AllTests.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/phpunit/AllTests.php b/test/phpunit/AllTests.php index 6aacecc6a00..206d180f700 100644 --- a/test/phpunit/AllTests.php +++ b/test/phpunit/AllTests.php @@ -195,7 +195,7 @@ class AllTests $suite->addTestSuite('HolidayTest'); require_once dirname(__FILE__).'/ExpenseReportTest.php'; $suite->addTestSuite('ExpenseReportTest'); - require_once dirname(__FILE__).'/LoadnTest.php'; + require_once dirname(__FILE__).'/LoanTest.php'; $suite->addTestSuite('LoanTest'); require_once dirname(__FILE__).'/EntrepotTest.php'; From 0073d63464c1b18061685e8401e33f619666d7ea Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 21 Sep 2018 09:42:33 +0200 Subject: [PATCH 45/51] Fix phpcs --- test/phpunit/LoanTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/test/phpunit/LoanTest.php b/test/phpunit/LoanTest.php index 8341f788ede..d54c810049d 100644 --- a/test/phpunit/LoanTest.php +++ b/test/phpunit/LoanTest.php @@ -214,5 +214,4 @@ class LoanTest extends PHPUnit_Framework_TestCase $this->assertLessThan($result, 0); return $result; } - } From d0fafe8f0f1299cfdd73eb5cf823b7c2372bf1dc Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 21 Sep 2018 09:49:13 +0200 Subject: [PATCH 46/51] fix link with connect transaction.php --- htdocs/stripe/transaction.php | 81 ++++++++++++++++------------------- 1 file changed, 37 insertions(+), 44 deletions(-) diff --git a/htdocs/stripe/transaction.php b/htdocs/stripe/transaction.php index 9d9a1c84597..2a62144a6e1 100644 --- a/htdocs/stripe/transaction.php +++ b/htdocs/stripe/transaction.php @@ -1,6 +1,5 @@ - * Copyright (C) 2018 Frédéric France +/* Copyright (C) 2018 PtibogXIV * * 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 @@ -26,9 +25,7 @@ require_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; -if (! empty($conf->accounting->enabled)) { - require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php'; -} +if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php'; // Load translation files required by the page $langs->loadLangs(array('compta', 'salaries', 'bills', 'hrm', 'stripe')); @@ -65,16 +62,16 @@ llxHeader('', $langs->trans("StripeTransactionList")); if (! empty($conf->stripe->enabled) && (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox','alpha'))) { $service = 'StripeTest'; - $servicestatus = '0'; + $servicestatus = '0'; dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), '', 'warning'); } else { $service = 'StripeLive'; - $servicestatus = '1'; + $servicestatus = '1'; } -$stripeaccount = $stripe->getStripeAccount($service); +$stripeacc = $stripe->getStripeAccount($service); /*if (empty($stripeaccount)) { print $langs->trans('ErrorStripeAccountNotDefined'); @@ -83,9 +80,8 @@ $stripeaccount = $stripe->getStripeAccount($service); if (! $rowid) { print ''; - if ($optioncss != '') { - print ''; - } + if ($optioncss != '') + print ''; print ''; print ''; print ''; @@ -94,7 +90,7 @@ if (! $rowid) { print ''; $title=$langs->trans("StripeTransactionList"); - $title.=($stripeaccount?' (Stripe connection with Stripe OAuth Connect account '.$stripeaccount.')':' (Stripe connection with keys from Stripe module setup)'); + $title.=($stripeaccount?' (Stripe connection with Stripe OAuth Connect account '.$stripeacc.')':' (Stripe connection with keys from Stripe module setup)'); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $totalnboflines, 'title_accountancy.png', 0, '', '', $limit); @@ -115,9 +111,9 @@ if (! $rowid) { print "\n"; - if ($stripeaccount) + if ($stripeacc) { - $txn = \Stripe\BalanceTransaction::all(array("limit" => $limit), array("stripe_account" => $stripeaccount)); + $txn = \Stripe\BalanceTransaction::all(array("limit" => $limit), array("stripe_account" => $stripeacc)); } else { @@ -128,10 +124,10 @@ if (! $rowid) { { //$charge = $txn; //var_dump($txn); - + // The metadata FULLTAG is defined by the online payment page /*$FULLTAG=$charge->metadata->FULLTAG; - + // Save into $tmparray all metadata $tmparray = dolExplodeIntoArray($FULLTAG,'.','='); // Load origin object according to metadata @@ -151,7 +147,7 @@ if (! $rowid) { { $memberstatic->id = 0; }*/ - + $societestatic->fetch($charge->metadata->idcustomer); $societestatic->id = $charge->metadata->idcustomer; $societestatic->lastname = $obj->lastname; @@ -162,28 +158,28 @@ if (! $rowid) { $societestatic->societe_id = $obj->fk_soc; print ''; - + + // Ref + if (!empty($stripeacc)) $connect=$stripeacc.'/'; + // Ref - if (! empty($conf->stripe->enabled) && !empty($stripeacc)) $connect=$stripeacc.'/'; - if (preg_match('/po_/i', $txn->source)){ $origin="payouts"; } elseif (preg_match('/fee_/i', $txn->source)) { - $origin="connect/application_fees"; + $origin="connect/application_fees"; } else { - $origin="payments"; - } - + $origin="payments"; + } + $url='https://dashboard.stripe.com/'.$connect.'test/'.$origin.'/'.$txn->source; - - if ($servicestatus) - { - $url='https://dashboard.stripe.com/'.$connect.$origin.'/'.$txn->source; - } - + if ($servicestatus) + { + $url='https://dashboard.stripe.com/'.$connect.$origin.'/'.$txn->source; + } if ($txn->type == 'stripe_fee' || $txn->type == 'reserve_transaction') { - print ""; - } else print "\n"; + print ""; + } else print "\n"; + // Stripe customer //print "\n"; // Link @@ -198,16 +194,15 @@ if (! $rowid) { } print "\n";*/ // Origine - //print "\n"; // Date payment @@ -219,21 +214,19 @@ if (! $rowid) { print ""; // Status print "'; print "\n"; } print "
'.img_picto('',$picto, 'class="valignmiddle widthpictotitle" id="pictotitle"', $pictoisfullpath).''.img_picto('',$picto, 'class="valignmiddle widthpictotitle pictotitle"', $pictoisfullpath).''; $return.= '
'.$titre.'
'; $return.= '
".$txn->type."".img_picto($langs->trans('ShowInStripe'), 'object_globe')." " . $txn->source . "".$txn->type."".img_picto($langs->trans('ShowInStripe'), 'object_globe')." " . $txn->source . "".$charge->customer.""; ////if ($charge->metadata->dol_type=="order"){ // $object = new Commande($db); // $object->fetch($charge->metadata->dol_id); - // print "".img_picto('', 'object_order')." ".$object->ref.""; + // print "".img_picto('', 'object_order')." ".$object->ref.""; //} elseif ($charge->metadata->dol_type=="invoice"){ // $object = new Facture($db); // $object->fetch($charge->metadata->dol_id); - // print "".img_picto('', 'object_invoice')." ".$object->ref.""; + // print "".img_picto('', 'object_invoice')." ".$object->ref.""; //} //print "" . price(($txn->fee) / 100, 0, '', 1, - 1, - 1, strtoupper($txn->currency)) . ""; - if ($txn->status=='available') { - print img_picto($langs->trans("".$txn->status.""),'statut4'); - } elseif ($txn->status=='pending') { - print img_picto($langs->trans("".$txn->status.""),'statut7'); - } elseif ($txn->status=='failed') { - print img_picto($langs->trans("".$txn->status.""),'statut8'); - } +if ($txn->status=='available') + {print img_picto($langs->trans("".$txn->status.""),'statut4');} +elseif ($txn->status=='pending') + {print img_picto($langs->trans("".$txn->status.""),'statut7');} +elseif ($txn->status=='failed') + {print img_picto($langs->trans("".$txn->status.""),'statut8');} print '
"; print '
'; print '
'; -} +} else {} -// End of page llxFooter(); $db->close(); From d544f0598b8b90fe69ba5b777433fd548355b843 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 21 Sep 2018 09:50:31 +0200 Subject: [PATCH 47/51] fix link in connect mode --- htdocs/stripe/charge.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/stripe/charge.php b/htdocs/stripe/charge.php index d39cac84eca..0f26bf0e11a 100644 --- a/htdocs/stripe/charge.php +++ b/htdocs/stripe/charge.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2018 Thibault FOUCART * * 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 @@ -62,13 +62,13 @@ llxHeader('', $langs->trans("StripeChargeList")); if (! empty($conf->stripe->enabled) && (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox','alpha'))) { $service = 'StripeTest'; - $servicestatus = '0'; + $servicestatus = '0'; dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), '', 'warning'); } else { - $service = 'StripeLive'; - $servicestatus = '1'; + $service = 'StripeLive'; + $servicestatus = '1'; } $stripeacc = $stripe->getStripeAccount($service); @@ -150,7 +150,7 @@ if (!$rowid) print ''; - if (! empty($conf->stripe->enabled) && !empty($stripeacc)) $connect=$stripeacc.'/'; + if (!empty($stripeacc)) $connect=$stripeacc.'/'; // Ref $url='https://dashboard.stripe.com/'.$connect.'test/payments/'.$charge->id; From 61d0aa66a57f1c28aaf141c41699744de0a51a1f Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 21 Sep 2018 09:52:08 +0200 Subject: [PATCH 48/51] Update transaction.php --- htdocs/stripe/transaction.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/stripe/transaction.php b/htdocs/stripe/transaction.php index 2a62144a6e1..79da90d4c10 100644 --- a/htdocs/stripe/transaction.php +++ b/htdocs/stripe/transaction.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2018 Thibault FOUCART + * Copyright (C) 2018 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 From 933f253c86bb9397109a6c3bfa4de28f560b6cb2 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 21 Sep 2018 09:52:27 +0200 Subject: [PATCH 49/51] Update transaction.php --- htdocs/stripe/transaction.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/stripe/transaction.php b/htdocs/stripe/transaction.php index 79da90d4c10..200eb8ee158 100644 --- a/htdocs/stripe/transaction.php +++ b/htdocs/stripe/transaction.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2018 Thibault FOUCART * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -227,7 +227,7 @@ elseif ($txn->status=='failed') print ""; print ''; print ''; -} else {} +} llxFooter(); $db->close(); From d09b74abe5150b8a9bd72bef6f369a123d31afa6 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 21 Sep 2018 09:54:07 +0200 Subject: [PATCH 50/51] Update transaction.php --- htdocs/stripe/transaction.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/htdocs/stripe/transaction.php b/htdocs/stripe/transaction.php index 200eb8ee158..c75b252ee43 100644 --- a/htdocs/stripe/transaction.php +++ b/htdocs/stripe/transaction.php @@ -125,10 +125,10 @@ if (! $rowid) { { //$charge = $txn; //var_dump($txn); - + // The metadata FULLTAG is defined by the online payment page /*$FULLTAG=$charge->metadata->FULLTAG; - + // Save into $tmparray all metadata $tmparray = dolExplodeIntoArray($FULLTAG,'.','='); // Load origin object according to metadata @@ -148,7 +148,7 @@ if (! $rowid) { { $memberstatic->id = 0; }*/ - + $societestatic->fetch($charge->metadata->idcustomer); $societestatic->id = $charge->metadata->idcustomer; $societestatic->lastname = $obj->lastname; @@ -167,11 +167,11 @@ if (! $rowid) { if (preg_match('/po_/i', $txn->source)){ $origin="payouts"; } elseif (preg_match('/fee_/i', $txn->source)) { - $origin="connect/application_fees"; + $origin="connect/application_fees"; } else { - $origin="payments"; - } - + $origin="payments"; + } + $url='https://dashboard.stripe.com/'.$connect.'test/'.$origin.'/'.$txn->source; if ($servicestatus) { @@ -229,5 +229,6 @@ elseif ($txn->status=='failed') print ''; } +// End of page llxFooter(); $db->close(); From 60cb83cf25af445544654fbb3ed25f94338d3d7b Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 21 Sep 2018 09:55:24 +0200 Subject: [PATCH 51/51] Update transaction.php --- htdocs/stripe/transaction.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/stripe/transaction.php b/htdocs/stripe/transaction.php index c75b252ee43..595583a63f1 100644 --- a/htdocs/stripe/transaction.php +++ b/htdocs/stripe/transaction.php @@ -215,12 +215,12 @@ if (! $rowid) { print "" . price(($txn->fee) / 100, 0, '', 1, - 1, - 1, strtoupper($txn->currency)) . ""; // Status print ""; -if ($txn->status=='available') - {print img_picto($langs->trans("".$txn->status.""),'statut4');} -elseif ($txn->status=='pending') - {print img_picto($langs->trans("".$txn->status.""),'statut7');} -elseif ($txn->status=='failed') - {print img_picto($langs->trans("".$txn->status.""),'statut8');} + if ($txn->status=='available') + {print img_picto($langs->trans("".$txn->status.""),'statut4');} + elseif ($txn->status=='pending') + {print img_picto($langs->trans("".$txn->status.""),'statut7');} + elseif ($txn->status=='failed') + {print img_picto($langs->trans("".$txn->status.""),'statut8');} print ''; print "\n"; }