diff --git a/htdocs/core/lib/modulebuilder.lib.php b/htdocs/core/lib/modulebuilder.lib.php index 436e0d5ff21..3232bae291a 100644 --- a/htdocs/core/lib/modulebuilder.lib.php +++ b/htdocs/core/lib/modulebuilder.lib.php @@ -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("; diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 757295ed179..932076d6bdd 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -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); } diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php index e7bd7540835..4c0ff154a04 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php @@ -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); @@ -1161,15 +1161,16 @@ class pdf_standard_myobject extends ModelePDFMyObject $result = $object->fetch_contact($arrayidcontact[0]); } - //Recipient name - // On peut utiliser le nom de la societe du contact + // Recipient name if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) { $thirdparty = $object->contact; } else { $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); diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index 9379b4c2d19..e463eae0390 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -554,15 +554,18 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print '