diff --git a/htdocs/bom/admin/index.html b/htdocs/bom/admin/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/bom/class/index.html b/htdocs/bom/class/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/bom/index.html b/htdocs/bom/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/bom/lib/index.html b/htdocs/bom/lib/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/compta/accounting-files.php b/htdocs/compta/accounting-files.php index 5a3097f6aa8..9069045c8b3 100644 --- a/htdocs/compta/accounting-files.php +++ b/htdocs/compta/accounting-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/accounting-files.php * \ingroup compta * \brief Page to show portoflio and files of a thirdparty and download it */ - require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -34,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php'; require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; -$langs->loadLangs(array("accountancy", "bills", "companies")); +$langs->loadLangs(array("accountancy", "bills", "companies", "salaries")); $date_start =GETPOST('date_start', 'alpha'); $date_startDay= GETPOST('date_startday', 'int'); @@ -46,11 +44,11 @@ $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); +$date_stop=($date_stopDay)?dol_mktime(23, 59, 59, $date_stopMonth, $date_stopDay, $date_stopYear):strtotime($date_stop); $action =GETPOST('action', 'alpha'); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context -$hookmanager->initHooks(array('comptafileslist', 'globallist')); +$hookmanager->initHooks(array('comptafileslist','globallist')); // Load variable for pagination $limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; @@ -66,6 +64,7 @@ if (! $sortorder) $sortorder="DESC"; $arrayfields=array( + 'type'=>array('label'=>"Type", 'checked'=>1), 'date'=>array('label'=>"Date", 'checked'=>1), //... ); @@ -74,16 +73,17 @@ $arrayfields=array( if (empty($conf->comptabilite->enabled) && empty($conf->accounting->enabled)) { accessforbidden(); } -if ($user->societe_id > 0) +if ($user->societe_id > 0) { accessforbidden(); +} +$entity = GETPOST('entity', 'int')?GETPOST('entity', 'int'):$conf->entity; /* * Actions */ -$entity = GETPOST('entity', 'int')?GETPOST('entity', 'int'):$conf->entity; //$parameters = array('socid' => $id); //$reshook = $hookmanager->executeHooks('doActions', $parameters, $object); // Note that $object may have been modified by some hooks @@ -106,38 +106,45 @@ if (($action=="searchfiles" || $action=="dl" )) { if (! $error) { - $wheretail=" '".$db->idate($date_start)."' AND '".$db->idate($date_stop)."'"; + $wheretail=" '".$db->idate($date_start)."' AND '".$db->idate($date_stop)."'"; - $sql="SELECT rowid as id, ref as ref, paye as paid, total_ttc, fk_soc, datef as date, 'Invoice' as item FROM ".MAIN_DB_PREFIX."facture"; + $sql="SELECT t.rowid as id, t.ref, t.paye as paid, total as total_ht, total_ttc, tva as total_vat, fk_soc, t.datef as date, 'Invoice' as item, s.nom as thirdparty_name, s.code_client as thirdparty_code, c.code as country_code, s.tva_intra as vatnum"; + $sql.=" FROM ".MAIN_DB_PREFIX."facture as t LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = t.fk_soc LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = s.fk_pays"; $sql.=" WHERE datef between ".$wheretail; - $sql.=" AND entity IN (".($entity==1?'0,1':$entity).')'; - $sql.=" AND fk_statut <> ".Facture::STATUS_DRAFT; + $sql.=" AND t.entity IN (".($entity==1?'0,1':$entity).')'; + $sql.=" AND t.fk_statut <> ".Facture::STATUS_DRAFT; $sql.=" UNION ALL"; - $sql.=" SELECT rowid as id, ref, paye as paid, total_ttc, fk_soc, datef as date, 'SupplierInvoice' as item FROM ".MAIN_DB_PREFIX."facture_fourn"; + $sql.=" SELECT t.rowid as id, t.ref, paye as paid, total_ht, total_ttc, total_tva as total_vat, fk_soc, datef as date, 'SupplierInvoice' as item, s.nom as thirdparty_name, s.code_fournisseur as thirdparty_code, c.code as country_code, s.tva_intra as vatnum"; + $sql.=" FROM ".MAIN_DB_PREFIX."facture_fourn as t LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = t.fk_soc LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = s.fk_pays"; $sql.=" WHERE datef between ".$wheretail; - $sql.=" AND entity IN (".($entity==1?'0,1':$entity).')'; - $sql.=" AND fk_statut <> ".FactureFournisseur::STATUS_DRAFT; + $sql.=" AND t.entity IN (".($entity==1?'0,1':$entity).')'; + $sql.=" AND t.fk_statut <> ".FactureFournisseur::STATUS_DRAFT; $sql.=" UNION ALL"; - $sql.=" SELECT rowid as id, ref, paid, total_ttc, fk_user_author as fk_soc, date_fin as date, 'ExpenseReport' as item FROM ".MAIN_DB_PREFIX."expensereport"; + $sql.=" SELECT t.rowid as id, t.ref, paid, total_ht, total_ttc, total_tva as total_vat, fk_user_author as fk_soc, date_fin as date, 'ExpenseReport' as item, CONCAT(CONCAT(u.lastname, ' '), u.firstname) as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum"; + $sql.=" FROM ".MAIN_DB_PREFIX."expensereport as t LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = t.fk_user_author LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = u.fk_country"; $sql.=" WHERE date_fin between ".$wheretail; - $sql.=" AND entity IN (".($entity==1?'0,1':$entity).')'; - $sql.=" AND fk_statut <> ".ExpenseReport::STATUS_DRAFT; + $sql.=" AND t.entity IN (".($entity==1?'0,1':$entity).')'; + $sql.=" AND t.fk_statut <> ".ExpenseReport::STATUS_DRAFT; $sql.=" UNION ALL"; - $sql.=" SELECT rowid as id, ref, paid, amount as total_ttc, '0' as fk_soc, datedon as date, 'Donation' as item FROM ".MAIN_DB_PREFIX."don"; + $sql.=" SELECT t.rowid as id, t.ref, paid, amount as total_ht, amount as total_ttc, 0 as total_vat, 0 as fk_soc, datedon as date, 'Donation' as item, t.societe as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum"; + $sql.=" FROM ".MAIN_DB_PREFIX."don as t LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = t.fk_country"; $sql.=" WHERE datedon between ".$wheretail; - $sql.=" AND entity IN (".($entity==1?'0,1':$entity).')'; - $sql.=" AND fk_statut <> ".Don::STATUS_DRAFT; + $sql.=" AND t.entity IN (".($entity==1?'0,1':$entity).')'; + $sql.=" AND t.fk_statut <> ".Don::STATUS_DRAFT; $sql.=" UNION ALL"; - $sql.=" SELECT rowid as id, label as ref, 1 as paid, amount as total_ttc, fk_user as fk_soc,datep as date, 'SalaryPayment' as item FROM ".MAIN_DB_PREFIX."payment_salary"; + $sql.=" SELECT t.rowid as id, t.label as ref, 1 as paid, amount as total_ht, amount as total_ttc, 0 as total_vat, t.fk_user as fk_soc, datep as date, 'SalaryPayment' as item, CONCAT(CONCAT(u.lastname, ' '), u.firstname) as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum"; + $sql.=" FROM ".MAIN_DB_PREFIX."payment_salary as t LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = t.fk_user LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = u.fk_country"; $sql.=" WHERE datep between ".$wheretail; - $sql.=" AND entity IN (".($entity==1?'0,1':$entity).')'; + $sql.=" AND t.entity IN (".($entity==1?'0,1':$entity).')'; //$sql.=" AND fk_statut <> ".PaymentSalary::STATUS_DRAFT; $sql.=" UNION ALL"; - $sql.=" SELECT rowid as id, libelle as ref, paye as paid, amount as total_ttc, 0 as fk_soc, date_creation as date, 'SocialContributions' as item FROM ".MAIN_DB_PREFIX."chargesociales"; + $sql.=" SELECT t.rowid as id, t.libelle as ref, paye as paid, amount as total_ht, amount as total_ttc, 0 as total_tva, 0 as fk_soc, date_creation as date, 'SocialContributions' as item, '' as thirdparty_name, '' as thirdparty_code, '' as country_code, '' as vatnum"; + $sql.=" FROM ".MAIN_DB_PREFIX."chargesociales as t"; $sql.=" WHERE date_creation between ".$wheretail; - $sql.=" AND entity IN (".($entity==1?'0,1':$entity).')'; + $sql.=" AND t.entity IN (".($entity==1?'0,1':$entity).')'; //$sql.=" AND fk_statut <> ".ChargeSociales::STATUS_DRAFT; $sql.= $db->order($sortfield, $sortorder); + //print $sql; $resd = $db->query($sql); $files=array(); @@ -162,63 +169,68 @@ if (($action=="searchfiles" || $action=="dl" )) { case "Invoice": $subdir = ''; $subdir.=($subdir ? '/' : '').dol_sanitizeFileName($objd->ref); - $upload_dir = $conf->facture->dir_output.'/'.$subdir; - $link="document.php?modulepart=facture&file=".str_replace('/', '%2F', $subdir).'%2F'; - break; + $upload_dir = $conf->facture->dir_output.'/'.$subdir; + $link="document.php?modulepart=facture&file=".str_replace('/', '%2F', $subdir).'%2F'; + break; case "SupplierInvoice": $tmpinvoicesupplier->fetch($objd->id); $subdir = get_exdir($tmpinvoicesupplier->id, 2, 0, 1, $tmpinvoicesupplier, 'invoice_supplier'); // TODO Use first file - $subdir.=($subdir ? '/' : '').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; + $subdir.=($subdir ? '/' : '').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; case "ExpenseReport": $subdir = ''; $subdir.=($subdir ? '/' : '').dol_sanitizeFileName($objd->ref); - $upload_dir = $conf->expensereport->dir_output.'/'.$subdir; - $link="document.php?modulepart=expensereport&file=".str_replace('/', '%2F', $subdir).'%2F'; - break; + $upload_dir = $conf->expensereport->dir_output.'/'.$subdir; + $link="document.php?modulepart=expensereport&file=".str_replace('/', '%2F', $subdir).'%2F'; + break; case "SalaryPayment": $subdir = ''; $subdir.=($subdir ? '/' : '').dol_sanitizeFileName($objd->id); - $upload_dir = $conf->salaries->dir_output.'/'.$subdir; - $link="document.php?modulepart=salaries&file=".str_replace('/', '%2F', $subdir).'%2F'; - break; + $upload_dir = $conf->salaries->dir_output.'/'.$subdir; + $link="document.php?modulepart=salaries&file=".str_replace('/', '%2F', $subdir).'%2F'; + break; case "Donation": - $tmpdonation->fetch($objp->id); - $subdir=get_exdir(0, 0, 0, 0, $tmpdonation, 'donation'); - $subdir.=($subdir ? '/' : '').dol_sanitizeFileName($objd->id); - $upload_dir = $conf->don->dir_output . '/' . $subdir; - $link="document.php?modulepart=don&file=".str_replace('/', '%2F', $subdir).'%2F'; - break; + $tmpdonation->fetch($objp->id); + $subdir=get_exdir(0, 0, 0, 0, $tmpdonation, 'donation'); + $subdir.=($subdir ? '/' : '').dol_sanitizeFileName($objd->id); + $upload_dir = $conf->don->dir_output . '/' . $subdir; + $link="document.php?modulepart=don&file=".str_replace('/', '%2F', $subdir).'%2F'; + break; case "SocialContributions": $subdir = ''; $subdir.=($subdir ? '/' : '').dol_sanitizeFileName($objd->id); - $upload_dir = $conf->tax->dir_output . '/' . $subdir; - $link="document.php?modulepart=tax&file=".str_replace('/', '%2F', $subdir).'%2F'; - break; + $upload_dir = $conf->tax->dir_output . '/' . $subdir; + $link="document.php?modulepart=tax&file=".str_replace('/', '%2F', $subdir).'%2F'; + break; default: - $subdir = ''; - $upload_dir = ''; - $link = ''; + $subdir=''; + $upload_dir=''; + $link=''; break; } if (!empty($upload_dir)) { $result=true; - $files=dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview\.png)$', '', SORT_ASC, 1); - + //var_dump($upload_dir); if (count($files) < 1) { - $nofile['id']=$objd->id; - $nofile['date']=$db->idate($objd->date); + $nofile['id']=$objd->id; + $nofile['date']=$db->idate($objd->date); $nofile['paid']=$objd->paid; - $nofile['amount']=$objd->total_ttc; + $nofile['amount_ht']=$objd->total_ht; + $nofile['amount_ttc']=$objd->total_ttc; + $nofile['amount_vat']=$objd->total_vat; $nofile['ref']=($objd->ref ? $objd->ref : $objd->id); $nofile['fk']=$objd->fk_soc; $nofile['item']=$objd->item; + $nofile['thirdparty_name']=$objd->thirdparty_name; + $nofile['thirdparty_code']=$objd->thirdparty_code; + $nofile['country_code']=$objd->country_code; + $nofile['vatnum']=$objd->vatnum; $filesarray[]=$nofile; } @@ -226,13 +238,21 @@ if (($action=="searchfiles" || $action=="dl" )) { { foreach ($files as $key => $file) { - $file['id']=$objd->id; - $file['date']=$db->idate($objd->date); + $file['id']=$objd->id; + $file['date']=$db->idate($objd->date); $file['paid']=$objd->paid; - $file['amount']=$objd->total_ttc; + $file['amount_ht']=$objd->total_ht; + $file['amount_ttc']=$objd->total_ttc; + $file['amount_vat']=$objd->total_vat; $file['ref']=($objd->ref ? $objd->ref : $objd->id); $file['fk']=$objd->fk_soc; $file['item']=$objd->item; + + $file['thirdparty_name']=$objd->thirdparty_name; + $file['thirdparty_code']=$objd->thirdparty_code; + $file['country_code']=$objd->country_code; + $file['vatnum']=$objd->vatnum; + $file['link']=$link.$file['name']; $file['relpathnamelang'] = $langs->trans($file['item']).'/'.$file['name']; @@ -252,27 +272,30 @@ if (($action=="searchfiles" || $action=="dl" )) { } } -/* - * cleanup of old ZIP - */ -//FIXME + /* *ZIP creation */ -if ($result && $action == "dl") +$dirfortmpfile = ($conf->accounting->dir_temp ? $conf->accounting->dir_temp : $conf->comptabilite->dir_temp); +if (empty($dirfortmpfile)) { - if (! extension_loaded('zip')) - { - setEventMessages('PHPZIPExtentionNotLoaded', null, 'errors'); - exit; - } + setEventMessages($langs->trans("ErrorNoAccountingModuleEnabled"), null, 'errors'); + $error++; +} - $dirfortmpfile = ($conf->accounting->dir_temp ? $conf->accounting->dir_temp : $conf->compta->dir_temp); + +if ($result && $action == "dl" && ! $error) +{ + if (! extension_loaded('zip')) + { + setEventMessages('PHPZIPExtentionNotLoaded', null, 'errors'); + exit; + } dol_mkdir($dirfortmpfile); - $log='date,type,ref,total,paid,filename,item_id'."\n"; + $log=$langs->transnoentitiesnoconv("Type").','.$langs->transnoentitiesnoconv("Date").','.$langs->transnoentitiesnoconv("Ref").','.$langs->transnoentitiesnoconv("TotalHT").','.$langs->transnoentitiesnoconv("TotalTTC").','.$langs->transnoentitiesnoconv("TotalVAT").','.$langs->transnoentitiesnoconv("Paid").',filename,item_id,'.$langs->transnoentitiesnoconv("ThirdParty").','.$langs->transnoentitiesnoconv("Code").','.$langs->transnoentitiesnoconv("Country").','.$langs->transnoentitiesnoconv("VATIntra")."\n"; $zipname = $dirfortmpfile.'/'.dol_print_date($date_start, 'dayrfc')."-".dol_print_date($date_stop, 'dayrfc').'_export.zip'; dol_delete_file($zipname); @@ -281,10 +304,10 @@ if ($result && $action == "dl") $res = $zip->open($zipname, ZipArchive::OVERWRITE|ZipArchive::CREATE); if ($res) { - foreach ($filesarray as $key=> $file) + foreach ($filesarray as $key => $file) { if (file_exists($file["fullname"])) $zip->addFile($file["fullname"], $file["relpathnamelang"]); // - $log.=dol_print_date($file['date'], 'dayrfc').','.$file['item'].','.$file['ref'].','.$file['amount'].','.$file['paid'].','.$file["name"].','.$file['fk']."\n"; + $log.=$file['item'].','.dol_print_date($file['date'], 'dayrfc').','.$file['ref'].','.$file['amount_ht'].','.$file['amount_ttc'].','.$file['amount_vat'].','.$file['paid'].','.$file["name"].','.$file['fk'].','.$file['thirdparty_name'].','.$file['thirdparty_code'].','.$file['country_code'].',"'.$file['vatnum'].'"'."\n"; } $zip->addFromString('transactions.csv', $log); $zip->close(); @@ -299,6 +322,10 @@ if ($result && $action == "dl") exit(); } + else + { + setEventMessages($langs->trans("FailedToOpenFile", $zipname), null, 'errors'); + } } @@ -329,11 +356,11 @@ print ' - '.$form->selectDate($date_stop, 'date_stop', 0, 0, 0, "", 1, 1, 0)."\n // Export is for current company only ! if (! empty($conf->multicompany->enabled) && is_object($mc)) { - print '('.$langs->trans("Entity").' : '; - $mc->dao->getEntities(); - $mc->dao->fetch($conf->entity); - print $mc->dao->label; - print ")\n"; + print '('.$langs->trans("Entity").' : '; + $mc->dao->getEntities(); + $mc->dao->fetch($conf->entity); + print $mc->dao->label; + print ")\n"; } print ''; @@ -376,14 +403,18 @@ if (!empty($date_start) && !empty($date_stop)) print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table print ''; print ''; - print_liste_field_titre($arrayfields['date']['label'], $_SERVER["PHP_SELF"], "date", "", $param, 'class="nowrap"', $sortfield, $sortorder); - print ''; + print_liste_field_titre($arrayfields['type']['label'], $_SERVER["PHP_SELF"], "type", "", $param, '', $sortfield, $sortorder, 'nowrap '); + print_liste_field_titre($arrayfields['date']['label'], $_SERVER["PHP_SELF"], "date", "", $param, '', $sortfield, $sortorder, 'center nowrap '); print ''; print ''; print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print ''; if ($result) { @@ -397,18 +428,11 @@ if (!empty($date_start) && !empty($date_stop)) { // Sort array by date ASC to calculate balance + $totalET = 0; + $totalIT = 0; + $totalVAT = 0; $totalDebit = 0; $totalCredit = 0; - // Balance calculation - $balance = 0; - foreach($TData as &$data1) { - if ($data1['item']!='Invoice' && $data1['item']!='Donation') - { - $data1['amount']=-$data1['amount']; - } - $balance += $data1['amount']; - $data1['balance'] = $balance; - } // Display array foreach($TData as $data) @@ -417,11 +441,17 @@ if (!empty($date_start) && !empty($date_stop)) //if (!empty($data['fk_facture'])) $html_class = 'facid-'.$data['fk_facture']; //elseif (!empty($data['fk_paiement'])) $html_class = 'payid-'.$data['fk_paiement']; print ''; - print "'; + + // Date + print '\n"; - print ''; - print ''; + + // Ref + print ''; // File link print '\n"; + print "\n"; + + // Paid + print ''; + + // Total ET + print '\n"; + // Total IT + print '\n"; + // Total VAT + print '\n"; + + print '\n"; + + print '\n"; + + print '\n"; + + print '\n"; + + // Debit + //print '\n"; + // Credit + //print '\n"; + + $totalET += $data['amount_ht']; + $totalIT += $data['amount_ttc']; + $totalVAT += $data['amount_vat']; + + $totalDebit += ($data['amount_ttc'] > 0) ? abs($data['amount_ttc']) : 0; + $totalCredit += ($data['amount_ttc'] > 0) ? 0 : abs($data['amount_ttc']); - 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 "\n"; } print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + /*print ''; + print ''; + print ''; + */ print "\n"; } } @@ -453,5 +521,6 @@ if (!empty($date_start) && !empty($date_stop)) print ''; } + llxFooter(); $db->close(); diff --git a/htdocs/datapolicy/admin/index.html b/htdocs/datapolicy/admin/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/datapolicy/class/index.html b/htdocs/datapolicy/class/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/datapolicy/index.html b/htdocs/datapolicy/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/datapolicy/lib/index.html b/htdocs/datapolicy/lib/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/debugbar/index.html b/htdocs/debugbar/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index 34cbdfe89bd..666403a7412 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -47,10 +47,25 @@ $confirm=GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); $contextpage=GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'expensereportlist'; +$childids = $user->getAllChildIds(1); + // Security check $socid = GETPOST('socid', 'int'); if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'expensereport', '', ''); +$id = GETPOST('id', 'int'); +// If we are on the view of a specific user +if ($id > 0) +{ + $canread=0; + if ($id == $user->id) $canread=1; + if (! empty($user->rights->expensereport->readall)) $canread=1; + if (! empty($user->rights->expensereport->lire) && in_array($id, $childids)) $canread=1; + if (! $canread) + { + accessforbidden(); + } +} $diroutputmassaction=$conf->expensereport->dir_output . '/temp/massgeneration/'.$user->id; @@ -67,7 +82,6 @@ $pagenext = $page + 1; if (!$sortorder) $sortorder="DESC"; if (!$sortfield) $sortfield="d.date_debut"; -$id = GETPOST('id', 'int'); $sall = trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml')); $search_ref = GETPOST('search_ref', 'alpha'); @@ -291,7 +305,6 @@ if ($search_status != '' && $search_status >= 0) $sql.=" AND d.fk_statut IN (".$ if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous) && (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || empty($user->rights->expensereport->writeall_advance))) { - $childids = $user->getAllChildIds(1); $sql.= " AND d.fk_user_author IN (".join(',', $childids).")\n"; } // Add where from extra fields diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index ce038709fcf..f74d731e8bd 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -61,6 +61,18 @@ if ($user->societe_id > 0) // Protection if external user } $result = restrictedArea($user, 'holiday', $id, ''); $id = GETPOST('id', 'int'); +// If we are on the view of a specific user +if ($id > 0) +{ + $canread=0; + if ($id == $user->id) $canread=1; + if (! empty($user->rights->holiday->read_all)) $canread=1; + if (! empty($user->rights->holiday->read) && in_array($id, $childids)) $canread=1; + if (! $canread) + { + accessforbidden(); + } +} // Load variable for pagination $limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; diff --git a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql index 40f7da3fa95..1270b8b279a 100644 --- a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql +++ b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql @@ -60,6 +60,8 @@ CREATE TABLE llx_pos_cash_fence( -- For 10.0 +UPDATE llx_chargesociales SET date_creation = tms WHERE date_creation IS NULL; + DROP TABLE llx_cotisation; ALTER TABLE llx_accounting_bookkeeping DROP COLUMN validated; ALTER TABLE llx_accounting_bookkeeping_tmp DROP COLUMN validated; diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index 387f8e159ec..076f1962325 100755 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -199,6 +199,15 @@ delete from llx_element_element where sourcetype='commande' and fk_source not in DELETE FROM llx_actioncomm_resources WHERE fk_actioncomm not in (select id from llx_actioncomm); +-- Fix link on parent that were removed +DROP table tmp_user; +CREATE TABLE tmp_user as (select * from llx_user); +UPDATE llx_user SET fk_user = NULL where fk_user NOT IN (select rowid from tmp_user); + + +update llx_user set fk_user = null where fk_user not in (select rowid from llx_user); + + UPDATE llx_product SET canvas = NULL where canvas = 'default@product'; UPDATE llx_product SET canvas = NULL where canvas = 'service@product'; @@ -400,6 +409,7 @@ ALTER TABLE llx_accounting_account ADD UNIQUE INDEX uk_accounting_account (accou -- p.tva_tx = 0 -- where price = 17.5 +UPDATE llx_chargesociales SET date_creation = tms WHERE date_creation IS NULL; -- VMYSQL4.1 SET sql_mode = 'ALLOW_INVALID_DATES'; -- VMYSQL4.1 update llx_accounting_account set tms = datec where DATE(STR_TO_DATE(tms, '%Y-%m-%d')) IS NULL; diff --git a/htdocs/install/mysql/tables/llx_societe.sql b/htdocs/install/mysql/tables/llx_societe.sql index ed4919c3fc5..e7a948d67c2 100644 --- a/htdocs/install/mysql/tables/llx_societe.sql +++ b/htdocs/install/mysql/tables/llx_societe.sql @@ -65,34 +65,34 @@ create table llx_societe fk_typent integer DEFAULT 0, -- fk_forme_juridique integer DEFAULT 0, -- juridical status fk_currency varchar(3), -- default currency - siren varchar(128), -- IDProf1: siren or RCS for france, ... - siret varchar(128), -- IDProf2: siret for france, ... - ape varchar(128), -- IDProf3: code ape for france, ... - idprof4 varchar(128), -- IDProf4: nu for france - idprof5 varchar(128), -- IDProf5: nu for france - idprof6 varchar(128), -- IDProf6: nu for france - tva_intra varchar(20), -- tva - capital double(24,8) DEFAULT NULL, -- capital de la societe - fk_stcomm integer DEFAULT 0 NOT NULL, -- commercial statut + siren varchar(128), -- IDProf1: depends on country (example: siren or RCS for france, ...) + siret varchar(128), -- IDProf2: depends on country (example: siret for france, ...) + ape varchar(128), -- IDProf3: depends on country (example: code ape for france, ...) + idprof4 varchar(128), -- IDProf4: depends on country (example: nu for france, ...) + idprof5 varchar(128), -- IDProf5: depends on country (example: nu for france, ...) + idprof6 varchar(128), -- IDProf6: depends on country (example: nu for france, ... + tva_intra varchar(20), -- vat numero + capital double(24,8) DEFAULT NULL, -- capital of company + fk_stcomm integer DEFAULT 0 NOT NULL, -- commercial status note_private text, -- note_public text, -- model_pdf varchar(255), - prefix_comm varchar(5), -- prefix commercial + prefix_comm varchar(5), -- prefix commercial (deprecated) client tinyint DEFAULT 0, -- client 0/1/2 fournisseur tinyint DEFAULT 0, -- fournisseur 0/1 - supplier_account varchar(32), -- compte client chez un fournisseur + supplier_account varchar(32), -- Id of our customer account known by the supplier fk_prospectlevel varchar(12), -- prospect level (in llx_c_prospectlevel) fk_incoterms integer, -- for incoterms location_incoterms varchar(255), -- for incoterms customer_bad tinyint DEFAULT 0, -- mauvais payeur 0/1 customer_rate real DEFAULT 0, -- taux fiabilite client (0 a 1) supplier_rate real DEFAULT 0, -- taux fiabilite fournisseur (0 a 1) - remise_client real DEFAULT 0, -- remise systematique pour le client - remise_supplier real DEFAULT 0, -- remise systematique auprès du fournisseur - mode_reglement tinyint, -- mode de reglement - cond_reglement tinyint, -- condition de reglement - mode_reglement_supplier tinyint, -- mode de reglement fournisseur - cond_reglement_supplier tinyint, -- condition de reglement fournisseur + remise_client real DEFAULT 0, -- discount by default granted to this customer + remise_supplier real DEFAULT 0, -- discount by default granted by this supplier + mode_reglement tinyint, -- payment mode customer + cond_reglement tinyint, -- payment term customer + mode_reglement_supplier tinyint, -- payment mode supplier + cond_reglement_supplier tinyint, -- payment term supplier fk_shipping_method integer, -- preferred shipping method id tva_assuj tinyint DEFAULT 1, -- assujeti ou non a la TVA localtax1_assuj tinyint DEFAULT 0, -- assujeti ou non a local tax 1 diff --git a/htdocs/user/param_ihm.php b/htdocs/user/param_ihm.php index 2ded2013601..90228aa952e 100644 --- a/htdocs/user/param_ihm.php +++ b/htdocs/user/param_ihm.php @@ -173,7 +173,7 @@ if (! empty($conf->projet->enabled)) $tmparray['projet/index.php?mainmenu=projec if (! empty($conf->holiday->enabled) || ! empty($conf->expensereport->enabled)) $tmparray['hrm/index.php?mainmenu=hrm&leftmenu=']='HRMArea'; // TODO Complete list with first level of menus if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) $tmparray['product/index.php?mainmenu=products&leftmenu=']='ProductsAndServicesArea'; if (! empty($conf->propal->enabled) || ! empty($conf->commande->enabled) || ! empty($conf->ficheinter->enabled) || ! empty($conf->contrat->enabled)) $tmparray['comm/index.php?mainmenu=commercial&leftmenu=']='CommercialArea'; -if (! empty($conf->compta->enabled) || ! empty($conf->accounting->enabled)) $tmparray['compta/index.php?mainmenu=compta&leftmenu=']='AccountancyTreasuryArea'; +if (! empty($conf->comptabilite->enabled) || ! empty($conf->accounting->enabled)) $tmparray['compta/index.php?mainmenu=compta&leftmenu=']='AccountancyTreasuryArea'; if (! empty($conf->adherent->enabled)) $tmparray['adherents/index.php?mainmenu=members&leftmenu=']='MembersArea'; if (! empty($conf->agenda->enabled)) $tmparray['comm/action/index.php?mainmenu=agenda&leftmenu=']='Agenda'; diff --git a/htdocs/website/class/index.html b/htdocs/website/class/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/website/lib/index.html b/htdocs/website/lib/index.html new file mode 100644 index 00000000000..e69de29bb2d
'.$langs->trans("Type").''.$langs->trans("Ref").''.$langs->trans("Document").''.$langs->trans("Paid").''.$langs->trans("Debit").''.$langs->trans("Credit").''.$langs->trans("Balance").''.$langs->trans("TotalHT").''.$langs->trans("TotalTTC").''.$langs->trans("TotalVAT").''.$langs->trans("ThirdParty").''.$langs->trans("Code").''.$langs->trans("Country").''.$langs->trans("VATIntra").'
"; + + // Type + print ''.$langs->trans($data['item']).''; print dol_print_date($data['date'], 'day'); print "'.$langs->trans($data['item']).''.$data['ref'].''.$data['ref'].''; @@ -429,23 +459,61 @@ if (!empty($date_start) && !empty($date_stop)) { print ''.($data['name'] ? $data['name'] : $data['ref']).''; } - print "'.$data['paid'].''.price($data['amount_ht'])."'.price($data['amount_ttc'])."'.price($data['amount_vat'])."'.$data['thirdparty_name']."'.$data['thirdparty_code']."'.$data['country_code']."'.$data['vatnum']."'.(($data['amount_ttc'] > 0) ? price(abs($data['amount_ttc'])) : '')."'.(($data['amount_ttc'] > 0) ? '' : price(abs($data['amount_ttc'])))."'.$data['paid'].''.(($data['amount'] > 0) ? price(abs($data['amount'])) : '')."'.(($data['amount'] > 0) ? '' : price(abs($data['amount'])))."'.price($data['balance'])."'.price($data['balance'])."
 '.price($totalDebit).''.price($totalCredit).''.price(price2num($totalDebit - $totalCredit, 'MT')).''.price($totalET).''.price($totalIT).''.price($totalVAT).''.price($totalDebit).''.price($totalCredit).''.price(price2num($totalDebit - $totalCredit, 'MT')).'