Merge pull request #22645 from JavierNR/feature/intervention_signature
NEW: Enable online signature for interventions
This commit is contained in:
commit
c22e97d7f3
@ -208,6 +208,32 @@ if ($action == 'updateMask') {
|
|||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$error) {
|
||||||
|
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||||
|
} else {
|
||||||
|
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||||
|
}
|
||||||
|
} elseif ($action == "set_FICHINTER_ALLOW_ONLINE_SIGN") {
|
||||||
|
$val = GETPOST('FICHINTER_ALLOW_ONLINE_SIGN', 'alpha');
|
||||||
|
$res = dolibarr_set_const($db, "FICHINTER_ALLOW_ONLINE_SIGN", ($val == 'on' ? 1 : 0), 'bool', 0, '', $conf->entity);
|
||||||
|
|
||||||
|
if (!($res > 0)) {
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$error) {
|
||||||
|
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||||
|
} else {
|
||||||
|
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||||
|
}
|
||||||
|
} elseif ($action == "set_FICHINTER_ALLOW_EXTERNAL_DOWNLOAD") {
|
||||||
|
$val = GETPOST('FICHINTER_ALLOW_EXTERNAL_DOWNLOAD', 'alpha');
|
||||||
|
$res = dolibarr_set_const($db, "FICHINTER_ALLOW_EXTERNAL_DOWNLOAD", ($val == 'on' ? 1 : 0), 'bool', 0, '', $conf->entity);
|
||||||
|
|
||||||
|
if (!($res > 0)) {
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||||
} else {
|
} else {
|
||||||
@ -594,6 +620,39 @@ print '<input type="submit" class="button button-edit" value="'.$langs->trans("M
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
// Allow online signing
|
||||||
|
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||||
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||||
|
print '<input type="hidden" name="action" value="set_FICHINTER_ALLOW_ONLINE_SIGN">';
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
print '<td>';
|
||||||
|
print $langs->trans("AllowOnlineSign");
|
||||||
|
print '</td>';
|
||||||
|
print '<td class="center">';
|
||||||
|
print '<input type="checkbox" name="FICHINTER_ALLOW_ONLINE_SIGN"'.(getDolGlobalString("FICHINTER_ALLOW_ONLINE_SIGN") ? ' checked' : '').'>';
|
||||||
|
print '</td>';
|
||||||
|
print '<td class="right">';
|
||||||
|
print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">';
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
print '</form>';
|
||||||
|
// Allow external download
|
||||||
|
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||||
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||||
|
print '<input type="hidden" name="action" value="set_FICHINTER_ALLOW_EXTERNAL_DOWNLOAD">';
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
print '<td>';
|
||||||
|
print $langs->trans("AllowExternalDownload");
|
||||||
|
print '</td>';
|
||||||
|
print '<td class="center">';
|
||||||
|
print '<input type="checkbox" name="FICHINTER_ALLOW_EXTERNAL_DOWNLOAD"'.(getDolGlobalString("FICHINTER_ALLOW_EXTERNAL_DOWNLOAD") ? ' checked' : '').'>';
|
||||||
|
print '</td>';
|
||||||
|
print '<td class="right">';
|
||||||
|
print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">';
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
print '</form>';
|
||||||
|
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|||||||
@ -314,6 +314,93 @@ if ($action == "importSignature") {
|
|||||||
// We should just create an image file with the signature.
|
// We should just create an image file with the signature.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} elseif ($mode == 'fichinter') {
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
|
||||||
|
$object = new Fichinter($db);
|
||||||
|
$object->fetch(0, $ref);
|
||||||
|
|
||||||
|
$upload_dir = !empty($conf->ficheinter->multidir_output[$object->entity])?$conf->ficheinter->multidir_output[$object->entity]:$conf->ficheinter->dir_output;
|
||||||
|
$upload_dir .= '/'.dol_sanitizeFileName($object->ref).'/';
|
||||||
|
$date = dol_print_date(dol_now(), "%Y%m%d%H%M%S");
|
||||||
|
$filename = "signatures/".$date."_signature.png";
|
||||||
|
if (!is_dir($upload_dir."signatures/")) {
|
||||||
|
if (!dol_mkdir($upload_dir."signatures/")) {
|
||||||
|
$response ="Error mkdir. Failed to create dir ".$upload_dir."signatures/";
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$error) {
|
||||||
|
$return = file_put_contents($upload_dir.$filename, $data);
|
||||||
|
if ($return == false) {
|
||||||
|
$error++;
|
||||||
|
$response = 'Error file_put_content: failed to create signature file.';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$error) {
|
||||||
|
// Defined modele of doc
|
||||||
|
$last_main_doc_file = $object->last_main_doc;
|
||||||
|
$directdownloadlink = $object->getLastMainDocLink('fichinter'); // url to download the $object->last_main_doc
|
||||||
|
if (preg_match('/\.pdf/i', $last_main_doc_file)) {
|
||||||
|
// TODO Use the $last_main_doc_file to defined the $newpdffilename and $sourcefile
|
||||||
|
$newpdffilename = $upload_dir.$ref."_signed-".$date.".pdf";
|
||||||
|
$sourcefile = $upload_dir.$ref.".pdf";
|
||||||
|
|
||||||
|
if (dol_is_file($sourcefile)) {
|
||||||
|
// We build the new PDF
|
||||||
|
$pdf = pdf_getInstance();
|
||||||
|
if (class_exists('TCPDF')) {
|
||||||
|
$pdf->setPrintHeader(false);
|
||||||
|
$pdf->setPrintFooter(false);
|
||||||
|
}
|
||||||
|
$pdf->SetFont(pdf_getPDFFont($langs));
|
||||||
|
|
||||||
|
if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
|
||||||
|
$pdf->SetCompression(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//$pdf->Open();
|
||||||
|
$pagecount = $pdf->setSourceFile($sourcefile); // original PDF
|
||||||
|
$s = array(); // Array with size of each page. Exemple array(w'=>210, 'h'=>297);
|
||||||
|
for ($i=1; $i<($pagecount+1); $i++) {
|
||||||
|
try {
|
||||||
|
$tppl = $pdf->importPage($i);
|
||||||
|
$s = $pdf->getTemplatesize($tppl);
|
||||||
|
$pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L');
|
||||||
|
$pdf->useTemplate($tppl);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
dol_syslog("Error when manipulating some PDF by onlineSign: ".$e->getMessage(), LOG_ERR);
|
||||||
|
$response = $e->getMessage();
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// A signature image file is 720 x 180 (ratio 1/4) but we use only the size into PDF
|
||||||
|
// TODO Get position of box from PDF template
|
||||||
|
$xforimgstart = 105;
|
||||||
|
$yforimgstart = (empty($s['h']) ? 250 : $s['h'] - 57);
|
||||||
|
$wforimg = $s['w']/1 - ($xforimgstart + 16);
|
||||||
|
$pdf->Image($upload_dir.$filename, $xforimgstart, $yforimgstart, $wforimg, round($wforimg / 4));
|
||||||
|
//$pdf->Close();
|
||||||
|
$pdf->Output($newpdffilename, "F");
|
||||||
|
|
||||||
|
// Index the new file and update the last_main_doc property of object.
|
||||||
|
$object->indexFile($newpdffilename, 1);
|
||||||
|
}
|
||||||
|
if (!$error) {
|
||||||
|
$response = "success";
|
||||||
|
}
|
||||||
|
} elseif (preg_match('/\.odt/i', $last_main_doc_file)) {
|
||||||
|
// Adding signature on .ODT not yet supported
|
||||||
|
// TODO
|
||||||
|
} else {
|
||||||
|
// Document format not supported to insert online signature.
|
||||||
|
// We should just create an image file with the signature.
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$error++;
|
$error++;
|
||||||
|
|||||||
@ -131,6 +131,21 @@ function getOnlineSignatureUrl($mode, $type, $ref = '', $localorexternal = 1)
|
|||||||
} else {
|
} else {
|
||||||
$out .= '&securekey='.dol_hash($securekeyseed.$type.$ref.(!isModEnabled('multicompany') ? '' : $object->entity), '0');
|
$out .= '&securekey='.dol_hash($securekeyseed.$type.$ref.(!isModEnabled('multicompany') ? '' : $object->entity), '0');
|
||||||
}
|
}
|
||||||
|
} elseif ($type == 'fichinter') {
|
||||||
|
$securekeyseed = isset($conf->global->FICHINTER_ONLINE_SIGNATURE_SECURITY_TOKEN) ? $conf->global->FICHINTER_ONLINE_SIGNATURE_SECURITY_TOKEN : '';
|
||||||
|
$out = $urltouse.'/public/onlinesign/newonlinesign.php?source=fichinter&ref='.($mode ? '<span style="color: #666666">' : '');
|
||||||
|
if ($mode == 1) {
|
||||||
|
$out .= 'fichinter_ref';
|
||||||
|
}
|
||||||
|
if ($mode == 0) {
|
||||||
|
$out .= urlencode($ref);
|
||||||
|
}
|
||||||
|
$out .= ($mode ? '</span>' : '');
|
||||||
|
if ($mode == 1) {
|
||||||
|
$out .= "hash('".$securekeyseed."' + '".$type."' + fichinter_ref)";
|
||||||
|
} else {
|
||||||
|
$out .= '&securekey='.dol_hash($securekeyseed.$type.$ref.(!isModEnabled('multicompany') ? '' : $object->entity), '0');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// For multicompany
|
// For multicompany
|
||||||
|
|||||||
@ -1713,6 +1713,13 @@ if ($action == 'create') {
|
|||||||
$linktoelem = $form->showLinkToObjectBlock($object, null, array('fichinter'));
|
$linktoelem = $form->showLinkToObjectBlock($object, null, array('fichinter'));
|
||||||
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
|
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
|
||||||
|
|
||||||
|
// Show online signature link
|
||||||
|
if ($object->statut != Fichinter::STATUS_DRAFT && $conf->global->FICHINTER_ALLOW_ONLINE_SIGN) {
|
||||||
|
print '<br><!-- Link to sign -->';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/signature.lib.php';
|
||||||
|
|
||||||
|
print showOnlineSignatureUrl('fichinter', $object->ref).'<br>';
|
||||||
|
}
|
||||||
|
|
||||||
print '</div><div class="fichehalfright">';
|
print '</div><div class="fichehalfright">';
|
||||||
|
|
||||||
|
|||||||
@ -442,7 +442,7 @@ class Fichinter extends CommonObject
|
|||||||
$sql .= " f.datec, f.dateo, f.datee, f.datet, f.fk_user_author,";
|
$sql .= " f.datec, f.dateo, f.datee, f.datet, f.fk_user_author,";
|
||||||
$sql .= " f.date_valid as datev,";
|
$sql .= " f.date_valid as datev,";
|
||||||
$sql .= " f.tms as datem,";
|
$sql .= " f.tms as datem,";
|
||||||
$sql .= " f.duree, f.fk_projet as fk_project, f.note_public, f.note_private, f.model_pdf, f.extraparams, fk_contrat, f.entity as entity";
|
$sql .= " f.duree, f.fk_projet as fk_project, f.note_public, f.note_private, f.model_pdf, f.last_main_doc, f.extraparams, fk_contrat, f.entity as entity";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."fichinter as f";
|
$sql .= " FROM ".MAIN_DB_PREFIX."fichinter as f";
|
||||||
if ($ref) {
|
if ($ref) {
|
||||||
$sql .= " WHERE f.entity IN (".getEntity('intervention').")";
|
$sql .= " WHERE f.entity IN (".getEntity('intervention').")";
|
||||||
@ -482,6 +482,8 @@ class Fichinter extends CommonObject
|
|||||||
|
|
||||||
$this->extraparams = (array) json_decode($obj->extraparams, true);
|
$this->extraparams = (array) json_decode($obj->extraparams, true);
|
||||||
|
|
||||||
|
$this->last_main_doc = $obj->last_main_doc;
|
||||||
|
|
||||||
if ($this->statut == 0) {
|
if ($this->statut == 0) {
|
||||||
$this->brouillon = 1;
|
$this->brouillon = 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -76,10 +76,14 @@ NoLimit=No limit
|
|||||||
ToOfferALinkForOnlineSignature=Link for online signature
|
ToOfferALinkForOnlineSignature=Link for online signature
|
||||||
WelcomeOnOnlineSignaturePageProposal=Welcome to the page to accept commercial proposals from %s
|
WelcomeOnOnlineSignaturePageProposal=Welcome to the page to accept commercial proposals from %s
|
||||||
WelcomeOnOnlineSignaturePageContract=Welcome to %s Contract PDF Signing Page
|
WelcomeOnOnlineSignaturePageContract=Welcome to %s Contract PDF Signing Page
|
||||||
|
WelcomeOnOnlineSignaturePageFichinter=Welcome to %s Intervention PDF Signing Page
|
||||||
ThisScreenAllowsYouToSignDocFromProposal=This screen allow you to accept and sign, or refuse, a quote/commercial proposal
|
ThisScreenAllowsYouToSignDocFromProposal=This screen allow you to accept and sign, or refuse, a quote/commercial proposal
|
||||||
ThisScreenAllowsYouToSignDocFromContract=This screen allow you to sign contract on PDF format online.
|
ThisScreenAllowsYouToSignDocFromContract=This screen allow you to sign contract on PDF format online.
|
||||||
|
ThisScreenAllowsYouToSignDocFromFichinter=This screen allow you to sign intervention on PDF format online.
|
||||||
ThisIsInformationOnDocumentToSignProposal=This is information on document to accept or refuse
|
ThisIsInformationOnDocumentToSignProposal=This is information on document to accept or refuse
|
||||||
ThisIsInformationOnDocumentToSignContract=This is information on contract to sign
|
ThisIsInformationOnDocumentToSignContract=This is information on contract to sign
|
||||||
|
ThisIsInformationOnDocumentToSignFichinter=This is information on intervention to sign
|
||||||
SignatureProposalRef=Signature of quote/commercial proposal %s
|
SignatureProposalRef=Signature of quote/commercial proposal %s
|
||||||
SignatureContractRef=Signature of contract %s
|
SignatureContractRef=Signature of contract %s
|
||||||
|
SignatureFichinterRef=Signature of intervention %s
|
||||||
FeatureOnlineSignDisabled=Feature for online signing disabled or document generated before the feature was enabled
|
FeatureOnlineSignDisabled=Feature for online signing disabled or document generated before the feature was enabled
|
||||||
|
|||||||
@ -69,3 +69,5 @@ GenerateInter=Generate intervention
|
|||||||
FichinterNoContractLinked=Intervention %s has been created without a linked contract.
|
FichinterNoContractLinked=Intervention %s has been created without a linked contract.
|
||||||
ErrorFicheinterCompanyDoesNotExist=Company does not exist. Intervention has not been created.
|
ErrorFicheinterCompanyDoesNotExist=Company does not exist. Intervention has not been created.
|
||||||
NextDateToIntervention=Date for next intervention generation
|
NextDateToIntervention=Date for next intervention generation
|
||||||
|
AllowOnlineSign=Allow online signing
|
||||||
|
AllowExternalDownload=Allow external download
|
||||||
@ -104,6 +104,7 @@ IdProduct=Product ID
|
|||||||
LineBuyPriceHT=Buy Price Amount net of tax for line
|
LineBuyPriceHT=Buy Price Amount net of tax for line
|
||||||
SignPropal=Accept proposal
|
SignPropal=Accept proposal
|
||||||
SignContract=Sign contract
|
SignContract=Sign contract
|
||||||
|
SignFichinter=Sign intervention
|
||||||
RefusePropal=Refuse proposal
|
RefusePropal=Refuse proposal
|
||||||
Sign=Sign
|
Sign=Sign
|
||||||
NoSign=Refuse
|
NoSign=Refuse
|
||||||
@ -111,5 +112,6 @@ PropalAlreadySigned=Proposal already accepted
|
|||||||
PropalAlreadyRefused=Proposal already refused
|
PropalAlreadyRefused=Proposal already refused
|
||||||
PropalSigned=Proposal accepted
|
PropalSigned=Proposal accepted
|
||||||
ContractSigned=Contract signed
|
ContractSigned=Contract signed
|
||||||
|
FichinterSigned=Intervention signed
|
||||||
PropalRefused=Proposal refused
|
PropalRefused=Proposal refused
|
||||||
ConfirmRefusePropal=Are you sure you want to refuse this commercial proposal?
|
ConfirmRefusePropal=Are you sure you want to refuse this commercial proposal?
|
||||||
|
|||||||
@ -68,13 +68,22 @@ ActionAC_OTH_AUTO=Eventos creados automáticamente
|
|||||||
ActionAC_MANUAL=Eventos creados manualmente
|
ActionAC_MANUAL=Eventos creados manualmente
|
||||||
ActionAC_AUTO=Eventos creados automáticamente
|
ActionAC_AUTO=Eventos creados automáticamente
|
||||||
ActionAC_OTH_AUTOShort=Auto
|
ActionAC_OTH_AUTOShort=Auto
|
||||||
|
ActionAC_EVENTORGANIZATION=Eventos de organización
|
||||||
Stats=Estadísticas de venta
|
Stats=Estadísticas de venta
|
||||||
StatusProsp=Estado prospección
|
StatusProsp=Estado prospección
|
||||||
DraftPropals=Presupuestos borrador
|
DraftPropals=Presupuestos borrador
|
||||||
NoLimit=Sin límite
|
NoLimit=Sin límite
|
||||||
ToOfferALinkForOnlineSignature=Enlace para la firma en línea
|
ToOfferALinkForOnlineSignature=Enlace para la firma en línea
|
||||||
WelcomeOnOnlineSignaturePage=Bienvenido a la página para aceptar presupuestos de %s
|
WelcomeOnOnlineSignaturePageProposal=Bienvenido a la página para firmar presupuestos de %s
|
||||||
ThisScreenAllowsYouToSignDocFrom=Esta pantalla le permite aceptar y firmar, o rechazar, una presupuesto/propuesta comercial
|
WelcomeOnOnlineSignaturePageContract=Bienvenido a la página para firmar contratos de %s
|
||||||
ThisIsInformationOnDocumentToSign=Esta es la información del documento para aceptar o rechazar
|
WelcomeOnOnlineSignaturePageFichinter=Bienvenido a la página para firmar intervenciones de %s
|
||||||
|
ThisScreenAllowsYouToSignDocFromProposal=Esta página permite aceptar y firmar o rechazar un presupuesto o propuesta comercial.
|
||||||
|
ThisScreenAllowsYouToSignDocFromContract=Esta página permite aceptar y firmar el contrato PDF online.
|
||||||
|
ThisScreenAllowsYouToSignDocFromFichinter=Esta página permite aceptar y firmar una intervención en formato PDF online.
|
||||||
|
ThisIsInformationOnDocumentToSignProposal=Esta es la información del presupuesto para aceptar o rechazar
|
||||||
|
ThisIsInformationOnDocumentToSignContract=Esta es la información del contrato a firmar
|
||||||
|
ThisIsInformationOnDocumentToSignFichinter=Esta es la información de la intervención a firmar
|
||||||
SignatureProposalRef=Firma del presupuesto/propuesta comercial %s
|
SignatureProposalRef=Firma del presupuesto/propuesta comercial %s
|
||||||
|
SignatureContractRef=Firma del contrato %s
|
||||||
|
SignatureFichinterRef=Firma de la intervención %s
|
||||||
FeatureOnlineSignDisabled=Característica para la firma en línea inhabilitada o documento generado antes de que se habilitara la característica
|
FeatureOnlineSignDisabled=Característica para la firma en línea inhabilitada o documento generado antes de que se habilitara la característica
|
||||||
|
|||||||
@ -66,3 +66,8 @@ RepeatableIntervention=Plantilla de intervención
|
|||||||
ToCreateAPredefinedIntervention=Para crear una intervención predefinida o recurrente, cree una intervención común y conviértala en plantilla de intervención
|
ToCreateAPredefinedIntervention=Para crear una intervención predefinida o recurrente, cree una intervención común y conviértala en plantilla de intervención
|
||||||
ConfirmReopenIntervention=¿Está seguro de querer volver a abrir la intervención <b> %s </b>?
|
ConfirmReopenIntervention=¿Está seguro de querer volver a abrir la intervención <b> %s </b>?
|
||||||
GenerateInter=Generar intervención
|
GenerateInter=Generar intervención
|
||||||
|
FichinterNoContractLinked=La intervención %s se ha creado sin un contacto vinculado.
|
||||||
|
ErrorFicheinterCompanyDoesNotExist=La compañía no existe, la intervención no se ha creado.
|
||||||
|
NextDateToIntervention=Fecha para la próxima generación de intervención
|
||||||
|
AllowOnlineSign=Permitir firma online
|
||||||
|
AllowExternalDownload=Permitir descarga externa
|
||||||
@ -926,6 +926,7 @@ DirectDownloadInternalLink=Enlace de descarga privado
|
|||||||
PrivateDownloadLinkDesc=Debe iniciar sesión y necesita permisos para ver o descargar el archivo
|
PrivateDownloadLinkDesc=Debe iniciar sesión y necesita permisos para ver o descargar el archivo
|
||||||
Download=Descargar
|
Download=Descargar
|
||||||
DownloadDocument=Descargar el documento
|
DownloadDocument=Descargar el documento
|
||||||
|
DownloadSignedDocument=Descargar el documento firmado
|
||||||
ActualizeCurrency=Actualizar el tipo de cambio
|
ActualizeCurrency=Actualizar el tipo de cambio
|
||||||
Fiscalyear=Año fiscal
|
Fiscalyear=Año fiscal
|
||||||
ModuleBuilder=Módulo Builder
|
ModuleBuilder=Módulo Builder
|
||||||
|
|||||||
@ -103,11 +103,15 @@ IdProposal=ID de Presupuesto
|
|||||||
IdProduct=ID del Producto
|
IdProduct=ID del Producto
|
||||||
LineBuyPriceHT=Precio de compra Importe neto de impuestos por línea
|
LineBuyPriceHT=Precio de compra Importe neto de impuestos por línea
|
||||||
SignPropal=Aceptar presupuesto
|
SignPropal=Aceptar presupuesto
|
||||||
|
SignContract=Firmar contrato
|
||||||
|
SignFichinter=Firmar intervención
|
||||||
RefusePropal=Rechazar presupuesto
|
RefusePropal=Rechazar presupuesto
|
||||||
Sign=Firma
|
Sign=Firma
|
||||||
NoSign=Establecer no firmado
|
NoSign=Establecer no firmado
|
||||||
PropalAlreadySigned=Presupuesto ya aceptado
|
PropalAlreadySigned=Presupuesto ya aceptado
|
||||||
PropalAlreadyRefused=Presupuesto ya rechazado
|
PropalAlreadyRefused=Presupuesto ya rechazado
|
||||||
PropalSigned=Presupuesto aceptado
|
PropalSigned=Presupuesto aceptado
|
||||||
|
ContractSigned=Contrato firmado
|
||||||
|
FichinterSigned=Intervención firmada
|
||||||
PropalRefused=Presupuesto rechazado
|
PropalRefused=Presupuesto rechazado
|
||||||
ConfirmRefusePropal=¿Está seguro de querer rechazar este presupuesto?
|
ConfirmRefusePropal=¿Está seguro de querer rechazar este presupuesto?
|
||||||
|
|||||||
@ -130,6 +130,8 @@ if ($source == 'proposal') {
|
|||||||
$securekeyseed = getDolGlobalString('PROPOSAL_ONLINE_SIGNATURE_SECURITY_TOKEN');
|
$securekeyseed = getDolGlobalString('PROPOSAL_ONLINE_SIGNATURE_SECURITY_TOKEN');
|
||||||
} elseif ($source == 'contract') {
|
} elseif ($source == 'contract') {
|
||||||
$securekeyseed = getDolGlobalString('CONTRACT_ONLINE_SIGNATURE_SECURITY_TOKEN');
|
$securekeyseed = getDolGlobalString('CONTRACT_ONLINE_SIGNATURE_SECURITY_TOKEN');
|
||||||
|
} elseif ($source == 'fichinter') {
|
||||||
|
$securekeyseed = getDolGlobalString('FICHINTER_ONLINE_SIGNATURE_SECURITY_TOKEN');
|
||||||
}
|
}
|
||||||
if (!dol_verifyHash($securekeyseed.$type.$ref.(isModEnabled('multicompany') ? $entity : ''), $SECUREKEY, '0')) {
|
if (!dol_verifyHash($securekeyseed.$type.$ref.(isModEnabled('multicompany') ? $entity : ''), $SECUREKEY, '0')) {
|
||||||
httponly_accessforbidden('Bad value for securitykey. Value provided '.dol_escape_htmltag($SECUREKEY).' does not match expected value for ref='.dol_escape_htmltag($ref), 403, 1);
|
httponly_accessforbidden('Bad value for securitykey. Value provided '.dol_escape_htmltag($SECUREKEY).' does not match expected value for ref='.dol_escape_htmltag($ref), 403, 1);
|
||||||
@ -143,6 +145,10 @@ if ($source == 'proposal') {
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
|
||||||
$object = new Contrat($db);
|
$object = new Contrat($db);
|
||||||
$result= $object->fetch(0, $ref);
|
$result= $object->fetch(0, $ref);
|
||||||
|
} elseif ($source == 'fichinter') {
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
|
||||||
|
$object = new Fichinter($db);
|
||||||
|
$result= $object->fetch(0, $ref);
|
||||||
} else {
|
} else {
|
||||||
httponly_accessforbidden($langs->trans('ErrorBadParameters')." - Bad value for source", 400, 1);
|
httponly_accessforbidden($langs->trans('ErrorBadParameters')." - Bad value for source", 400, 1);
|
||||||
}
|
}
|
||||||
@ -289,6 +295,9 @@ if (empty($text)) {
|
|||||||
} elseif ($source == 'contract') {
|
} elseif ($source == 'contract') {
|
||||||
$text .= '<tr><td class="textpublicpayment"><br><strong>'.$langs->trans("WelcomeOnOnlineSignaturePageContract", $mysoc->name).'</strong></td></tr>'."\n";
|
$text .= '<tr><td class="textpublicpayment"><br><strong>'.$langs->trans("WelcomeOnOnlineSignaturePageContract", $mysoc->name).'</strong></td></tr>'."\n";
|
||||||
$text .= '<tr><td class="textpublicpayment opacitymedium">'.$langs->trans("ThisScreenAllowsYouToSignDocFromContract", $creditor).'<br><br></td></tr>'."\n";
|
$text .= '<tr><td class="textpublicpayment opacitymedium">'.$langs->trans("ThisScreenAllowsYouToSignDocFromContract", $creditor).'<br><br></td></tr>'."\n";
|
||||||
|
} elseif ($source == 'fichinter') {
|
||||||
|
$text .= '<tr><td class="textpublicpayment"><br><strong>'.$langs->trans("WelcomeOnOnlineSignaturePageFichinter", $mysoc->name).'</strong></td></tr>'."\n";
|
||||||
|
$text .= '<tr><td class="textpublicpayment opacitymedium">'.$langs->trans("ThisScreenAllowsYouToSignDocFromFichinter", $creditor).'<br><br></td></tr>'."\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print $text;
|
print $text;
|
||||||
@ -300,6 +309,8 @@ if ($source == 'proposal') {
|
|||||||
print '<tr><td align="left" colspan="2" class="opacitymedium">'.$langs->trans("ThisIsInformationOnDocumentToSignProposal").' :</td></tr>'."\n";
|
print '<tr><td align="left" colspan="2" class="opacitymedium">'.$langs->trans("ThisIsInformationOnDocumentToSignProposal").' :</td></tr>'."\n";
|
||||||
} elseif ($source == 'contract') {
|
} elseif ($source == 'contract') {
|
||||||
print '<tr><td align="left" colspan="2" class="opacitymedium">'.$langs->trans("ThisIsInformationOnDocumentToSignContract").' :</td></tr>'."\n";
|
print '<tr><td align="left" colspan="2" class="opacitymedium">'.$langs->trans("ThisIsInformationOnDocumentToSignContract").' :</td></tr>'."\n";
|
||||||
|
} elseif ($source == 'fichinter') {
|
||||||
|
print '<tr><td align="left" colspan="2" class="opacitymedium">'.$langs->trans("ThisIsInformationOnDocumentToSignFichinter").' :</td></tr>'."\n";
|
||||||
}
|
}
|
||||||
$found = false;
|
$found = false;
|
||||||
$error = 0;
|
$error = 0;
|
||||||
@ -430,6 +441,55 @@ if ($source == 'proposal') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
print '<input type="hidden" name="source" value="'.GETPOST("source", 'alpha').'">';
|
||||||
|
print '<input type="hidden" name="ref" value="'.$object->ref.'">';
|
||||||
|
print '</td></tr>'."\n";
|
||||||
|
} elseif ($source == 'fichinter') { // Signature on fichinter
|
||||||
|
$found = true;
|
||||||
|
$langs->load("fichinter");
|
||||||
|
|
||||||
|
$result = $object->fetch_thirdparty($object->socid);
|
||||||
|
// Proposer
|
||||||
|
print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("Proposer");
|
||||||
|
print '</td><td class="CTableRow2">';
|
||||||
|
print img_picto('', 'company', 'class="pictofixedwidth"');
|
||||||
|
print '<b>'.$creditor.'</b>';
|
||||||
|
print '<input type="hidden" name="creditor" value="'.$creditor.'">';
|
||||||
|
print '</td></tr>'."\n";
|
||||||
|
|
||||||
|
// Target
|
||||||
|
print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("ThirdParty");
|
||||||
|
print '</td><td class="CTableRow2">';
|
||||||
|
print img_picto('', 'company', 'class="pictofixedwidth"');
|
||||||
|
print '<b>'.$object->thirdparty->name.'</b>';
|
||||||
|
print '</td></tr>'."\n";
|
||||||
|
|
||||||
|
// Object
|
||||||
|
$text = '<b>'.$langs->trans("SignatureFichinterRef", $object->ref).'</b>';
|
||||||
|
print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("Designation");
|
||||||
|
print '</td><td class="CTableRow2">'.$text;
|
||||||
|
|
||||||
|
$last_main_doc_file = $object->last_main_doc;
|
||||||
|
|
||||||
|
if (empty($last_main_doc_file) || !dol_is_file(DOL_DATA_ROOT.'/'.$object->last_main_doc)) {
|
||||||
|
// It seems document has never been generated, or was generated and then deleted.
|
||||||
|
// So we try to regenerate it with its default template.
|
||||||
|
$defaulttemplate = ''; // We force the use an empty string instead of $object->model_pdf to be sure to use a "main" default template and not the last one used.
|
||||||
|
$object->generateDocument($defaulttemplate, $langs);
|
||||||
|
}
|
||||||
|
|
||||||
|
$directdownloadlink = $object->getLastMainDocLink('fichinter');
|
||||||
|
if ($directdownloadlink) {
|
||||||
|
print '<br><a href="'.$directdownloadlink.'">';
|
||||||
|
print img_mime($object->last_main_doc, '');
|
||||||
|
if ($message == "signed") {
|
||||||
|
print $langs->trans("DownloadSignedDocument").'</a>';
|
||||||
|
} else {
|
||||||
|
print $langs->trans("DownloadDocument").'</a>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
print '<input type="hidden" name="source" value="'.GETPOST("source", 'alpha').'">';
|
print '<input type="hidden" name="source" value="'.GETPOST("source", 'alpha').'">';
|
||||||
print '<input type="hidden" name="ref" value="'.$object->ref.'">';
|
print '<input type="hidden" name="ref" value="'.$object->ref.'">';
|
||||||
print '</td></tr>'."\n";
|
print '</td></tr>'."\n";
|
||||||
@ -542,6 +602,12 @@ if ($action == "dosign" && empty($cancel)) {
|
|||||||
} else {
|
} else {
|
||||||
print '<input type="submit" class="butAction small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans("SignContract").'">';
|
print '<input type="submit" class="butAction small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans("SignContract").'">';
|
||||||
}
|
}
|
||||||
|
} elseif ($source == 'fichinter') {
|
||||||
|
if ($message == 'signed') {
|
||||||
|
print '<span class="ok">'.$langs->trans("FichinterSigned").'</span>';
|
||||||
|
} else {
|
||||||
|
print '<input type="submit" class="butAction small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans("SignFichinter").'">';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print '</td></tr>'."\n";
|
print '</td></tr>'."\n";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user