Restore button to create object from the project view.

This commit is contained in:
Laurent Destailleur 2016-04-04 15:20:21 +02:00
parent 1d700cd286
commit 5101c96223
7 changed files with 119 additions and 48 deletions

View File

@ -649,14 +649,14 @@ if ($action == 'create')
// Type of event
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
{
print '<tr><td width="30%"><span class="fieldrequired">'.$langs->trans("Type").'</span></b></td><td>';
print '<tr><td class="titlefieldcreate"><span class="fieldrequired">'.$langs->trans("Type").'</span></b></td><td>';
$default=(empty($conf->global->AGENDA_USE_EVENT_TYPE_DEFAULT)?'':$conf->global->AGENDA_USE_EVENT_TYPE_DEFAULT);
$formactions->select_type_actions(GETPOST("actioncode")?GETPOST("actioncode"):($object->type_code?$object->type_code:$default), "actioncode", "systemauto", 0, -1);
print '</td></tr>';
}
// Title
print '<tr><td'.(empty($conf->global->AGENDA_USE_EVENT_TYPE)?' class="fieldrequired"':'').'>'.$langs->trans("Title").'</td><td><input type="text" id="label" name="label" class="soixantepercent" value="'.GETPOST('label').'"></td></tr>';
print '<tr><td'.(empty($conf->global->AGENDA_USE_EVENT_TYPE)?' class="fieldrequired titlefieldcreate"':'').'>'.$langs->trans("Title").'</td><td><input type="text" id="label" name="label" class="soixantepercent" value="'.GETPOST('label').'"></td></tr>';
// Full day
print '<tr><td>'.$langs->trans("EventOnFullDay").'</td><td><input type="checkbox" id="fullday" name="fullday" '.(GETPOST('fullday')?' checked':'').'></td></tr>';
@ -664,7 +664,7 @@ if ($action == 'create')
// Date start
$datep=($datep?$datep:$object->datep);
if (GETPOST('datep','int',1)) $datep=dol_stringtotime(GETPOST('datep','int',1),0);
print '<tr><td width="30%" class="nowrap"><span class="fieldrequired">'.$langs->trans("DateActionStart").'</span></td><td>';
print '<tr><td class="nowrap"><span class="fieldrequired">'.$langs->trans("DateActionStart").'</span></td><td>';
if (GETPOST("afaire") == 1) $form->select_date($datep,'ap',1,1,0,"action",1,1,0,0,'fulldayend');
else if (GETPOST("afaire") == 2) $form->select_date($datep,'ap',1,1,1,"action",1,1,0,0,'fulldayend');
else $form->select_date($datep,'ap',1,1,1,"action",1,1,0,0,'fulldaystart');
@ -684,7 +684,7 @@ if ($action == 'create')
print '</td></tr>';
// Status
print '<tr><td width="10%">'.$langs->trans("Status").' / '.$langs->trans("Percentage").'</td>';
print '<tr><td>'.$langs->trans("Status").' / '.$langs->trans("Percentage").'</td>';
print '<td>';
$percent=-1;
if (isset($_GET['status']) || isset($_POST['status'])) $percent=GETPOST('status');
@ -743,7 +743,7 @@ if ($action == 'create')
print '<table class="border" width="100%">';
// Societe, contact
print '<tr><td width="30%" class="nowrap">'.$langs->trans("ActionOnCompany").'</td><td>';
print '<tr><td class="titlefieldcreate nowrap">'.$langs->trans("ActionOnCompany").'</td><td>';
if (GETPOST('socid','int') > 0)
{
$societe = new Societe($db);
@ -834,7 +834,7 @@ if ($action == 'create')
print '<div class="center">';
print '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
print '<input type="button" class="button" name="cancel" value="' . $langs->trans("Cancel") . '" onClick="javascript:history.go(-1)">';
print '</div>';
print "</form>";

View File

@ -307,7 +307,7 @@ if ($action == 'create')
if (! empty($conf->projet->enabled)) $nbrows++;
// Date
print '<tr><td class="fieldrequired" width="25%">'.$langs->trans("Date").'</td><td>';
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("Date").'</td><td>';
$form->select_date($donation_date?$donation_date:-1,'','','','',"add",1,1);
print '</td>';
@ -332,7 +332,7 @@ if ($action == 'create')
print '</tr>';
// Country
print '<tr><td width="25%"><label for="selectcountry_id">'.$langs->trans('Country').'</label></td><td colspan="3" class="maxwidthonsmartphone">';
print '<tr><td><label for="selectcountry_id">'.$langs->trans('Country').'</label></td><td colspan="3" class="maxwidthonsmartphone">';
print $form->select_country(GETPOST('country_id')!=''?GETPOST('country_id'):$object->country_id);
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
print '</td></tr>';
@ -382,7 +382,11 @@ if ($action == 'create')
dol_fiche_end();
print '<div class="center"><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></div>';
print '<div class="center">';
print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="button" class="button" value="' . $langs->trans("Cancel") . '" onClick="javascript:history.go(-1)">';
print '</div>';
print "</form>\n";
}

View File

@ -1054,7 +1054,7 @@ if ($action == 'create')
print '<table class="border" width="100%">';
print '<input type="hidden" name="socid" value='.$soc->id.'>';
print '<tr><td class="fieldrequired">'.$langs->trans("ThirdParty").'</td><td>'.$soc->getNomUrl(1).'</td></tr>';
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("ThirdParty").'</td><td>'.$soc->getNomUrl(1).'</td></tr>';
print '<input type="hidden" name="action" value="add">';
@ -1159,6 +1159,8 @@ if ($action == 'create')
print '<div class="center">';
print '<input type="submit" class="button" value="'.$langs->trans("CreateDraftIntervention").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="button" class="button" value="' . $langs->trans("Cancel") . '" onClick="javascript:history.go(-1)">';
print '</div>';
print '</form>';

View File

@ -16,8 +16,8 @@ Rendez-Vous=Rendezvous
ConfirmDeleteAction=Are you sure you want to delete this event ?
CardAction=Event card
PercentDone=Percentage complete
ActionOnCompany=Task about company
ActionOnContact=Task about contact
ActionOnCompany=Event about company
ActionOnContact=Event about contact
TaskRDV=Meetings
TaskRDVWith=Meeting with %s
ShowTask=Show task

View File

@ -90,7 +90,7 @@ $object = new Project($db);
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once
// Security check
$socid=0;
$socid=$object->socid;
if ($user->societe_id > 0) $socid=$user->societe_id;
$result = restrictedArea($user, 'projet', $projectid, 'projet&project');
@ -189,7 +189,10 @@ $listofreferent=array(
'class'=>'Propal',
'table'=>'propal',
'datefieldname'=>'datep',
'urlnew'=>DOL_URL_ROOT.'/comm/propal.php?action=create&project_id='.$id,
'urlnew'=>DOL_URL_ROOT.'/comm/propal.php?action=create&projectid='.$id.'&socid='.$socid,
'lang'=>'propal',
'buttonnew'=>'AddProp',
'testnew'=>$user->rights->propal->creer,
'test'=>$conf->propal->enabled && $user->rights->propale->lire),
'order'=>array(
'name'=>"CustomersOrders",
@ -197,8 +200,11 @@ $listofreferent=array(
'class'=>'Commande',
'table'=>'commande',
'datefieldname'=>'date_commande',
'urlnew'=>DOL_URL_ROOT.'/commande/card.php?action=create&project_id='.$id,
'test'=>$conf->commande->enabled && $user->rights->commande->lire),
'urlnew'=>DOL_URL_ROOT.'/commande/card.php?action=create&projectid='.$id.'&socid='.$socid,
'lang'=>'orders',
'buttonnew'=>'CreateOrder',
'testnew'=>$user->rights->commande->creer,
'test'=>$conf->commande->enabled && $user->rights->commande->lire),
'invoice'=>array(
'name'=>"CustomersInvoices",
'title'=>"ListInvoicesAssociatedProject",
@ -206,22 +212,43 @@ $listofreferent=array(
'margin'=>'add',
'table'=>'facture',
'datefieldname'=>'datef',
'urlnew'=>DOL_URL_ROOT.'/compta/facture/card.php?action=create&project_id='.$id,
'test'=>$conf->facture->enabled && $user->rights->facture->lire),
'urlnew'=>DOL_URL_ROOT.'/compta/facture.php?action=create&projectid='.$id.'&socid='.$socid,
'lang'=>'bills',
'buttonnew'=>'CreateBill',
'testnew'=>$user->rights->facture->creer,
'test'=>$conf->facture->enabled && $user->rights->facture->lire),
'invoice_predefined'=>array(
'name'=>"PredefinedInvoices",
'title'=>"ListPredefinedInvoicesAssociatedProject",
'class'=>'FactureRec',
'table'=>'facture_rec',
'datefieldname'=>'datec',
'test'=>$conf->facture->enabled && $user->rights->facture->lire),
'urlnew'=>DOL_URL_ROOT.'/compta/facture.php?action=create&projectid='.$id.'&socid='.$socid,
'lang'=>'bills',
'buttonnew'=>'CreateBill',
'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',
'urlnew'=>DOL_URL_ROOT.'/supplier_proposal/card.php?action=create&projectid='.$id.'&socid='.$socid,
'lang'=>'supplier_proposal',
'buttonnew'=>'AddSupplierProposal',
'testnew'=>$user->rights->supplier_proposal->creer,
'test'=>$conf->supplier_proposal->enabled && $user->rights->supplier_proposal->lire),
'order_supplier'=>array(
'name'=>"SuppliersOrders",
'title'=>"ListSupplierOrdersAssociatedProject",
'class'=>'CommandeFournisseur',
'table'=>'commande_fournisseur',
'datefieldname'=>'date_commande',
'urlnew'=>DOL_URL_ROOT.'/fourn/commande/card.php?action=create&project_id='.$id,
'urlnew'=>DOL_URL_ROOT.'/fourn/commande/card.php?action=create&projectid='.$id.'&socid='.$socid,
'lang'=>'suppliers',
'buttonnew'=>'AddSupplierOrder',
'testnew'=>$user->rights->fournisseur->commande->creer,
'test'=>$conf->supplier_order->enabled && $user->rights->fournisseur->commande->lire),
'invoice_supplier'=>array(
'name'=>"BillsSuppliers",
@ -230,7 +257,10 @@ $listofreferent=array(
'margin'=>'minus',
'table'=>'facture_fourn',
'datefieldname'=>'datef',
'urlnew'=>DOL_URL_ROOT.'/fourn/facture/card.php?action=create&project_id='.$id,
'urlnew'=>DOL_URL_ROOT.'/fourn/facture/card.php?action=create&projectid='.$id.'&socid='.$socid,
'lang'=>'suppliers',
'buttonnew'=>'AddSupplierInvoice',
'testnew'=>$user->rights->fournisseur->facture->creer,
'test'=>$conf->supplier_invoice->enabled && $user->rights->fournisseur->facture->lire),
'contract'=>array(
'name'=>"Contracts",
@ -238,7 +268,11 @@ $listofreferent=array(
'class'=>'Contrat',
'table'=>'contrat',
'datefieldname'=>'date_contrat',
'test'=>$conf->contrat->enabled && $user->rights->contrat->lire),
'urlnew'=>DOL_URL_ROOT.'/contrat/card.php?action=create&projectid='.$id.'&socid='.$socid,
'lang'=>'contracts',
'buttonnew'=>'AddContract',
'testnew'=>$user->rights->contrat->creer,
'test'=>$conf->contrat->enabled && $user->rights->contrat->lire),
'intervention'=>array(
'name'=>"Interventions",
'title'=>"ListFichinterAssociatedProject",
@ -246,8 +280,11 @@ $listofreferent=array(
'table'=>'fichinter',
'datefieldname'=>'date_valid',
'disableamount'=>1,
'urlnew'=>DOL_URL_ROOT.'/contract/card.php?action=create&project_id='.$id,
'test'=>$conf->ficheinter->enabled && $user->rights->ficheinter->lire),
'urlnew'=>DOL_URL_ROOT.'/fichinter/card.php?action=create&projectid='.$id.'&socid='.$socid,
'lang'=>'interventions',
'buttonnew'=>'AddIntervention',
'testnew'=>$user->rights->ficheinter->creer,
'test'=>$conf->ficheinter->enabled && $user->rights->ficheinter->lire),
'trip'=>array(
'name'=>"TripsAndExpenses",
'title'=>"ListExpenseReportsAssociatedProject",
@ -256,7 +293,10 @@ $listofreferent=array(
'datefieldname'=>'dated',
'margin'=>'minus',
'disableamount'=>1,
'urlnew'=>DOL_URL_ROOT.'/fichinter/card.php?action=create&project_id='.$id,
'urlnew'=>DOL_URL_ROOT.'/deplacement/card.php?action=create&projectid='.$id.'&socid='.$socid,
'lang'=>'trips',
'buttonnew'=>'AddTrip',
'testnew'=>$user->rights->deplacement->creer,
'test'=>$conf->deplacement->enabled && $user->rights->deplacement->lire),
'expensereport'=>array(
'name'=>"ExpenseReports",
@ -266,17 +306,11 @@ $listofreferent=array(
'datefieldname'=>'date',
'margin'=>'minus',
'disableamount'=>0,
'urlnew'=>DOL_URL_ROOT.'/expensereport/card.php?action=create&project_id='.$id,
'urlnew'=>DOL_URL_ROOT.'/expensereport/card.php?action=create&projectid='.$id.'&socid='.$socid,
'lang'=>'trips',
'buttonnew'=>'AddTrip',
'testnew'=>$user->rights->expensereport->creer,
'test'=>$conf->expensereport->enabled && $user->rights->expensereport->lire),
'agenda'=>array(
'name'=>"Agenda",
'title'=>"ListActionsAssociatedProject",
'class'=>'ActionComm',
'table'=>'actioncomm',
'datefieldname'=>'datep',
'disableamount'=>1,
'urlnew'=>DOL_URL_ROOT.'/action/comm/card.php?action=create&project_id='.$id,
'test'=>$conf->agenda->enabled && $user->rights->agenda->allactions->lire),
'donation'=>array(
'name'=>"Donation",
'title'=>"ListDonationsAssociatedProject",
@ -285,8 +319,23 @@ $listofreferent=array(
'table'=>'don',
'datefieldname'=>'datedon',
'disableamount'=>0,
'urlnew'=>DOL_URL_ROOT.'/donation/card.php?action=create&project_id='.$id,
'urlnew'=>DOL_URL_ROOT.'/don/card.php?action=create&projectid='.$id.'&socid='.$socid,
'lang'=>'donations',
'buttonnew'=>'AddDonation',
'testnew'=>$user->rights->don->creer,
'test'=>$conf->don->enabled && $user->rights->don->lire),
'agenda'=>array(
'name'=>"Agenda",
'title'=>"ListActionsAssociatedProject",
'class'=>'ActionComm',
'table'=>'actioncomm',
'datefieldname'=>'datep',
'disableamount'=>1,
'urlnew'=>DOL_URL_ROOT.'/comm/action/card.php?action=create&projectid='.$id.'&socid='.$socid,
'lang'=>'agenda',
'buttonnew'=>'AddEvent',
'testnew'=>$user->rights->agenda->myactions->create,
'test'=>$conf->agenda->enabled && $user->rights->agenda->myactions->read),
'project_task'=>array(
'name'=>"TaskTimeValorised",
'title'=>"ListTaskTimeUserProject",
@ -295,7 +344,7 @@ $listofreferent=array(
'table'=>'projet_task',
'datefieldname'=>'task_date',
'disableamount'=>0,
'test'=>$conf->projet->enabled && $user->rights->projet->lire && $conf->salaries->enabled),
'test'=>$conf->projet->enabled && $user->rights->projet->lire && $conf->salaries->enabled && empty($conf->global->PROJECT_HIDE_TASKS)),
);
if ($action=="addelement")
@ -511,13 +560,18 @@ foreach ($listofreferent as $key => $value)
$tablename=$value['table'];
$datefieldname=$value['datefieldname'];
$qualified=$value['test'];
$urlnew=$value['urlnew'];
$langtoload=$value['lang'];
$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='';
@ -525,7 +579,7 @@ foreach ($listofreferent as $key => $value)
$idtofilterthirdparty=0;
if (! in_array($tablename, array('facture_fourn', 'commande_fourn'))) $idtofilterthirdparty=$object->thirdparty->id;
if (empty($conf->global->PROJECT_LINK_DISABLE))
if (empty($conf->global->PROJECT_LINK_ON_OVERWIEW_DISABLED) && $idtofilterthirdparty > 0)
{
$selectList=$formproject->select_element($tablename, $idtofilterthirdparty, 'minwidth300');
if (! $selectList || ($selectList<0))
@ -535,7 +589,8 @@ foreach ($listofreferent as $key => $value)
elseif($selectList)
{
// Define form with the combo list of elements to link
$addform.='<form class="inline-block" action="'.$_SERVER["PHP_SELF"].'?id='.$projectid.'" method="post">';
$addform.='<div class="inline-block valignmiddle">';
$addform.='<form action="'.$_SERVER["PHP_SELF"].'?id='.$projectid.'" method="post">';
$addform.='<input type="hidden" name="tablename" value="'.$tablename.'">';
$addform.='<input type="hidden" name="action" value="addelement">';
$addform.='<input type="hidden" name="datesrfc" value="'.dol_print_date($dates,'dayhourrfc').'">';
@ -545,14 +600,16 @@ foreach ($listofreferent as $key => $value)
$addform.='<td><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("AddElement")).'"></td>';
$addform.='</tr></table>';
$addform.='</form>';
$addform.='</div>';
}
}
/*if (empty($conf->global->PROJECT_CREATE_ELEM_DISABLE) && $urlnew) // Not yet ready. Use instead button on project card
if (empty($conf->global->PROJECT_CREATE_ON_OVERVIEW_DISABLED) && $urlnew)
{
$addform.='<div class="inline-block">';
$addform.='<a class="button" href="'.$urlnew.'">'.$langs->trans("Create").'</a>';
$addform.='<div class="inline-block valignmiddle">';
if ($testnew) $addform.='<a class="buttonxxx" href="'.$urlnew.'">'.($buttonnew?$langs->trans($buttonnew):$langs->trans("Create")).'</a>';
else $addform.='<a class="buttonxxx buttonRefused" disabled="disabled" href="#">'.($buttonnew?$langs->trans($buttonnew):$langs->trans("Create")).'</a>';
$addform.='<div>';
}*/
}
print load_fiche_titre($langs->trans($title), $addform, '');

View File

@ -355,7 +355,8 @@ fieldset { border: 1px solid #AAAAAA !important; box-shadow: 2px 2px 3px #DDD; }
margin-top: 0;
text-align: center;
cursor: pointer;
color: #333333;
color: #333333 !important;
text-decoration: none !important;
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
background-color: #f5f5f5;
background-image: -moz-linear-gradient(top, #ffffff, #e6e6e6);
@ -432,6 +433,9 @@ th .button {
.maxwidthsearch { /* Max width of column with the search picto */
width: 54px;
}
.valigntop {
vertical-align: top;
}
.valignmiddle {
vertical-align: middle;
}

View File

@ -422,6 +422,9 @@ th .button {
width: 54px;
}
.valigntop {
vertical-align: top;
}
.valignmiddle {
vertical-align: middle;
}
@ -1828,7 +1831,8 @@ span.butAction, span.butActionDelete {
text-align: center;
vertical-align: middle;
cursor: pointer;
color: #333333;
color: #333333 !important;
text-decoration: none !important;
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
background-color: #f5f5f5;
background-image: -moz-linear-gradient(top, #ffffff, #e6e6e6);