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
commit 838a13cec1
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['help']) $texttoinsert .= " 'help'=>\"".preg_replace('/"/', '', $val['help'])."\",";
if ($val['showoncombobox']) $texttoinsert .= " 'showoncombobox'=>'".$val['showoncombobox']."',"; if ($val['showoncombobox']) $texttoinsert .= " 'showoncombobox'=>'".$val['showoncombobox']."',";
if ($val['disabled']) $texttoinsert .= " 'disabled'=>'".$val['disabled']."',"; if ($val['disabled']) $texttoinsert .= " 'disabled'=>'".$val['disabled']."',";
if ($val['autofocusoncreate']) $texttoinsert .= " 'autofocusoncreate'=>'".$val['autofocusoncreate']."',";
if ($val['arrayofkeyval']) if ($val['arrayofkeyval'])
{ {
$texttoinsert .= " 'arrayofkeyval'=>array("; $texttoinsert .= " 'arrayofkeyval'=>array(";

View File

@ -890,10 +890,12 @@ if ($dirins && $action == 'initobject' && $module && $objectname)
'/\$includedocgeneration = 0;/' => '$includedocgeneration = 1;' '/\$includedocgeneration = 0;/' => '$includedocgeneration = 1;'
); );
dolReplaceInFile($destdir.'/class/'.strtolower($objectname).'.class.php', $arrayreplacement, '', 0, 0, 1); dolReplaceInFile($destdir.'/class/'.strtolower($objectname).'.class.php', $arrayreplacement, '', 0, 0, 1);
dolReplaceInFile($destdir.'/'.strtolower($objectname).'_card.php', $arrayreplacement, '', 0, 0, 1);
$arrayreplacement = array( $arrayreplacement = array(
'/\'models\' => 0,/' => '\'models\' => 1,' '/\'models\' => 0,/' => '\'models\' => 1,'
); );
dolReplaceInFile($destdir.'/core/modules/mod'.$module.'.class.php', $arrayreplacement, '', 0, 0, 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")); $outputlangsbis->loadLangs(array("main", "bills", "products", "dict", "companies"));
} }
$nblines = count($object->lines); $nblines = (is_array($object->lines) ? count($object->lines) : 0);
$hidetop = 0; $hidetop = 0;
if (!empty($conf->global->MAIN_PDF_DISABLE_COL_HEAD_TITLE)) { 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 $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 // 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 // Create pdf instance
$pdf = pdf_getInstance($this->format); $pdf = pdf_getInstance($this->format);
@ -1161,15 +1161,16 @@ class pdf_standard_myobject extends ModelePDFMyObject
$result = $object->fetch_contact($arrayidcontact[0]); $result = $object->fetch_contact($arrayidcontact[0]);
} }
//Recipient name // Recipient name
// On peut utiliser le nom de la societe du contact
if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) { if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
$thirdparty = $object->contact; $thirdparty = $object->contact;
} else { } else {
$thirdparty = $object->thirdparty; $thirdparty = $object->thirdparty;
} }
$carac_client_name = pdfBuildThirdpartyName($thirdparty, $outputlangs); 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); $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 '<div class="fichecenter"><div class="fichehalfleft">';
print '<a name="builddoc"></a>'; // ancre print '<a name="builddoc"></a>'; // ancre
$includedocgeneration = 0;
// Documents // Documents
/*$objref = dol_sanitizeFileName($object->ref); if ($includedocgeneration) {
$relativepath = $objref . '/' . $objref . '.pdf'; $objref = dol_sanitizeFileName($object->ref);
$filedir = $conf->mymodule->dir_output . '/' . $objref; $relativepath = $objref . '/' . $objref . '.pdf';
$urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id; $filedir = $conf->mymodule->dir_output.'/'.$object->element.'/'.$objref;
$genallowed = $user->rights->mymodule->myobject->read; // If you can read, you can build the PDF to read content $urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id;
$delallowed = $user->rights->mymodule->myobject->create; // If you can create/edit, you can remove a file on card $genallowed = $user->rights->mymodule->myobject->read; // If you can read, you can build the PDF to read content
print $formfile->showdocuments('mymodule', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang); $delallowed = $user->rights->mymodule->myobject->create; // If you can create/edit, you can remove a file on card
*/ print $formfile->showdocuments('mymodule:myobject', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang);
}
// Show links to link elements // Show links to link elements
$linktoelem = $form->showLinkToObjectBlock($object, null, array('myobject')); $linktoelem = $form->showLinkToObjectBlock($object, null, array('myobject'));