diff --git a/.travis.yml b/.travis.yml index 4f32a1dea43..6eced4be075 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,7 @@ php: - '5.3' - '5.4' - '5.5' -- '5.6' +- '5.6.29' - '7.0' - '7.1' - nightly diff --git a/ChangeLog b/ChangeLog index c43fd92f676..228a2fd6291 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,10 +2,17 @@ English Dolibarr ChangeLog -------------------------------------------------------------- + ***** ChangeLog for 5.0.4 compared to 5.0.3 ***** -FIX: #6880 -FIX: #6925 +FIX: #5640 Prices of a predefined product/service were incorrect under certain circumstances +FIX: #6541 since 4.0.4 to 5.0.0 autofill zip/town not working +FIX: #6880 #6925 +FIX: #6885 FIX: #6926 +FIX: #7003 +FIX: #7012 +FIX: #7040 +FIX: #7048 #6075 FIX: Can set supplier invoice to billed. FIX: Can't create invoice if PO disapproved FIX: contratligne update @@ -17,6 +24,7 @@ FIX: Redirect to payment page from member subscription page failed if a unique s FIX: REST api to get project when user has permission to read all. FIX: situation_progress param default value must be 100 and not 0 FIX: SQL injection on user/index.php parameter search_statut. +FIX: vat code not saved during product creation. FIX: Warnings ***** ChangeLog for 5.0.3 compared to 5.0.2 ***** diff --git a/build/exe/doliwamp/install.forced.php.install b/build/exe/doliwamp/install.forced.php.install index fd98dbf3984..5b186c17268 100644 --- a/build/exe/doliwamp/install.forced.php.install +++ b/build/exe/doliwamp/install.forced.php.install @@ -5,7 +5,7 @@ // during install process to be used. // // -$force_install_noedit=2; +$force_install_noedit=2; // 1=To block vars specific to distrib, 2 to block all technical parameters $force_install_message='KeepDefaultValuesWamp'; $force_install_main_data_root='WAMPROOT/dolibarr_documents'; $force_install_type='mysqli'; diff --git a/build/rpm/install.forced.php.fedora b/build/rpm/install.forced.php.fedora index 108455a9403..a8db3e25c9e 100644 --- a/build/rpm/install.forced.php.fedora +++ b/build/rpm/install.forced.php.fedora @@ -1,7 +1,7 @@ trans('CommandIsNotInsideAllowedCommands'); } } - + if (! $errormsg && $cmddump) { dolibarr_set_const($db, 'SYSTEMTOOLS_MYSQLDUMP', $cmddump,'chaine',0,'',$conf->entity); } - if (! $errormsg) + if (! $errormsg) { $utils->dumpDatabase(GETPOST('compression','alpha'), $what, 0, $file); $errormsg=$utils->error; @@ -172,13 +173,13 @@ if ($what == 'postgresql') { $cmddump=GETPOST("postgresqldump"); // Do not sanitize here with 'alpha', will be sanitize later by dol_sanitizePathName and escapeshellarg $cmddump=dol_sanitizePathName($cmddump); - + if (! $errormsg && $cmddump) { dolibarr_set_const($db, 'SYSTEMTOOLS_POSTGRESQLDUMP', $cmddump,'chaine',0,'',$conf->entity); } - if (! $errormsg) + if (! $errormsg) { $utils->dumpDatabase(GETPOST('compression','alpha'), $what, 0, $file); $errormsg=$utils->error; diff --git a/htdocs/compta/bank/bankentries.php b/htdocs/compta/bank/bankentries.php index 4845012a3e0..c3afc9634cf 100644 --- a/htdocs/compta/bank/bankentries.php +++ b/htdocs/compta/bank/bankentries.php @@ -107,7 +107,7 @@ $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; if (! $sortorder) $sortorder='ASC'; -if (! $sortfield) $sortfield='b.datev'; +if (! $sortfield) $sortfield='b.datev, b.dateo, b.rowid'; $mode_balance_ok=false; //if (($sortfield == 'b.datev' || $sortfield == 'b.datev, b.dateo, b.rowid')) // TODO Manage balance when account not selected @@ -194,7 +194,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP $search_num_releve=''; $search_conciliated=''; $thirdparty=''; - + $account=""; if ($id > 0 || ! empty($ref)) $account=$object->id; } @@ -396,18 +396,18 @@ if ($id > 0 || ! empty($ref)) foreach ($bankcateg->fetchAll() as $bankcategory) { $options[$bankcategory->id] = $bankcategory->label; } - + // Bank card - + $head=bank_prepare_head($object); dol_fiche_head($head,'journal',$langs->trans("FinancialAccount"),0,'account'); - + $linkback = ''.$langs->trans("BackToList").''; - + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1); - + dol_fiche_end(); - + /* @@ -416,7 +416,7 @@ if ($id > 0 || ! empty($ref)) if ($action != 'addline' && $action != 'reconcile') { print '
'; - + if ($action != 'addline') { if (empty($conf->global->BANK_DISABLE_DIRECT_INPUT)) @@ -438,7 +438,7 @@ if ($id > 0 || ! empty($ref)) print ''.$langs->trans("Conciliate").''; } } - + print '
'; } } @@ -524,10 +524,10 @@ if (($id > 0 || ! empty($ref)) && ((string) $page == '')) $offset = $limit * $page; if ($page < 0) $page = 0; } -if ($page >= $nbtotalofpages) +if ($page >= $nbtotalofpages) { // If we made a search and result has low page than the page number we were on - $page = ($nbtotalofpages -1); + $page = ($nbtotalofpages -1); $offset = $limit * $page; if ($page < 0) $page = 0; } @@ -550,9 +550,9 @@ if ($resql) { $var=True; $num = $db->num_rows($resql); - + $arrayofselected=is_array($toselect)?$toselect:array(); - + // List of mass actions available $arrayofmassactions = array( //'presend'=>$langs->trans("SendByMail"), @@ -561,16 +561,16 @@ if ($resql) //if ($user->rights->bank->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); if ($massaction == 'presend') $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); - - + + // Confirmation delete if ($action == 'delete') { $text=$langs->trans('ConfirmDeleteTransaction'); print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id.'&rowid='.GETPOST("rowid"), $langs->trans('DeleteTransaction'), $text, 'confirm_delete', null, '', 1); } - - + + // Lines of title fields print '
'."\n"; if ($optioncss != '') print ''; @@ -583,7 +583,7 @@ if ($resql) print ''; print ''; if (GETPOST('bid')) print ''; - + // Form to reconcile if ($user->rights->banque->consolidate && $action == 'reconcile') { @@ -602,7 +602,7 @@ if ($resql) print ''; print ' '.$langs->trans("or").' '; print ''; - + // Show last bank statements $nbmax=15; // We accept to show last 15 receipts (so we can have more than one year) $liste=""; @@ -644,7 +644,7 @@ if ($resql) if ($user->rights->banque->modifier && $action == 'addline') { print load_fiche_titre($langs->trans("AddBankRecordLong"),'',''); - + print ''; print ''; print ''; @@ -656,7 +656,7 @@ if ($resql) print ''; print ''; print ''; - + print ''; print ''; print '
'.$langs->trans("Date").''.$langs->trans("Credit").' 
'; $form->select_date(empty($dateop)?-1:$dateop,'op',0,0,0,'transaction'); @@ -680,9 +680,9 @@ if ($resql) print '
'; print '
'; - } - - + } + + /// ajax to adjust value date with plus and less picto print ' - - '; - + + '; + $i = 0; - + // Title $bankcateg=new BankCateg($db); $morehtml='
'; @@ -713,7 +713,7 @@ if ($resql) $morehtml.=''; $morehtml.='/'.$nbtotalofpages.' '; $morehtml.='
'; - + $picto='title_bank'; if ($id > 0 || ! empty($ref)) $picto=''; if (GETPOST("bid")) @@ -725,13 +725,13 @@ if ($resql) { print_barre_liste($langs->trans("BankTransactions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $picto, 0, $morehtml, '', $limit); } - + // We can add page now to param if ($page != '') $param.='&page='.urlencode($page); - - + + $moreforfilter = ''; - + $moreforfilter.='
'; $moreforfilter .= $langs->trans('DateOperationShort').' : '; $moreforfilter .= '
'.$langs->trans('From') . ' '; @@ -739,7 +739,7 @@ if ($resql) //$moreforfilter .= ' - '; $moreforfilter .= '
'.$langs->trans('to') . ' ' . $form->select_date($search_dt_end, 'search_end_dt', 0, 0, 1, "search_form", 1, 0, 1).'
'; $moreforfilter .= '
'; - + $moreforfilter.='
'; $moreforfilter .= $langs->trans('DateValueShort').' : '; $moreforfilter .= '
'.$langs->trans('From') . ' '; @@ -747,25 +747,25 @@ if ($resql) //$moreforfilter .= ' - '; $moreforfilter .= '
'.$langs->trans('to') . ' ' . $form->select_date($search_dv_end, 'search_end_dv', 0, 0, 1, "search_form", 1, 0, 1).'
'; $moreforfilter .= '
'; - + $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint; else $moreforfilter = $hookmanager->resPrint; - - if ($moreforfilter) + + if ($moreforfilter) { print '
'; print $moreforfilter; print '
'."\n"; } - + $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields - + print '
'; print ''."\n"; - + // Fields title print ''; if (! empty($arrayfields['b.rowid']['checked'])) print_liste_field_titre($arrayfields['b.rowid']['label'],$_SERVER['PHP_SELF'],'b.rowid','',$param,'',$sortfield,$sortorder); @@ -784,9 +784,9 @@ if ($resql) // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { - foreach($extrafields->attribute_label as $key => $val) + foreach($extrafields->attribute_label as $key => $val) { - if (! empty($arrayfields["ef.".$key]['checked'])) + if (! empty($arrayfields["ef.".$key]['checked'])) { $align=$extrafields->getAlignFlag($key); print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); @@ -802,7 +802,7 @@ if ($resql) print "\n"; print ''; - if (! empty($arrayfields['b.rowid']['checked'])) + if (! empty($arrayfields['b.rowid']['checked'])) { print '"; // Ref - if (! empty($arrayfields['b.rowid']['checked'])) + if (! empty($arrayfields['b.rowid']['checked'])) { print ''; if (! $i) $totalarray['nbfield']++; } - + // Date ope - if (! empty($arrayfields['b.dateo']['checked'])) + if (! empty($arrayfields['b.dateo']['checked'])) { print '\n"; if (! $i) $totalarray['nbfield']++; } // Date value - if (! empty($arrayfields['b.datev']['checked'])) + if (! empty($arrayfields['b.datev']['checked'])) { print '\n"; if (! $i) $totalarray['nbfield']++; } - + // Third party - if (! empty($arrayfields['bu.label']['checked'])) + if (! empty($arrayfields['bu.label']['checked'])) { print "'; if (! $i) $totalarray['nbfield']++; } - + // Bank account - if (! empty($arrayfields['ba.ref']['checked'])) + if (! empty($arrayfields['ba.ref']['checked'])) { print '\n"; if (! $i) $totalarray['nbfield']++; } - + // Debit if (! empty($arrayfields['b.debit']['checked'])) { @@ -1192,7 +1193,7 @@ if ($resql) if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totalcredfield']=$totalarray['nbfield']; } - + // Balance if (! empty($arrayfields['balance']['checked'])) { @@ -1212,7 +1213,7 @@ if ($resql) print ''; } } - + if (! empty($arrayfields['b.num_releve']['checked'])) { print ''; if (! $i) $totalarray['nbfield']++; } - + // Action edit/delete print ''; - if (! $i) $totalarray['nbfield']++; - + if (! $i) $totalarray['nbfield']++; + // Action column print '
'; print ''; @@ -884,25 +884,25 @@ if ($resql) $balance = 0; // For balance $balancecalculated = false; - + // Loop on each record $sign = 1; - + $totalarray=array(); - while ($i < min($num,$limit)) + while ($i < min($num,$limit)) { $objp = $db->fetch_object($resql); // If we are in a situation where we need/can show balance, we calculate the start of balance if (! $balancecalculated && ! empty($arrayfields['balance']['checked']) && $mode_balance_ok) { - if (! $account) + if (! $account) { dol_print_error('', 'account is not defined but $mode_balance_ok is true'); exit; } - - //Loop on each record + + // Loop on each record before $sign = 1; $i = 0; $sqlforbalance='SELECT SUM(b.amount) as balance'; @@ -912,7 +912,8 @@ if ($resql) $sqlforbalance.= " WHERE b.fk_account = ba.rowid"; $sqlforbalance.= " AND ba.entity IN (".getEntity('bank_account', 1).")"; $sqlforbalance.= " AND b.fk_account = ".$account; - $sqlforbalance.= " AND b.datev < '" . $db->idate($db->jdate($objp->dv)) . "'"; + //$sqlforbalance.= " AND (b.datev < '" . $db->idate($db->jdate($objp->dv)) . "')"; + $sqlforbalance.= " AND (b.datev < '" . $db->idate($db->jdate($objp->dv)) . "' OR (b.datev = '" . $db->idate($db->jdate($objp->dv)) . "' AND (b.dateo < '".$db->idate($db->jdate($objp->do))."' OR (b.dateo = '".$db->idate($db->jdate($objp->do))."' AND b.rowid < ".$objp->rowid."))))"; $resqlforbalance = $db->query($sqlforbalance); //print $sqlforbalance; if ($resqlforbalance) @@ -924,12 +925,12 @@ if ($resql) } } else dol_print_error($db); - + $balancecalculated=true; } - + $balance = price2num($balance + ($sign * $objp->amount),'MT'); - + if (empty($cachebankaccount[$objp->bankid])) { $bankaccounttmp = new Account($db); @@ -941,13 +942,13 @@ if ($resql) { $bankaccount = $cachebankaccount[$objp->bankid]; } - + $var=!$var; print "
'; print "rowid.'">'.img_object($langs->trans("ShowPayment").': '.$objp->rowid, 'account', 'class="classfortooltip"').' '.$objp->rowid."   "; @@ -959,14 +960,14 @@ if ($resql) if (! empty($arrayfields['description']['checked'])) { print ""; - + //print "rowid."&account=".$objp->fk_account."\">"; $reg=array(); preg_match('/\((.+)\)/i',$objp->label,$reg); // Si texte entoure de parenthee on tente recherche de traduction if ($reg[1] && $langs->trans($reg[1])!=$reg[1]) print $langs->trans($reg[1]); else print dol_trunc($objp->label,40); //print " "; - + // Add links after description $links = $bankaccountstatic->get_url($objp->rowid); $cachebankaccount=array(); @@ -1054,19 +1055,19 @@ if ($resql) } elseif ($links[$key]['type']=='company') { - + } elseif ($links[$key]['type']=='user') { - + } elseif ($links[$key]['type']=='member') { - + } elseif ($links[$key]['type']=='sc') { - + } else { @@ -1086,20 +1087,20 @@ if ($resql) print ''; } } - + print ''.dol_print_date($db->jdate($objp->do),"day")."'; print ''.dol_print_date($db->jdate($objp->dv),"day").""; @@ -1115,7 +1116,7 @@ if ($resql) } // Payment type - if (! empty($arrayfields['type']['checked'])) + if (! empty($arrayfields['type']['checked'])) { print ''; $labeltype=($langs->trans("PaymentTypeShort".$objp->fk_type)!="PaymentTypeShort".$objp->fk_type)?$langs->trans("PaymentTypeShort".$objp->fk_type):$langs->getLabelFromKey($db,$objp->fk_type,'c_paiement','code','libelle'); @@ -1131,9 +1132,9 @@ if ($resql) print ''.($objp->num_chq?$objp->num_chq:"").""; if ($objp->url_id) @@ -1156,16 +1157,16 @@ if ($resql) print ''; print $bankaccount->getNomUrl(1); print "-'; @@ -1224,7 +1225,7 @@ if ($resql) print ''.$objp->num_releve.''; } else if ($action == 'reconcile') - { + { print 'rowid])?' checked':'').'>'; } } @@ -1239,7 +1240,7 @@ if ($resql) print ''; // Transaction reconciliated or edit link @@ -1279,8 +1280,8 @@ if ($resql) } } print ''; if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined @@ -1296,7 +1297,7 @@ if ($resql) $i++; } - + // Show total line if (isset($totalarray['totaldebfield']) || isset($totalarray['totalcredfield'])) { @@ -1319,7 +1320,7 @@ if ($resql) print "
"; print "
"; - + print ''; $db->free($resql); } diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 2d0208d0c2b..bc51f0b226b 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1003,7 +1003,7 @@ if (empty($reshook)) } $id = $object->create($user); // This include class to add_object_linked() and add add_contact() - + if ($id > 0) { dol_include_once('/' . $element . '/class/' . $subelement . '.class.php'); @@ -1052,7 +1052,7 @@ if (empty($reshook)) $tva_tx = $lines[$i]->tva_tx; if (! empty($lines[$i]->vat_src_code) && ! preg_match('/\(/', $tva_tx)) $tva_tx .= ' ('.$lines[$i]->vat_src_code.')'; - + $result = $object->addline( $langs->trans('Deposit'), $amountdeposit, // subprice @@ -1155,7 +1155,7 @@ if (empty($reshook)) $tva_tx = $lines[$i]->tva_tx; if (! empty($lines[$i]->vat_src_code) && ! preg_match('/\(/', $tva_tx)) $tva_tx .= ' ('.$lines[$i]->vat_src_code.')'; - + // View third's localtaxes for NOW and do not use value from origin. // TODO Is this really what we want ? Yes if source if template invoice but what if proposal or order ? $localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty); @@ -1456,7 +1456,7 @@ if (empty($reshook)) $tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx)); $tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx)); - + // if price ht was forced (ie: from gui when calculated by margin rate and cost price). TODO Why this ? if (! empty($price_ht)) { @@ -1718,7 +1718,7 @@ if (empty($reshook)) } } } - + $result = $object->updateline(GETPOST('lineid'), $description, $pu_ht, $qty, GETPOST('remise_percent'), $date_start, $date_end, $vat_rate, $localtax1_rate, $localtax2_rate, 'HT', $info_bits, $type, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $special_code, $array_options, GETPOST('progress'), @@ -2024,11 +2024,11 @@ if ($action == 'create') if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code; } - + if (!empty($soc->id)) $absolute_discount = $soc->getAvailableDiscounts(); $note_public = $object->getDefaultCreateValueFor('note_public', (is_object($objectsrc)?$objectsrc->note_public:null)); $note_private = $object->getDefaultCreateValueFor('note_private', ((! empty($origin) && ! empty($originid) && is_object($objectsrc))?$objectsrc->note_private:null)); - + if (! empty($conf->use_javascript_ajax)) { require_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; @@ -2110,7 +2110,7 @@ if ($action == 'create') print '' . "\n"; $exampletemplateinvoice=new FactureRec($db); - + // Overwrite value if creation of invoice is from a predefined invoice if (empty($origin) && empty($originid) && GETPOST('fac_rec','int') > 0) { @@ -2232,7 +2232,7 @@ if ($action == 'create') if ((empty($origin)) || ((($origin == 'propal') || ($origin == 'commande')) && (! empty($originid)))) { // Deposit - if (empty($conf->global->INVOICE_DISABLE_DEPOSIT)) + if (empty($conf->global->INVOICE_DISABLE_DEPOSIT)) { print '
'; $tmp=' '; @@ -2243,7 +2243,7 @@ if ($action == 'create') }); }); '; - + $desc = $form->textwithpicto($tmp.$langs->trans("InvoiceDeposit"), $langs->transnoentities("InvoiceDepositDesc"), 1, 'help', '', 0, 3); print '
'; print $desc; @@ -2257,7 +2257,7 @@ if ($action == 'create') print '' . $langs->trans('Value') . ':'; } print '
'; - + print '
'; } } @@ -2289,7 +2289,7 @@ if ($action == 'create') } // Replacement - if (empty($conf->global->INVOICE_DISABLE_REPLACEMENT)) + if (empty($conf->global->INVOICE_DISABLE_REPLACEMENT)) { print ''; print '
'; @@ -2336,7 +2336,7 @@ if ($action == 'create') if ($socid > 0) { // Credit note - if (empty($conf->global->INVOICE_DISABLE_CREDIT_NOTE)) + if (empty($conf->global->INVOICE_DISABLE_CREDIT_NOTE)) { print '
'; $tmp='textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1, 'help', '', 0, 3); print $desc; - + print '
'; print '    0 ? 'checked':'').' /> "; print '
    0 ? 'checked':'').' /> "; print '
'; - + print '
'; } } @@ -2393,7 +2393,7 @@ if ($action == 'create') print '
' . "\n"; } } - + // Template invoice print '
'; $tmp=' '; @@ -2428,7 +2428,7 @@ if ($action == 'create') } $datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); - + // Date invoice print '' . $langs->trans('DateInvoice') . ''; print $form->select_date($datefacture?$datefacture:$dateinvoice, '', '', '', '', "add", 1, 1, 1); @@ -2534,15 +2534,15 @@ if ($action == 'create') '__INVOICE_YEAR__' => $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample,'%Y').')', '__INVOICE_NEXT_YEAR__' => $langs->trans("NextYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'y'),'%Y').')' ); - + $htmltext = ''.$langs->trans("FollowingConstantsWillBeSubstituted").':
'; foreach($substitutionarray as $key => $val) { $htmltext.=$key.' = '.$langs->trans($val).'
'; } - $htmltext.='
'; + $htmltext.=''; } - + // Public note print ''; print ''; @@ -2630,9 +2630,9 @@ if ($action == 'create') if (!empty($conf->multicurrency->enabled)) { - print '' . $langs->trans('MulticurrencyTotalHT') . '' . price($objectsrc->multicurrency_total_ht) . ''; - print '' . $langs->trans('MulticurrencyTotalVAT') . '' . price($objectsrc->multicurrency_total_tva) . ""; - print '' . $langs->trans('MulticurrencyTotalTTC') . '' . price($objectsrc->multicurrency_total_ttc) . ""; + print '' . $langs->trans('MulticurrencyAmountHT') . '' . price($objectsrc->multicurrency_total_ht) . ''; + print '' . $langs->trans('MulticurrencyAmountVAT') . '' . price($objectsrc->multicurrency_total_tva) . ""; + print '' . $langs->trans('MulticurrencyAmountTTC') . '' . price($objectsrc->multicurrency_total_ttc) . ""; } } @@ -3336,9 +3336,9 @@ else if ($id > 0 || ! empty($ref)) $prevsits_total_amount += $object->total_ht; print price($prevsits_total_amount, 0, $langs, 1, -1, -1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency) ); - + print ''; - + // Previous situation(s) deduction(s) for ($i = 0; $i < $cprevsits; $i++) { @@ -3352,7 +3352,7 @@ else if ($id > 0 || ! empty($ref)) print ''; print '- ' . price($prevsits[$i]->total_ht, 0, $langs, 1, -1, -1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency) ); print ''; - + } } } @@ -3390,21 +3390,21 @@ else if ($id > 0 || ! empty($ref)) print '
'; print '
'; print '
'; - + print ''; - + if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency)) { // Multicurrency Amount HT print ''; print ''; print ''; - + // Multicurrency Amount VAT print ''; print ''; print ''; - + // Multicurrency Amount TTC print ''; print ''; @@ -3463,7 +3463,7 @@ else if ($id > 0 || ! empty($ref)) print '
' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
'; - + // List of previous situation invoices $sign = 1; @@ -3486,12 +3486,12 @@ else if ($id > 0 || ! empty($ref)) $nbrows += 5; if (! empty($conf->incoterm->enabled)) $nbrows += 1; - - if ($object->type == Facture::TYPE_SITUATION && ! empty($conf->global->INVOICE_USE_SITUATION)) + + if ($object->type == Facture::TYPE_SITUATION && ! empty($conf->global->INVOICE_USE_SITUATION)) { if (count($object->tab_previous_situation_invoice) > 0 || count($object->tab_next_situation_invoice) > 0) print ''; - + if (count($object->tab_previous_situation_invoice) > 0) { // List of previous invoices print ''; @@ -3503,7 +3503,7 @@ else if ($id > 0 || ! empty($ref)) print ''; print ''; print ''; - + $total_prev_ht = $total_prev_ttc = 0; $var = true; foreach ($object->tab_previous_situation_invoice as $prev_invoice) { @@ -3519,10 +3519,10 @@ else if ($id > 0 || ! empty($ref)) print ''; print ''; print ''; - + $var = ! $var; } - + print ''; print ''; print ''; @@ -3530,7 +3530,7 @@ else if ($id > 0 || ! empty($ref)) print ''; print ''; } - + if (count($object->tab_next_situation_invoice) > 0) { // List of next invoices print ''; @@ -3542,9 +3542,9 @@ else if ($id > 0 || ! empty($ref)) print ''; print ''; print ''; - + $total_next_ht = $total_next_ttc = 0; - + $var = true; foreach ($object->tab_next_situation_invoice as $next_invoice) { $totalpaye = $next_invoice->getSommePaiement(); @@ -3559,10 +3559,10 @@ else if ($id > 0 || ! empty($ref)) print ''; print ''; print ''; - + $var = ! $var; } - + print ''; print ''; print ''; @@ -3570,14 +3570,14 @@ else if ($id > 0 || ! empty($ref)) print ''; print ''; } - + if (count($object->tab_previous_situation_invoice) > 0 || count($object->tab_next_situation_invoice) > 0) print '
' . $langs->trans('AmountTTC') . ' 
' . price($prev_invoice->total_ttc) . '' . $prev_invoice->getLibStatut(3, $totalpaye) . '
' . price($total_prev_ht) . ' 
' . $langs->trans('AmountTTC') . ' 
' . price($next_invoice->total_ttc) . '' . $next_invoice->getLibStatut(3, $totalpaye) . '
' . price($total_next_ht) . ' 
'; } - + // List of payments already done - + print ''; print ''; @@ -3735,7 +3735,7 @@ else if ($id > 0 || ! empty($ref)) // Billed print ''; - + // Remainder to pay print ''; print ''; print ''; - } + } else // Credit note { $cssforamountpaymentcomplete=''; - + // Total already paid back print '
' . $langs->trans("Billed") . ' :' . price($object->total_ttc) . ' 
'; if ($resteapayeraffiche >= 0) @@ -3745,11 +3745,11 @@ else if ($id > 0 || ! empty($ref)) print ' :' . price($resteapayeraffiche) . ' 
'; print $langs->trans('AlreadyPaidBack'); @@ -3807,15 +3807,15 @@ else if ($id > 0 || ! empty($ref)) { if ($object->situation_cycle_ref && $object->statut == 0) { print '
'; - + print '
'; print ''; print ''; print ''; - + print ''; print ''; - + if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { print ''; } @@ -3838,7 +3838,7 @@ else if ($id > 0 || ! empty($ref)) print ''; print ''; print "\n"; - + if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { print ''; } @@ -3851,19 +3851,19 @@ else if ($id > 0 || ! empty($ref)) print ''; print ''; print ''; - + print '
   
 %
'; - + print '
'; - + print '
'; - + } - + } - - - + + + print '
@@ -3899,7 +3899,7 @@ else if ($id > 0 || ! empty($ref)) print "
\n"; print "
"; - + print "\n"; dol_fiche_end(); @@ -3998,7 +3998,7 @@ else if ($id > 0 || ! empty($ref)) //print ''.$langs->trans("MakeWithdrawRequest").''; } } - + // Create payment if ($object->type != Facture::TYPE_CREDIT_NOTE && $object->statut == 1 && $object->paye == 0 && $user->rights->facture->paiement) { if ($objectidnext) { @@ -4149,7 +4149,7 @@ else if ($id > 0 || ! empty($ref)) // Show links to link elements $linktoelem = $form->showLinkToObjectBlock($object, null, array('invoice')); $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); - + // Link for paypal payment if (! empty($conf->paypal->enabled) && $object->statut != 0) { include_once DOL_DOCUMENT_ROOT . '/paypal/lib/paypal.lib.php'; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index b440c012f04..321a4752006 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4332,7 +4332,7 @@ class Form * Si vendeur et acheteur dans Communauté européenne et acheteur= entreprise alors TVA par défaut=0. Fin de règle. * Sinon la TVA proposee par defaut=0. Fin de regle. * @param bool $options_only Return HTML options lines only (for ajax treatment) - * @param int $mode 1=Add code into key in select list + * @param int $mode 0=Use vat rate as key in combo list, 1=Add VAT code after vat rate into key, -1=Use id of vat line as key * @return string */ function load_tva($htmlname='tauxtva', $selectedrate='', $societe_vendeuse='', $societe_acheteuse='', $idprod=0, $info_bits=0, $type='', $options_only=false, $mode=0) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index f9f9c8557ee..aa70c2680dd 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3891,7 +3891,7 @@ function getTaxesFromId($vatrowid) * @param Societe $buyer Company object * @param Societe $seller Company object * @param int $firstparamisid 1 if first param is id into table (use this if you can) - * @return array array(localtax_type1(1-6 / 0 if not found), rate of localtax1, ...) + * @return array array(localtax_type1(1-6/0 if not found), rate localtax1, localtax_type1, rate localtax2, accountancycodecust, accountancycodesupp) */ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisid=0) { @@ -3927,22 +3927,22 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisi { if (! isOnlyOneLocalTax(1)) { - return array($obj->localtax1_type, get_localtax($vatrate, $local, $buyer, $seller), $obj->accountancy_code_sell,$obj->accountancy_code_buy); + return array($obj->localtax1_type, get_localtax($vatrate, $local, $buyer, $seller), $obj->accountancy_code_sell, $obj->accountancy_code_buy); } else { - return array($obj->localtax1_type, $obj->localtax1,$obj->accountancy_code_sell,$obj->accountancy_code_buy); + return array($obj->localtax1_type, $obj->localtax1,$obj->accountancy_code_sell, $obj->accountancy_code_buy); } } elseif ($local == 2) { if (! isOnlyOneLocalTax(2)) { - return array($obj->localtax2_type, get_localtax($vatrate, $local, $buyer, $seller),$obj->accountancy_code_sell,$obj->accountancy_code_buy); + return array($obj->localtax2_type, get_localtax($vatrate, $local, $buyer, $seller),$obj->accountancy_code_sell, $obj->accountancy_code_buy); } else { - return array($obj->localtax2_type, $obj->localtax2,$obj->accountancy_code_sell,$obj->accountancy_code_buy); + return array($obj->localtax2_type, $obj->localtax2,$obj->accountancy_code_sell, $obj->accountancy_code_buy); } } else @@ -3951,22 +3951,22 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisi { if(! isOnlyOneLocalTax(2)) { - return array($obj->localtax1_type, get_localtax($vatrate, 1, $buyer, $seller), $obj->localtax2_type, get_localtax($vatrate, 2, $buyer, $seller),$obj->accountancy_code_sell,$obj->accountancy_code_buy); + return array($obj->localtax1_type, get_localtax($vatrate, 1, $buyer, $seller), $obj->localtax2_type, get_localtax($vatrate, 2, $buyer, $seller), $obj->accountancy_code_sell,$obj->accountancy_code_buy); } else { - return array($obj->localtax1_type, get_localtax($vatrate, 1, $buyer, $seller), $obj->localtax2_type, $obj->localtax2,$obj->accountancy_code_sell,$obj->accountancy_code_buy); + return array($obj->localtax1_type, get_localtax($vatrate, 1, $buyer, $seller), $obj->localtax2_type, $obj->localtax2, $obj->accountancy_code_sell, $obj->accountancy_code_buy); } } else { if(! isOnlyOneLocalTax(2)) { - return array($obj->localtax1_type, $obj->localtax1, $obj->localtax2_type,get_localtax($vatrate, 2, $buyer, $seller) ,$obj->accountancy_code_sell,$obj->accountancy_code_buy); + return array($obj->localtax1_type, $obj->localtax1, $obj->localtax2_type, get_localtax($vatrate, 2, $buyer, $seller), $obj->accountancy_code_sell, $obj->accountancy_code_buy); } else { - return array($obj->localtax1_type, $obj->localtax1, $obj->localtax2_type, $obj->localtax2,$obj->accountancy_code_sell,$obj->accountancy_code_buy); + return array($obj->localtax1_type, $obj->localtax1, $obj->localtax2_type, $obj->localtax2, $obj->accountancy_code_sell, $obj->accountancy_code_buy); } } } diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index c4257c3c7f8..1b79cc9163d 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1039,10 +1039,10 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass // Show page nb only on iso languages (so default Helvetica font) if (strtolower(pdf_getPDFFont($outputlangs)) == 'helvetica') { - $pdf->SetXY(-20,-$posy); + $pdf->SetXY($dims['wk']-$dims['rm']-15, -$posy); //print 'xxx'.$pdf->PageNo().'-'.$pdf->getAliasNbPages().'-'.$pdf->getAliasNumPage();exit; - if (empty($conf->global->MAIN_USE_FPDF)) $pdf->MultiCell(13, 2, $pdf->PageNo().'/'.$pdf->getAliasNbPages(), 0, 'R', 0); - else $pdf->MultiCell(13, 2, $pdf->PageNo().'/{nb}', 0, 'R', 0); + if (empty($conf->global->MAIN_USE_FPDF)) $pdf->MultiCell(15, 2, $pdf->PageNo().'/'.$pdf->getAliasNbPages(), 0, 'R', 0); + else $pdf->MultiCell(15, 2, $pdf->PageNo().'/{nb}', 0, 'R', 0); } return $marginwithfooter; @@ -1246,7 +1246,7 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl if (empty($hideref)) { - if ($issupplierline) + if ($issupplierline) { //$ref_prodserv = $prodser->ref.($ref_supplier ? ' ('.$outputlangs->transnoentitiesnoconv("SupplierRef").' '.$ref_supplier.')' : ''); // Show local ref and supplier ref if (! empty($conf->global->PDF_HIDE_PRODUCT_REF_IN_SUPPLIER_LINES)) $ref_prodserv =$ref_supplier; diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index 5aa272380cc..b40eb4bafa9 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -220,6 +220,8 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2460__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_tax', 2451__+MAX_llx_menu__, '/admin/dict.php?id=7&from=accountancy&search_country_id=__MYCOUNTRYID__&mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuTaxAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 50, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2461__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_expensereport', 2451__+MAX_llx_menu__, '/admin/dict.php?id=17&from=accountancy&mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuExpenseReportAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 60, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2462__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_product', 2451__+MAX_llx_menu__, '/accountancy/admin/productaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuProductsAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 70, __ENTITY__); + -- Accounting period + insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin" && $conf->global->MAIN_FEATURES_LEVEL > 0', __HANDLER__, 'left', 2450__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_period', 2451__+MAX_llx_menu__, '/accountancy/admin/fiscalyear.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'FiscalPeriod', 1, 'admin', '', '', 2, 80, __ENTITY__); -- Binding insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2401__+MAX_llx_menu__, 'accountancy', 'dispatch_customer', 2400__+MAX_llx_menu__, '/accountancy/customer/index.php?leftmenu=dispatch_customer', 'CustomersVentilation', 1, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="dispatch_customer"', __HANDLER__, 'left', 2402__+MAX_llx_menu__, 'accountancy', '', 2401__+MAX_llx_menu__, '/accountancy/customer/list.php', 'ToDispatch', 2, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 3, __ENTITY__); @@ -245,8 +247,6 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2445__+MAX_llx_menu__, 'accountancy', '', 2440__+MAX_llx_menu__, '/compta/stats/casoc.php?leftmenu=ca', 'ByCompanies', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 22, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2446__+MAX_llx_menu__, 'accountancy', '', 2440__+MAX_llx_menu__, '/compta/stats/cabyuser.php?leftmenu=ca', 'ByUsers', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 23, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2447__+MAX_llx_menu__, 'accountancy', '', 2440__+MAX_llx_menu__, '/compta/stats/cabyprodserv.php?leftmenu=ca', 'ByProductsAndServices', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 24, __ENTITY__); - -- Accounting period - insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2450__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_period', 2400__+MAX_llx_menu__, '/accountancy/admin/fiscalyear.php?mainmenu=setup', 'FiscalPeriod', 1, 'admin', '', '', 2, 4, __ENTITY__); -- Rapports compta simple insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled', __HANDLER__, 'left', 2700__+MAX_llx_menu__, 'accountancy', 'ca', 6__+MAX_llx_menu__, '/compta/resultat/index.php?leftmenu=ca&mainmenu=accountancy', 'Reportings', 0, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 11, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2701__+MAX_llx_menu__, 'accountancy', '', 2700__+MAX_llx_menu__, '/compta/resultat/index.php?leftmenu=ca', 'ReportInOut', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 0, __ENTITY__); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 66fe9f993a9..e96ac4a7193 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -966,7 +966,13 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu { if (preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/don/admin/donation.php?from=accountancy&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuDonationAccounts"), 2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_donation', 47); }*/ - if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/productaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuProductsAccounts"), 2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_product', 50); + if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/productaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuProductsAccounts"), 2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_product', 50); + + // Fiscal year + if ($conf->global->MAIN_FEATURES_LEVEL > 0) // Not yet used. In a future will lock some periods. + { + if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("FiscalPeriod"), 2, $user->rights->accounting->fiscalyear, '', $mainmenu, 'fiscalyear'); + } // Binding if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/customer/index.php?leftmenu=accountancy_dispatch_customer&mainmenu=accountancy",$langs->trans("CustomersVentilation"),1,$user->rights->accounting->bind->write, '', $mainmenu, 'dispatch_customer'); @@ -1039,12 +1045,6 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report",$langs->trans("ByCompanies"),3,$user->rights->accounting->comptarapport->lire); if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report",$langs->trans("ByUsers"),3,$user->rights->accounting->comptarapport->lire); if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/cabyprodserv.php?leftmenu=accountancy_report", $langs->trans("ByProductsAndServices"),3,$user->rights->accounting->comptarapport->lire); - - // Fiscal year - if ($conf->global->MAIN_FEATURES_LEVEL > 0) // Not yet used. In a future will lock some periods. - { - if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("FiscalPeriod"),1,$user->rights->accounting->fiscalyear, '', $mainmenu, 'fiscalyear'); - } } // Accountancy (simple) diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 971a2189854..28e47ad4c98 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -49,7 +49,7 @@ class Expedition extends CommonObject public $table_element_line="expeditiondet"; protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe public $picto = 'sending'; - + var $socid; var $ref_customer; var $ref_int; @@ -396,7 +396,7 @@ class Expedition extends CommonObject { $error++; } - + if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options)>0) // For avoid conflicts if trigger used { $expeditionline = new ExpeditionLigne($this->db); @@ -915,7 +915,7 @@ class Expedition extends CommonObject $this->error='ADDLINE_WAS_CALLED_INSTEAD_OF_ADDLINEBATCH'; return -4; } - + // extrafields if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options)>0) // For avoid conflicts if trigger used $line->array_options = $array_options; @@ -1316,7 +1316,8 @@ class Expedition extends CommonObject $sql = "SELECT cd.rowid, cd.fk_product, cd.label as custom_label, cd.description, cd.qty as qty_asked, cd.product_type"; $sql.= ", cd.total_ht, cd.total_localtax1, cd.total_localtax2, cd.total_ttc, cd.total_tva"; - $sql.= ", cd.tva_tx, cd.localtax1_tx, cd.localtax2_tx, cd.price, cd.subprice, cd.remise_percent,cd.buy_price_ht as pa_ht"; + $sql.= ", cd.vat_src_code, cd.tva_tx, cd.localtax1_tx, cd.localtax2_tx, cd.localtax1_type, cd.localtax2_type, cd.price, cd.subprice, cd.remise_percent,cd.buy_price_ht as pa_ht"; + $sql.= ", cd.fk_multicurrency, cd.multicurrency_code, cd.multicurrency_subprice, cd.multicurrency_total_ht, cd.multicurrency_total_tva, cd.multicurrency_total_ttc"; $sql.= ", ed.rowid as line_id, ed.qty as qty_shipped, ed.fk_origin_line, ed.fk_entrepot"; $sql.= ", p.ref as product_ref, p.label as product_label, p.fk_product_type"; $sql.= ", p.weight, p.weight_units, p.length, p.length_units, p.surface, p.surface_units, p.volume, p.volume_units, p.tobatch as product_tobatch"; @@ -1389,8 +1390,10 @@ class Expedition extends CommonObject $line->pa_ht = $obj->pa_ht; + $localtax_array=array(0=>$obj->localtax1_type, 1=>$obj->localtax1_tx, 2=>$obj->localtax2_type, 3=>$obj->localtax2_tx); + // For invoicing - $tabprice = calcul_price_total($obj->qty_shipped, $obj->subprice, $obj->remise_percent, $obj->tva_tx, $obj->localtax1_tx, $obj->localtax2_tx, 0, 'HT', $obj->info_bits, $obj->fk_product_type, $mysoc); // We force type to 0 + $tabprice = calcul_price_total($obj->qty_shipped, $obj->subprice, $obj->remise_percent, $obj->tva_tx, $obj->localtax1_tx, $obj->localtax2_tx, 0, 'HT', $obj->info_bits, $obj->fk_product_type, $mysoc, $localtax_array); // We force type to 0 $line->desc = $obj->description; // We need ->desc because some code into CommonObject use desc (property defined for other elements) $line->qty = $line->qty_shipped; $line->total_ht = $tabprice[0]; @@ -1398,6 +1401,7 @@ class Expedition extends CommonObject $line->total_localtax2 = $tabprice[10]; $line->total_ttc = $tabprice[2]; $line->total_tva = $tabprice[1]; + $line->vat_src_code = $obj->vat_src_code; $line->tva_tx = $obj->tva_tx; $line->localtax1_tx = $obj->localtax1_tx; $line->localtax2_tx = $obj->localtax2_tx; @@ -1411,6 +1415,14 @@ class Expedition extends CommonObject $this->total_localtax1+= $tabprice[9]; $this->total_localtax2+= $tabprice[10]; + // Multicurrency + $this->fk_multicurrency = $obj->fk_multicurrency; + $this->multicurrency_code = $obj->multicurrency_code; + $this->multicurrency_subprice = $obj->multicurrency_subprice; + $this->multicurrency_total_ht = $obj->multicurrency_total_ht; + $this->multicurrency_total_tva = $obj->multicurrency_total_tva; + $this->multicurrency_total_ttc = $obj->multicurrency_total_ttc; + if ($originline != $obj->fk_origin_line) { $line->detail_batch = array(); @@ -1479,7 +1491,7 @@ class Expedition extends CommonObject $label = '' . $langs->trans("ShowSending") . ''; $label .= '
' . $langs->trans('Ref') . ': '.$this->ref; $label .= '
'.$langs->trans('RefCustomer').': '.($this->ref_customer ? $this->ref_customer : $this->ref_client); - + $url = DOL_URL_ROOT.'/expedition/card.php?id='.$this->id; if ($short) return $url; @@ -1495,7 +1507,7 @@ class Expedition extends CommonObject $linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"'; $linkclose.=' class="classfortooltip"'; } - + $linkstart = ''; $linkend=''; diff --git a/htdocs/install/fileconf.php b/htdocs/install/fileconf.php index cdd639ad50b..c1083062a5f 100644 --- a/htdocs/install/fileconf.php +++ b/htdocs/install/fileconf.php @@ -66,6 +66,7 @@ if (@file_exists($forcedfile)) { } + /* * View */ @@ -426,8 +427,8 @@ if (! empty($force_install_message)) 0 && ! empty($force_install_databaserootlogin)) { print ' disabled'; } ?> > @@ -499,26 +500,28 @@ if (! empty($force_install_message)) trans("Password"); ?> + " - 0 && ! empty($force_install_databaserootpass)) { + print ' disabled'; // May be removed by javascript } ?> > @@ -561,7 +564,10 @@ jQuery(document).ready(function() { if (jQuery("#db_create_database").is(":checked") || jQuery("#db_create_user").is(":checked")) { jQuery(".hideroot").show(); - jQuery(".needroot").removeAttr('disabled'); + + jQuery(".needroot").removeAttr('disabled'); + } else { diff --git a/htdocs/install/mysql/migration/4.0.0-5.0.0.sql b/htdocs/install/mysql/migration/4.0.0-5.0.0.sql index b5978efac99..5f62c766a01 100644 --- a/htdocs/install/mysql/migration/4.0.0-5.0.0.sql +++ b/htdocs/install/mysql/migration/4.0.0-5.0.0.sql @@ -270,3 +270,8 @@ ALTER TABLE llx_product_fournisseur_price ADD COLUMN default_vat_code varchar(10 ALTER TABLE llx_events MODIFY COLUMN ip varchar(250); + + +UPDATE llx_bank SET label= '(SupplierInvoicePayment)' WHERE label= 'Règlement fournisseur'; +UPDATE llx_bank SET label= '(CustomerInvoicePayment)' WHERE label= 'Règlement client'; + diff --git a/htdocs/install/step1.php b/htdocs/install/step1.php index b323c970a9d..486b156fcaf 100644 --- a/htdocs/install/step1.php +++ b/htdocs/install/step1.php @@ -88,6 +88,7 @@ if (@file_exists($forcedfile)) { $main_data_dir = detect_dolibarr_main_data_root($main_dir); } $main_url = detect_dolibarr_main_url_root(); + if (!empty($force_install_databaserootlogin)) { $userroot = parse_database_login($force_install_databaserootlogin); } @@ -542,7 +543,7 @@ if (! $error && $db->connected && $action == "set") if ($db->connected) { $resultbis = 1; - + // Create user $result=$db->DDLCreateUser($dolibarr_main_db_host, $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name); // Create user bis @@ -553,7 +554,7 @@ if (! $error && $db->connected && $action == "set") $resultbis=$db->DDLCreateUser('%', $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name); } } - + if ($result > 0 && $resultbis > 0) { diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 31a865132c8..833330126bb 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -239,12 +239,43 @@ if (empty($reshook)) else $object->price_min = GETPOST('price_min'); - $object->tva_tx = str_replace('*','',GETPOST('tva_tx')); - $object->tva_npr = preg_match('/\*/',GETPOST('tva_tx'))?1:0; + $tva_tx_txt = GETPOST('tva_tx', 'alpha'); // tva_tx can be '8.5' or '8.5*' or '8.5 (XXX)' or '8.5* (XXX)' - // local taxes. - $object->localtax1_tx = get_localtax($object->tva_tx,1); - $object->localtax2_tx = get_localtax($object->tva_tx,2); + // We must define tva_tx, npr and local taxes + $vatratecode = ''; + $tva_tx = preg_replace('/[^0-9\.].*$/', '', $tva_tx_txt); // keep remove all after the numbers and dot + $npr = preg_match('/\*/', $tva_tx_txt) ? 1 : 0; + $localtax1 = 0; $localtax2 = 0; $localtax1_type = '0'; $localtax2_type = '0'; + // If value contains the unique code of vat line (new recommanded method), we use it to find npr and local taxes + if (preg_match('/\((.*)\)/', $tva_tx_txt, $reg)) + { + // We look into database using code (we can't use get_localtax() because it depends on buyer that is not known). Same in update price. + $vatratecode=$reg[1]; + // Get record from code + $sql = "SELECT t.rowid, t.code, t.recuperableonly, t.localtax1, t.localtax2, t.localtax1_type, t.localtax2_type"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c"; + $sql.= " WHERE t.fk_pays = c.rowid AND c.code = '".$mysoc->country_code."'"; + $sql.= " AND t.taux = ".((float) $tva_tx)." AND t.active = 1"; + $sql.= " AND t.code ='".$vatratecode."'"; + $resql=$db->query($sql); + if ($resql) + { + $obj = $db->fetch_object($resql); + $npr = $obj->recuperableonly; + $localtax1 = $obj->localtax1; + $localtax2 = $obj->localtax2; + $localtax1_type = $obj->localtax1_type; + $localtax2_type = $obj->localtax2_type; + } + } + + $object->default_vat_code = $vatratecode; + $object->tva_tx = $tva_tx; + $object->tva_npr = $npr; + $object->localtax1_tx = $localtax1; + $object->localtax2_tx = $localtax2; + $object->localtax1_type = $localtax1_type; + $object->localtax2_type = $localtax2_type; $object->type = $type; $object->status = GETPOST('statut'); @@ -1109,7 +1140,8 @@ else // VAT print ''.$langs->trans("VATRate").''; - print $form->load_tva("tva_tx",-1,$mysoc,''); + $defaultva=get_default_tva($mysoc, $mysoc); + print $form->load_tva("tva_tx", $defaultva, $mysoc, $mysoc, 0, 0, '', false, 1); print ''; print ''; diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 0f28ffdea30..2e2f3007540 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -396,7 +396,7 @@ class Product extends CommonObject $sql = "SELECT count(*) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."product"; $sql.= " WHERE entity IN (".getEntity('product', 1).")"; - $sql.= " AND ref = '" .$this->ref."'"; + $sql.= " AND ref = '" .$this->db->escape($this->ref)."'"; $result = $this->db->query($sql); if ($result) @@ -1285,7 +1285,7 @@ class Product extends CommonObject if (empty($this->price_by_qty)) $this->price_by_qty=0; // Add new price - $sql = "INSERT INTO ".MAIN_DB_PREFIX."product_price(price_level,date_price,fk_product,fk_user_author,price,price_ttc,price_base_type,tosell, tva_tx, default_vat_code, recuperableonly,"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."product_price(price_level,date_price, fk_product, fk_user_author, price, price_ttc, price_base_type,tosell, tva_tx, default_vat_code, recuperableonly,"; $sql.= " localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, price_min,price_min_ttc,price_by_qty,entity,fk_price_expression) "; $sql.= " VALUES(".($level?$level:1).", '".$this->db->idate($now)."',".$this->id.",".$user->id.",".$this->price.",".$this->price_ttc.",'".$this->price_base_type."',".$this->status.",".$this->tva_tx.", ".($this->default_vat_code?("'".$this->default_vat_code."'"):"null").",".$this->tva_npr.","; $sql.= " ".$this->localtax1_tx.", ".$this->localtax2_tx.", '".$this->localtax1_type."', '".$this->localtax2_type."', ".$this->price_min.",".$this->price_min_ttc.",".$this->price_by_qty.",".$conf->entity.",".($this->fk_price_expression > 0?$this->fk_price_expression:'null'); @@ -1721,6 +1721,7 @@ class Product extends CommonObject $this->tva_tx = $obj->tva_tx; //! French VAT NPR $this->tva_npr = $obj->tva_npr; + $this->recuperableonly = $obj->tva_npr; // For backward compatibility //! Local taxes $this->localtax1_tx = $obj->localtax1_tx; $this->localtax2_tx = $obj->localtax2_tx; diff --git a/htdocs/product/price.php b/htdocs/product/price.php index cbfe90a5a52..2b5617c601d 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -113,7 +113,7 @@ if (empty($reshook)) // If value contains the unique code of vat line (new recommanded method), we use it to find npr and local taxes if (preg_match('/\((.*)\)/', $tva_tx_txt, $reg)) { - // We look into database using code + // We look into database using code (we can't use get_localtax() because it depends on buyer that is not known). Same in create product. $vatratecode=$reg[1]; // Get record from code $sql = "SELECT t.rowid, t.code, t.recuperableonly, t.localtax1, t.localtax2, t.localtax1_type, t.localtax2_type"; @@ -1819,7 +1819,10 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print "" . ""; print '' . $langs->trans($object->price_base_type) . ""; - print '' . vatrate($object->tva_tx, true, $object->recuperableonly) . ""; + print ''; + print vatrate($object->tva_tx, true, $object->recuperableonly); + print $object->default_vat_code?' ('.$object->default_vat_code.')':''; + print ""; print '' . price($object->price) . ""; print '' . price($object->price_ttc) . ""; print '' . price($object->price_min) . '';