Skip to content

Commit

Permalink
Merge branch '15.0' of [email protected]:Dolibarr/dolibarr.git into develop
Browse files Browse the repository at this point in the history
Conflicts:
	ChangeLog
	htdocs/core/ajax/row.php
	htdocs/filefunc.inc.php
  • Loading branch information
eldy committed Mar 10, 2022
2 parents 66f21fc + f6fb406 commit 88ffe18
Show file tree
Hide file tree
Showing 18 changed files with 126 additions and 58 deletions.
29 changes: 29 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ English Dolibarr ChangeLog
--------------------------------------------------------------



***** ChangeLog for 16.0.0 compared to 15.0.0 *****

For users:
Expand Down Expand Up @@ -30,6 +31,34 @@ Following changes may create regressions for some external modules, but were nec



***** ChangeLog for 15.0.1 compared to 15.0.0 *****
FIX: #19777 #20281
FIX: bad position of extrafields for interventions
FIX: Blocking situation when a payment was deleted in bank.
FIX: creation of the shipment if order contains services
FIX: Drag and drop line of files on join files tab
FIX: Error management on mass action "Approve holiday"
FIX: error with php8
FIX: in case of VAT refund, negative amount must be allowed
FIX: invoice pdf: lines originating from deposits were not detailed anymore
FIX: Invoice - When you create an invoice for a given thirdparty, fk_account is not retrieved from company card
FIX: list of visible type of event was not correctly filtered
FIX: Missing or bad permissions
FIX: Missing the field date start/end in export supplier invoice/order
FIX: On large proposal or invoice, fix n(n+1) sql into a n sql.
FIX: options should not exists on invoices
FIX: payment not completed when using Paypal.
FIX: permission to download files of expense report with readall.
FIX- Preview icon in documents list PDF in the admin page third-party
FIX: shipping list, e.shipping_method_id should be e.fk_shipping_method.
FIX: Show product photo on Supplier order Cornas model.
FIX: User name in ManufacturingOrder
FIX: viewimage.php blocks requests with multicompany from other enties
FIX: #yogosha9048
FIX: #yogosha9054
FIX: #yogosha9095


***** ChangeLog for 15.0.0 compared to 14.0.0 *****

For users:
Expand Down
3 changes: 2 additions & 1 deletion htdocs/admin/tools/export_files.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@

if ($compression == 'zip') {
$file .= '.zip';
$excludefiles = '/(\.back|\.old|\.log|\.pdf_preview-.*\.png|[\/\\\]temp[\/\\\]|documents[\/\\\]admin[\/\\\]documents[\/\\\])/i';

$excludefiles = '/(\.back|\.old|\.log|\.pdf_preview-.*\.png|[\/\\\]temp[\/\\\]|[\/\\\]admin[\/\\\]documents[\/\\\])/i';

//var_dump($fulldirtocompress);
//var_dump($outputdir."/".$file);exit;
Expand Down
18 changes: 12 additions & 6 deletions htdocs/core/ajax/row.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@
$perm = 1;
} elseif ($table_element_line == 'facturedet_rec' && $user->rights->facture->creer) {
$perm = 1;
} elseif ($table_element_line == 'ecm_files' && $user->rights->ecm->creer) {
$perm = 1;
} elseif ($table_element_line == 'emailcollector_emailcollectoraction' && $user->admin) {
$perm = 1;
} elseif ($table_element_line == 'bom_bomline' && $user->rights->bom->write) {
Expand All @@ -97,10 +95,18 @@
$perm = 1;
} elseif ($table_element_line == 'facture_fourn_det_rec' && $user->rights->fournisseur->facture->creer) {
$perm = 1;
} elseif ($table_element_line == 'ecm_files' && $fk_element == 'fk_product' && (!empty($user->rights->produit->creer) || !empty($user->rights->service->creer))) {
$perm = 1;
} elseif ($table_element_line == 'ecm_files' && $fk_element == 'fk_ticket' && !empty($user->rights->ticket->write)) {
$perm = 1;
} elseif ($table_element_line == 'ecm_files') { // Used when of page "documents.php"
if (!empty($user->rights->ecm->creer)) {
$perm = 1;
} elseif ($fk_element == 'fk_product' && (!empty($user->rights->produit->creer) || !empty($user->rights->service->creer))) {
$perm = 1;
} elseif ($fk_element == 'fk_ticket' && !empty($user->rights->ticket->write)) {
$perm = 1;
} elseif ($fk_element == 'fk_holiday' && !empty($user->rights->holiday->write)) {
$perm = 1;
} elseif ($fk_element == 'fk_soc' && !empty($user->rights->societe->creer)) {
$perm = 1;
}
} elseif ($table_element_line == 'product_association' && $fk_element == 'fk_product' && (!empty($user->rights->produit->creer) || !empty($user->rights->service->creer))) {
$perm = 1;
} elseif ($table_element_line == 'projet_task' && $fk_element == 'fk_projet' && $user->rights->projet->creer) {
Expand Down
6 changes: 3 additions & 3 deletions htdocs/core/class/html.form.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -6680,7 +6680,7 @@ public function select_duration($prefix, $iSecond = '', $disabled = 0, $typehour
// phpcs:enable
global $langs;

$retstring = '';
$retstring = '<span class="nowraponall">';

$hourSelected = 0;
$minSelected = 0;
Expand Down Expand Up @@ -6712,7 +6712,7 @@ public function select_duration($prefix, $iSecond = '', $disabled = 0, $typehour
if ($typehour != 'text') {
$retstring .= ' '.$langs->trans('HourShort');
} else {
$retstring .= '<span class="hideonsmartphone">:</span>';
$retstring .= '<span class="">:</span>';
}

// Minutes
Expand Down Expand Up @@ -6740,7 +6740,7 @@ public function select_duration($prefix, $iSecond = '', $disabled = 0, $typehour
$retstring .= ' '.$langs->trans('MinuteShort');
}

//$retstring.="&nbsp;";
$retstring.="</span>";

if (!empty($nooutput)) {
return $retstring;
Expand Down
38 changes: 19 additions & 19 deletions htdocs/core/class/html.formfile.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1283,12 +1283,22 @@ public function list_of_documents($filearray, $object, $modulepart, $param = '',
}
print '<td></td>';
print '<td></td>';
if (!$disablemove) {
if (empty($disablemove) && count($filearray) > 1) {
print '<td></td>';
}
print "</tr>\n";
}

// Get list of files stored into database for same relative directory
if ($relativedir) {
completeFileArrayWithDatabaseInfo($filearray, $relativedir);

//var_dump($sortfield.' - '.$sortorder);
if ($sortfield && $sortorder) { // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name)
$filearray = dol_sort_array($filearray, $sortfield, $sortorder);
}
}

print '<tr class="liste_titre nodrag nodrop">';
//print $url.' sortfield='.$sortfield.' sortorder='.$sortorder;
print_liste_field_titre('Documents2', $url, "name", "", $param, '', $sortfield, $sortorder, 'left ');
Expand All @@ -1301,21 +1311,11 @@ public function list_of_documents($filearray, $object, $modulepart, $param = '',
print_liste_field_titre('');
// Action button
print_liste_field_titre('');
if (!$disablemove) {
if (empty($disablemove) && count($filearray) > 1) {
print_liste_field_titre('');
}
print "</tr>\n";

// Get list of files stored into database for same relative directory
if ($relativedir) {
completeFileArrayWithDatabaseInfo($filearray, $relativedir);

//var_dump($sortfield.' - '.$sortorder);
if ($sortfield && $sortorder) { // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name)
$filearray = dol_sort_array($filearray, $sortfield, $sortorder);
}
}

$nboffiles = count($filearray);
if ($nboffiles > 0) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
Expand Down Expand Up @@ -1510,18 +1510,18 @@ public function list_of_documents($filearray, $object, $modulepart, $param = '',
}
print "</td>";

if (empty($disablemove)) {
if (empty($disablemove) && count($filearray) > 1) {
if ($nboffiles > 1 && $conf->browser->layout != 'phone') {
print '<td class="linecolmove tdlineupdown center">';
if ($i > 0) {
print '<a class="lineupdown" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&action=up&rowid='.$line->id.'">'.img_up('default', 0, 'imgupforline').'</a>';
}
if ($i < $nboffiles - 1) {
if ($i < ($nboffiles - 1)) {
print '<a class="lineupdown" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&action=down&rowid='.$line->id.'">'.img_down('default', 0, 'imgdownforline').'</a>';
}
print '</td>';
} else {
print '<td'.(($conf->browser->layout != 'phone' && empty($disablemove)) ? ' class="linecolmove tdlineupdown center"' : ' class="linecolmove center"').'>';
print '<td'.(($conf->browser->layout != 'phone') ? ' class="linecolmove tdlineupdown center"' : ' class="linecolmove center"').'>';
print '</td>';
}
}
Expand All @@ -1531,7 +1531,7 @@ public function list_of_documents($filearray, $object, $modulepart, $param = '',
print '<input type="submit" class="button button-save" name="renamefilesave" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
print '<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">';
print '</td>';
if (empty($disablemove)) {
if (empty($disablemove) && count($filearray) > 1) {
print '<td class="right"></td>';
}
}
Expand All @@ -1542,7 +1542,7 @@ public function list_of_documents($filearray, $object, $modulepart, $param = '',
}
if ($nboffiles == 0) {
$colspan = '6';
if (empty($disablemove)) {
if (empty($disablemove) && count($filearray) > 1) {
$colspan++; // 6 columns or 7
}
print '<tr class="oddeven"><td colspan="'.$colspan.'">';
Expand Down Expand Up @@ -2032,7 +2032,7 @@ public function listOfLinks($object, $permissiontodelete = 1, $action = null, $s
print '<form action="'.$_SERVER['PHP_SELF'].($param ? '?'.$param : '').'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">';

print '<table width="100%" class="liste noborder nobottom">';
print '<table class="liste noborder nobottom centpercent">';
print '<tr class="liste_titre">';
print_liste_field_titre(
$langs->trans("Links"),
Expand Down Expand Up @@ -2117,7 +2117,7 @@ public function listOfLinks($object, $permissiontodelete = 1, $action = null, $s
print '<td class="right">';
print '<a href="'.$_SERVER['PHP_SELF'].'?action=update&linkid='.$link->id.$param.'&token='.newToken().'" class="editfilelink editfielda reposition" >'.img_edit().'</a>'; // id= is included into $param
if ($permissiontodelete) {
print ' &nbsp; <a class="deletefilelink" href="'.$_SERVER['PHP_SELF'].'?action=delete&token='.newToken().'&linkid='.$link->id.$param.'">'.img_delete().'</a>'; // id= is included into $param
print ' &nbsp; <a class="deletefilelink reposition" href="'.$_SERVER['PHP_SELF'].'?action=deletelink&token='.newToken().'&linkid='.((int) $link->id).$param.'">'.img_delete().'</a>'; // id= is included into $param
} else {
print '&nbsp;';
}
Expand Down
5 changes: 4 additions & 1 deletion htdocs/core/filemanagerdol/browser/default/frmupload.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ function SetCurrentFolder( resourceType, folderPath )

function OnSubmit()
{
console.log("Click on OnSubmit");
if ( document.getElementById('NewFile').value.length == 0 )
{
alert( 'Please select a file from your computer' );
Expand All @@ -80,6 +81,8 @@ function OnSubmit()

function OnUploadCompleted( errorNumber, data )
{
console.log("errorNumber = "+errorNumber);

// Reset the Upload Worker Frame.
window.parent.frames['frmUploadWorker'].location = 'javascript:void(0)' ;

Expand All @@ -106,7 +109,7 @@ function OnUploadCompleted( errorNumber, data )
alert( 'A file with the same name is already available. The uploaded file has been renamed to "' + data + '"' );
break;
case 202:
alert( 'Invalid file' );
alert( 'Invalid file (Bad extension)' );
break;
default:
alert( 'Error on file upload. Error number: ' + errorNumber );
Expand Down
20 changes: 18 additions & 2 deletions htdocs/core/filemanagerdol/connectors/php/commands.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,19 +203,26 @@ function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '')

$oFile = isset($_FILES['NewFile']) ? $_FILES['NewFile'] : $_FILES['upload'];

// $resourceType should be 'Image';
$detectHtml = 0;

// Map the virtual path to the local server path.
$sServerDir = ServerMapFolder($resourceType, $currentFolder, $sCommand);

// Get the uploaded file name.
$sFileName = $oFile['name'];
$sFileName = SanitizeFileName($sFileName);

//$sFileName = SanitizeFileName($sFileName);
$sFileName = dol_sanitizeFileName($sFileName);

$sOriginalFileName = $sFileName;

// Get the extension.
$sExtension = substr($sFileName, (strrpos($sFileName, '.') + 1));
$sExtension = strtolower($sExtension);

//var_dump($Config);
/*
if (isset($Config['SecureImageUploads'])) {
if (($isImageValid = IsImageValid($oFile['tmp_name'], $sExtension)) === false) {
$sErrorNumber = '202';
Expand All @@ -228,6 +235,14 @@ function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '')
$sErrorNumber = '202';
}
}
*/

include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
$isImageValid = image_format_supported($sFileName) > 0 ? true : false;
if (!$isImageValid) {
$sErrorNumber = '202';
}


// Check if it is an allowed extension.
if (!$sErrorNumber && IsAllowedExt($sExtension, $resourceType)) {
Expand All @@ -241,7 +256,8 @@ function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '')
$sFileName = RemoveExtension($sOriginalFileName).'('.$iCounter.').'.$sExtension;
$sErrorNumber = '201';
} else {
move_uploaded_file($oFile['tmp_name'], $sFilePath);
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
dol_move_uploaded_file($oFile['tmp_name'], $sFilePath, 0, 0);

if (is_file($sFilePath)) {
if (isset($Config['ChmodOnUpload']) && !$Config['ChmodOnUpload']) {
Expand Down
3 changes: 2 additions & 1 deletion htdocs/core/filemanagerdol/connectors/php/io.php
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,8 @@ function SendUploadResults($errorNumber, $fileUrl = '', $fileName = '', $customM
}

$rpl = array('\\' => '\\\\', '"' => '\\"');
echo 'window.parent.OnUploadCompleted('.$errorNumber.',"'.strtr($fileUrl, $rpl).'","'.strtr($fileName, $rpl).'", "'.strtr($customMsg, $rpl).'");';
echo 'console.log('.$errorNumber.');';
echo 'window.parent.OnUploadCompleted('.$errorNumber.', "'.strtr($fileUrl, $rpl).'", "'.strtr($fileName, $rpl).'", "'.strtr($customMsg, $rpl).'");';
echo '</script>';
exit;
}
Expand Down
4 changes: 3 additions & 1 deletion htdocs/core/filemanagerdol/connectors/php/upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@
* This is the "File Uploader" for PHP.
*/

require 'config.php';
require 'config.php'; // This include the main.inc.php
require 'util.php';
require 'io.php';
require 'commands.php';


/**
* SendError
*
Expand Down Expand Up @@ -63,6 +64,7 @@ function SendError($number, $text)
}



// @CHANGE
//FileUpload( $sType, $sCurrentFolder, $sCommand )

Expand Down
4 changes: 2 additions & 2 deletions htdocs/core/lib/project.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1561,8 +1561,8 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
$disabledtask = 1;
}

// Form to add new time
print '<td class="nowrap leftborder center">';
// Select hour
print '<td class="nowraponall leftborder center minwidth150imp">';
$tableCell = $form->selectDate($preselectedday, $lines[$i]->id, 1, 1, 2, "addtime", 0, 0, $disabledtask);
print $tableCell;
print '</td>';
Expand Down
10 changes: 7 additions & 3 deletions htdocs/core/modules/project/doc/pdf_baleine.modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -432,10 +432,12 @@ public function write_file($object, $outputlangs)
$pdf->MultiCell($this->posxlabel - $this->posxref, 3, $outputlangs->convToOutputCharset($ref), 0, 'L');
// Workload
$pdf->SetXY($this->posxworkload, $curY);
$pdf->SetFont('', '', $default_font_size - 2); // We use a smaller font
$pdf->MultiCell($this->posxprogress - $this->posxworkload, 3, $planned_workload ? $planned_workload : '', 0, 'R');
// Progress
$pdf->SetXY($this->posxprogress, $curY);
$pdf->MultiCell($this->posxdatestart - $this->posxprogress, 3, $progress, 0, 'R');
$pdf->SetFont('', '', $default_font_size - 1); // We restore font

// Date start and end
$pdf->SetXY($this->posxdatestart, $curY);
Expand Down Expand Up @@ -640,9 +642,11 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
$pdf->SetTextColor(0, 0, 60);
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("DateStart")." : ".dol_print_date($object->date_start, 'day', false, $outputlangs, true), '', 'R');

$posy += 6;
$pdf->SetXY($posx, $posy);
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("DateEnd")." : ".dol_print_date($object->date_end, 'day', false, $outputlangs, true), '', 'R');
if ($object->date_end) {
$posy += 6;
$pdf->SetXY($posx, $posy);
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("DateEnd")." : ".dol_print_date($object->date_end, 'day', false, $outputlangs, true), '', 'R');
}

if (is_object($object->thirdparty)) {
$posy += 6;
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/tpl/document_actions_post_headers.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
* Confirm form to delete a file
*/

if ($action == 'deletefile') {
if ($action == 'deletefile' || $action == 'deletelink') {
$langs->load("companies"); // Need for string DeleteFile+ConfirmDeleteFiles
print $form->formconfirm(
$_SERVER["PHP_SELF"].'?id='.$object->id.'&urlfile='.urlencode(GETPOST("urlfile")).'&linkid='.GETPOST('linkid', 'int').(empty($param) ? '' : $param),
Expand Down
2 changes: 1 addition & 1 deletion htdocs/langs/en_US/products.lang
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ UseProductFournDesc=Add a feature to define the product description defined by t
ProductSupplierDescription=Vendor description for the product
UseProductSupplierPackaging=Use packaging on supplier prices (recalculate quantities according to packaging set on supplier price when adding/updating line in supplier documents)
PackagingForThisProduct=Packaging
PackagingForThisProductDesc=On supplier order, you will automaticly order this quantity (or a multiple of this quantity). Cannot be less than minimum buying quantity
PackagingForThisProductDesc=You will automaticaly buy a multiple of this quantity. Can't be lower than the minimum purchase quantity
QtyRecalculatedWithPackaging=The quantity of the line were recalculated according to supplier packaging

#Attributes
Expand Down
Loading

0 comments on commit 88ffe18

Please sign in to comment.