diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php
index 3bb65cd0826..7ef9924ac00 100644
--- a/htdocs/contrat/card.php
+++ b/htdocs/contrat/card.php
@@ -991,6 +991,7 @@ if (empty($reshook))
}
}
+
/*
* View
*/
@@ -1381,7 +1382,6 @@ else
print '';
print '';
-
// Other attributes
$cols = 3;
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
@@ -1395,7 +1395,7 @@ else
print '';
}
- //echo '
';
+ echo '
';
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
{
diff --git a/htdocs/contrat/contact.php b/htdocs/contrat/contact.php
index 7ec43fc2a56..e6607729767 100644
--- a/htdocs/contrat/contact.php
+++ b/htdocs/contrat/contact.php
@@ -46,9 +46,7 @@ $result=restrictedArea($user,'contrat',$id);
$object = new Contrat($db);
-/*
- * Ajout d'un nouveau contact
- */
+// Add new contact
if ($action == 'addcontact' && $user->rights->contrat->creer)
{
@@ -91,7 +89,7 @@ if ($action == 'swapstatut' && $user->rights->contrat->creer)
}
}
-// Efface un contact
+// Delete contact
if ($action == 'deletecontact' && $user->rights->contrat->creer)
{
$object->fetch($id);
@@ -134,37 +132,100 @@ if ($id > 0 || ! empty($ref))
dol_fiche_head($head, $hselected, $langs->trans("Contract"), 0, 'contract');
- /*
- * Contrat
- */
+ // Contract card
+
+ $linkback = ''.$langs->trans("BackToList").'';
+
+
+ $morehtmlref='';
+ //if (! empty($modCodeContract->code_auto)) {
+ $morehtmlref.=$object->ref;
+ /*} else {
+ $morehtmlref.=$form->editfieldkey("",'ref',$object->ref,0,'string','',0,3);
+ $morehtmlref.=$form->editfieldval("",'ref',$object->ref,0,'string','',0,2);
+ }*/
+
+ $morehtmlref.='
';
+ // Ref customer
+ $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_customer, $object, 0, 'string', '', 0, 1);
+ $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, 0, 'string', '', null, null, '', 1);
+ // Ref supplier
+ $morehtmlref.='
';
+ $morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1);
+ $morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, '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')) . ' : ';
+ $morehtmlref.=' : ';
+ if ($action == 'classify') {
+ //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
+ $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.='
';
+
+
+ dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'none', $morehtmlref);
+
+
+ print '';
+ print '
';
+
print '
';
- $linkback = ''.$langs->trans("BackToList").'';
+
+ // Ligne info remises tiers
+ 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();
+ print '. ';
+ if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->trans("Currency".$conf->currency));
+ else print $langs->trans("CompanyHasNoAbsoluteDiscount");
+ print '.';
+ print ' |
';
- // Reference du contrat
- print '| '.$langs->trans("Ref").' | ';
- print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', '');
- print " |
";
-
- // Customer
- print "| ".$langs->trans("Customer")." | ";
- print ''.$object->thirdparty->getNomUrl(1).' |
';
-
- // Ligne info remises tiers
- 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();
- print '. ';
- if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->trans("Currency".$conf->currency));
- else print $langs->trans("CompanyHasNoAbsoluteDiscount");
- print '.';
- print ' |
';
+ // Date
+ print '';
+ print '| ';
+ print $form->editfieldkey("Date",'date_contrat',$object->date_contrat,$object,0);
+ print ' | ';
+ print $form->editfieldval("Date",'date_contrat',$object->date_contrat,$object,0,'datehourpicker');
+ print ' | ';
+ print '
';
print "
";
print '
';
+ dol_fiche_end();
+
print '
';
// Contacts lines
diff --git a/htdocs/contrat/document.php b/htdocs/contrat/document.php
index ef7e73ad4c8..289ec50b78b 100644
--- a/htdocs/contrat/document.php
+++ b/htdocs/contrat/document.php
@@ -105,23 +105,81 @@ if ($object->id)
}
+ // Contract card
+
+ $linkback = ''.$langs->trans("BackToList").'';
+
+
+ $morehtmlref='';
+ //if (! empty($modCodeContract->code_auto)) {
+ $morehtmlref.=$object->ref;
+ /*} else {
+ $morehtmlref.=$form->editfieldkey("",'ref',$object->ref,0,'string','',0,3);
+ $morehtmlref.=$form->editfieldval("",'ref',$object->ref,0,'string','',0,2);
+ }*/
+
+ $morehtmlref.='';
+ // Ref customer
+ $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_customer, $object, 0, 'string', '', 0, 1);
+ $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, 0, 'string', '', null, null, '', 1);
+ // Ref supplier
+ $morehtmlref.='
';
+ $morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1);
+ $morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, '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')) . ' : ';
+ $morehtmlref.=' : ';
+ if ($action == 'classify') {
+ //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
+ $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.='
';
+
+
+ dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'none', $morehtmlref);
+
+
+ print '';
+ print '
';
+
+
print '
';
-
- $linkback = ''.$langs->trans("BackToList").'';
-
- // Reference
- print '| '.$langs->trans('Ref').' | '.$form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', '').' |
';
-
- // Societe
- print '| '.$langs->trans("Customer").' | ';
- print ''.$object->thirdparty->getNomUrl(1).' |
';
-
- print '| '.$langs->trans("NbOfAttachedFiles").' | '.count($filearray).' |
';
+ print '| '.$langs->trans("NbOfAttachedFiles").' | '.count($filearray).' |
';
print '| '.$langs->trans("TotalSizeOfAttachedFiles").' | '.$totalsize.' '.$langs->trans("bytes").' |
';
print '
';
print '
';
+ dol_fiche_end();
+
$modulepart = 'contract';
$permission = $user->rights->contrat->creer;
$permtoedit = $user->rights->contrat->creer;
diff --git a/htdocs/contrat/info.php b/htdocs/contrat/info.php
index f993a940e14..7f20b21c888 100644
--- a/htdocs/contrat/info.php
+++ b/htdocs/contrat/info.php
@@ -40,20 +40,91 @@ $result = restrictedArea($user, 'contrat',$contratid,'');
llxHeader('',$langs->trans("Contract"),"");
-$contrat = new Contrat($db);
-$contrat->fetch($contratid);
-$contrat->info($contratid);
+$object = new Contrat($db);
+$object->fetch($contratid);
+$object->fetch_thirdparty();
+$object->info($contratid);
-$head = contract_prepare_head($contrat);
+$head = contract_prepare_head($object);
dol_fiche_head($head, 'info', $langs->trans("Contract"), 0, 'contract');
+// Contract card
+
+$linkback = ''.$langs->trans("BackToList").'';
+
+
+$morehtmlref='';
+//if (! empty($modCodeContract->code_auto)) {
+$morehtmlref.=$object->ref;
+/*} else {
+ $morehtmlref.=$form->editfieldkey("",'ref',$object->ref,0,'string','',0,3);
+$morehtmlref.=$form->editfieldval("",'ref',$object->ref,0,'string','',0,2);
+}*/
+
+$morehtmlref.='';
+// Ref customer
+$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_customer, $object, 0, 'string', '', 0, 1);
+$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, 0, 'string', '', null, null, '', 1);
+// Ref supplier
+$morehtmlref.='
';
+$morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1);
+$morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, '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')) . ' : ';
+ $morehtmlref.=' : ';
+ if ($action == 'classify') {
+ //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
+ $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.='
';
+
+
+dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'none', $morehtmlref);
+
+
+print '';
+print '
';
+
+print '
';
+
print '
| ';
-dol_print_object_info($contrat);
+dol_print_object_info($object);
print ' |
';
print '
';
+dol_fiche_end();
+
+
llxFooter();
$db->close();
diff --git a/htdocs/contrat/note.php b/htdocs/contrat/note.php
index 806434176fd..c97124ed35b 100644
--- a/htdocs/contrat/note.php
+++ b/htdocs/contrat/note.php
@@ -1,6 +1,6 @@
- * Copyright (C) 2004-2012 Laurent Destailleur
+ * Copyright (C) 2004-2016 Laurent Destailleur
* Copyright (C) 2005-2012 Regis Houssin
*
* This program is free software; you can redistribute it and/or modify
@@ -72,31 +72,98 @@ if ($id > 0 || ! empty($ref))
dol_fiche_head($head, 'note', $langs->trans("Contract"), 0, 'contract');
-
- print '';
+ // Contract card
$linkback = ''.$langs->trans("BackToList").'';
- // Reference
- print '| '.$langs->trans('Ref').' | '.$form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', '').' |
';
- // Societe
- print '| '.$langs->trans("Customer").' | ';
- print ''.$object->thirdparty->getNomUrl(1).' |
';
+ $morehtmlref='';
+ //if (! empty($modCodeContract->code_auto)) {
+ $morehtmlref.=$object->ref;
+ /*} else {
+ $morehtmlref.=$form->editfieldkey("",'ref',$object->ref,0,'string','',0,3);
+ $morehtmlref.=$form->editfieldval("",'ref',$object->ref,0,'string','',0,2);
+ }*/
- // Ligne info remises tiers
- 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();
- print '. ';
- if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",$absolute_discount,$langs->trans("Currency".$conf->currency));
- else print $langs->trans("CompanyHasNoAbsoluteDiscount");
- print '.';
- print ' |
';
+ $morehtmlref.='';
+ // Ref customer
+ $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_customer, $object, 0, 'string', '', 0, 1);
+ $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, 0, 'string', '', null, null, '', 1);
+ // Ref supplier
+ $morehtmlref.='
';
+ $morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1);
+ $morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, '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')) . ' : ';
+ $morehtmlref.=' : ';
+ if ($action == 'classify') {
+ //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
+ $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.='
';
+
+
+ dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'none', $morehtmlref);
+
+
+ print '';
+ print '
';
+
+ print '
';
+
+
+ // Ligne info remises tiers
+ 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();
+ print '. ';
+ if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->trans("Currency".$conf->currency));
+ else print $langs->trans("CompanyHasNoAbsoluteDiscount");
+ print '.';
+ print ' |
';
+
+ // Date
+ print '';
+ print '| ';
+ print $form->editfieldkey("Date",'date_contrat',$object->date_contrat,$object,0);
+ print ' | ';
+ print $form->editfieldval("Date",'date_contrat',$object->date_contrat,$object,0,'datehourpicker');
+ print ' | ';
+ print '
';
print "
";
-
+
+ print '
';
+
print '
';
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php
index 98b1946d772..a07c506d758 100644
--- a/htdocs/core/lib/functions2.lib.php
+++ b/htdocs/core/lib/functions2.lib.php
@@ -228,14 +228,14 @@ function dol_print_object_info($object, $usetable=0)
else print ': ';
if (is_object($object->user_creation))
{
- if ($object->user_creation->id) print $object->user_creation->getNomUrl(1);
+ if ($object->user_creation->id) print $object->user_creation->getNomUrl(1, '', 0, 0, 0);
else print $langs->trans("Unknown");
}
else
{
$userstatic=new User($db);
$userstatic->fetch($object->user_creation_id ? $object->user_creation_id : $object->user_creation);
- if ($userstatic->id) print $userstatic->getNomUrl(1);
+ if ($userstatic->id) print $userstatic->getNomUrl(1, '', 0, 0, 0);
else print $langs->trans("Unknown");
}
if ($usetable) print '';
@@ -264,14 +264,14 @@ function dol_print_object_info($object, $usetable=0)
else print ': ';
if (is_object($object->user_modification))
{
- if ($object->user_modification->id) print $object->user_modification->getNomUrl(1);
+ if ($object->user_modification->id) print $object->user_modification->getNomUrl(1, '', 0, 0, 0);
else print $langs->trans("Unknown");
}
else
{
$userstatic=new User($db);
$userstatic->fetch($object->user_modification_id ? $object->user_modification_id : $object->user_modification);
- if ($userstatic->id) print $userstatic->getNomUrl(1);
+ if ($userstatic->id) print $userstatic->getNomUrl(1, '', 0, 0, 0);
else print $langs->trans("Unknown");
}
if ($usetable) print '';
@@ -300,14 +300,14 @@ function dol_print_object_info($object, $usetable=0)
else print ': ';
if (is_object($object->user_validation))
{
- if ($object->user_validation->id) print $object->user_validation->getNomUrl(1);
+ if ($object->user_validation->id) print $object->user_validation->getNomUrl(1, '', 0, 0, 0);
else print $langs->trans("Unknown");
}
else
{
$userstatic=new User($db);
$userstatic->fetch($object->user_validation_id ? $object->user_validation_id : $object->user_validation);
- if ($userstatic->id) print $userstatic->getNomUrl(1);
+ if ($userstatic->id) print $userstatic->getNomUrl(1, '', 0, 0, 0);
else print $langs->trans("Unknown");
}
if ($usetable) print '';
@@ -336,14 +336,14 @@ function dol_print_object_info($object, $usetable=0)
else print ': ';
if (is_object($object->user_approve))
{
- if ($object->user_approve->id) print $object->user_approve->getNomUrl(1);
+ if ($object->user_approve->id) print $object->user_approve->getNomUrl(1, '', 0, 0, 0);
else print $langs->trans("Unknown");
}
else
{
$userstatic=new User($db);
$userstatic->fetch($object->user_approve_id ? $object->user_approve_id : $object->user_approve);
- if ($userstatic->id) print $userstatic->getNomUrl(1);
+ if ($userstatic->id) print $userstatic->getNomUrl(1, '', 0, 0, 0);
else print $langs->trans("Unknown");
}
if ($usetable) print '';
@@ -372,7 +372,7 @@ function dol_print_object_info($object, $usetable=0)
else print ': ';
$userstatic=new User($db);
$userstatic->fetch($object->user_approve_id2);
- if ($userstatic->id) print $userstatic->getNomUrl(1);
+ if ($userstatic->id) print $userstatic->getNomUrl(1, '', 0, 0, 0);
else print $langs->trans("Unknown");
if ($usetable) print '';
else print '
';
@@ -400,14 +400,14 @@ function dol_print_object_info($object, $usetable=0)
else print ': ';
if (is_object($object->user_cloture))
{
- if ($object->user_cloture->id) print $object->user_cloture->getNomUrl(1);
+ if ($object->user_cloture->id) print $object->user_cloture->getNomUrl(1, '', 0, 0, 0);
else print $langs->trans("Unknown");
}
else
{
$userstatic=new User($db);
$userstatic->fetch($object->user_cloture);
- if ($userstatic->id) print $userstatic->getNomUrl(1);
+ if ($userstatic->id) print $userstatic->getNomUrl(1, '', 0, 0, 0);
else print $langs->trans("Unknown");
}
if ($usetable) print '';
@@ -436,14 +436,14 @@ function dol_print_object_info($object, $usetable=0)
else print ': ';
if (is_object($object->user_rappro))
{
- if ($object->user_rappro->id) print $object->user_rappro->getNomUrl(1);
+ if ($object->user_rappro->id) print $object->user_rappro->getNomUrl(1, '', 0, 0, 0);
else print $langs->trans("Unknown");
}
else
{
$userstatic=new User($db);
$userstatic->fetch($object->user_rappro);
- if ($userstatic->id) print $userstatic->getNomUrl(1);
+ if ($userstatic->id) print $userstatic->getNomUrl(1, '', 0, 0, 0);
else print $langs->trans("Unknown");
}
if ($usetable) print '';