Fix project edition on loan menu

Fix translation on profit view of projects.
This commit is contained in:
Laurent Destailleur 2017-07-29 00:28:41 +02:00
parent af63dc76c1
commit 8b82fc3c70
5 changed files with 131 additions and 39 deletions

View File

@ -41,6 +41,8 @@ $action=GETPOST('action','aZ09');
$confirm=GETPOST('confirm'); $confirm=GETPOST('confirm');
$cancel=GETPOST('cancel','alpha'); $cancel=GETPOST('cancel','alpha');
$projectid = GETPOST('projectid','int');
// Security check // Security check
$socid = GETPOST('socid','int'); $socid = GETPOST('socid','int');
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
@ -133,7 +135,7 @@ if (empty($reshook))
$object->rate = $rate; $object->rate = $rate;
$object->note_private = GETPOST('note_private'); $object->note_private = GETPOST('note_private');
$object->note_public = GETPOST('note_public'); $object->note_public = GETPOST('note_public');
$object->fk_project = GETPOST('fk_project'); $object->fk_project = GETPOST('projectid','int');
$accountancy_account_capital = GETPOST('accountancy_account_capital'); $accountancy_account_capital = GETPOST('accountancy_account_capital');
$accountancy_account_insurance = GETPOST('accountancy_account_insurance'); $accountancy_account_insurance = GETPOST('accountancy_account_insurance');
@ -215,7 +217,7 @@ if (empty($reshook))
if ($action == 'classin' && $user->rights->loan->write) if ($action == 'classin' && $user->rights->loan->write)
{ {
$object->fetch($id); $object->fetch($id);
$result = $object->setProject(GETPOST('projectid')); $result = $object->setProject($projectid);
if ($result < 0) if ($result < 0)
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
@ -309,7 +311,7 @@ if ($action == 'create')
print '<tr><td>'.$langs->trans("Project").'</td><td>'; print '<tr><td>'.$langs->trans("Project").'</td><td>';
$numproject=$formproject->select_projects(-1,GETPOST("fk_project"),'fk_project',16,0,1,1); $numproject=$formproject->select_projects(-1, $projectid, 'projectid', 16, 0, 1, 1);
print '</td></tr>'; print '</td></tr>';
} }
@ -443,21 +445,21 @@ if ($id > 0)
{ {
$langs->load("projects"); $langs->load("projects");
$morehtmlref.='<br>'.$langs->trans('Project') . ' '; $morehtmlref.='<br>'.$langs->trans('Project') . ' ';
if ($user->rights->commande->creer) if ($user->rights->loan->write)
{ {
if ($action != 'classify') if ($action != 'classify')
$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : '; $morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
if ($action == 'classify') { if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">'; $morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref.='<input type="hidden" name="action" value="classin">'; $morehtmlref.='<input type="hidden" name="action" value="classin">';
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; $morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; $morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref.='</form>'; $morehtmlref.='</form>';
} else { } else {
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
} }
} else { } else {
if (! empty($object->fk_project)) { if (! empty($object->fk_project)) {
$proj = new Project($db); $proj = new Project($db);

View File

@ -89,8 +89,38 @@ if ($object->id)
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';
// Ref loan // Ref loan
$morehtmlref.=$form->editfieldkey("Label", 'label', $object->label, $object, $user->rights->loan->write, 'string', '', 0, 1); $morehtmlref.=$form->editfieldkey("Label", 'label', $object->label, $object, 0, 'string', '', 0, 1);
$morehtmlref.=$form->editfieldval("Label", 'label', $object->label, $object, $user->rights->loan->write, 'string', '', null, null, '', 1); $morehtmlref.=$form->editfieldval("Label", 'label', $object->label, $object, 0, 'string', '', null, null, '', 1);
// Project
if (! empty($conf->projet->enabled)) {
$langs->load("projects");
$morehtmlref .= '<br>' . $langs->trans('Project') . ' : ';
if ($user->rights->loan->write) {
//if ($action != 'classify')
// $morehtmlref .= '<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
if ($action == 'classify') {
// $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '">';
$morehtmlref .= '<input type="hidden" name="action" value="classin">';
$morehtmlref .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
$morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">';
$morehtmlref .= '</form>';
} 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 .= '<a href="' . DOL_URL_ROOT . '/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
$morehtmlref .= $proj->ref;
$morehtmlref .= '</a>';
} else {
$morehtmlref .= '';
}
}
}
$morehtmlref.='</div>'; $morehtmlref.='</div>';
$linkback = '<a href="' . DOL_URL_ROOT . '/loan/index.php">' . $langs->trans("BackToList") . '</a>'; $linkback = '<a href="' . DOL_URL_ROOT . '/loan/index.php">' . $langs->trans("BackToList") . '</a>';

View File

@ -57,8 +57,38 @@ dol_fiche_head($head, 'info', $langs->trans("Loan"), -1, 'bill');
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';
// Ref loan // Ref loan
$morehtmlref.=$form->editfieldkey("Label", 'label', $object->label, $object, $user->rights->loan->write, 'string', '', 0, 1); $morehtmlref.=$form->editfieldkey("Label", 'label', $object->label, $object, 0, 'string', '', 0, 1);
$morehtmlref.=$form->editfieldval("Label", 'label', $object->label, $object, $user->rights->loan->write, 'string', '', null, null, '', 1); $morehtmlref.=$form->editfieldval("Label", 'label', $object->label, $object, 0, 'string', '', null, null, '', 1);
// Project
if (! empty($conf->projet->enabled)) {
$langs->load("projects");
$morehtmlref .= '<br>' . $langs->trans('Project') . ' : ';
if ($user->rights->loan->write) {
//if ($action != 'classify')
// $morehtmlref .= '<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
if ($action == 'classify') {
// $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '">';
$morehtmlref .= '<input type="hidden" name="action" value="classin">';
$morehtmlref .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
$morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">';
$morehtmlref .= '</form>';
} 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 .= '<a href="' . DOL_URL_ROOT . '/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
$morehtmlref .= $proj->ref;
$morehtmlref .= '</a>';
} else {
$morehtmlref .= '';
}
}
}
$morehtmlref.='</div>'; $morehtmlref.='</div>';
$linkback = '<a href="' . DOL_URL_ROOT . '/loan/index.php">' . $langs->trans("BackToList") . '</a>'; $linkback = '<a href="' . DOL_URL_ROOT . '/loan/index.php">' . $langs->trans("BackToList") . '</a>';

View File

@ -74,8 +74,38 @@ if ($id > 0)
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';
// Ref loan // Ref loan
$morehtmlref.=$form->editfieldkey("Label", 'label', $object->label, $object, $user->rights->loan->write, 'string', '', 0, 1); $morehtmlref.=$form->editfieldkey("Label", 'label', $object->label, $object, 0, 'string', '', 0, 1);
$morehtmlref.=$form->editfieldval("Label", 'label', $object->label, $object, $user->rights->loan->write, 'string', '', null, null, '', 1); $morehtmlref.=$form->editfieldval("Label", 'label', $object->label, $object, 0, 'string', '', null, null, '', 1);
// Project
if (! empty($conf->projet->enabled)) {
$langs->load("projects");
$morehtmlref .= '<br>' . $langs->trans('Project') . ' : ';
if ($user->rights->loan->write) {
//if ($action != 'classify')
// $morehtmlref .= '<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
if ($action == 'classify') {
// $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '">';
$morehtmlref .= '<input type="hidden" name="action" value="classin">';
$morehtmlref .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
$morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">';
$morehtmlref .= '</form>';
} 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 .= '<a href="' . DOL_URL_ROOT . '/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
$morehtmlref .= $proj->ref;
$morehtmlref .= '</a>';
} else {
$morehtmlref .= '';
}
}
}
$morehtmlref.='</div>'; $morehtmlref.='</div>';
$linkback = '<a href="' . DOL_URL_ROOT . '/loan/index.php">' . $langs->trans("BackToList") . '</a>'; $linkback = '<a href="' . DOL_URL_ROOT . '/loan/index.php">' . $langs->trans("BackToList") . '</a>';

View File

@ -419,7 +419,7 @@ $listofreferent=array(
'testnew'=>$user->rights->tax->charges->lire, 'testnew'=>$user->rights->tax->charges->lire,
'test'=>$conf->tax->enabled && $user->rights->tax->charges->lire), 'test'=>$conf->tax->enabled && $user->rights->tax->charges->lire),
'project_task'=>array( 'project_task'=>array(
'name'=>"TaskTimeValorised", 'name'=>"TaskTimeSpent",
'title'=>"ListTaskTimeUserProject", 'title'=>"ListTaskTimeUserProject",
'class'=>'Task', 'class'=>'Task',
'margin'=>'minus', 'margin'=>'minus',
@ -629,7 +629,7 @@ foreach ($listofreferent as $key => $value)
$total_ttc = -$total_ttc; $total_ttc = -$total_ttc;
} }
switch ($classname) { /*switch ($classname) {
case 'FactureFournisseur': case 'FactureFournisseur':
$newclassname = 'SupplierInvoice'; $newclassname = 'SupplierInvoice';
break; break;
@ -653,12 +653,12 @@ foreach ($listofreferent as $key => $value)
break; break;
default: default:
$newclassname = $classname; $newclassname = $classname;
} }*/
$var = ! $var; $var = ! $var;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
// Module // Module
print '<td align="left">'.$langs->trans($newclassname).'</td>'; print '<td align="left">'.$name.'</td>';
// Nb // Nb
print '<td align="right">'.$i.'</td>'; print '<td align="right">'.$i.'</td>';
// Amount HT // Amount HT