Merge branch '12.0' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur
2020-06-01 02:41:11 +02:00
4 changed files with 20 additions and 13 deletions

View File

@@ -140,6 +140,7 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir =
if ($val['help']) $texttoinsert .= " 'help'=>\"".preg_replace('/"/', '', $val['help'])."\",";
if ($val['showoncombobox']) $texttoinsert .= " 'showoncombobox'=>'".$val['showoncombobox']."',";
if ($val['disabled']) $texttoinsert .= " 'disabled'=>'".$val['disabled']."',";
if ($val['autofocusoncreate']) $texttoinsert .= " 'autofocusoncreate'=>'".$val['autofocusoncreate']."',";
if ($val['arrayofkeyval'])
{
$texttoinsert .= " 'arrayofkeyval'=>array(";

View File

@@ -890,10 +890,12 @@ if ($dirins && $action == 'initobject' && $module && $objectname)
'/\$includedocgeneration = 0;/' => '$includedocgeneration = 1;'
);
dolReplaceInFile($destdir.'/class/'.strtolower($objectname).'.class.php', $arrayreplacement, '', 0, 0, 1);
dolReplaceInFile($destdir.'/'.strtolower($objectname).'_card.php', $arrayreplacement, '', 0, 0, 1);
$arrayreplacement = array(
'/\'models\' => 0,/' => '\'models\' => 1,'
);
dolReplaceInFile($destdir.'/core/modules/mod'.$module.'.class.php', $arrayreplacement, '', 0, 0, 1);
}

View File

@@ -226,7 +226,7 @@ class pdf_standard_myobject extends ModelePDFMyObject
$outputlangsbis->loadLangs(array("main", "bills", "products", "dict", "companies"));
}
$nblines = count($object->lines);
$nblines = (is_array($object->lines) ? count($object->lines) : 0);
$hidetop = 0;
if (!empty($conf->global->MAIN_PDF_DISABLE_COL_HEAD_TITLE)) {
@@ -328,7 +328,7 @@ class pdf_standard_myobject extends ModelePDFMyObject
$reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
// Set nblines with the new facture lines content after hook
$nblines = count($object->lines);
$nblines = (is_array($object->lines) ? count($object->lines) : 0);
// Create pdf instance
$pdf = pdf_getInstance($this->format);
@@ -1162,14 +1162,15 @@ class pdf_standard_myobject extends ModelePDFMyObject
}
// Recipient name
// On peut utiliser le nom de la societe du contact
if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
$thirdparty = $object->contact;
} else {
$thirdparty = $object->thirdparty;
}
if (is_object($thirdparty)) {
$carac_client_name = pdfBuildThirdpartyName($thirdparty, $outputlangs);
}
$carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact : ''), $usecontact, 'target', $object);

View File

@@ -554,15 +554,18 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<div class="fichecenter"><div class="fichehalfleft">';
print '<a name="builddoc"></a>'; // ancre
$includedocgeneration = 0;
// Documents
/*$objref = dol_sanitizeFileName($object->ref);
if ($includedocgeneration) {
$objref = dol_sanitizeFileName($object->ref);
$relativepath = $objref . '/' . $objref . '.pdf';
$filedir = $conf->mymodule->dir_output . '/' . $objref;
$filedir = $conf->mymodule->dir_output.'/'.$object->element.'/'.$objref;
$urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id;
$genallowed = $user->rights->mymodule->myobject->read; // If you can read, you can build the PDF to read content
$delallowed = $user->rights->mymodule->myobject->create; // If you can create/edit, you can remove a file on card
print $formfile->showdocuments('mymodule', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang);
*/
print $formfile->showdocuments('mymodule:myobject', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang);
}
// Show links to link elements
$linktoelem = $form->showLinkToObjectBlock($object, null, array('myobject'));