Merge branch 'staging' into production

This commit is contained in:
narindraezway 2025-07-09 13:50:01 +03:00
commit 5a880677c4
5 changed files with 58 additions and 3 deletions

View File

@ -365,7 +365,10 @@ class PageController extends Controller {
$produits = json_decode($this->myDb->getListProduit($d->id, $this->idNextcloud)); $produits = json_decode($this->myDb->getListProduit($d->id, $this->idNextcloud));
$d->dproduits = $produits; $d->dproduits = $produits;
} }
$clients = json_decode($this->myDb->getClientsAndClientGroupFacturations(includeClientInsideGroup:false)); $clients = json_decode($this->myDb->getClientsAndClientGroupFacturations(includeClientInsideGroup:false ));
usort($clients, function($a, $b) {
return strcmp($a->nom, $b->nom);
});
return new TemplateResponse('gestion', 'apercustousdevis', array('groups' => $this->groups, 'user' => $this->user, 'path' => $this->idNextcloud, return new TemplateResponse('gestion', 'apercustousdevis', array('groups' => $this->groups, 'user' => $this->user, 'path' => $this->idNextcloud,
'configuration'=> $this->getConfiguration(), 'configuration'=> $this->getConfiguration(),
'devis'=> $devis, 'devis'=> $devis,
@ -398,6 +401,9 @@ class PageController extends Controller {
$facture->dproduits = $produits; $facture->dproduits = $produits;
} }
$clients = json_decode($this->myDb->getClientsAndClientGroupFacturations()); $clients = json_decode($this->myDb->getClientsAndClientGroupFacturations());
usort($clients, function($a, $b) {
return strcmp($a->nom, $b->nom);
});
return new TemplateResponse('gestion', 'apercustoutesfactures', array( 'groups' => $this->groups, 'user' => $this->user, 'path' => $this->idNextcloud, return new TemplateResponse('gestion', 'apercustoutesfactures', array( 'groups' => $this->groups, 'user' => $this->user, 'path' => $this->idNextcloud,
'configuration'=> $this->getConfiguration(), 'configuration'=> $this->getConfiguration(),
'factures'=> $factures, 'factures'=> $factures,

View File

@ -150,6 +150,31 @@ class DevisPdfService {
$devisByYearFolder $devisByYearFolder
]; ];
} }
/**
* Genere simplement le dossier de defunt et client pour le devis pour le user connecter
*/
public function generateClientAndDefuntFolder($devisId,$idNextCloud){
$storage = $this->rootFolder->getUserFolder($idNextCloud);
$configs = json_decode($this->gestionBdd->getConfiguration(self::DEFAULT_NEXTCLOUD_ADMIN));
$currentConfig = $configs[0];
$devisPdfData = $this->gestionBdd->getDevisPdfDataByDevisId($devisId);
if($devisPdfData == null){
return null;
}
$clean_folder = html_entity_decode(string: $currentConfig->path).'/';
$devisPdfDataFormatted = $this->formatDevisDataToPdfDataFormat($devisPdfData,$currentConfig);
$devisPdfFolders = $this->getDevisPdfFolder($devisPdfDataFormatted,$clean_folder);
foreach($devisPdfFolders as $folder){
try {
$storage->newFolder($folder);
}
catch(\OCP\Files\NotPermittedException $e) {
}
}
}
private function GetMultipleDevisFilename($multipleDevisData,$month,$year,$type = DevisExportTypeConstant::TYPE_SINGLE){ private function GetMultipleDevisFilename($multipleDevisData,$month,$year,$type = DevisExportTypeConstant::TYPE_SINGLE){
$filename = ""; $filename = "";

View File

@ -34,6 +34,7 @@ use OCA\Gestion\Db\Bdd;
use OCP\IUserSession; use OCP\IUserSession;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
use OCA\Gestion\Helpers\VCalendarHelpers; use OCA\Gestion\Helpers\VCalendarHelpers;
use OCA\Gestion\Service\Devis\Pdf\DevisPdfService;
class GestionService class GestionService
{ {
@ -48,15 +49,22 @@ class GestionService
private $userConnectedUuid; private $userConnectedUuid;
/** @var DevisPdfService */
private $devisPdfService;
public function __construct( public function __construct(
Bdd $gestionBdd, Bdd $gestionBdd,
LoggerInterface $logger, LoggerInterface $logger,
TalkService $talkService, TalkService $talkService,
IUserSession $userSession IUserSession $userSession,
DevisPdfService $devisPdfService
) { ) {
$this->logger = $logger; $this->logger = $logger;
$this->gestionBdd = $gestionBdd; $this->gestionBdd = $gestionBdd;
$this->talkService = $talkService; $this->talkService = $talkService;
$this->devisPdfService = $devisPdfService;
try { try {
$this->userConnectedUuid = $userSession->getUser()->getUID(); $this->userConnectedUuid = $userSession->getUser()->getUID();
} catch (Exception) { } catch (Exception) {
@ -325,12 +333,14 @@ class GestionService
$devisTalkMessage = $this->gestionBdd->getDevisTalkRoomMessage($devisId, $userName); $devisTalkMessage = $this->gestionBdd->getDevisTalkRoomMessage($devisId, $userName);
$this->talkService->sendDevisTalkNotifications($devisTalkMessage, $userName, $this->userConnectedUuid); $this->talkService->sendDevisTalkNotifications($devisTalkMessage, $userName, $this->userConnectedUuid);
$this->gestionBdd->createDevisTrajetFromVCalendar($devisId, $userName); $this->gestionBdd->createDevisTrajetFromVCalendar($devisId, $userName);
$this->devisPdfService->generateClientAndDefuntFolder($devisId , $this->userConnectedUuid);
} catch (\OC\OCS\Exception $e) { } catch (\OC\OCS\Exception $e) {
$this->logger->debug("Error while handling created calendar object: " . $e->getMessage()); $this->logger->debug("Error while handling created calendar object: " . $e->getMessage());
} catch (\Throwable $e) { } catch (\Throwable $e) {
$this->logger->debug("Error while handling created calendar object: " . $e->getMessage()); $this->logger->debug("Error while handling created calendar object: " . $e->getMessage());
} }
} }
private function GetThanatoNameFromVCalendarString($vCalendarString) private function GetThanatoNameFromVCalendarString($vCalendarString)
{ {

View File

@ -334,7 +334,8 @@ class InvoiceGroupPdfHandler extends FPDF
$totalTtc = 0; $totalTtc = 0;
$totalTva = 0; $totalTva = 0;
$yValue = $this->startingYOfArticlesTable + 13; $yValue = $this->startingYOfArticlesTable + 13;
$maxDescriptionWidth = 102; // $maxDescriptionWidth = 102;
$maxDescriptionWidth = 104.3;
$currentIndexPosition = $this->currentIndexPosition; $currentIndexPosition = $this->currentIndexPosition;
for ($currentIndexPosition; $currentIndexPosition < ($this->initialIndexPosition + $this->devisCountToGet); $currentIndexPosition++) { for ($currentIndexPosition; $currentIndexPosition < ($this->initialIndexPosition + $this->devisCountToGet); $currentIndexPosition++) {
$currentDevis = $devisData[$currentIndexPosition]; $currentDevis = $devisData[$currentIndexPosition];

View File

@ -0,0 +1,13 @@
alter table oc_gestion_facture
add column document_generated_date DATE DEFAULT NULL,
add column document_sent_date DATE DEFAULT NULL;
create table if not exists oc_gestion_recap_facture_state (
id INT PRIMARY KEY AUTO_INCREMENT NOT NULL,
fk_client_id INT,
fk_client_group_facturation_id INT,
month INT,
year INT,
document_generated_date DATE DEFAULT NULL,
document_sent_date DATE DEFAULT NULL
);