diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 6ced019c076..551dacfcafc 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -2898,7 +2898,7 @@ else if ($id > 0 || ! empty($ref)) $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->facture->creer, 'string', '', 0, 1); $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->facture->creer, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1); + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); // Project if (! empty($conf->projet->enabled)) { @@ -2943,73 +2943,6 @@ else if ($id > 0 || ! empty($ref)) print ''; - // Ref - /* - print ''; - print ''; - - // Ref customer - print ''; - print ''; - - // Third party - print '';*/ - // Type print ''; - print ''; - - // Project - if (! empty($conf->projet->enabled)) { - $langs->load('projects'); - print ''; - print ''; - print ''; - }*/ - // Incoterms if (!empty($conf->incoterm->enabled)) { diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 007c8040d0d..cd7c9dd7ae8 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -42,7 +42,8 @@ class FactureRec extends CommonInvoice public $table_element='facture_rec'; public $table_element_line='facturedet_rec'; public $fk_element='fk_facture'; - + public $picto='bill'; + var $entity; var $number; var $date; diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index 2862b98ca4e..33da64e3221 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -31,10 +31,12 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php'; -require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +if (! empty($conf->projet->enabled)) { + require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; + require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; +} $langs->load('bills'); $langs->load('compta'); @@ -297,12 +299,14 @@ if (empty($reshook)) // Set bank account elseif ($action == 'setref' && $user->rights->facture->creer) { + //var_dump(GETPOST('ref', 'alpha'));exit; $result=$object->setValueFrom('titre', GETPOST('ref', 'alpha'), '', null, 'text', '', $user, 'BILLREC_MODIFY'); if ($result > 0) { $object->titre = GETPOST('ref', 'alpha'); $object->ref = $object->titre; } + else dol_print_error($db, $object->error, $object->errors); } // Set bank account elseif ($action == 'setbankaccount' && $user->rights->facture->creer) @@ -863,6 +867,7 @@ llxHeader('',$langs->trans("RepeatableInvoices"),'ch-facture.html#s-fac-facture- $form = new Form($db); $formother = new FormOther($db); +if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); } $companystatic = new Societe($db); $now = dol_now(); @@ -1069,11 +1074,64 @@ else dol_fiche_head($head, 'card', $langs->trans("RepeatableInvoice"),0,'bill'); // Add a div - print '
' . $langs->trans('Ref') . ''; - $morehtmlright = ''; - $discount = new DiscountAbsolute($db); - $result = $discount->fetch(0, $object->id); - if ($result > 0) { - $morehtmlright = '  (' . $langs->trans("CreditNoteConvertedIntoDiscount", $discount->getNomUrl(1, 'discount')) . ')'; - } - if ($result < 0) { - dol_print_error('', $discount->error); - } - print $form->showrefnav($object, 'ref', $linkback, 1, 'facnumber', 'ref', '', '', 0, '', '', $morehtmlright); - print '
'; - print ''; - if ($action != 'refclient' && ! empty($object->brouillon)) - print ''; - print '
'; - print $langs->trans('RefCustomer'); - print '' . img_edit($langs->trans('Modify')) . '
'; - print '
'; - if ($user->rights->facture->creer && $action == 'refclient') { - print '
'; - print ''; - print ''; - print ''; - print ' '; - print '
'; - } else { - print $object->ref_client; - } - print '
'; - print ''; - print ''; - print ''; - print '
' . $langs->trans('Company') . ''; - if (! empty($conf->global->FACTURE_CHANGE_THIRDPARTY) && $action != 'editthirdparty' && $object->brouillon && $user->rights->facture->creer) - print 'id . '">' . img_edit($langs->trans('SetLinkToAnotherThirdParty'), 1) . '
'; - print '
'; - if ($action == 'editthirdparty') { - $form->form_thirdparty($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->socid, 'socid','client>0'); - } else { - print '  ' . $soc->getNomUrl(1, 'compta'); - print '   '; - print '(' . $langs->trans('OtherBills') . ''; - // Outstanding Bill - $outstandingBills = $soc->get_OutstandingBill(); - print ' - ' . $langs->trans('CurrentOutstandingBill') . ': '; - print price($outstandingBills, '', $langs, 0, 0, - 1, $conf->currency); - if ($soc->outstanding_limit != '') - { - if ($outstandingBills > $soc->outstanding_limit) - print img_warning($langs->trans("OutstandingBillReached")); - print ' / ' . price($soc->outstanding_limit); - } - print ')'; - } - print '
' . $langs->trans('Type') . ''; print $object->getLibType(); @@ -3338,37 +3271,6 @@ else if ($id > 0 || ! empty($ref)) } } - // Statut - /* - print '
' . $langs->trans('Status') . '' . ($object->getLibStatut(4, $totalpaye)) . '
'; - - print ''; - if ($action != 'classify') { - print ''; - } - print '
'; - print $langs->trans('Project'); - print 'id . '">'; - print img_edit($langs->trans('SetProject'), 1); - print '
'; - - print '
'; - if ($action == 'classify') { - $form->form_project($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1); - } else { - $form->form_project($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0); - } - print '
'; - + // Recurring invoice content + $linkback = '' . $langs->trans("BackToList") . ''; + + $morehtmlref=''; + if ($action != 'editref') $morehtmlref.=$form->editfieldkey($object->ref, 'ref', $object->ref, $object, $user->rights->facture->creer, '', '', 0, 2); + else $morehtmlref.= $form->editfieldval('', 'ref', $object->ref, $object, $user->rights->facture->creer, 'string'); + + $morehtmlref.='
'; + // Ref customer + //$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->facture->creer, 'string', '', 0, 1); + //$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->facture->creer, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.=$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->facture->creer) + { + if ($action != 'classify') + $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.=''; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } + } + $morehtmlref.='
'; + + dol_banner_tab($object, 'ref', $linkback, 1, 'titre', 'none', $morehtmlref, '', 0, '', $morehtmlright); + + print '
'; + print '
'; + print '
'; + + print '
'; // Ref + /* print ''; - print ''; print ''; - - print ""; + */ + + print '"; print ''; print ''; @@ -1158,6 +1216,7 @@ else print ''; // Project + /* if (! empty($conf->projet->enabled)) { $langs->load('projects'); @@ -1182,7 +1241,7 @@ else } print ''; print ''; - } + }*/ // Bank Account print '"; print ''; - print "
'; //print $langs->trans('Ref'); print $form->editfieldkey($langs->trans("Ref"), 'ref', $object->ref, $object, $user->rights->facture->creer); @@ -1083,11 +1141,11 @@ else print $form->showrefnav($object, 'ref', $linkback, 1, 'titre', 'none', $morehtmlref); print '
'.$langs->trans("Customer").''.$object->thirdparty->getNomUrl(1,'customer').'
".$langs->trans("Author").''.$author->getFullName($langs)."
'.$langs->trans("Author").''.$author->getFullName($langs)."
'.$langs->trans("AmountHT").''.price($object->total_ht,'',$langs,1,-1,-1,$conf->currency).'
'; @@ -1204,10 +1263,15 @@ else print "
"; - - print '
'; - + print ''; + + print ''; + print '
'; + print '
'; + print '
'; + + print ''; + /* * Recurrence */ @@ -1217,14 +1281,14 @@ else print '
'; // if "frequency" is empty or = 0, the reccurence is disabled - print '
'; + print '
'; print ''; if ($action != 'editfrequency' && ! empty($object->brouillon) && $user->rights->facture->creer) print ''; print '
'; print $langs->trans('Frequency'); print 'id . '">' . img_edit($langs->trans('Edit'), 1) . '
'; - print '
'; + print ''; if ($action == 'editfrequency') { print '
'; @@ -1260,7 +1324,7 @@ else { print $langs->trans("NextDateToExecution"); } - print '
'; + print ''; if ($action == 'date_when' || $object->frequency > 0) { print $form->editfieldval($langs->trans("NextDateToExecution"), 'date_when', $object->date_when, $object, $user->rights->facture->creer, 'day'); @@ -1278,7 +1342,7 @@ else { print $langs->trans("MaxPeriodNumber"); } - print ''; + print ''; if ($action == 'nb_gen_max' || $object->frequency > 0) { print $form->editfieldval($langs->trans("MaxPeriodNumber"), 'nb_gen_max', $object->nb_gen_max?$object->nb_gen_max:'', $object, $user->rights->facture->creer); @@ -1296,7 +1360,7 @@ else print $form->editfieldkey($langs->trans("StatusOfGeneratedInvoices"), 'auto_validate', $object->auto_validate, $object, $user->rights->facture->creer); else print $langs->trans("StatusOfGeneratedInvoices"); - print ''; + print ''; $select = 'select;0:'.$langs->trans('BillStatusDraft').',1:'.$langs->trans('BillStatusValidated'); if ($action == 'auto_validate' || $object->frequency > 0) { @@ -1307,20 +1371,21 @@ else print '
'; - print '
'; - // Frequencry/Recurring section - if ($object->frequency > 0) - { - if (empty($conf->cron->enabled)) - { - print info_admin($langs->trans("EnableAndSetupModuleCron", $langs->transnoentitiesnoconv("Module2300Name"))); - } + if ($object->frequency > 0) + { + print '
'; + + if (empty($conf->cron->enabled)) + { + print info_admin($langs->trans("EnableAndSetupModuleCron", $langs->transnoentitiesnoconv("Module2300Name"))); + } - print ''; + print '
'; + print '
'; // Nb of generation already done - print ''; + print ''; print ''; @@ -1329,7 +1394,7 @@ else // Date last print ''; print ''; @@ -1339,6 +1404,13 @@ else print '
'; } + print ''; + print ''; + print ''; + + print '

'; + + // Lines print ' diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index eddff48b1fe..cc21279eacf 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -80,7 +80,7 @@ class Form * @param string $typeofdata Type of data ('string' by default, 'email', 'amount:99', 'numeric:99', 'text' or 'textarea:rows:cols', 'datepicker' ('day' do not work, don't know why), 'ckeditor:dolibarr_zzz:width:height:savemethod:1:rows:cols', 'select;xxx[:class]'...) * @param string $moreparam More param to add on a href URL* * @param int $fieldrequired 1 if we want to show field as mandatory using the "fieldrequired" CSS. - * @param int $notabletag Do no output table tags + * @param int $notabletag 1=Do not output table tags but output a ':', 2=Do not output table tags and no ':' * @return string HTML edit field */ function editfieldkey($text, $htmlname, $preselected, $object, $perm, $typeofdata='string', $moreparam='', $fieldrequired=0, $notabletag=0) @@ -118,7 +118,7 @@ class Form if (empty($notabletag) && GETPOST('action') != 'edit'.$htmlname && $perm) $ret.=''; if (empty($notabletag) && GETPOST('action') != 'edit'.$htmlname && $perm) $ret.=''; if (empty($notabletag) && GETPOST('action') != 'edit'.$htmlname && $perm) $ret.='
'.$langs->trans("NbOfGenerationDone").'
'.$langs->trans("NbOfGenerationDone").''; print $object->nb_gen_done?$object->nb_gen_done:'0'; print '
'; print $langs->trans("DateLastGeneration"); - print ''; + print ''; print dol_print_date($object->date_last_gen, 'dayhour'); print '
'; if ($htmlname && GETPOST('action') != 'edit'.$htmlname && $perm) $ret.='id.$moreparam.'">'.img_edit($langs->trans('Edit'), ($notabletag ? 0 : 1)).''; - if (! empty($notabletag)) $ret.=' : '; + if (! empty($notabletag) && $notabletag == 1) $ret.=' : '; if (empty($notabletag) && GETPOST('action') != 'edit'.$htmlname && $perm) $ret.='
'; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 828c4c301ff..3c3cfc9267a 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -992,6 +992,10 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3)) $tmptxt=$object->getLibStatut(5, $object->totalpaye); $morehtmlright.=$tmptxt; } + elseif ($object->element == 'facturerec') + { + $morehtmlright.=''; + } else { $tmptxt=$object->getLibStatut(6); if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3)) $tmptxt=$object->getLibStatut(5); 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 aefe62a0189..3d2e2cbeedc 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 @@ -27,6 +27,8 @@ ALTER TABLE llx_product_lot MODIFY COLUMN entity integer DEFAULT 1; UPDATE llx_product_lot SET entity = 1 WHERE entity IS NULL; +ALTER TABLE llx_facture_rec ADD COLUMN fk_user_modif integer; + ALTER TABLE llx_adherent ADD COLUMN model_pdf varchar(255); ALTER TABLE llx_don ADD COLUMN date_valid datetime; diff --git a/htdocs/install/mysql/tables/llx_facture.sql b/htdocs/install/mysql/tables/llx_facture.sql index f62d8452953..aaf467a06b0 100644 --- a/htdocs/install/mysql/tables/llx_facture.sql +++ b/htdocs/install/mysql/tables/llx_facture.sql @@ -60,7 +60,7 @@ create table llx_facture fk_statut smallint DEFAULT 0 NOT NULL, fk_user_author integer, -- user making creation - fk_user_modif integer, -- user making last change + fk_user_modif integer, -- user making last change fk_user_valid integer, -- user validating fk_facture_source integer, -- facture origine si facture avoir diff --git a/htdocs/install/mysql/tables/llx_facture_rec.sql b/htdocs/install/mysql/tables/llx_facture_rec.sql index 4a65f4389b5..d0d79ef57dc 100644 --- a/htdocs/install/mysql/tables/llx_facture_rec.sql +++ b/htdocs/install/mysql/tables/llx_facture_rec.sql @@ -39,7 +39,8 @@ create table llx_facture_rec total double(24,8) DEFAULT 0, total_ttc double(24,8) DEFAULT 0, - fk_user_author integer, -- createur + fk_user_author integer, -- user creating + fk_user_modif integer, -- user making last change fk_projet integer, -- projet auquel est associe la facture