mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Merge branch '17.0' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
c630253fda
File diff suppressed because one or more lines are too long
|
|
@ -249,7 +249,7 @@ if ($id > 0 || $ref) {
|
|||
print '</td>';
|
||||
print '</tr>';
|
||||
*/
|
||||
print '<tr><td class="nowrap">';
|
||||
print '<tr><td class="titlefieldcreate">';
|
||||
print '<table class="nobordernopadding centpercent"><tr><td class="nowrap">';
|
||||
print $form->textwithpicto($langs->trans("BankAccount"), $langs->trans($labelofbankfield));
|
||||
print '<td>';
|
||||
|
|
|
|||
|
|
@ -147,6 +147,7 @@ if ($id > 0 || $ref) {
|
|||
print '<tr><td class="titlefieldcreate">';
|
||||
print $form->textwithpicto($langs->trans("BankAccount"), $langs->trans($labelofbankfield));
|
||||
print '</td>';
|
||||
|
||||
print '<td>';
|
||||
if ($acc->id > 0) {
|
||||
print $acc->getNomUrl(1);
|
||||
|
|
@ -347,12 +348,12 @@ if ($resql) {
|
|||
}
|
||||
print '<td> </td>';
|
||||
print '<td class="right">';
|
||||
//if ($totalinvoices != $object->amount) print img_warning("AmountOfFileDiffersFromSumOfInvoices"); // It is normal to have total that differs. For an amount of invoice of 100, request to pay may be 50 only.
|
||||
if ($totalamount_requested != $object->amount) {
|
||||
print img_warning("AmountOfFileDiffersFromSumOfInvoices");
|
||||
}
|
||||
print "</td>\n";
|
||||
print '<td class="right">';
|
||||
// If the page show all record (no pagination) and total does not match total of file, we show a warning. Should not happen.
|
||||
if (($nbtotalofrecords <= $num) && $totalamount_requested != $object->amount) {
|
||||
print img_warning("AmountOfFileDiffersFromSumOfInvoices");
|
||||
}
|
||||
print price($totalamount_requested);
|
||||
print "</td>\n";
|
||||
print '<td> </td>';
|
||||
|
|
|
|||
|
|
@ -255,7 +255,7 @@ class Form
|
|||
if (empty($notabletag)) {
|
||||
$ret .= '<tr><td>';
|
||||
}
|
||||
if (preg_match('/^(string|safehtmlstring|email)/', $typeofdata)) {
|
||||
if (preg_match('/^(string|safehtmlstring|email|url)/', $typeofdata)) {
|
||||
$tmp = explode(':', $typeofdata);
|
||||
$ret .= '<input type="text" id="' . $htmlname . '" name="' . $htmlname . '" value="' . ($editvalue ? $editvalue : $value) . '"' . (empty($tmp[1]) ? '' : ' size="' . $tmp[1] . '"') . ' autofocus>';
|
||||
} elseif (preg_match('/^(integer)/', $typeofdata)) {
|
||||
|
|
@ -339,6 +339,8 @@ class Form
|
|||
} else {
|
||||
if (preg_match('/^(email)/', $typeofdata)) {
|
||||
$ret .= dol_print_email($value, 0, 0, 0, 0, 1);
|
||||
} elseif (preg_match('/^url/', $typeofdata)) {
|
||||
$ret .= dol_print_url($value, '_blank', 32, 1);
|
||||
} elseif (preg_match('/^(amount|numeric)/', $typeofdata)) {
|
||||
$ret .= ($value != '' ? price($value, '', $langs, 0, -1, -1, $conf->currency) : '');
|
||||
} elseif (preg_match('/^(checkbox)/', $typeofdata)) {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ EnterNameOfObjectDesc=Enter the name of the object to create with no spaces. Use
|
|||
EnterNameOfDictionaryDesc=Enter the name of the dictionary to create with no spaces. Use uppercase to separate words (For example: MyDico...). The class file, but also the SQL file will be generated.
|
||||
ModuleBuilderDesc2=Path where modules are generated/edited (first directory for external modules defined into %s): <strong>%s</strong>
|
||||
ModuleBuilderDesc3=Generated/editable modules found: <strong>%s</strong>
|
||||
ModuleBuilderDesc4=A module is detected as 'editable' when the file <strong>%s</strong> exists in root of module directory
|
||||
ModuleBuilderDesc4=A module is detected as a 'module for Module Builer' when the file <strong>%s</strong> exists in the root of the module directory
|
||||
NewModule=New module
|
||||
NewObjectInModulebuilder=New object
|
||||
NewDictionary=New dictionary
|
||||
|
|
|
|||
|
|
@ -223,7 +223,7 @@ print '<div class="tabsAction">';
|
|||
|
||||
if (empty($action) && !empty($user->rights->loan->delete)) {
|
||||
if (!$disable_delete) {
|
||||
print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', 1);
|
||||
print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$id.'&action=delete&token='.newToken(), 'delete', 1);
|
||||
} else {
|
||||
print dolGetButtonAction($langs->trans("CantRemovePaymentWithOneInvoicePaid"), $langs->trans("Delete"), 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', 0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -928,20 +928,20 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||
print $userstatic->getNomUrl(-1);
|
||||
print "</td>\n";
|
||||
}
|
||||
// Inventory code
|
||||
if (!empty($arrayfields['m.inventorycode']['checked'])) {
|
||||
// Inventory code
|
||||
print '<td>';
|
||||
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($objp->inventorycode).'">';
|
||||
//print '<a href="' . DOL_URL_ROOT . '/product/stock/movement_card.php' . '?id=' . $objp->entrepot_id . '&search_inventorycode=' . $objp->inventorycode . '&search_type_mouvement=' . $objp->type_mouvement . '">';
|
||||
print dol_escape_htmltag($objp->inventorycode);
|
||||
//print '</a>';
|
||||
print '</td>';
|
||||
}
|
||||
// Label of movement
|
||||
if (!empty($arrayfields['m.label']['checked'])) {
|
||||
// Label of movement
|
||||
print '<td class="tdoverflowmax300" title="'.dol_escape_htmltag($objp->label).'">'.dol_escape_htmltag($objp->label).'</td>';
|
||||
}
|
||||
// Type of movement
|
||||
if (!empty($arrayfields['m.type_mouvement']['checked'])) {
|
||||
// Type of movement
|
||||
switch ($objp->type_mouvement) {
|
||||
case "0":
|
||||
print '<td class="center">'.$langs->trans('StockIncreaseAfterCorrectTransfer').'</td>';
|
||||
|
|
@ -972,17 +972,18 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||
if (!empty($arrayfields['m.value']['checked'])) {
|
||||
// Qty
|
||||
print '<td class="right">';
|
||||
if ($objp->qt > 0) {
|
||||
print '+';
|
||||
if ($objp->qty >0) {
|
||||
print '<span class="stockmovemententry">+'.$objp->qty.'</span>';
|
||||
} else {
|
||||
print '<span class="stockmovementexit">'.$objp->qty.'<span>';
|
||||
}
|
||||
print $objp->qty;
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['m.price']['checked'])) {
|
||||
// Price
|
||||
print '<td class="right">';
|
||||
if ($objp->price != 0) {
|
||||
print price($objp->price);
|
||||
print '<span class="opacitymedium">'.price($objp->price).'</span>';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -517,6 +517,7 @@ class Tasks extends DolibarrApi
|
|||
* @param string $note Note
|
||||
*
|
||||
* @url POST {id}/addtimespent
|
||||
* NOTE: Should be "POST {id}/timespent", since POST already implies "add"
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
|
@ -563,6 +564,110 @@ class Tasks extends DolibarrApi
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update time spent for a task of a project.
|
||||
* You can test this API with the following input message
|
||||
* { "date": "2016-12-31 23:15:00", "duration": 1800, "user_id": 1, "note": "My time test" }
|
||||
*
|
||||
* @param int $id Task ID
|
||||
* @param int $timespent_id Time spent ID (llx_projet_task_time.rowid)
|
||||
* @param datetime $date Date (YYYY-MM-DD HH:MI:SS in GMT)
|
||||
* @param int $duration Duration in seconds (3600 = 1h)
|
||||
* @param int $user_id User (Use 0 for connected user)
|
||||
* @param string $note Note
|
||||
*
|
||||
* @url PUT {id}/timespent/{timespent_id}
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function putTimeSpent($id, $timespent_id, $date, $duration, $user_id = 0, $note = '')
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->projet->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$this->timespentRecordChecks($id, $timespent_id);
|
||||
|
||||
if (!DolibarrApi::_checkAccessToResource('task', $this->task->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$newdate = dol_stringtotime($date, 1);
|
||||
$this->task->timespent_date = $newdate;
|
||||
$this->task->timespent_datehour = $newdate;
|
||||
$this->task->timespent_withhour = 1;
|
||||
$this->task->timespent_duration = $duration;
|
||||
$this->task->timespent_fk_user = $user_id ?? DolibarrApiAccess::$user->id;
|
||||
$this->task->timespent_note = $note;
|
||||
|
||||
$result = $this->task->updateTimeSpent(DolibarrApiAccess::$user, 0);
|
||||
if ($result == 0) {
|
||||
throw new RestException(304, 'Error nothing done.');
|
||||
}
|
||||
if ($result < 0) {
|
||||
throw new RestException(500, 'Error when updating time spent: '.$this->task->error);
|
||||
}
|
||||
|
||||
return array(
|
||||
'success' => array(
|
||||
'code' => 200,
|
||||
'message' => 'Time spent updated'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete time spent for a task of a project.
|
||||
*
|
||||
* @param int $id Task ID
|
||||
* @param int $timespent_id Time spent ID (llx_projet_task_time.rowid)
|
||||
*
|
||||
* @url DELETE {id}/timespent/{timespent_id}
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function deleteTimeSpent($id, $timespent_id)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->projet->supprimer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$this->timespentRecordChecks($id, $timespent_id);
|
||||
|
||||
if (!DolibarrApi::_checkAccessToResource('task', $this->task->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
if ($this->task->delTimeSpent(DolibarrApiAccess::$user, 0) < 0) {
|
||||
throw new RestException(500, 'Error when deleting time spent: '.$this->task->error);
|
||||
}
|
||||
|
||||
return array(
|
||||
'success' => array(
|
||||
'code' => 200,
|
||||
'message' => 'Time spent deleted'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate task & timespent IDs for timespent API methods.
|
||||
* Loads the selected task & timespent records.
|
||||
*
|
||||
* @param int $id Task ID
|
||||
* @param int $timespent_id Time spent ID (llx_projet_task_time.rowid)
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function timespentRecordChecks($id, $timespent_id)
|
||||
{
|
||||
if ($this->task->fetch($id) <= 0) {
|
||||
throw new RestException(404, 'Task not found');
|
||||
}
|
||||
if ($this->task->fetchTimeSpent($timespent_id) <= 0) {
|
||||
throw new RestException(404, 'Timespent not found');
|
||||
} elseif ($this->task->id != $id) {
|
||||
throw new RestException(404, 'Timespent not found in selected task');
|
||||
}
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -504,6 +504,7 @@ $listofreferent = array(
|
|||
'buttonnew'=>'CreateMO',
|
||||
'testnew'=>$user->hasRight('mrp', 'write'),
|
||||
'project_field'=>'fk_project',
|
||||
'nototal'=>1,
|
||||
'test'=>!empty($conf->mrp->enabled) && $user->hasRight('mrp', 'read')),
|
||||
'trip'=>array(
|
||||
'name'=>"TripsAndExpenses",
|
||||
|
|
@ -992,6 +993,7 @@ foreach ($listofreferent as $key => $value) {
|
|||
$buttonnew = empty($value['buttonnew']) ? '' : $value['buttonnew'];
|
||||
$testnew = empty($value['testnew']) ? '' : $value['testnew'];
|
||||
$project_field = empty($value['project_field']) ? '' : $value['project_field'];
|
||||
$nototal = empty($value['nototal']) ? 0 : 1;
|
||||
|
||||
$exclude_select_element = array('payment_various');
|
||||
if (!empty($value['exclude_select_element'])) {
|
||||
|
|
@ -1518,47 +1520,49 @@ foreach ($listofreferent as $key => $value) {
|
|||
}
|
||||
|
||||
// Total
|
||||
$colspan = 4;
|
||||
if (in_array($tablename, array('projet_task'))) {
|
||||
$colspan = 2;
|
||||
}
|
||||
if (empty($nototal)) {
|
||||
$colspan = 4;
|
||||
if (in_array($tablename, array('projet_task'))) {
|
||||
$colspan = 2;
|
||||
}
|
||||
|
||||
print '<tr class="liste_total"><td colspan="'.$colspan.'">'.$langs->trans("Number").': '.$i.'</td>';
|
||||
if (in_array($tablename, array('projet_task'))) {
|
||||
print '<td class="center">';
|
||||
print convertSecondToTime($total_time, 'allhourmin');
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print '</td>';
|
||||
}
|
||||
//if (empty($value['disableamount']) && ! in_array($tablename, array('projet_task'))) print '<td class="right" width="100">'.$langs->trans("TotalHT").' : '.price($total_ht).'</td>';
|
||||
//elseif (empty($value['disableamount']) && in_array($tablename, array('projet_task'))) print '<td class="right" width="100">'.$langs->trans("Total").' : '.price($total_ht).'</td>';
|
||||
// If fichinter add the total_duration
|
||||
if ($tablename == 'fichinter') {
|
||||
print '<td class="left">'.convertSecondToTime($total_duration, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY).'</td>';
|
||||
}
|
||||
print '<td class="right">';
|
||||
if (empty($value['disableamount'])) {
|
||||
if ($key == 'loan') {
|
||||
print $langs->trans("Total").' '.$langs->trans("LoanCapital").' : '.price($total_ttc);
|
||||
} elseif ($tablename != 'projet_task' || !empty($conf->salaries->enabled)) {
|
||||
print ''.$langs->trans("TotalHT").' : '.price($total_ht);
|
||||
print '<tr class="liste_total"><td colspan="'.$colspan.'">'.$langs->trans("Number").': '.$i.'</td>';
|
||||
if (in_array($tablename, array('projet_task'))) {
|
||||
print '<td class="center">';
|
||||
print convertSecondToTime($total_time, 'allhourmin');
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
//if (empty($value['disableamount']) && ! in_array($tablename, array('projet_task'))) print '<td class="right" width="100">'.$langs->trans("TotalTTC").' : '.price($total_ttc).'</td>';
|
||||
//elseif (empty($value['disableamount']) && in_array($tablename, array('projet_task'))) print '<td class="right" width="100"></td>';
|
||||
print '<td class="right">';
|
||||
if (empty($value['disableamount'])) {
|
||||
if ($key == 'loan') {
|
||||
print $langs->trans("Total").' '.$langs->trans("RemainderToPay").' : '.price($total_ttc);
|
||||
} elseif ($tablename != 'projet_task' || !empty($conf->salaries->enabled)) {
|
||||
print $langs->trans("TotalTTC").' : '.price($total_ttc);
|
||||
//if (empty($value['disableamount']) && ! in_array($tablename, array('projet_task'))) print '<td class="right" width="100">'.$langs->trans("TotalHT").' : '.price($total_ht).'</td>';
|
||||
//elseif (empty($value['disableamount']) && in_array($tablename, array('projet_task'))) print '<td class="right" width="100">'.$langs->trans("Total").' : '.price($total_ht).'</td>';
|
||||
// If fichinter add the total_duration
|
||||
if ($tablename == 'fichinter') {
|
||||
print '<td class="left">'.convertSecondToTime($total_duration, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY).'</td>';
|
||||
}
|
||||
print '<td class="right">';
|
||||
if (empty($value['disableamount'])) {
|
||||
if ($key == 'loan') {
|
||||
print $langs->trans("Total").' '.$langs->trans("LoanCapital").' : '.price($total_ttc);
|
||||
} elseif ($tablename != 'projet_task' || !empty($conf->salaries->enabled)) {
|
||||
print ''.$langs->trans("TotalHT").' : '.price($total_ht);
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
//if (empty($value['disableamount']) && ! in_array($tablename, array('projet_task'))) print '<td class="right" width="100">'.$langs->trans("TotalTTC").' : '.price($total_ttc).'</td>';
|
||||
//elseif (empty($value['disableamount']) && in_array($tablename, array('projet_task'))) print '<td class="right" width="100"></td>';
|
||||
print '<td class="right">';
|
||||
if (empty($value['disableamount'])) {
|
||||
if ($key == 'loan') {
|
||||
print $langs->trans("Total").' '.$langs->trans("RemainderToPay").' : '.price($total_ttc);
|
||||
} elseif ($tablename != 'projet_task' || !empty($conf->salaries->enabled)) {
|
||||
print $langs->trans("TotalTTC").' : '.price($total_ttc);
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
print '<td> </td>';
|
||||
print '</tr>';
|
||||
}
|
||||
print '</td>';
|
||||
print '<td> </td>';
|
||||
print '</tr>';
|
||||
} else {
|
||||
if (!is_array($elementarray)) { // error
|
||||
print '<tr><td>'.$elementarray.'</td></tr>';
|
||||
|
|
|
|||
|
|
@ -321,6 +321,10 @@ class CodingSqlTest extends PHPUnit\Framework\TestCase
|
|||
$result=strpos($filecontent, 'eldy@');
|
||||
print __METHOD__." Result for checking we don't have personal data = ".$result."\n";
|
||||
$this->assertTrue($result===false, 'Found a bad key eldy@ into file '.$file);
|
||||
|
||||
$result=strpos($filecontent, 'INSERT INTO `llx_oauth_token`');
|
||||
print __METHOD__." Result for checking we don't have data into llx_oauth_token = ".$result."\n";
|
||||
$this->assertTrue($result===false, 'Found a non expected insert into file '.$file);
|
||||
}
|
||||
|
||||
return;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user