From a2f1291f945ab14ec219d002f1edee37ee819c9d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 9 Aug 2016 17:28:02 +0200 Subject: [PATCH 1/9] Fix missing supplier proposals in project overview --- htdocs/langs/en_US/supplier_proposal.lang | 1 + htdocs/projet/element.php | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/htdocs/langs/en_US/supplier_proposal.lang b/htdocs/langs/en_US/supplier_proposal.lang index 909a4d713c1..e39a69a3dbe 100644 --- a/htdocs/langs/en_US/supplier_proposal.lang +++ b/htdocs/langs/en_US/supplier_proposal.lang @@ -47,6 +47,7 @@ DefaultModelSupplierProposalCreate=Default model creation DefaultModelSupplierProposalToBill=Default template when closing a price request (accepted) DefaultModelSupplierProposalClosed=Default template when closing a price request (refused) ListOfSupplierProposal=List of supplier proposal requests +ListSupplierProposalsAssociatedProject=List of supplier proposals associated with project SupplierProposalsToClose=Supplier proposals to close SupplierProposalsToProcess=Supplier proposals to process LastSupplierProposals=Last price requests diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 80b9499ed9e..2f07756fb8d 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -37,6 +37,7 @@ if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/ if (! empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; if (! empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php'; if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; +if (! empty($conf->supplier_proposal->enabled)) require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php'; if (! empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; if (! empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; if (! empty($conf->contrat->enabled)) require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; @@ -232,11 +233,11 @@ $listofreferent=array( 'testnew'=>$user->rights->facture->creer, 'test'=>$conf->facture->enabled && $user->rights->facture->lire), 'proposal_supplier'=>array( - 'name'=>"SuppliersOrders", - 'title'=>"ListSupplierOrdersAssociatedProject", - 'class'=>'CommandeFournisseur', - 'table'=>'commande_fournisseur', - 'datefieldname'=>'date_commande', + 'name'=>"SuppliersProposals", + 'title'=>"ListSupplierProposalsAssociatedProject", + 'class'=>'SupplierProposal', + 'table'=>'supplier_proposal', + 'datefieldname'=>'date', 'urlnew'=>DOL_URL_ROOT.'/supplier_proposal/card.php?action=create&projectid='.$id.'&socid='.$socid, 'lang'=>'supplier_proposal', 'buttonnew'=>'AddSupplierProposal', From 43ffb061ef2d040a44964d82dd9622ff006f3b92 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Wed, 10 Aug 2016 08:07:27 +0200 Subject: [PATCH 2/9] FIX : Accountancy - BANK_DISABLE_DIRECT_INPUT Add an option --- htdocs/accountancy/admin/index.php | 26 +++++++++++++++++++++ htdocs/compta/bank/account.php | 15 ++++-------- htdocs/core/modules/modAccounting.class.php | 5 ++++ htdocs/langs/en_US/accountancy.lang | 3 ++- 4 files changed, 38 insertions(+), 11 deletions(-) diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index b019872da6e..0173ac931cc 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -168,6 +168,18 @@ if ($action == 'setmanagezero') { } } +if ($action == 'setdisabledirectinput') { + $setdisabledirectinput = GETPOST('value', 'int'); + $res = dolibarr_set_const($db, "BANK_DISABLE_DIRECT_INPUT", $setdisabledirectinput, 'yesno', 0, '', $conf->entity); + if (! $res > 0) + $error ++; + if (! $error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'mesgs'); + } +} + /* * View */ @@ -342,6 +354,20 @@ if (! empty($conf->global->ACCOUNTING_MANAGE_ZERO)) { } print ''; +$var = ! $var; +print ""; +print '' . $langs->trans("BANK_DISABLE_DIRECT_INPUT") . ''; +if (! empty($conf->global->BANK_DISABLE_DIRECT_INPUT)) { + print ''; + print img_picto($langs->trans("Activated"), 'switch_on'); + print ''; +} else { + print ''; + print img_picto($langs->trans("Disabled"), 'switch_off'); + print ''; +} +print ''; + print "\n"; dol_fiche_end(); diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php index 3eb4764bb11..10c52e657ab 100644 --- a/htdocs/compta/bank/account.php +++ b/htdocs/compta/bank/account.php @@ -366,16 +366,11 @@ if ($id > 0 || ! empty($ref)) { if (empty($conf->global->BANK_DISABLE_DIRECT_INPUT)) { - if (empty($conf->accounting->enabled)) - { - if ($user->rights->banque->modifier) { - print 'id.'&page='.$page.($vline?'&vline='.$vline:'').'">'.$langs->trans("AddBankRecord").''; - } else { - print ''.$langs->trans("AddBankRecord").''; - } - } else { - print ''.$langs->trans("AddBankRecord").''; - } + if ($user->rights->banque->modifier) { + print 'id.'&page='.$page.($vline?'&vline='.$vline:'').'">'.$langs->trans("AddBankRecord").''; + } else { + print ''.$langs->trans("AddBankRecord").''; + } } else { print ''.$langs->trans("AddBankRecord").''; } diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php index af51e01c576..60d99438f4f 100644 --- a/htdocs/core/modules/modAccounting.class.php +++ b/htdocs/core/modules/modAccounting.class.php @@ -207,6 +207,11 @@ class modAccounting extends DolibarrModules "chaine", "csv" ); + $this->const[24] = array( + "BANK_DISABLE_DIRECT_INPUT", + "yesno", + "1" + ); // Tabs $this->tabs = array(); diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 056466706a1..3c8a431fbb6 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -56,7 +56,8 @@ ACCOUNTING_LENGTH_DESCRIPTION=Length for displaying product & services descripti ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT=Length for displaying product & services account description form in listings (Best = 50) ACCOUNTING_LENGTH_GACCOUNT=Length of the general accounts ACCOUNTING_LENGTH_AACCOUNT=Length of the third party accounts -ACCOUNTING_MANAGE_ZERO=Manage the zero at the end of an accounting account. Needed by some countries. Disable by default. Be careful with the function of length of the accounts. +ACCOUNTING_MANAGE_ZERO=Manage the zero at the end of an accounting account. Needed by some countries. Disable by default. Be careful with the function "length of the accounts". +BANK_DISABLE_DIRECT_INPUT=Disable free input of bank transactions. Enable by default with this module. ACCOUNTING_SELL_JOURNAL=Sell journal ACCOUNTING_PURCHASE_JOURNAL=Purchase journal From 5bb3b5c07450a2322110e8bfd6f445452dcf9eca Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Wed, 10 Aug 2016 09:47:25 +0200 Subject: [PATCH 3/9] FIX : MULTICURRENCY if value is 1,56 then GETPOST 'int' check return '' --- htdocs/comm/propal/card.php | 34 +++++------ htdocs/commande/card.php | 46 +++++++-------- htdocs/compta/facture.php | 98 +++++++++++++++---------------- htdocs/fourn/commande/card.php | 90 ++++++++++++++-------------- htdocs/fourn/facture/card.php | 94 ++++++++++++++--------------- htdocs/supplier_proposal/card.php | 38 ++++++------ 6 files changed, 200 insertions(+), 200 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 25337446b5b..8a46079955b 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -279,7 +279,7 @@ if (empty($reshook)) if ($socid < 1) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Customer")), null, 'errors'); - + $action = 'create'; $error ++; } @@ -345,7 +345,7 @@ if (empty($reshook)) $object->origin = GETPOST('origin'); $object->origin_id = GETPOST('originid'); - + // Multicurrency if (!empty($conf->multicurrency->enabled)) { @@ -718,7 +718,7 @@ if (empty($reshook)) $tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id); $tva_npr = get_default_npr($mysoc, $object->thirdparty, $prod->id); if (empty($tva_tx)) $tva_npr=0; - + $pu_ht = $prod->price; $pu_ttc = $prod->price_ttc; $price_min = $prod->price_min; @@ -932,7 +932,7 @@ if (empty($reshook)) // Add buying price $fournprice = price2num(GETPOST('fournprice') ? GETPOST('fournprice') : ''); - $buyingprice = price2num(GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we muste keep this value + $buyingprice = price2num(GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we muste keep this value $date_start = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), GETPOST('date_startsec'), GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear')); $date_end = dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), GETPOST('date_endsec'), GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear')); @@ -1082,7 +1082,7 @@ if (empty($reshook)) // Multicurrency rate else if ($action == 'setmulticurrencyrate' && $user->rights->propal->creer) { - $result = $object->setMulticurrencyRate(GETPOST('multicurrency_tx', 'int')); + $result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx'))); } // bank account @@ -1167,12 +1167,12 @@ if (empty($reshook)) } } } - + // Actions to build doc $upload_dir = $conf->propal->dir_output; $permissioncreate=$user->rights->propal->creer; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; - + } @@ -1432,11 +1432,11 @@ if ($action == 'create') print ''; print ''.fieldLabel('Currency','multicurrency_code').''; print ''; - $currency_code = (!empty($soc->multicurrency_code) ? $soc->multicurrency_code : ($object->multicurrency_code ? $object->multicurrency_code : $conf->currency)); + $currency_code = (!empty($soc->multicurrency_code) ? $soc->multicurrency_code : ($object->multicurrency_code ? $object->multicurrency_code : $conf->currency)); print $form->selectMultiCurrency($currency_code, 'multicurrency_code', 0); print ''; } - + // Public note print ''; print '' . $langs->trans('NotePublic') . ''; @@ -1934,7 +1934,7 @@ if ($action == 'create') $form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'none'); } print ''; - + // Multicurrency rate print ''; print ''; @@ -2053,7 +2053,7 @@ if ($action == 'create') print '' . price($object->total_ht, '', $langs, 0, - 1, - 1, $conf->currency) . ''; // Margin Infos - if (! empty($conf->margin->enabled)) + if (! empty($conf->margin->enabled)) { $rowspan=4; if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) $rowspan++; @@ -2087,25 +2087,25 @@ if ($action == 'create') print '' . $langs->trans('AmountTTC') . ''; print '' . price($object->total_ttc, '', $langs, 0, - 1, - 1, $conf->currency) . ''; print ''; - + if (!empty($conf->multicurrency->enabled)) { // Multicurrency Amount HT print '' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . ''; print '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ''; print ''; - + // Multicurrency Amount VAT print '' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . ''; print '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ''; print ''; - + // Multicurrency Amount TTC print '' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . ''; print '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ''; - print ''; + print ''; } - + // Statut print '' . $langs->trans('Status') . '' . $object->getLibStatut(4) . ''; @@ -2397,7 +2397,7 @@ if ($action == 'create') { include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; $formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'pro'.$object->id); - } + } $formmail->withfrom = 1; $liste = array(); foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key => $value) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index bf1925ed061..8409eb47e9e 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -262,14 +262,14 @@ if (empty($reshook)) $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); $object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int'); - + // Fill array 'array_options' with data from add form if (! $error) { $ret = $extrafields->setOptionalsFromPost($extralabels, $object); if ($ret < 0) $error++; } - + // If creation from another object of another module (Example: origin=propal, originid=1) if (! empty($origin) && ! empty($originid)) { @@ -388,7 +388,7 @@ if (empty($reshook)) } $sqlcontact = "SELECT code, fk_socpeople FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as ctc"; $sqlcontact.= " WHERE element_id = ".$originidforcontact." AND ec.fk_c_type_contact = ctc.rowid AND ctc.element = '".$originforcontact."'"; - + $resqlcontact = $db->query($sqlcontact); if ($resqlcontact) { @@ -400,14 +400,14 @@ if (empty($reshook)) } else dol_print_error($resqlcontact); } - + // Hooks $parameters = array('objFrom' => $srcobject); $reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been // modified by hook if ($reshook < 0) $error++; - + } else { setEventMessages($object->error, $object->errors, 'errors'); $error++; @@ -475,12 +475,12 @@ if (empty($reshook)) else if ($action == 'classifyunbilled' && $user->rights->commande->creer) { $ret=$object->classifyUnBilled(); - + if ($ret < 0) { setEventMessages($object->error, $object->errors, 'errors'); } } - + // Positionne ref commande client else if ($action == 'set_ref_client' && $user->rights->commande->creer) { $object->set_ref_client($user, GETPOST('ref_client')); @@ -525,7 +525,7 @@ if (empty($reshook)) if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); } - + // Multicurrency Code else if ($action == 'setmulticurrencycode' && $user->rights->commande->creer) { $result = $object->setMulticurrencyCode(GETPOST('multicurrency_code', 'alpha')); @@ -533,9 +533,9 @@ if (empty($reshook)) // Multicurrency rate else if ($action == 'setmulticurrencyrate' && $user->rights->commande->creer) { - $result = $object->setMulticurrencyRate(GETPOST('multicurrency_tx', 'int')); + $result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx'))); } - + else if ($action == 'setavailability' && $user->rights->commande->creer) { $result = $object->availability(GETPOST('availability_id')); if ($result < 0) @@ -1334,7 +1334,7 @@ if ($action == 'create' && $user->rights->commande->creer) $remise_absolue = 0; $currency_code = $conf->currency; - + if (! empty($origin) && ! empty($originid)) { // Parse element/subelement (ex: project_task) $element = $subelement = $origin; @@ -1405,7 +1405,7 @@ if ($action == 'create' && $user->rights->commande->creer) if (!empty($conf->multicurrency->enabled)) { if (!empty($objectsrc->multicurrency_code)) $currency_code = $objectsrc->multicurrency_code; - if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) $currency_tx = $objectsrc->multicurrency_tx; + if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) $currency_tx = $objectsrc->multicurrency_tx; } $note_private = $object->getDefaultCreateValueFor('note_private', (! empty($objectsrc->note_private) ? $objectsrc->note_private : null)); @@ -1428,7 +1428,7 @@ if ($action == 'create' && $user->rights->commande->creer) $remise_absolue = 0; $dateorder = empty($conf->global->MAIN_AUTOFILL_DATE_ORDER)?-1:''; $projectid = 0; - + if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code; $note_private = $object->getDefaultCreateValueFor('note_private'); @@ -1696,12 +1696,12 @@ if ($action == 'create' && $user->rights->commande->creer) } print '' . $langs->trans('TotalTTC') . '' . price($objectsrc->total_ttc) . ""; - + 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('MulticurrencyTotalTTC') . '' . price($objectsrc->multicurrency_total_ttc) . ""; } } else @@ -1747,7 +1747,7 @@ if ($action == 'create' && $user->rights->commande->creer) print '     '; print ''; print ''; - + print ''; // Show origin lines @@ -2018,7 +2018,7 @@ if ($action == 'create' && $user->rights->commande->creer) print ''; print ''; } - + // Relative and absolute discounts if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { $filterabsolutediscount = "fk_facture_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final @@ -2203,7 +2203,7 @@ if ($action == 'create' && $user->rights->commande->creer) $form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'none'); } print ''; - + // Multicurrency rate print ''; print ''; @@ -2269,8 +2269,8 @@ if ($action == 'create' && $user->rights->commande->creer) print ' / '; print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND)?$conf->global->MAIN_VOLUME_DEFAULT_ROUND:-1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT)?$conf->global->MAIN_VOLUME_DEFAULT_UNIT:'no'); print ''; - } - + } + // TODO How record was recorded OrderMode (llx_c_input_method) // Project @@ -2385,16 +2385,16 @@ if ($action == 'create' && $user->rights->commande->creer) print '' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . ''; print '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ''; print ''; - + // Multicurrency Amount VAT print '' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . ''; print '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ''; print ''; - + // Multicurrency Amount TTC print '' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . ''; print '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ''; - print ''; + print ''; } // Statut diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index c2dbb5996a7..8586a5d77a5 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -141,7 +141,7 @@ if (empty($reshook)) $object->fetch_thirdparty(); $result = $object->add_object_linked('commande', GETPOST('linkedOrder')); } - + // Action clone object if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->facture->creer) { // if (1 == 0 && empty($_REQUEST["clone_content"]) && empty($_REQUEST["clone_receivers"])) { @@ -290,9 +290,9 @@ if (empty($reshook)) // Multicurrency rate else if ($action == 'setmulticurrencyrate' && $user->rights->facture->creer) { - $result = $object->setMulticurrencyRate(GETPOST('multicurrency_tx', 'int')); + $result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx'))); } - + else if ($action == 'setinvoicedate' && $user->rights->facture->creer) { $object->fetch($id); @@ -320,7 +320,7 @@ if (empty($reshook)) $result = $object->update($user); if ($result < 0) dol_print_error($db, $object->error); } - + else if ($action == 'setconditions' && $user->rights->facture->creer) { $object->fetch($id); @@ -713,7 +713,7 @@ if (empty($reshook)) } $date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']); - + if (! $error) { // This is a replacement invoice $result = $object->fetch($_POST['fac_replacement']); @@ -766,7 +766,7 @@ if (empty($reshook)) } $date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']); - + if (! $error) { $object->socid = GETPOST('socid','int'); @@ -788,7 +788,7 @@ if (empty($reshook)) $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); $object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int'); - + // Proprietes particulieres a facture avoir $object->fk_facture_source = $sourceinvoice > 0 ? $sourceinvoice : ''; $object->type = Facture::TYPE_CREDIT_NOTE; @@ -875,7 +875,7 @@ if (empty($reshook)) } $date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']); - + if (! $error) { $object->socid = GETPOST('socid','int'); @@ -899,7 +899,7 @@ if (empty($reshook)) $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); $object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int'); - + // Source facture $object->fac_rec = GETPOST('fac_rec'); @@ -924,7 +924,7 @@ if (empty($reshook)) } $date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']); - + if (! $error) { // Si facture standard @@ -1206,9 +1206,9 @@ if (empty($reshook)) $object->add_contact($objcontact->fk_socpeople, $objcontact->code); } } - else dol_print_error($resqlcontact); + else dol_print_error($resqlcontact); } - + // Hooks $parameters = array('objFrom' => $srcobject); $reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been @@ -1218,7 +1218,7 @@ if (empty($reshook)) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); $error++; } - + } else { setEventMessages($object->error, $object->errors, 'errors'); $error++; @@ -1250,7 +1250,7 @@ if (empty($reshook)) } $date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']); - + if (!($_POST['situations'] > 0)) { $error++; $mesg = '
' . $langs->trans("ErrorFieldRequired", $langs->trans("InvoiceSituation")) . '
'; @@ -1265,8 +1265,8 @@ if (empty($reshook)) { $object->origin = $origin; $object->origin_id = $originid; - - foreach ($object->lines as &$line) + + foreach ($object->lines as &$line) { $line->origin = $object->origin; $line->origin_id = $line->id; @@ -1612,7 +1612,7 @@ if (empty($reshook)) $pu_ht = GETPOST('price_ht'); $vat_rate = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); $qty = GETPOST('qty'); - + // Define info_bits $info_bits = 0; if (preg_match('/\*/', $vat_rate)) @@ -1797,7 +1797,7 @@ if (empty($reshook)) $upload_dir = $conf->facture->dir_output; $permissioncreate=$user->rights->facture->creer; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; - + if ($action == 'update_extras') { // Fill array 'array_options' with data from add form @@ -1904,7 +1904,7 @@ if ($action == 'create') $res = $soc->fetch($socid); $currency_code = $conf->currency; - + // Load objectsrc $remise_absolue = 0; @@ -1976,9 +1976,9 @@ if ($action == 'create') if (!empty($conf->multicurrency->enabled)) { if (!empty($objectsrc->multicurrency_code)) $currency_code = $objectsrc->multicurrency_code; - if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) $currency_tx = $objectsrc->multicurrency_tx; + if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) $currency_tx = $objectsrc->multicurrency_tx; } - + // Replicate extrafields $objectsrc->fetch_optionals($originid); $object->array_options = $objectsrc->array_options; @@ -1992,7 +1992,7 @@ if ($action == 'create') $remise_percent = $soc->remise_percent; $remise_absolue = 0; $dateinvoice = (empty($dateinvoice)?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''):$dateinvoice); // Do not set 0 here (0 for a date is 1970) - + if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code; } @@ -2018,7 +2018,7 @@ if ($action == 'create') } print info_admin($text, 0, 0, 0).'
'; } - + print '
'; print ''; print ''; @@ -2029,7 +2029,7 @@ if ($action == 'create') print ''; print ''; if (!empty($currency_tx)) print ''; - + dol_fiche_head(''); print ''; @@ -2083,7 +2083,7 @@ if ($action == 'create') { $invoice_predefined = new FactureRec($db); $invoice_predefined->fetch(GETPOST('fac_rec','int')); - + $dateinvoice = $invoice_predefined->date_when; // To use next gen date by default later $sql = 'SELECT r.rowid, r.titre, r.total_ttc'; @@ -2349,7 +2349,7 @@ if ($action == 'create') $desc = $form->textwithpicto($text, $langs->transnoentities("YouMustCreateStandardInvoiceFirstDesc"), 1, 'help', '', 0, 3); print $desc; print ''; - + print ''; print ''; @@ -2388,7 +2388,7 @@ if ($action == 'create') print $form->select_date($date_pointoftax?$date_pointoftax:-1, 'date_pointoftax', '', '', '', "add", 1, 1, 1); print ''; } - + // Payment term print ''; } - + // Public note print ''; print ''; @@ -2536,12 +2536,12 @@ if ($action == 'create') print '"; } print '"; - + if (!empty($conf->multicurrency->enabled)) { print ''; print '"; - print '"; + print '"; } } else @@ -3153,13 +3153,13 @@ else if ($id > 0 || ! empty($ref)) $nbrows ++; if (! empty($conf->multicurrency->enabled)) $nbrows+=5; if (! empty($conf->incoterm->enabled)) $nbrows+=1; - + print ''; - } + } // Conditions de reglement print ''; - + // Multicurrency rate print ''; print ''; print ''; print ''; - + // Multicurrency Amount VAT print ''; print ''; print ''; - + // Multicurrency Amount TTC print ''; print ''; - print ''; + print ''; } // Statut @@ -4003,7 +4003,7 @@ else if ($id > 0 || ! empty($ref)) } // Classify 'closed not completely paid' (possible si validee et pas encore classee payee) - + if ($object->statut == 1 && $object->paye == 0 && $resteapayer > 0 && $user->rights->facture->paiement) { if ($totalpaye > 0 || $totalcreditnotes > 0) @@ -4015,11 +4015,11 @@ else if ($id > 0 || ! empty($ref)) { if ( empty($conf->global->INVOICE_CAN_NEVER_BE_CANCELED)) { - if ($objectidnext) + if ($objectidnext) { print '
' . $langs->trans('ClassifyCanceled') . '
'; } - else + else { print ''; } diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index d5be9002241..7eb60259d74 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -165,7 +165,7 @@ if (empty($reshook)) $result = $object->setPaymentMethods(GETPOST('mode_reglement_id','int')); if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); } - + // Multicurrency Code else if ($action == 'setmulticurrencycode' && $user->rights->fournisseur->commande->creer) { $result = $object->setMulticurrencyCode(GETPOST('multicurrency_code', 'alpha')); @@ -173,7 +173,7 @@ if (empty($reshook)) // Multicurrency rate else if ($action == 'setmulticurrencyrate' && $user->rights->fournisseur->commande->creer) { - $result = $object->setMulticurrencyRate(GETPOST('multicurrency_tx', 'int')); + $result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx'))); } // bank account @@ -218,13 +218,13 @@ if (empty($reshook)) //$newstatus=3; // Submited // TODO If there is at least one reception, we can set to Received->Received partially $newstatus=4; // Received partially - + } else if ($object->statut == 6) $newstatus=2; // Canceled->Approved else if ($object->statut == 7) $newstatus=3; // Canceled->Process running else if ($object->statut == 9) $newstatus=1; // Refused->Validated else $newstatus = 2; - + //print "old status = ".$object->statut.' new status = '.$newstatus; $db->begin(); @@ -237,7 +237,7 @@ if (empty($reshook)) $sql.= ' WHERE rowid = '.$object->id; $resql=$db->query($sql); - + if ($newstatus == 0) { $sql = 'UPDATE '.MAIN_DB_PREFIX.'commande_fournisseur'; @@ -351,7 +351,7 @@ if (empty($reshook)) $idprod=0; if (GETPOST('idprodfournprice') == -1 || GETPOST('idprodfournprice') == '') $idprod=-99; // Same behaviour than with combolist. When not select idprodfournprice is now -99 (to avoid conflict with next action that may return -1, -2, ...) } - + if (GETPOST('idprodfournprice') > 0) { $idprod=$productsupplier->get_buyprice(GETPOST('idprodfournprice'), $qty); // Just to see if a price exists for the quantity. Not used to found vat. @@ -367,7 +367,7 @@ if (empty($reshook)) if (trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc); $type = $productsupplier->type; - + $tva_tx = get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice')); $tva_npr = get_default_npr($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice')); if (empty($tva_tx)) $tva_npr=0; @@ -763,7 +763,7 @@ if (empty($reshook)) $result = $object->commande($user, $_REQUEST["datecommande"], $_REQUEST["methode"], $_REQUEST['comment']); if ($result > 0) { - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { $outputlangs = $langs; $newlang = ''; @@ -870,10 +870,10 @@ if (empty($reshook)) if ($action == 'builddoc' && $user->rights->fournisseur->commande->creer) // En get ou en post { // Build document - + // Save last template used to generate document if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha')); - + $outputlangs = $langs; if (GETPOST('lang_id')) { @@ -899,7 +899,7 @@ if (empty($reshook)) if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs'); else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors'); } - + if ($action == 'update_extras') { // Fill array 'array_options' with data from add form @@ -972,7 +972,7 @@ if (empty($reshook)) $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); $object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int'); $object->fk_project = GETPOST('projectid'); - + // Fill array 'array_options' with data from add form if (! $error) { @@ -994,7 +994,7 @@ if (empty($reshook)) $element = 'supplier_proposal'; $subelement = 'supplier_proposal'; } - + $object->origin = $origin; $object->origin_id = $originid; @@ -1031,7 +1031,7 @@ if (empty($reshook)) $num = count($lines); $productsupplier = new ProductFournisseur($db); - + for($i = 0; $i < $num; $i ++) { @@ -1041,12 +1041,12 @@ if (empty($reshook)) $label = (! empty($lines[$i]->label) ? $lines[$i]->label : ''); $desc = (! empty($lines[$i]->desc) ? $lines[$i]->desc : $lines[$i]->libelle); $product_type = (! empty($lines[$i]->product_type) ? $lines[$i]->product_type : 0); - + // Reset fk_parent_line for no child products and special product if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) { $fk_parent_line = 0; } - + // Extrafields if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) // For avoid conflicts if // trigger used @@ -1056,17 +1056,17 @@ if (empty($reshook)) } $result = $productsupplier->find_min_price_product_fournisseur($lines[$i]->fk_product, $lines[$i]->qty); - if ($result>=0) + if ($result>=0) { $tva_tx = $lines[$i]->tva_tx; - + if ($origin=="commande") { $soc=new societe($db); $soc->fetch($socid); $tva_tx=get_default_tva($soc, $mysoc, $lines[$i]->fk_product, $productsupplier->product_fourn_price_id); } - + $result = $object->addline( $desc, $lines[$i]->subprice, @@ -1089,7 +1089,7 @@ if (empty($reshook)) $lines[$i]->fk_unit ); } - + if ($result < 0) { $error++; break; @@ -1102,8 +1102,8 @@ if (empty($reshook)) } // Add link between elements - - + + // Hooks $parameters = array('objFrom' => $srcobject); $reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been @@ -1149,14 +1149,14 @@ if (empty($reshook)) /* * Send mail */ - + // Actions to send emails $actiontypecode='AC_SUP_ORD'; $trigger_name='ORDER_SUPPLIER_SENTBYMAIL'; $paramname='id'; $mode='emailfromsupplierorder'; include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; - + if ($action == 'webservice' && GETPOST('mode', 'alpha') == "send" && ! GETPOST('cancel')) { @@ -1380,9 +1380,9 @@ if ($action=='create') if (!empty($conf->multicurrency->enabled)) { if (!empty($objectsrc->multicurrency_code)) $currency_code = $objectsrc->multicurrency_code; - if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) $currency_tx = $objectsrc->multicurrency_tx; + if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) $currency_tx = $objectsrc->multicurrency_tx; } - + $note_private = $object->getDefaultCreateValueFor('note_private', (! empty($objectsrc->note_private) ? $objectsrc->note_private : null)); $note_public = $object->getDefaultCreateValueFor('note_public', (! empty($objectsrc->note_public) ? $objectsrc->note_public : null)); @@ -1394,9 +1394,9 @@ if ($action=='create') { $cond_reglement_id = $societe->cond_reglement_supplier_id; $mode_reglement_id = $societe->mode_reglement_supplier_id; - + if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code; - + $note_private = $object->getDefaultCreateValueFor('note_private'); $note_public = $object->getDefaultCreateValueFor('note_public'); } @@ -1409,7 +1409,7 @@ if ($action=='create') print ''; print ''; if (!empty($currency_tx)) print ''; - + dol_fiche_head(''); print '
' . $langs->trans('PaymentConditionsShort') . ''; $form->select_conditions_paiements(isset($_POST['cond_reglement_id']) ? $_POST['cond_reglement_id'] : $cond_reglement_id, 'cond_reglement_id'); @@ -2453,7 +2453,7 @@ if ($action == 'create') print $form->selectMultiCurrency($currency_code, 'multicurrency_code'); print '
' . $langs->trans('NotePublic') . '
' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '' . price($objectsrc->total_localtax2) . "
' . $langs->trans('TotalTTC') . '' . price($objectsrc->total_ttc) . "
' . $langs->trans('MulticurrencyTotalHT') . '' . price($objectsrc->multicurrency_total_ht) . '
' . $langs->trans('MulticurrencyTotalVAT') . '' . price($objectsrc->multicurrency_total_tva) . "
' . $langs->trans('MulticurrencyTotalTTC') . '' . price($objectsrc->multicurrency_total_ttc) . "
' . $langs->trans('MulticurrencyTotalTTC') . '' . price($objectsrc->multicurrency_total_ttc) . "
'; 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 @@ -3172,7 +3172,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) @@ -3189,10 +3189,10 @@ else if ($id > 0 || ! empty($ref)) print ''; print ''; print ''; - + $var = !$var; } - + print ''; print ''; print ''; @@ -3200,7 +3200,7 @@ else if ($id > 0 || ! empty($ref)) print ''; print ''; } - + if (count($object->tab_next_situation_invoice) > 0) { //List of next invoices @@ -3213,9 +3213,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) { @@ -3231,10 +3231,10 @@ else if ($id > 0 || ! empty($ref)) print ''; print ''; print ''; - + $var = !$var; } - + print ''; print ''; print ''; @@ -3242,7 +3242,7 @@ 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) . ' 
'; } @@ -3469,7 +3469,7 @@ else if ($id > 0 || ! empty($ref)) print dol_print_date($object->date_pointoftax, 'daytext'); } print '
'; @@ -3554,7 +3554,7 @@ else if ($id > 0 || ! empty($ref)) $form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'none'); } print '
'; @@ -3695,16 +3695,16 @@ 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)) . '
'; @@ -1497,7 +1497,7 @@ if ($action=='create') print $form->selectMultiCurrency($currency_code, 'multicurrency_code'); print ''; } - + print ''; print '"; - + if (!empty($conf->multicurrency->enabled)) { print ''; print ''; - print ''; + print ''; } } @@ -1571,7 +1571,7 @@ if ($action=='create') print "\n"; // Show origin lines - if (! empty($origin) && ! empty($originid) && is_object($objectsrc)) + if (! empty($origin) && ! empty($originid) && is_object($objectsrc)) { $title = $langs->trans('ProductsAndServices'); print load_fiche_titre($title); @@ -1631,7 +1631,7 @@ elseif (! empty($object->id)) $object->date_commande=dol_now(); // We check if number is temporary number - if (preg_match('/^[\(]?PROV/i',$object->ref) || empty($object->ref)) // empty should not happened, but when it occurs, the test save life + if (preg_match('/^[\(]?PROV/i',$object->ref) || empty($object->ref)) // empty should not happened, but when it occurs, the test save life { $newref = $object->getNextNumRef($object->thirdparty); } @@ -1841,7 +1841,7 @@ elseif (! empty($object->id)) $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->mode_reglement_id,'none'); } print ''; - + // Multicurrency if (! empty($conf->multicurrency->enabled)) { @@ -1861,7 +1861,7 @@ elseif (! empty($object->id)) $form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'none'); } print ''; - + // Multicurrency rate print ''; print ''; print ''; print ''; - + // Multicurrency Amount VAT print ''; print ''; print ''; - + // Multicurrency Amount TTC print ''; print ''; - print ''; + print ''; } print "
'.$langs->trans('NotePublic').''; $doleditor = new DolEditor('note_public', isset($note_public) ? $note_public : GETPOST('note_public'), '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); @@ -1539,12 +1539,12 @@ if ($action=='create') } print '
' . $langs->trans('TotalTTC') . '' . price($objectsrc->total_ttc) . "
' . $langs->trans('MulticurrencyTotalHT') . '' . price($objectsrc->multicurrency_total_ht) . '
' . $langs->trans('MulticurrencyTotalVAT') . '' . price($objectsrc->multicurrency_total_tva) . '
' . $langs->trans('MulticurrencyTotalTTC') . '' . price($objectsrc->multicurrency_total_ttc) . '
' . $langs->trans('MulticurrencyTotalTTC') . '' . price($objectsrc->multicurrency_total_ttc) . '
'; @@ -2021,16 +2021,16 @@ elseif (! empty($object->id)) 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)) . '

"; @@ -2339,7 +2339,7 @@ elseif (! empty($object->id)) { include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; $formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'sor'.$object->id); - } + } $formmail->withfrom=1; $liste=array(); foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key=>$value) $liste[$key]=$value; @@ -2615,7 +2615,7 @@ elseif (! empty($object->id)) /** * Boutons actions */ - + if ($user->societe_id == 0 && $action != 'editline' && $action != 'delete') { print '
'; @@ -2625,7 +2625,7 @@ elseif (! empty($object->id)) // modified by hook if (empty($reshook)) { - + // Validate if ($object->statut == 0 && $num > 0) { @@ -2771,7 +2771,7 @@ elseif (! empty($object->id)) { print ''.$langs->trans("CreateBill").''; } - + if ($user->rights->fournisseur->commande->creer && $object->statut >= 2 && !empty($object->linkedObjectsIds['invoice_supplier'])) { print ''.$langs->trans("ClassifyBilled").''; @@ -2808,7 +2808,7 @@ elseif (! empty($object->id)) } } - + print "
"; } @@ -2833,7 +2833,7 @@ elseif (! empty($object->id)) // Linked object block $somethingshown = $form->showLinkedObjectBlock($object); - + // Show links to link elements //$linktoelem = $form->showLinkToObjectBlock($object); //if ($linktoelem) print '
'.$linktoelem; diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 058c148ce88..c308ff3a57e 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -118,7 +118,7 @@ if (empty($reshook)) $object->fetch_thirdparty(); $result = $object->add_object_linked('order_supplier', GETPOST('linkedOrder')); } - + // Action clone object if ($action == 'confirm_clone' && $confirm == 'yes') { @@ -248,7 +248,7 @@ if (empty($reshook)) if ($action == 'setref_supplier' && $user->rights->fournisseur->commande->creer) { $object->ref_supplier = GETPOST('ref_supplier', 'alpha'); - + if ($object->update($user) < 0) { setEventMessages($object->error, $object->errors, 'errors'); } @@ -265,7 +265,7 @@ if (empty($reshook)) { $result = $object->setPaymentMethods(GETPOST('mode_reglement_id','int')); } - + // Multicurrency Code else if ($action == 'setmulticurrencycode' && $user->rights->facture->creer) { $result = $object->setMulticurrencyCode(GETPOST('multicurrency_code', 'alpha')); @@ -273,7 +273,7 @@ if (empty($reshook)) // Multicurrency rate else if ($action == 'setmulticurrencyrate' && $user->rights->facture->creer) { - $result = $object->setMulticurrencyRate(GETPOST('multicurrency_tx', 'int')); + $result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx'))); } // bank account @@ -485,7 +485,7 @@ if (empty($reshook)) break; } } - + // Now reload line $object->fetch_lines(); } @@ -506,7 +506,7 @@ if (empty($reshook)) { $error++; } - + if (! $error) { // If some invoice's lines already known @@ -544,7 +544,7 @@ if (empty($reshook)) { $langs->load("errors"); $db->rollback(); - + setEventMessages($object->error, $object->errors, 'errors'); $action='create'; $_GET['socid']=$_POST['socid']; @@ -938,14 +938,14 @@ if (empty($reshook)) /* * Send mail */ - + // Actions to send emails $actiontypecode='AC_SUP_INV'; $trigger_name='BILL_SUPPLIER_SENTBYMAIL'; $paramname='id'; $mode='emailfromsupplierinvoice'; include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; - + // Build document if ($action == 'builddoc') @@ -1125,7 +1125,7 @@ if ($action == 'create') dol_htmloutput_events(); $currency_code = $conf->currency; - + $societe=''; if (GETPOST('socid') > 0) { @@ -1133,7 +1133,7 @@ if ($action == 'create') $societe->fetch(GETPOST('socid','int')); if (!empty($conf->multicurrency->enabled) && !empty($societe->multicurrency_code)) $currency_code = $societe->multicurrency_code; } - + if (GETPOST('origin') && GETPOST('originid')) { // Parse element/subelement (ex: project_task) @@ -1181,9 +1181,9 @@ if ($action == 'create') if (!empty($conf->multicurrency->enabled)) { if (!empty($objectsrc->multicurrency_code)) $currency_code = $objectsrc->multicurrency_code; - if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) $currency_tx = $objectsrc->multicurrency_tx; + if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) $currency_tx = $objectsrc->multicurrency_tx; } - + $datetmp=dol_mktime(12,0,0,$_POST['remonth'],$_POST['reday'],$_POST['reyear']); $dateinvoice=($datetmp==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''):$datetmp); $datetmp=dol_mktime(12,0,0,$_POST['echmonth'],$_POST['echday'],$_POST['echyear']); @@ -1199,7 +1199,7 @@ if ($action == 'create') $dateinvoice=($datetmp==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''):$datetmp); $datetmp=dol_mktime(12,0,0,$_POST['echmonth'],$_POST['echday'],$_POST['echyear']); $datedue=($datetmp==''?-1:$datetmp); - + if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code; } @@ -1210,9 +1210,9 @@ if ($action == 'create') print ''; print ''; if (!empty($currency_tx)) print ''; - + dol_fiche_head(); - + print ''; // Ref @@ -1444,12 +1444,12 @@ if ($action == 'create') } } print '"; - + if (!empty($conf->multicurrency->enabled)) { print ''; print '"; - print '"; + print '"; } } else @@ -1721,7 +1721,7 @@ else if (! empty($conf->projet->enabled)) $nbrows++; if (! empty($conf->banque->enabled)) { $nbrows++; $nbcols++; } if (! empty($conf->incoterm->enabled)) $nbrows++; - + // Local taxes if ($societe->localtax1_assuj=="1") $nbrows++; if ($societe->localtax2_assuj=="1") $nbrows++; @@ -1896,7 +1896,7 @@ else $form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'none'); } print ''; - + // Multicurrency rate print ''; print ''; print ''; print ''; - + // Multicurrency Amount VAT print ''; print ''; print ''; - + // Multicurrency Amount TTC print ''; print ''; - print ''; + print ''; } // Project @@ -2082,7 +2082,7 @@ else global $forceall, $senderissupplier, $dateSelector, $inputalsopricewithtax; $forceall=1; $senderissupplier=1; $dateSelector=0; $inputalsopricewithtax=1; - + // Show object lines if (! empty($object->lines)) $ret = $object->printObjectLines($action, $societe, $mysoc, $lineid, 1); @@ -2123,15 +2123,15 @@ else $parameters = array(); $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been // modified by hook - if (empty($reshook)) + if (empty($reshook)) { - + // Modify a validated invoice with no payments if ($object->statut == FactureFournisseur::STATUS_VALIDATED && $action != 'edit' && $object->getSommePaiement() == 0 && $user->rights->fournisseur->facture->creer) { print ''.$langs->trans('Modify').''; } - + // Reopen a standard paid invoice if (($object->type == FactureFournisseur::TYPE_STANDARD || $object->type == FactureFournisseur::TYPE_REPLACEMENT) && ($object->statut == 2 || $object->statut == 3)) // A paid invoice (partially or completely) { @@ -2144,7 +2144,7 @@ else print ''.$langs->trans('ReOpen').''; } } - + // Send by mail if (($object->statut == FactureFournisseur::STATUS_VALIDATED || $object->statut == FactureFournisseur::STATUS_CLOSED)) { @@ -2154,23 +2154,23 @@ else } else print ''.$langs->trans('SendByMail').''; } - - + + // Make payments if ($action != 'edit' && $object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $user->societe_id == 0) { print ''.$langs->trans('DoPayment').''; // must use facid because id is for payment id not invoice } - + // Classify paid if ($action != 'edit' && $object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $user->societe_id == 0) { print ''.$langs->trans('ClassifyPaid').''; - + //print ''.$langs->trans('ClassifyPaid').''; } - + // Validate if ($action != 'edit' && $object->statut == FactureFournisseur::STATUS_DRAFT) { @@ -2189,19 +2189,19 @@ else } } } - + // Create event if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) // Add hidden condition because this is not a "workflow" action so should appears somewhere else on page. { print ''; } - + // Clone if ($action != 'edit' && $user->rights->fournisseur->facture->creer) { print 'socid.'">'.$langs->trans('ToClone').''; } - + // Delete if ($action != 'edit' && $user->rights->fournisseur->facture->supprimer) { @@ -2213,17 +2213,17 @@ else } print ''; print '
'; - + if ($action != 'edit') { print '
'; //print '
'.$langs->trans('TotalTTC').''.price($objectsrc->total_ttc)."
' . $langs->trans('MulticurrencyTotalHT') . '' . price($objectsrc->multicurrency_total_ht) . '
' . $langs->trans('MulticurrencyTotalVAT') . '' . price($objectsrc->multicurrency_total_tva) . "
' . $langs->trans('MulticurrencyTotalTTC') . '' . price($objectsrc->multicurrency_total_ttc) . "
' . $langs->trans('MulticurrencyTotalTTC') . '' . price($objectsrc->multicurrency_total_ttc) . "
'; @@ -1972,16 +1972,16 @@ else 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)) . '
'; //print ''; // ancre - + /* * Documents generes */ - + $ref=dol_sanitizeFileName($object->ref); $subdir = get_exdir($object->id,2,0,0,$object,'invoice_supplier').$ref; $filedir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2,0,0,$object,'invoice_supplier').$ref; @@ -2231,27 +2231,27 @@ else $genallowed=$user->rights->fournisseur->facture->creer; $delallowed=$user->rights->fournisseur->facture->supprimer; $modelpdf=(! empty($object->modelpdf)?$object->modelpdf:(empty($conf->global->INVOICE_SUPPLIER_ADDON_PDF)?'':$conf->global->INVOICE_SUPPLIER_ADDON_PDF)); - + print $formfile->showdocuments('facture_fournisseur',$subdir,$filedir,$urlsource,$genallowed,$delallowed,$modelpdf,1,0,0,40,0,'','','',$societe->default_lang); $somethingshown=$formfile->numoffiles; - + // Linked object block $somethingshown = $form->showLinkedObjectBlock($object); - + // Show links to link elements $linktoelem = $form->showLinkToObjectBlock($object,array('supplier_order')); if ($linktoelem) print '
'.$linktoelem; - - + + print '
'; //print '
'; //print '
'; - + // List of actions on element include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; $formactions=new FormActions($db); $somethingshown=$formactions->showactions($object,'invoice_supplier',$socid,0,'listaction'.($genallowed?'largetitle':'')); - + print ''; //print '
'; } @@ -2318,7 +2318,7 @@ else { include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; $formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'sin'.$object->id); - } + } $formmail->withfrom=1; $liste=array(); foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key=>$value) $liste[$key]=$value; diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 481981bdabd..75e3ab23110 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -109,13 +109,13 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e if (empty($reshook)) { if ($cancel) $action=''; - + include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once - + include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once - + include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once - + // Action clone object if ($action == 'confirm_clone' && $confirm == 'yes') { @@ -130,8 +130,8 @@ if (empty($reshook)) if ($result > 0) { header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $result); exit(); - } - else + } + else { setEventMessages($object->error, $object->errors, 'errors'); $action = ''; @@ -581,7 +581,7 @@ if (empty($reshook)) $tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id); $tva_npr = get_default_npr($mysoc, $object->thirdparty, $prod->id); if (empty($tva_tx)) $tva_npr=0; - + //On garde le prix indiqué dans l'input pour la demande de prix fournisseur //$pu_ht = $prod->price; $pu_ht = price2num($price_ht, 'MU'); @@ -776,7 +776,7 @@ if (empty($reshook)) // Add buying price $fournprice = (GETPOST('fournprice') ? GETPOST('fournprice') : ''); - $buyingprice = (GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we muste keep this value + $buyingprice = (GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we muste keep this value // Extrafields $extrafieldsline = new ExtraFields($db); @@ -947,7 +947,7 @@ if (empty($reshook)) else if ($action == 'setmode' && $user->rights->supplier_proposal->creer) { $result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int')); } - + // Multicurrency Code else if ($action == 'setmulticurrencycode' && $user->rights->supplier_proposal->creer) { $result = $object->setMulticurrencyCode(GETPOST('multicurrency_code', 'alpha')); @@ -955,7 +955,7 @@ if (empty($reshook)) // Multicurrency rate else if ($action == 'setmulticurrencyrate' && $user->rights->supplier_proposal->creer) { - $result = $object->setMulticurrencyRate(GETPOST('multicurrency_tx', 'int')); + $result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx'))); } else if ($action == 'update_extras') { @@ -1142,14 +1142,14 @@ if ($action == 'create') print ''; print ''; } - + // Multicurrency if (! empty($conf->multicurrency->enabled)) { print ''; print ''.fieldLabel('Currency','multicurrency_code').''; print ''; - $currency_code = (!empty($soc->multicurrency_code) ? $soc->multicurrency_code : ($object->multicurrency_code ? $object->multicurrency_code : $conf->currency)); + $currency_code = (!empty($soc->multicurrency_code) ? $soc->multicurrency_code : ($object->multicurrency_code ? $object->multicurrency_code : $conf->currency)); print $form->selectMultiCurrency($currency_code, 'multicurrency_code'); print ''; } @@ -1506,7 +1506,7 @@ if ($action == 'create') $form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'none'); } print ''; - + // Multicurrency rate print ''; print ''; @@ -1560,7 +1560,7 @@ if ($action == 'create') // Other attributes $cols = 2; if (empty($conf->margin->enabled)) $cols++; - + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; // Amount HT @@ -1609,16 +1609,16 @@ if ($action == 'create') print '' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . ''; print '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ''; print ''; - + // Multicurrency Amount VAT print '' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . ''; print '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ''; print ''; - + // Multicurrency Amount TTC print '' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . ''; print '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ''; - print ''; + print ''; } // Statut @@ -1770,7 +1770,7 @@ if ($action == 'create') print ''; } - + // Clone if ($user->rights->supplier_proposal->creer) { print ''; @@ -1884,7 +1884,7 @@ if ($action == 'create') include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; $formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'spr'.$object->id); } - + $formmail->withfrom = 1; $liste = array(); foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key => $value) From d38ff5c246410dea9841941e6bb55b25cd475848 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Wed, 10 Aug 2016 11:34:10 +0200 Subject: [PATCH 4/9] FIX : create proposal from project --- htdocs/comm/propal/card.php | 34 ++++++++++++++++++---------------- htdocs/projet/element.php | 22 +++++++++++----------- 2 files changed, 29 insertions(+), 27 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 25337446b5b..d3924e944a6 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -279,7 +279,7 @@ if (empty($reshook)) if ($socid < 1) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Customer")), null, 'errors'); - + $action = 'create'; $error ++; } @@ -345,7 +345,7 @@ if (empty($reshook)) $object->origin = GETPOST('origin'); $object->origin_id = GETPOST('originid'); - + // Multicurrency if (!empty($conf->multicurrency->enabled)) { @@ -718,7 +718,7 @@ if (empty($reshook)) $tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id); $tva_npr = get_default_npr($mysoc, $object->thirdparty, $prod->id); if (empty($tva_tx)) $tva_npr=0; - + $pu_ht = $prod->price; $pu_ttc = $prod->price_ttc; $price_min = $prod->price_min; @@ -932,7 +932,7 @@ if (empty($reshook)) // Add buying price $fournprice = price2num(GETPOST('fournprice') ? GETPOST('fournprice') : ''); - $buyingprice = price2num(GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we muste keep this value + $buyingprice = price2num(GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we muste keep this value $date_start = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), GETPOST('date_startsec'), GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear')); $date_end = dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), GETPOST('date_endsec'), GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear')); @@ -1167,12 +1167,12 @@ if (empty($reshook)) } } } - + // Actions to build doc $upload_dir = $conf->propal->dir_output; $permissioncreate=$user->rights->propal->creer; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; - + } @@ -1266,6 +1266,8 @@ if ($action == 'create') if ($origin != 'project' && $originid) { print ''; print ''; + } elseif ($origin == 'project' && !empty($projectid)) { + print ''; } dol_fiche_head(); @@ -1432,11 +1434,11 @@ if ($action == 'create') print ''; print ''.fieldLabel('Currency','multicurrency_code').''; print ''; - $currency_code = (!empty($soc->multicurrency_code) ? $soc->multicurrency_code : ($object->multicurrency_code ? $object->multicurrency_code : $conf->currency)); + $currency_code = (!empty($soc->multicurrency_code) ? $soc->multicurrency_code : ($object->multicurrency_code ? $object->multicurrency_code : $conf->currency)); print $form->selectMultiCurrency($currency_code, 'multicurrency_code', 0); print ''; } - + // Public note print ''; print '' . $langs->trans('NotePublic') . ''; @@ -1934,7 +1936,7 @@ if ($action == 'create') $form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'none'); } print ''; - + // Multicurrency rate print ''; print ''; @@ -2053,7 +2055,7 @@ if ($action == 'create') print '' . price($object->total_ht, '', $langs, 0, - 1, - 1, $conf->currency) . ''; // Margin Infos - if (! empty($conf->margin->enabled)) + if (! empty($conf->margin->enabled)) { $rowspan=4; if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) $rowspan++; @@ -2087,25 +2089,25 @@ if ($action == 'create') print '' . $langs->trans('AmountTTC') . ''; print '' . price($object->total_ttc, '', $langs, 0, - 1, - 1, $conf->currency) . ''; print ''; - + if (!empty($conf->multicurrency->enabled)) { // Multicurrency Amount HT print '' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . ''; print '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ''; print ''; - + // Multicurrency Amount VAT print '' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . ''; print '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ''; print ''; - + // Multicurrency Amount TTC print '' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . ''; print '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ''; - print ''; + print ''; } - + // Statut print '' . $langs->trans('Status') . '' . $object->getLibStatut(4) . ''; @@ -2397,7 +2399,7 @@ if ($action == 'create') { include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; $formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'pro'.$object->id); - } + } $formmail->withfrom = 1; $liste = array(); foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key => $value) diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 2f07756fb8d..017a03fd4bd 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -165,7 +165,7 @@ if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) $code = dol_getIdFromCode($db, $object->opp_status, 'c_lead_status', 'rowid', 'code'); if ($code) print $langs->trans("OppStatus".$code); print ''; - + // Opportunity Amount print ''.$langs->trans("OpportunityAmount").''; if (strcmp($object->opp_amount,'')) print price($object->opp_amount,'',$langs,0,0,0,$conf->currency); @@ -193,7 +193,7 @@ $listofreferent=array( 'class'=>'Propal', 'table'=>'propal', 'datefieldname'=>'datep', - 'urlnew'=>DOL_URL_ROOT.'/comm/propal/card.php?action=create&projectid='.$id.'&socid='.$socid, + 'urlnew'=>DOL_URL_ROOT.'/comm/propal/card.php?action=create&origin=project&originid='.$id.'&socid='.$socid, 'lang'=>'propal', 'buttonnew'=>'AddProp', 'testnew'=>$user->rights->propal->creer, @@ -356,19 +356,19 @@ if ($action=="addelement") $tablename = GETPOST("tablename"); $elementselectid = GETPOST("elementselect"); $result=$object->update_element($tablename, $elementselectid); - if ($result<0) + if ($result<0) { setEventMessages($object->error, $object->errors, 'errors'); } } -elseif ($action == "unlink") +elseif ($action == "unlink") { $tablename = GETPOST("tablename"); $elementselectid = GETPOST("elementselect"); $result = $object->remove_element($tablename, $elementselectid); - if ($result < 0) + if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } @@ -399,7 +399,7 @@ if (! $showdatefilter) print ''; print ''; print ''; - + $showdatefilter++; } @@ -569,14 +569,14 @@ foreach ($listofreferent as $key => $value) $urlnew=$value['urlnew']; $buttonnew=$value['buttonnew']; $testnew=$value['testnew']; - + if ($qualified) { // If we want the project task array to have details of users //if ($key == 'project_task') $key = 'project_task_time'; - + if ($langtoload) $langs->load($langtoload); - + $element = new $classname($db); $addform=''; @@ -584,7 +584,7 @@ foreach ($listofreferent as $key => $value) $idtofilterthirdparty=0; if (! in_array($tablename, array('facture_fourn', 'commande_fournisseur'))) $idtofilterthirdparty=$object->thirdparty->id; - if (empty($conf->global->PROJECT_LINK_ON_OVERWIEW_DISABLED) && $idtofilterthirdparty > 0) + if (empty($conf->global->PROJECT_LINK_ON_OVERWIEW_DISABLED) && $idtofilterthirdparty > 0) { $selectList=$formproject->select_element($tablename, $idtofilterthirdparty, 'minwidth300'); if (! $selectList || ($selectList<0)) @@ -615,7 +615,7 @@ foreach ($listofreferent as $key => $value) else $addform.=''.($buttonnew?$langs->trans($buttonnew):$langs->trans("Create")).''; $addform.='
'; } - + print load_fiche_titre($langs->trans($title), $addform, ''); print ''; From cd8585da6397335487d62048aa43fbd0b638e6df Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Wed, 10 Aug 2016 11:54:49 +0200 Subject: [PATCH 5/9] fix for finche inter same problem --- htdocs/fichinter/card.php | 31 ++++++++++++++++++++----------- htdocs/projet/element.php | 2 +- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index a01ba2f1180..c12eba0a7c4 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -140,7 +140,7 @@ if (empty($reshook)) } } } - + if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->ficheinter->creer) { $result = $object->setValid($user); @@ -733,14 +733,14 @@ if (empty($reshook)) /* * Send mail */ - + // Actions to send emails $actiontypecode='AC_OTH_AUTO'; $trigger_name='FICHINTER_SENTBYMAIL'; $paramname='id'; $mode='emailfromintervention'; include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; - + if ($action == 'update_extras') { @@ -955,7 +955,7 @@ if ($action == 'create') else $numprojet=select_projects($societe->id,$_POST["projectid"],'projectid'); */ - $numprojet=$formproject->select_projects($soc->id,GETPOST('projectid','int'),'projectid'); + $numprojet=$formproject->select_projects($soc->id,$projectid,'projectid'); if ($numprojet==0) { print '   '.$langs->trans("AddProject").''; @@ -1027,6 +1027,8 @@ if ($action == 'create') { print ''; print ''; + } elseif ($origin == 'project' && !empty($projectid)) { + print ''; } dol_fiche_end(); @@ -1044,6 +1046,13 @@ if ($action == 'create') dol_fiche_head(''); print '
'; + if (is_object($objectsrc)) + { + print ''; + print ''; + } elseif ($origin == 'project' && !empty($projectid)) { + print ''; + } print '
'; print ''; print ''; } - + if (! empty($conf->global->FICHINTER_USE_PLANNED_AND_DONE_DATES)) { // Date Start @@ -1177,14 +1186,14 @@ else if ($id > 0 || ! empty($ref)) print $object->dateo ? dol_print_date($object->dateo, 'daytext') : ' '; print ''; print ''; - + // Date End print ''; print ''; print ''; - + // Date Terminate/close print ''; print ''; - + // Duration print '
'.$langs->trans("ThirdParty").''; print $form->select_company('','socid','','SelectThirdParty',1); @@ -1137,7 +1146,7 @@ else if ($id > 0 || ! empty($ref)) // Paiement incomplet. On demande si motif = escompte ou autre $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('CloneIntervention'), $langs->trans('ConfirmCloneIntervention', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); } - + if (!$formconfirm) { $parameters=array('lineid'=>$lineid); @@ -1168,7 +1177,7 @@ else if ($id > 0 || ! empty($ref)) print ''.convertSecondToTime($object->duration, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY).'
'.$langs->trans("Datee").''; print $object->datee ? dol_print_date($object->datee, 'daytext') : ' '; print '
'.$langs->trans("Datet").''; @@ -1428,7 +1437,7 @@ else if ($id > 0 || ! empty($ref)) print ''; $form->select_date($db->jdate($objp->date_intervention),'di',1,1,0,"date_intervention"); print ''; if (empty($conf->global->FICHINTER_WITHOUT_DURATION)) { @@ -1629,7 +1638,7 @@ else if ($id > 0 || ! empty($ref)) if ($user->rights->ficheinter->creer) { print ''; } - + // Delete if (($object->statut == 0 && $user->rights->ficheinter->creer) || $user->rights->ficheinter->supprimer) { @@ -1742,7 +1751,7 @@ else if ($id > 0 || ! empty($ref)) { include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; $formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'int'.$object->id); - } + } $formmail->withfrom=1; $liste=array(); foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key=>$value) $liste[$key]=$value; diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 017a03fd4bd..629b89f9a8b 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -284,7 +284,7 @@ $listofreferent=array( 'table'=>'fichinter', 'datefieldname'=>'date_valid', 'disableamount'=>1, - 'urlnew'=>DOL_URL_ROOT.'/fichinter/card.php?action=create&projectid='.$id.'&socid='.$socid, + 'urlnew'=>DOL_URL_ROOT.'/fichinter/card.php?action=create&origin=project&originid='.$id.'&socid='.$socid, 'lang'=>'interventions', 'buttonnew'=>'AddIntervention', 'testnew'=>$user->rights->ficheinter->creer, From e9962bb887eb3c3baf40983834fe3826059e4099 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Wed, 10 Aug 2016 17:22:58 +0200 Subject: [PATCH 6/9] fix export --- htdocs/accountancy/class/accountancyexport.class.php | 4 ++++ htdocs/accountancy/journal/purchasesjournal.php | 4 ++-- htdocs/accountancy/journal/sellsjournal.php | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index ddc80e00571..8c7fedbfa5c 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -295,6 +295,8 @@ class AccountancyExport public function exportCiel(&$TData) { global $conf; + $this->end_line ="\r\n"; + $i = 1; $date_ecriture = dol_print_date(time(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be yyyymmdd foreach ( $TData as $data ) { @@ -333,6 +335,8 @@ class AccountancyExport public function exportQuadratus(&$TData) { global $conf; + $this->end_line ="\r\n"; + $date_ecriture = dol_print_date(time(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy foreach ( $TData as $data ) { $code_compta = $data->numero_compte; diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index 47bc9576a91..937b6a8fa36 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -166,7 +166,7 @@ if ($action == 'writebookkeeping') { $now = dol_now(); $error = 0; - foreach ($tabfac as $key => $val) + foreach ($tabfac as $key => $val) { $companystatic = new Societe($db); $invoicestatic = new FactureFournisseur($db); @@ -425,7 +425,7 @@ if ($action == 'export_csv') { 'action' => '' )); - if ($conf->global->ACCOUNTING_EXPORT_MODELCSV != 1 || $conf->global->ACCOUNTING_EXPORT_MODELCSV != 2) { + if ($conf->global->ACCOUNTING_EXPORT_MODELCSV != 1 && $conf->global->ACCOUNTING_EXPORT_MODELCSV != 2) { print ''; } else { print ''; diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 7a92d6649d3..24e1bfa81ea 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -443,7 +443,7 @@ if ($action == 'export_csv') { 'action' => '' )); - if ($conf->global->ACCOUNTING_EXPORT_MODELCSV != 1 || $conf->global->ACCOUNTING_EXPORT_MODELCSV != 2) { + if ($conf->global->ACCOUNTING_EXPORT_MODELCSV != 1 && $conf->global->ACCOUNTING_EXPORT_MODELCSV != 2) { print ''; } else { print ''; From 07412b2f79fa2327a30269c9d2d15e2d61dacbd0 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Wed, 10 Aug 2016 17:37:22 +0200 Subject: [PATCH 7/9] force export txt for ciel and quadratus --- htdocs/accountancy/admin/export.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/accountancy/admin/export.php b/htdocs/accountancy/admin/export.php index 14d91d85581..3cb9f407ce6 100644 --- a/htdocs/accountancy/admin/export.php +++ b/htdocs/accountancy/admin/export.php @@ -81,6 +81,9 @@ if ($action == 'update') { if (! dolibarr_set_const($db, 'ACCOUNTING_EXPORT_MODELCSV', $modelcsv, 'chaine', 0, '', $conf->entity)) { $error ++; } + if ($modelcsv==AccountancyExport::$EXPORT_TYPE_QUADRATUS || $modelcsv==AccountancyExport::$EXPORT_TYPE_CIEL) { + dolibarr_set_const($db, 'ACCOUNTING_EXPORT_FORMAT', 'txt', 'chaine', 0, '', $conf->entity); + } } else { $error ++; } From 55a83f9d8d59073a46929920babfcf0283abf940 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Thu, 11 Aug 2016 06:08:33 +0200 Subject: [PATCH 8/9] Fix: Accountancy - Problem to define account_parent for an accounting account & presentation --- htdocs/accountancy/admin/card.php | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php index 1dcb2a533de..6702a98bf7f 100644 --- a/htdocs/accountancy/admin/card.php +++ b/htdocs/accountancy/admin/card.php @@ -69,10 +69,10 @@ if ($action == 'add') { $account_number = clean_account(GETPOST('account_number')); } - if (GETPOST('account_category') <= 0) { + if (GETPOST('account_parent') <= 0) { $account_parent = ''; } else { - $account_parent = GETPOST('account_category','int'); + $account_parent = GETPOST('account_parent','int'); } $object->fk_pcg_version = $obj->pcg_version; @@ -98,7 +98,7 @@ if ($action == 'add') { header("Location: account.php"); exit; } else if ($action == 'edit') { - if (! GETPOST('cancel', 'alpha')) { + if (! $cancel) { $result = $object->fetch($id); $sql = 'SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS; @@ -119,10 +119,10 @@ if ($action == 'add') { $account_number = clean_account(GETPOST('account_number')); } - if (GETPOST('account_category') <= 0) { - $account_parent = ''; + if (GETPOST('account_parent') <= 0) { + $account_parent = 0; } else { - $account_parent = GETPOST('account_category','int'); + $account_parent = GETPOST('account_parent','int'); } $object->fk_pcg_version = $obj->pcg_version; @@ -165,7 +165,9 @@ if ($action == 'add') { /* * View */ -llxheader('', $langs->trans('AccountAccounting')); +$title = $langs->trans('AccountAccounting') ." - ". $langs->trans('Card'); +$helpurl = ''; +llxheader('', $title, $helpurl); $form = new Form($db); $htmlacc = new FormVentilation($db); @@ -184,7 +186,7 @@ if ($action == 'create') { print ''; // Account number - print ''; + print ''; print ''; // Label @@ -247,7 +249,7 @@ if ($action == 'create') { print '
' . $langs->trans("AccountNumber") . '
' . $langs->trans("AccountNumber") . '
'; // Account number - print ''; + print ''; print ''; // Label @@ -299,7 +301,7 @@ if ($action == 'create') { print '
' . $langs->trans("AccountNumber") . '
' . $langs->trans("AccountNumber") . '
'; // Account number - print ''; + print ''; print ''; print ''; From 300da71b9c7a466884d8a75c7a7839d7e1588124 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Thu, 11 Aug 2016 06:12:04 +0200 Subject: [PATCH 9/9] Replace with 0 --- htdocs/accountancy/admin/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php index 6702a98bf7f..057e2f0484c 100644 --- a/htdocs/accountancy/admin/card.php +++ b/htdocs/accountancy/admin/card.php @@ -70,7 +70,7 @@ if ($action == 'add') { } if (GETPOST('account_parent') <= 0) { - $account_parent = ''; + $account_parent = 0; } else { $account_parent = GETPOST('account_parent','int'); }
' . $langs->trans("AccountNumber") . '
' . $langs->trans("AccountNumber") . '' . $object->account_number . '' . $linkback . '