Merge branch 'fixes/fix-photos-folder-on-defunt' into staging

This commit is contained in:
Tiavina 2025-01-31 16:39:37 +03:00
commit 66f6137031
25 changed files with 31 additions and 26 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -2,6 +2,7 @@
namespace OCA\Gestion\Controller; namespace OCA\Gestion\Controller;
use Exception; use Exception;
use OCA\Gestion\Constants\BddConstant;
use OCA\Gestion\Service\InvoicePdfHandler; use OCA\Gestion\Service\InvoicePdfHandler;
defined("TAB1") or define("TAB1", "\t"); defined("TAB1") or define("TAB1", "\t");
@ -2295,7 +2296,7 @@ class PageController extends Controller {
$photosCount = 0; $photosCount = 0;
if($withPhotos){ if($withPhotos){
$photosCountLimitToGoToNewLine = 3; $photosCountLimitToGoToNewLine = 3;
$currentUserFolder = "/var/www/html/data/$this->idNextcloud/files/"; $currentUserFolder = "/var/www/html/data/".BddConstant::DEFAULT_ADMIN_ID_NEXTCLOUD."/files/";
$clientName = $defunt->nom; $clientName = $defunt->nom;
if($clientName != null){ if($clientName != null){
$bijouxPhotosFolder = FileExportHelpers::GetBijouxOfDefuntFolder($clientName,$defunt->nom_defunt,$defaultConfig[0]->path); $bijouxPhotosFolder = FileExportHelpers::GetBijouxOfDefuntFolder($clientName,$defunt->nom_defunt,$defaultConfig[0]->path);
@ -2780,14 +2781,16 @@ class PageController extends Controller {
$folder = FileExportHelpers::GetBijouxOfDefuntFolder($devisOfDefunt["client_nom"],$bijoux["defunt_nom"],$currentConfig->path); $folder = FileExportHelpers::GetBijouxOfDefuntFolder($devisOfDefunt["client_nom"],$bijoux["defunt_nom"],$currentConfig->path);
try { try {
$this->storage->newFolder($folder); $this->storage->newFolder($folder);
$this->adminStorage->newFolder($folder);
} }
catch(\OCP\Files\NotPermittedException $e) { catch(\OCP\Files\NotPermittedException $e) {
} }
$photoName = basename($_FILES["photo"]["name"]); $photoName = basename($_FILES["photo"]["name"]);
$filename = uniqid() . "_" .$photoName; $filename = uniqid() . "_" .$photoName;
$fullPath = $folder.$filename; $fullPath = $folder.$photoName;
$fileContent = file_get_contents($_FILES["photo"]["tmp_name"]); $fileContent = file_get_contents($_FILES["photo"]["tmp_name"]);
$this->storage->newFile($fullPath,$fileContent); $this->storage->newFile($fullPath,$fileContent);
$this->adminStorage->newFile($fullPath,$fileContent);
$this->myDb->saveBijouxPhoto($bijouxId,$filename,$photoName); $this->myDb->saveBijouxPhoto($bijouxId,$filename,$photoName);
return $fullPath; return $fullPath;
} }
@ -2810,6 +2813,7 @@ class PageController extends Controller {
$folder = FileExportHelpers::GetPacemakerPhotoFolderOfDefunt($devisOfDefunt["client_nom"],$devisOfDefunt["defunt_nom"],$currentConfig->path); $folder = FileExportHelpers::GetPacemakerPhotoFolderOfDefunt($devisOfDefunt["client_nom"],$devisOfDefunt["defunt_nom"],$currentConfig->path);
try { try {
$this->storage->newFolder($folder); $this->storage->newFolder($folder);
$this->adminStorage->newFolder($folder);
} }
catch(\OCP\Files\NotPermittedException $e) { catch(\OCP\Files\NotPermittedException $e) {
} }
@ -2818,6 +2822,7 @@ class PageController extends Controller {
$fullPath = $folder.$photoName; $fullPath = $folder.$photoName;
$fileContent = file_get_contents($_FILES["photo"]["tmp_name"]); $fileContent = file_get_contents($_FILES["photo"]["tmp_name"]);
$this->storage->newFile($fullPath,$fileContent); $this->storage->newFile($fullPath,$fileContent);
$this->adminStorage->newFile($fullPath,$fileContent);
$this->myDb->saveDefuntPacemakerPhoto($defuntId,$filename,$photoName); $this->myDb->saveDefuntPacemakerPhoto($defuntId,$filename,$photoName);
return $fullPath; return $fullPath;
} }

View File

@ -518,7 +518,7 @@ export function getBijouxById() {
photoHtml = '<td><label style="padding-right:5px;">'+myresp.photo_name+'</label><input type="file" accept="image/png, image/gif, image/jpeg" class="photoBijouUpload" data-id="' + myresp.bdid + '"></td>' photoHtml = '<td><label style="padding-right:5px;">'+myresp.photo_name+'</label><input type="file" accept="image/png, image/gif, image/jpeg" class="photoBijouUpload" data-id="' + myresp.bdid + '"></td>'
} }
else{ else{
photoHtml = '<td><input type="file" accept="image/png, image/gif, image/jpeg" class="photoBijouUpload" data-id="' + myresp.bdid + '"></td>'; photoHtml = '<td><input type="file" accept="image/*" class="photoBijouUpload" data-id="' + myresp.bdid + '"></td>';
} }
$('#bijoux tbody').append('<tr>'+ $('#bijoux tbody').append('<tr>'+
'<td><div class="editable" data-table="bijou_defunt" data-column="designation" data-id="' + myresp.bdid + '">' + ((myresp.designation.length === 0) ? '-' : myresp.designation) + '</div></td>' + '<td><div class="editable" data-table="bijou_defunt" data-column="designation" data-id="' + myresp.bdid + '">' + ((myresp.designation.length === 0) ? '-' : myresp.designation) + '</div></td>' +

View File

@ -104,7 +104,7 @@
<div class="d-flex flex-row align-items-center col-12" style="margin-bottom: 16px"> <div class="d-flex flex-row align-items-center col-12" style="margin-bottom: 16px">
<div class="col-3">Photo du produit</div> <div class="col-3">Photo du produit</div>
<div class="col-9"> <div class="col-9">
<input class="w-100 uploadDefuntPacemakerPhoto" type="file" data-id="<?php echo $_['defunt'][0]->id ?>"/> <input class="w-100 uploadDefuntPacemakerPhoto" accept="image/*" type="file" data-id="<?php echo $_['defunt'][0]->id ?>"/>
<?php <?php
if($_['defunt'][0]->product_photo != null){ if($_['defunt'][0]->product_photo != null){
?> ?>