diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index c6e9a12e338..2d53eb6abbb 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -121,7 +121,7 @@ if (empty($reshook)) setEventMessages($object->error, $object->errors, 'errors'); } } - + else if ($action == 'confirm_closeline' && $confirm == 'yes' && $user->rights->contrat->activer) { if (! GETPOST('dateend')) @@ -999,7 +999,8 @@ llxHeader('',$langs->trans("Contract"),""); $form = new Form($db); $formfile = new FormFile($db); - +if (! empty($conf->projet->enabled)) $formproject = new FormProjets($db); + $objectlignestatic=new ContratLigne($db); // Load object modContract @@ -1086,34 +1087,36 @@ if ($action == 'create') print ''; // Ref + print ''; + print $tmpcode; + print ''; // Ref customer print ''; - print ''; + print ''; // Ref supplier print ''; - print ''; + print ''; // Thirdparty print ''; print ''; if ($socid>0) { - print ''; } else { - print ''; } @@ -1122,7 +1125,7 @@ if ($action == 'create') if($socid>0) { // Ligne info remises tiers - print ''; if (empty($user->societe_id)) { @@ -1293,47 +1294,75 @@ else print $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('CloneContract'), $langs->trans('ConfirmCloneContract', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); } - print '
'.$langs->trans('Ref').''; if (! empty($modCodeContract->code_auto)) { $tmpcode=$langs->trans("Draft"); } else { - $tmpcode=''; + $tmpcode=''; } - print '
'.$langs->trans('Ref').''.$tmpcode.'
'.$langs->trans('RefCustomer').'
'.$langs->trans('RefSupplier').'
'.$langs->trans('ThirdParty').''; + print ''; print $soc->getNomUrl(1); print ''; print ''; + print ''; print $form->select_company('','socid','','SelectThirdParty',1); print '
'.$langs->trans('Discounts').''; + print '
'.$langs->trans('Discounts').''; if ($soc->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_percent); else print $langs->trans("CompanyHasNoRelativeDiscount"); print '. '; @@ -1158,11 +1161,9 @@ if ($action == 'create') } print '
'.$langs->trans("NotePublic").''; - - $doleditor=new DolEditor('note_public', $note_public, '', '100', 'dolibarr_notes', 'In', 1, true, true, ROWS_3, '90%'); print $doleditor->Create(1); - + print '
'; + // Contract card $linkback = ''.$langs->trans("BackToList").''; - // Ref du contrat - if (! empty($modCodeContract->code_auto)) { - print '"; - } else { - print ''; - print ''; - print ''; - } - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + $morehtmlref=''; + if (! empty($modCodeContract->code_auto)) { + $morehtmlref.=$object->ref; + } else { + $morehtmlref.=$form->editfieldkey("",'ref',$object->ref,$object,$user->rights->contrat->creer,'string','',0,3); + $morehtmlref.=$form->editfieldval("",'ref',$object->ref,$object,$user->rights->contrat->creer,'string','',0,2); + } + + $morehtmlref.='
'; + // Ref customer + $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_customer, $object, $user->rights->contrat->creer, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, $user->rights->contrat->creer, 'string', '', null, null, '', 1); + // Ref supplier + $morehtmlref.='
'; + $morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->contrat->creer, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->contrat->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->contrat->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->thirdparty->id, $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->thirdparty->id, $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.='
'; - // Customer - print ""; - print ''; + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'none', $morehtmlref); + + + print '
'; + print '
'; + + + print '
'.$langs->trans("Ref").''; - print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', ''); - print "
'; - print $form->editfieldkey("Ref",'ref',$object->ref,$object,$user->rights->contrat->creer); - print ''; - print $form->editfieldval("Ref",'ref',$object->ref,$object,$user->rights->contrat->creer); - print '
'; - print $form->editfieldkey("RefCustomer",'ref_customer',$object->ref_customer,$object,$user->rights->contrat->creer); - print ''; - print $form->editfieldval("RefCustomer",'ref_customer',$object->ref_customer,$object,$user->rights->contrat->creer); - print '
'; - print $form->editfieldkey("RefSupplier",'ref_supplier',$object->ref_supplier,$object,$user->rights->contrat->creer); - print ''; - print $form->editfieldval("RefSupplier",'ref_supplier',$object->ref_supplier,$object,$user->rights->contrat->creer); - print '
".$langs->trans("Customer")."'.$object->thirdparty->getNomUrl(1).'
'; + // Ligne info remises tiers - print ''; - // Statut contrat - print '"; - // Date print ''; - print ''; print ''; - /* print ''; - print '\n";*/ - // Projet - if (! empty($conf->projet->enabled)) - { - $langs->load("projects"); - print '"; - } // Other attributes $cols = 3; @@ -1388,12 +1388,14 @@ else print "
'.$langs->trans('Discount').''; + print '
'.$langs->trans('Discount').''; if ($object->thirdparty->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$object->thirdparty->remise_percent); else print $langs->trans("CompanyHasNoRelativeDiscount"); $absolute_discount=$object->thirdparty->getAvailableDiscounts(); @@ -1343,44 +1372,15 @@ else print '.'; print '
'.$langs->trans("Status").''; - if ($object->statut==0) print $object->getLibStatut(2); - else print $object->getLibStatut(4); - print "
'; + print ''; print $form->editfieldkey("Date",'date_contrat',$object->date_contrat,$object,$user->rights->contrat->creer); print ''; print $form->editfieldval("Date",'date_contrat',$object->date_contrat,$object,$user->rights->contrat->creer,'datehourpicker'); print '
'.$langs->trans("Date").''.dol_print_date($object->date_contrat,"dayhour")."
'; - print ''; - if ($action != "classify" && $user->rights->projet->creer) print ''; - print '
'; - print $langs->trans("Project"); - print 'id.'">'.img_edit($langs->trans("SetProject")).'
'; - print '
'; - if ($action == "classify") - { - $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, "projectid", 1, 0, 1); - } - else - { - $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, "none", 0, 0); - } - print "
"; + print ''; + if (! empty($object->brouillon) && $user->rights->contrat->creer) { print ''; } - echo '
'; + //echo '
'; if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) { @@ -1457,8 +1459,8 @@ else print ''; print ''.$langs->trans("ServiceNb",$cursorline).''; - print ''.$langs->trans("VAT").''; - print ''.$langs->trans("PriceUHT").''; + print ''.$langs->trans("VAT").''; + print ''.$langs->trans("PriceUHT").''; print ''.$langs->trans("Qty").''; if ($conf->global->PRODUCT_USE_UNITS) print ''.$langs->trans("Unit").''; print ''.$langs->trans("ReductionShort").''; @@ -1606,7 +1608,7 @@ else } // Ligne en mode update else - { + { // Ligne carac print ""; print ''; @@ -1927,8 +1929,6 @@ else '; - print '
'; - print '
'; print ''; // Array with (n*2)+1 lines diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index a8f84731650..52a32e00067 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -45,7 +45,8 @@ class Contrat extends CommonObject public $table_element_line='contratdet'; public $fk_element='fk_contrat'; protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe - + public $picto='contract'; + /** * {@inheritdoc} */ diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 05fae4f7637..de42ced0997 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3301,7 +3301,7 @@ abstract class CommonObject } // VAT - print ''; + print ''; // Price HT print ''; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index f8c81249ed1..ee5bb19bc9a 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -78,9 +78,9 @@ class Form * @param object $object Object * @param boolean $perm Permission to allow button to edit parameter. Set it to 0 to have a not edited field. * @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 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 1=Do not output table tags but output a ':', 2=Do not output table tags and no ':' + * @param int $notabletag 1=Do not output table tags but output a ':', 2=Do not output table tags and no ':', 3=Do not output table tags but output a ' ' * @return string HTML edit field */ function editfieldkey($text, $htmlname, $preselected, $object, $perm, $typeofdata='string', $moreparam='', $fieldrequired=0, $notabletag=0) @@ -119,6 +119,7 @@ class Form if (empty($notabletag) && GETPOST('action') != 'edit'.$htmlname && $perm) $ret.=''; if (empty($notabletag) && GETPOST('action') != 'edit'.$htmlname && $perm) $ret.='
'.$langs->trans('VAT').''.$langs->trans('VAT').''.$langs->trans('PriceUHT').''; if ($htmlname && GETPOST('action') != 'edit'.$htmlname && $perm) $ret.='id.$moreparam.'">'.img_edit($langs->trans('Edit'), ($notabletag ? 0 : 1)).''; if (! empty($notabletag) && $notabletag == 1) $ret.=' : '; + if (! empty($notabletag) && $notabletag == 3) $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 01c23ce70f6..f330fb92e84 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1061,9 +1061,10 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3) || $conf->browser->layout=='phone') $tmptxt=$object->getLibStatut(5, $object->totalpaye); $morehtmlstatus.=$tmptxt; } - elseif ($object->element == 'facturerec') + elseif ($object->element == 'contrat') { - $morehtmlstatus.=''; + if ($object->statut==0) $morehtmlstatus.=$object->getLibStatut(2); + else $morehtmlstatus.=$object->getLibStatut(4); } else { // Generic case $tmptxt=$object->getLibStatut(6); diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 62866e31ea1..c01f16293b6 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -107,7 +107,7 @@ if ($nolinesbefore) { - + global->MAIN_VIEW_LINE_NUMBER)) { $coldisplay=2; } 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 9b65050b663..2fd59793a09 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 @@ -243,3 +243,6 @@ ALTER TABLE llx_expensereport ADD UNIQUE INDEX idx_expensereport_uk_ref (ref, en UPDATE llx_projet_task SET ref = NULL WHERE ref = ''; ALTER TABLE llx_projet_task ADD UNIQUE INDEX uk_projet_task_ref (ref, entity); + +ALTER TABLE llx_contrat ADD COLUMN fk_user_modif integer; + diff --git a/htdocs/install/mysql/tables/llx_contrat.sql b/htdocs/install/mysql/tables/llx_contrat.sql index f229f020bf6..60a6b574d44 100644 --- a/htdocs/install/mysql/tables/llx_contrat.sql +++ b/htdocs/install/mysql/tables/llx_contrat.sql @@ -38,6 +38,7 @@ create table llx_contrat fk_commercial_signature integer, -- obsolete fk_commercial_suivi integer, -- obsolete fk_user_author integer NOT NULL default 0, + fk_user_modif integer, fk_user_mise_en_service integer, fk_user_cloture integer, note_private text, diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 19f6dfe9d81..82ff69fe88a 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -231,7 +231,7 @@ SpaceX=Space X SpaceY=Space Y FontSize=Font size Content=Content -NoticePeriod=Notice +NoticePeriod=Notice period NewByMonth=New by month Emails=E-mails EMailsSetup=E-mails setup diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 9aae20a6300..09f1604e931 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -674,14 +674,12 @@ elseif ($object->id > 0) } - print '
'; print ''; print ''; print ''; print ''; - $head=project_prepare_head($object); dol_fiche_head($head, 'project', $langs->trans("Project"),0,($object->public?'projectpub':'project'));