Qual: Fix (propal|facture|contrat|fichinter)/card, commonobject, files.lib/card_presend.tpl (#31087)
# Qual: Fix (propal|facture|contrat|fichinter)/card, commonobject, files.lib/card_presend.tpl Fix phan notices in these files Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
parent
4a25c28968
commit
c62e015410
9 changed files with 125 additions and 80 deletions
|
|
@ -10,14 +10,14 @@
|
|||
return [
|
||||
// # Issue statistics:
|
||||
// PhanPluginUnknownPropertyType : 1490+ occurrences
|
||||
// PhanUndeclaredProperty : 840+ occurrences
|
||||
// PhanUndeclaredProperty : 830+ occurrences
|
||||
// PhanTypeMismatchArgumentProbablyReal : 740+ occurrences
|
||||
// PhanPossiblyUndeclaredGlobalVariable : 730+ occurrences
|
||||
// PhanPossiblyUndeclaredGlobalVariable : 720+ occurrences
|
||||
// PhanUndeclaredGlobalVariable : 440+ occurrences
|
||||
// PhanPluginUnknownArrayMethodReturnType : 430+ occurrences
|
||||
// PhanPluginUnknownArrayMethodParamType : 360+ occurrences
|
||||
// PhanPossiblyUndeclaredVariable : 330+ occurrences
|
||||
// PhanPluginUnknownObjectMethodCall : 230+ occurrences
|
||||
// PhanPossiblyUndeclaredVariable : 320+ occurrences
|
||||
// PhanPluginUnknownObjectMethodCall : 200+ occurrences
|
||||
// PhanTypeMismatchProperty : 200+ occurrences
|
||||
// PhanPluginUnknownArrayFunctionReturnType : 160+ occurrences
|
||||
// PhanPluginUnknownArrayFunctionParamType : 150+ occurrences
|
||||
|
|
@ -27,22 +27,22 @@ return [
|
|||
// PhanPluginEmptyStatementIf : 55+ occurrences
|
||||
// PhanRedefineFunction : 50+ occurrences
|
||||
// PhanTypeSuspiciousNonTraversableForeach : 50+ occurrences
|
||||
// PhanTypeMismatchDimFetch : 40+ occurrences
|
||||
// PhanTypeMismatchDimFetch : 35+ occurrences
|
||||
// PhanTypeExpectedObjectPropAccess : 25+ occurrences
|
||||
// PhanPossiblyNullTypeMismatchProperty : 15+ occurrences
|
||||
// PhanTypeComparisonFromArray : 15+ occurrences
|
||||
// PhanUndeclaredConstant : 15+ occurrences
|
||||
// PhanEmptyForeach : 10+ occurrences
|
||||
// PhanPluginConstantVariableNull : 10+ occurrences
|
||||
// PhanPluginDuplicateExpressionBinaryOp : 10+ occurrences
|
||||
// PhanPluginSuspiciousParamPosition : 10+ occurrences
|
||||
// PhanUndeclaredMethod : 9 occurrences
|
||||
// PhanPluginBothLiteralsBinaryOp : 8 occurrences
|
||||
// PhanPluginDuplicateArrayKey : 8 occurrences
|
||||
// PhanPluginDuplicateExpressionBinaryOp : 7 occurrences
|
||||
// PhanTypeMismatchDimFetchNullable : 7 occurrences
|
||||
// PhanTypeExpectedObjectPropAccessButGotNull : 6 occurrences
|
||||
// PhanParamTooMany : 3 occurrences
|
||||
// PhanInvalidFQSENInClasslike : 2 occurrences
|
||||
// PhanParamTooMany : 2 occurrences
|
||||
// PhanAccessMethodProtected : 1 occurrence
|
||||
// PhanEmptyFQSENInClasslike : 1 occurrence
|
||||
|
||||
|
|
@ -60,7 +60,7 @@ return [
|
|||
'htdocs/api/class/api_status.class.php' => ['PhanPluginUnknownArrayMethodReturnType'],
|
||||
'htdocs/asset/admin/setup.php' => ['PhanTypeMismatchArgumentProbablyReal'],
|
||||
'htdocs/asset/card.php' => ['PhanTypeMismatchArgumentProbablyReal'],
|
||||
'htdocs/asset/class/asset.class.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanTypeMismatchArgumentProbablyReal'],
|
||||
'htdocs/asset/class/asset.class.php' => ['PhanPluginUndeclaredVariableIsset'],
|
||||
'htdocs/asset/class/assetaccountancycodes.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType'],
|
||||
'htdocs/asset/class/assetdepreciationoptions.class.php' => ['PhanPluginUnknownArrayPropertyType'],
|
||||
'htdocs/asset/class/assetmodel.class.php' => ['PhanUndeclaredProperty'],
|
||||
|
|
@ -120,7 +120,7 @@ return [
|
|||
'htdocs/comm/mailing/class/html.formadvtargetemailing.class.php' => ['PhanPluginUnknownArrayMethodParamType'],
|
||||
'htdocs/comm/mailing/class/mailing.class.php' => ['PhanPluginUnknownArrayPropertyType'],
|
||||
'htdocs/comm/mailing/index.php' => ['PhanUndeclaredProperty'],
|
||||
'htdocs/comm/propal/card.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'],
|
||||
'htdocs/comm/propal/card.php' => ['PhanTypeMismatchProperty'],
|
||||
'htdocs/comm/propal/class/api_proposals.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeMismatchArgumentProbablyReal'],
|
||||
'htdocs/comm/propal/class/propal.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'],
|
||||
'htdocs/comm/propal/class/propalestats.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'],
|
||||
|
|
@ -151,7 +151,7 @@ return [
|
|||
'htdocs/compta/bank/various_payment/document.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
|
||||
'htdocs/compta/bank/various_payment/info.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
|
||||
'htdocs/compta/bank/various_payment/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchProperty'],
|
||||
'htdocs/compta/cashcontrol/cashcontrol_card.php' => ['PhanPluginDuplicateExpressionBinaryOp', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
|
||||
'htdocs/compta/cashcontrol/cashcontrol_card.php' => ['PhanPluginDuplicateExpressionBinaryOp', 'PhanPossiblyUndeclaredGlobalVariable'],
|
||||
'htdocs/compta/cashcontrol/class/cashcontrol.class.php' => ['PhanPluginUnknownPropertyType'],
|
||||
'htdocs/compta/charges/index.php' => ['PhanTypeMismatchArgumentNullableInternal'],
|
||||
'htdocs/compta/clients.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'],
|
||||
|
|
@ -237,7 +237,7 @@ return [
|
|||
'htdocs/contact/list.php' => ['PhanTypeMismatchArgumentProbablyReal'],
|
||||
'htdocs/contact/perso.php' => ['PhanTypeMismatchProperty'],
|
||||
'htdocs/contrat/agenda.php' => ['PhanTypeMismatchArgumentProbablyReal'],
|
||||
'htdocs/contrat/card.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable'],
|
||||
'htdocs/contrat/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable'],
|
||||
'htdocs/contrat/class/api_contracts.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'],
|
||||
'htdocs/contrat/messaging.php' => ['PhanTypeMismatchArgumentProbablyReal'],
|
||||
'htdocs/contrat/services_list.php' => ['PhanEmptyForeach', 'PhanTypeMismatchArgumentProbablyReal'],
|
||||
|
|
@ -247,10 +247,10 @@ return [
|
|||
'htdocs/core/actions_comments.inc.php' => ['PhanUndeclaredGlobalVariable'],
|
||||
'htdocs/core/actions_extrafields.inc.php' => ['PhanTypeMismatchArgumentProbablyReal'],
|
||||
'htdocs/core/actions_lineupdown.inc.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'],
|
||||
'htdocs/core/actions_linkedfiles.inc.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'],
|
||||
'htdocs/core/actions_linkedfiles.inc.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'],
|
||||
'htdocs/core/actions_massactions.inc.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
|
||||
'htdocs/core/actions_printing.inc.php' => ['PhanUndeclaredProperty'],
|
||||
'htdocs/core/actions_sendmails.inc.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
|
||||
'htdocs/core/actions_sendmails.inc.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
|
||||
'htdocs/core/actions_setmoduleoptions.inc.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable'],
|
||||
'htdocs/core/ajax/ajaxdirpreview.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
|
||||
'htdocs/core/ajax/ajaxdirtree.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'],
|
||||
|
|
@ -289,7 +289,7 @@ return [
|
|||
'htdocs/core/class/commondocgenerator.class.php' => ['PhanPluginUnknownArrayPropertyType', 'PhanPluginUnknownPropertyType', 'PhanTypeSuspiciousNonTraversableForeach', 'PhanUndeclaredProperty'],
|
||||
'htdocs/core/class/commonhookactions.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayPropertyType'],
|
||||
'htdocs/core/class/commoninvoice.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable'],
|
||||
'htdocs/core/class/commonobject.class.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanTypeComparisonFromArray', 'PhanTypeMismatchDimFetch', 'PhanUndeclaredProperty'],
|
||||
'htdocs/core/class/commonobject.class.php' => ['PhanParamTooMany', 'PhanUndeclaredProperty'],
|
||||
'htdocs/core/class/commonobjectline.class.php' => ['PhanPluginUnknownPropertyType'],
|
||||
'htdocs/core/class/commonorder.class.php' => ['PhanPluginUnknownPropertyType'],
|
||||
'htdocs/core/class/commonpeople.class.php' => ['PhanUndeclaredProperty'],
|
||||
|
|
@ -300,7 +300,6 @@ return [
|
|||
'htdocs/core/class/ctypent.class.php' => ['PhanPluginUnknownPropertyType'],
|
||||
'htdocs/core/class/ctyperesource.class.php' => ['PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'],
|
||||
'htdocs/core/class/cunits.class.php' => ['PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'],
|
||||
'htdocs/core/class/defaultvalues.class.php' => ['PhanTypeMismatchArgumentProbablyReal'],
|
||||
'htdocs/core/class/diasporahandler.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType'],
|
||||
'htdocs/core/class/discount.class.php' => ['PhanPluginUnknownPropertyType'],
|
||||
'htdocs/core/class/doleditor.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType'],
|
||||
|
|
@ -372,7 +371,7 @@ return [
|
|||
'htdocs/core/lib/expedition.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'],
|
||||
'htdocs/core/lib/expensereport.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'],
|
||||
'htdocs/core/lib/fichinter.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType', 'PhanPluginUnknownObjectMethodCall'],
|
||||
'htdocs/core/lib/files.lib.php' => ['PhanPluginDuplicateExpressionBinaryOp', 'PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredProperty'],
|
||||
'htdocs/core/lib/files.lib.php' => ['PhanUndeclaredProperty'],
|
||||
'htdocs/core/lib/fourn.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'],
|
||||
'htdocs/core/lib/ftp.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal'],
|
||||
'htdocs/core/lib/functions.lib.php' => ['PhanPluginDuplicateArrayKey'],
|
||||
|
|
@ -632,7 +631,6 @@ return [
|
|||
'htdocs/expensereport/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'],
|
||||
'htdocs/externalsite/frames.php' => ['PhanUndeclaredGlobalVariable'],
|
||||
'htdocs/fichinter/card-rec.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
|
||||
'htdocs/fichinter/card.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
|
||||
'htdocs/fichinter/class/api_interventions.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanUndeclaredProperty'],
|
||||
'htdocs/fichinter/class/fichinter.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall'],
|
||||
'htdocs/fichinter/class/fichinterrec.class.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
|
||||
|
|
@ -788,11 +786,11 @@ return [
|
|||
'htdocs/product/dynamic_price/class/price_parser.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType'],
|
||||
'htdocs/product/index.php' => ['PhanPluginUndeclaredVariableIsset'],
|
||||
'htdocs/product/inventory/card.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
|
||||
'htdocs/product/inventory/class/inventory.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
|
||||
'htdocs/product/inventory/class/inventory.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'],
|
||||
'htdocs/product/inventory/inventory.php' => ['PhanTypeMismatchArgumentProbablyReal'],
|
||||
'htdocs/product/inventory/lib/inventory.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'],
|
||||
'htdocs/product/inventory/list.php' => ['PhanTypeMismatchArgumentProbablyReal'],
|
||||
'htdocs/product/list.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
|
||||
'htdocs/product/list.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable'],
|
||||
'htdocs/product/price.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
|
||||
'htdocs/product/reassort.php' => ['PhanTypeExpectedObjectPropAccessButGotNull'],
|
||||
'htdocs/product/stats/card.php' => ['PhanTypeComparisonFromArray'],
|
||||
|
|
@ -881,7 +879,7 @@ return [
|
|||
'htdocs/public/stripe/ipn.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable'],
|
||||
'htdocs/public/test/test_arrays.php' => ['PhanPluginUndeclaredVariableIsset'],
|
||||
'htdocs/public/test/test_forms.php' => ['PhanTypeMismatchArgumentProbablyReal'],
|
||||
'htdocs/public/ticket/create_ticket.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchDimFetchNullable', 'PhanTypeMismatchProperty'],
|
||||
'htdocs/public/ticket/create_ticket.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchDimFetchNullable', 'PhanTypeMismatchProperty'],
|
||||
'htdocs/public/ticket/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
|
||||
'htdocs/public/ticket/view.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
|
||||
'htdocs/public/webportal/index.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable'],
|
||||
|
|
@ -1011,7 +1009,7 @@ return [
|
|||
'htdocs/user/param_ihm.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
|
||||
'htdocs/user/passwordforgotten.php' => ['PhanTypeMismatchArgumentProbablyReal'],
|
||||
'htdocs/variants/ajax/get_attribute_values.php' => ['PhanTypeComparisonFromArray'],
|
||||
'htdocs/variants/class/ProductAttribute.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanTypeMismatchArgumentProbablyReal'],
|
||||
'htdocs/variants/class/ProductAttribute.class.php' => ['PhanPluginUnknownArrayMethodParamType'],
|
||||
'htdocs/variants/class/ProductCombination.class.php' => ['PhanPluginSuspiciousParamPosition'],
|
||||
'htdocs/variants/combinations.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchProperty'],
|
||||
'htdocs/variants/tpl/productattributevalueline_edit.tpl.php' => ['PhanUndeclaredProperty'],
|
||||
|
|
|
|||
|
|
@ -547,7 +547,7 @@ if (empty($reshook)) {
|
|||
$element = $subelement = 'contrat';
|
||||
}
|
||||
if ($element == 'inter') {
|
||||
$element = $subelement = 'ficheinter';
|
||||
$element = $subelement = 'fichinter';
|
||||
}
|
||||
if ($element == 'shipping') {
|
||||
$element = $subelement = 'expedition';
|
||||
|
|
@ -568,6 +568,7 @@ if (empty($reshook)) {
|
|||
|
||||
$classname = ucfirst($subelement);
|
||||
$srcobject = new $classname($db);
|
||||
'@phan-var-force Commande|Propal|Contrat|Fichinter|Expedition $srcobject'; // Can be other class, but CommonObject is too generic
|
||||
|
||||
dol_syslog("Try to find source object origin=".$object->origin." originid=".$object->origin_id." to add lines");
|
||||
$result = $srcobject->fetch($object->origin_id);
|
||||
|
|
@ -1885,6 +1886,7 @@ if ($action == 'create') {
|
|||
|
||||
$classname = ucfirst($subelement);
|
||||
$objectsrc = new $classname($db);
|
||||
'@phan-var-force Commande|Propal|Contrat|Expedition $objectsrc'; // Can be other class, but CommonObject is too generic
|
||||
$objectsrc->fetch($originid);
|
||||
if (empty($objectsrc->lines) && method_exists($objectsrc, 'fetch_lines')) {
|
||||
$objectsrc->fetch_lines();
|
||||
|
|
@ -2002,7 +2004,7 @@ if ($action == 'create') {
|
|||
} else {
|
||||
print '<td class="valuefieldcreate">';
|
||||
$filter = '((s.client:IN:1,2,3) AND (s.status:=:1))';
|
||||
print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company('', 'socid', $filter, 'SelectThirdParty', 1, 0, null, 0, 'minwidth300 maxwidth500 widthcentpercentminusxx');
|
||||
print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company('', 'socid', $filter, 'SelectThirdParty', 1, 0, array(), 0, 'minwidth300 maxwidth500 widthcentpercentminusxx');
|
||||
// reload page to retrieve customer information
|
||||
if (!getDolGlobalString('RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED')) {
|
||||
print '<script>
|
||||
|
|
@ -2335,7 +2337,7 @@ if ($action == 'create') {
|
|||
$formquestion = array(
|
||||
// 'text' => $langs->trans("ConfirmClone"),
|
||||
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
|
||||
array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOSTINT('socid'), 'socid', $filter, '', 0, 0, null, 0, 'maxwidth300')),
|
||||
array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOSTINT('socid'), 'socid', $filter, '', 0, 0, array(), 0, 'maxwidth300')),
|
||||
array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans('PuttingPricesUpToDate'), 'value' => 0),
|
||||
array('type' => 'checkbox', 'name' => 'update_desc', 'label' => $langs->trans('PuttingDescUpToDate'), 'value' => 0),
|
||||
);
|
||||
|
|
@ -2370,6 +2372,7 @@ if ($action == 'create') {
|
|||
|
||||
if (array_key_exists('facture', $object->linkedObjects)) {
|
||||
foreach ($object->linkedObjects['facture'] as $invoice) {
|
||||
'@phan-var-force Facture $invoice';
|
||||
if ($invoice->type == Facture::TYPE_DEPOSIT) {
|
||||
$eligibleForDepositGeneration = false;
|
||||
break;
|
||||
|
|
@ -2383,6 +2386,7 @@ if ($action == 'create') {
|
|||
|
||||
if (array_key_exists('facture', $order->linkedObjects)) {
|
||||
foreach ($order->linkedObjects['facture'] as $invoice) {
|
||||
'@phan-var-force Facture $invoice';
|
||||
if ($invoice->type == Facture::TYPE_DEPOSIT) {
|
||||
$eligibleForDepositGeneration = false;
|
||||
break 2;
|
||||
|
|
@ -2631,8 +2635,8 @@ if ($action == 'create') {
|
|||
|
||||
print '<tr><td class="titlefieldmax45">'.$langs->trans('Discounts').'</td><td>';
|
||||
|
||||
$absolute_discount = $soc->getAvailableDiscounts('', $filterabsolutediscount);
|
||||
$absolute_creditnote = $soc->getAvailableDiscounts('', $filtercreditnote);
|
||||
$absolute_discount = $soc->getAvailableDiscounts(null, $filterabsolutediscount);
|
||||
$absolute_creditnote = $soc->getAvailableDiscounts(null, $filtercreditnote);
|
||||
$absolute_discount = price2num($absolute_discount, 'MT');
|
||||
$absolute_creditnote = price2num($absolute_creditnote, 'MT');
|
||||
|
||||
|
|
@ -3223,7 +3227,7 @@ if ($action == 'create') {
|
|||
print $formfile->showdocuments('propal', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang, '', $object);
|
||||
|
||||
// Show links to link elements
|
||||
$linktoelem = $form->showLinkToObjectBlock($object, null, array('propal'));
|
||||
$linktoelem = $form->showLinkToObjectBlock($object, array(), array('propal'));
|
||||
|
||||
$compatibleImportElementsList = false;
|
||||
if ($user->hasRight('propal', 'creer') && $object->statut == Propal::STATUS_DRAFT) {
|
||||
|
|
|
|||
|
|
@ -1526,7 +1526,7 @@ if (empty($reshook)) {
|
|||
$element = $subelement = 'contrat';
|
||||
}
|
||||
if ($element == 'inter') {
|
||||
$element = $subelement = 'ficheinter';
|
||||
$element = $subelement = 'fichinter';
|
||||
}
|
||||
if ($element == 'shipping') {
|
||||
$element = $subelement = 'expedition';
|
||||
|
|
@ -1991,7 +1991,8 @@ if (empty($reshook)) {
|
|||
$line->fk_prev_id = $line->id;
|
||||
$line->fetch_optionals();
|
||||
if (getDolGlobalInt('INVOICE_USE_SITUATION') == 2) {
|
||||
$line->situation_percent = $line->get_allprev_progress($object->id);; // get good progress including credit note
|
||||
$line->situation_percent = $line->get_allprev_progress($object->id);
|
||||
; // get good progress including credit note
|
||||
} else {
|
||||
$line->situation_percent = $line->get_prev_progress($object->id); // get good progress including credit note
|
||||
}
|
||||
|
|
@ -2128,7 +2129,7 @@ if (empty($reshook)) {
|
|||
$remise_percent = (GETPOST('remiseforalllines') ? GETPOST('remiseforalllines') : 0);
|
||||
$remise_percent = str_replace('*', '', $remise_percent);
|
||||
foreach ($object->lines as $line) {
|
||||
$tvatx= $line->tva_tx;
|
||||
$tvatx = $line->tva_tx;
|
||||
if (!empty($line->vat_src_code)) {
|
||||
$tvatx .= ' ('.$line->vat_src_code.')';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,6 +77,9 @@ $hideref = (GETPOSTINT('hideref') ? GETPOSTINT('hideref') : (getDolGlobalString(
|
|||
|
||||
|
||||
$datecontrat = '';
|
||||
$moreparam = '';
|
||||
$note_public = '';
|
||||
$note_private = '';
|
||||
$usehm = (getDolGlobalString('MAIN_USE_HOURMIN_IN_DATE_RANGE') ? $conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE : 0);
|
||||
|
||||
// Security check
|
||||
|
|
@ -318,6 +321,7 @@ if (empty($reshook)) {
|
|||
|
||||
$classname = ucfirst($subelement);
|
||||
$srcobject = new $classname($db);
|
||||
'@phan-var-force Commande|Propal|Facture $srcobject'; // Can be other class, but CommonObject is too Generic
|
||||
|
||||
dol_syslog("Try to find source object origin=".$object->origin." originid=".$object->origin_id." to add lines");
|
||||
$result = $srcobject->fetch($object->origin_id);
|
||||
|
|
@ -519,6 +523,8 @@ if (empty($reshook)) {
|
|||
$date_start = dol_mktime(GETPOST('date_start'.$predef.'hour'), GETPOST('date_start'.$predef.'min'), GETPOST('date_start'.$predef.'sec'), GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year'));
|
||||
$date_end = dol_mktime(GETPOST('date_end'.$predef.'hour'), GETPOST('date_end'.$predef.'min'), GETPOST('date_end'.$predef.'sec'), GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year'));
|
||||
|
||||
$price_base_type = '';
|
||||
$price_min = '';
|
||||
// Ecrase $tva_tx par celui du produit. TODO Remove this once vat selection is open
|
||||
// Get and check minimum price
|
||||
if ($idprod > 0) {
|
||||
|
|
@ -737,7 +743,9 @@ if (empty($reshook)) {
|
|||
}
|
||||
$objectline->fetch_optionals();
|
||||
|
||||
$objectline->oldcopy = dol_clone($objectline, 2);
|
||||
$objectline->oldcopy = dol_clone($objectline, 2); // @phan-suppress-current-line PhanTypeMismatchProperty
|
||||
} else {
|
||||
$objectline = null;
|
||||
}
|
||||
|
||||
$db->begin();
|
||||
|
|
@ -1117,8 +1125,10 @@ if (substr($module, 0, 13) == 'mod_contract_' && substr($module, -3) == 'php') {
|
|||
$module = substr($module, 0, dol_strlen($module) - 4);
|
||||
}
|
||||
$result = dol_include_once('/core/modules/contract/'.$module.'.php');
|
||||
$modCodeContract = null;
|
||||
if ($result > 0) {
|
||||
$modCodeContract = new $module();
|
||||
'@phan-var-force ModelNumRefContracts $modCodeContract';
|
||||
}
|
||||
|
||||
// Create
|
||||
|
|
@ -1160,6 +1170,7 @@ if ($action == 'create') {
|
|||
|
||||
$classname = ucfirst($subelement);
|
||||
$objectsrc = new $classname($db);
|
||||
'@phan-var-force Commande|Propal|Facture $objectsrc';
|
||||
$objectsrc->fetch($originid);
|
||||
if (empty($objectsrc->lines) && method_exists($objectsrc, 'fetch_lines')) {
|
||||
$objectsrc->fetch_lines();
|
||||
|
|
@ -1182,8 +1193,8 @@ if ($action == 'create') {
|
|||
}
|
||||
} else {
|
||||
$projectid = GETPOSTINT('projectid');
|
||||
$note_private = GETPOST("note_private");
|
||||
$note_public = GETPOST("note_public");
|
||||
$note_private = GETPOST("note_private", "alpha");
|
||||
$note_public = GETPOST("note_public", "alpha");
|
||||
}
|
||||
|
||||
$object->date_contrat = dol_now();
|
||||
|
|
@ -1228,7 +1239,7 @@ if ($action == 'create') {
|
|||
} else {
|
||||
print '<td>';
|
||||
print img_picto('', 'company', 'class="pictofixedwidth"');
|
||||
print $form->select_company('', 'socid', '', 'SelectThirdParty', 1, 0, null, 0, 'minwidth300 widthcentpercentminusxx maxwidth500');
|
||||
print $form->select_company('', 'socid', '', 'SelectThirdParty', 1, 0, array(), 0, 'minwidth300 widthcentpercentminusxx maxwidth500');
|
||||
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddThirdParty").'"></span></a>';
|
||||
print '</td>';
|
||||
}
|
||||
|
|
@ -1444,7 +1455,7 @@ if ($action == 'create') {
|
|||
$morehtmlref .= $object->ref;
|
||||
} else {
|
||||
$morehtmlref .= $form->editfieldkey("", 'ref', $object->ref, $object, $user->hasRight('contrat', 'creer'), 'string', '', 0, 3);
|
||||
$morehtmlref .= $form->editfieldval("", 'ref', $object->ref, $object, $user->hasRight('contrat', 'creer'), 'string', '', 0, 2);
|
||||
$morehtmlref .= $form->editfieldval("", 'ref', $object->ref, $object, $user->hasRight('contrat', 'creer'), 'string', '', null, 2);
|
||||
}
|
||||
|
||||
$morehtmlref .= '<div class="refidno">';
|
||||
|
|
@ -1672,7 +1683,7 @@ if ($action == 'create') {
|
|||
$description = ''; // Already added into main visible desc
|
||||
}
|
||||
|
||||
print $form->textwithtooltip($text, $description, 3, '', '', $cursorline, 3, (!empty($line->fk_parent_line) ? img_picto('', 'rightarrow') : ''));
|
||||
print $form->textwithtooltip($text, $description, 3, 0, 0, $cursorline, 3, (!empty($line->fk_parent_line) ? img_picto('', 'rightarrow') : ''));
|
||||
|
||||
print '</td>';
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -2750,6 +2750,8 @@ abstract class CommonObject
|
|||
case 'propal':
|
||||
/** @var Propal $this */
|
||||
/** @var PropaleLigne $line */
|
||||
'@phan-var-force Propal $this';
|
||||
'@phan-var-force PropaleLigne $line';
|
||||
$this->updateline(
|
||||
$line->id,
|
||||
$line->subprice,
|
||||
|
|
@ -2778,6 +2780,8 @@ abstract class CommonObject
|
|||
case 'commande':
|
||||
/** @var Commande $this */
|
||||
/** @var OrderLine $line */
|
||||
'@phan-var-force Commande $this';
|
||||
'@phan-var-force OrderLine $line';
|
||||
$this->updateline(
|
||||
$line->id,
|
||||
($line->description ? $line->description : $line->desc),
|
||||
|
|
@ -2806,6 +2810,8 @@ abstract class CommonObject
|
|||
case 'facture':
|
||||
/** @var Facture $this */
|
||||
/** @var FactureLigne $line */
|
||||
'@phan-var-force Facture $this';
|
||||
'@phan-var-force FactureLigne $line';
|
||||
$this->updateline(
|
||||
$line->id,
|
||||
($line->description ? $line->description : $line->desc),
|
||||
|
|
@ -2835,6 +2841,8 @@ abstract class CommonObject
|
|||
case 'supplier_proposal':
|
||||
/** @var SupplierProposal $this */
|
||||
/** @var SupplierProposalLine $line */
|
||||
'@phan-var-force SupplierProposal $this';
|
||||
'@phan-var-force SupplierProposalLine $line';
|
||||
$this->updateline(
|
||||
$line->id,
|
||||
$line->subprice,
|
||||
|
|
@ -2861,6 +2869,8 @@ abstract class CommonObject
|
|||
case 'order_supplier':
|
||||
/** @var CommandeFournisseur $this */
|
||||
/** @var CommandeFournisseurLigne $line */
|
||||
'@phan-var-force CommandeFournisseur $this';
|
||||
'@phan-var-force CommandeFournisseurLigne $line';
|
||||
$this->updateline(
|
||||
$line->id,
|
||||
($line->description ? $line->description : $line->desc),
|
||||
|
|
@ -2885,6 +2895,8 @@ abstract class CommonObject
|
|||
case 'invoice_supplier':
|
||||
/** @var FactureFournisseur $this */
|
||||
/** @var SupplierInvoiceLine $line */
|
||||
'@phan-var-force FactureFournisseur $this';
|
||||
'@phan-var-force SupplierInvoiceLIne $line';
|
||||
$this->updateline(
|
||||
$line->id,
|
||||
($line->description ? $line->description : $line->desc),
|
||||
|
|
@ -4028,8 +4040,9 @@ abstract class CommonObject
|
|||
$this->multicurrency_total_ttc += isset($this->revenuestamp) ? ($this->revenuestamp * $multicurrency_tx) : 0;
|
||||
|
||||
// Situations totals
|
||||
if (!empty($this->situation_cycle_ref) && !empty($this->situation_counter) && $this->situation_counter > 1 && method_exists($this, 'get_prev_sits')) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
if (!empty($this->situation_cycle_ref) && !empty($this->situation_counter) && $this->situation_counter > 1 && method_exists($this, 'get_prev_sits')) { // @phan-suppress-current-line PhanUndeclaredProperty
|
||||
'@phan-var-force Facture $this';
|
||||
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; // Note: possibly useless as $this is normally already Facture, so the class file should be loaded
|
||||
if ($this->type != Facture::TYPE_CREDIT_NOTE) { // @phpstan-ignore-line
|
||||
if (getDolGlobalInt('INVOICE_USE_SITUATION') != 2) {
|
||||
$prev_sits = $this->get_prev_sits();
|
||||
|
|
@ -4353,6 +4366,7 @@ abstract class CommonObject
|
|||
if (class_exists($className)) {
|
||||
foreach ($objectids as $i => $objectid) { // $i is rowid into llx_element_element
|
||||
$object = new $className($this->db);
|
||||
'@phan-var-force CommonObject $object';
|
||||
$ret = $object->fetch($objectid);
|
||||
if ($ret >= 0) {
|
||||
$this->linkedObjects[$objecttype][$i] = $object;
|
||||
|
|
@ -4459,13 +4473,13 @@ abstract class CommonObject
|
|||
/**
|
||||
* Delete all links between an object $this
|
||||
*
|
||||
* @param int $sourceid Object source id
|
||||
* @param ?int $sourceid Object source id
|
||||
* @param string $sourcetype Object source type
|
||||
* @param int $targetid Object target id
|
||||
* @param ?int $targetid Object target id
|
||||
* @param string $targettype Object target type
|
||||
* @param int $rowid Row id of line to delete. If defined, other parameters are not used.
|
||||
* @param User $f_user User that create
|
||||
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||
* @param ?User $f_user User that create
|
||||
* @param int<0,1> $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||
* @return int >0 if OK, <0 if KO
|
||||
* @see add_object_linked(), updateObjectLinked(), fetchObjectLinked()
|
||||
*/
|
||||
|
|
@ -4631,7 +4645,7 @@ abstract class CommonObject
|
|||
* Set status of an object.
|
||||
*
|
||||
* @param int $status Status to set
|
||||
* @param int $elementId Id of element to force (use this->id by default if null)
|
||||
* @param ?int $elementId Id of element to force (use this->id by default if null)
|
||||
* @param string $elementType Type of element to force (use this->table_element by default)
|
||||
* @param string $trigkey Trigger key to use for trigger. Use '' means automatic but it is not recommended and is deprecated.
|
||||
* @param string $fieldstatus Name of status field in this->table_element
|
||||
|
|
@ -5269,7 +5283,7 @@ abstract class CommonObject
|
|||
* @param Societe $seller Object of seller third party
|
||||
* @param Societe $buyer Object of buyer third party
|
||||
* @param int $selected ID line selected
|
||||
* @param Extrafields $extrafields Object of extrafields
|
||||
* @param ?Extrafields $extrafields Object of extrafields
|
||||
* @param string $defaulttpldir Directory where to find the template (deprecated)
|
||||
* @return void
|
||||
*/
|
||||
|
|
@ -5519,6 +5533,7 @@ abstract class CommonObject
|
|||
}
|
||||
|
||||
if (!empty($line->desc)) {
|
||||
'@phan-var-force OrderLine|FactureLigne|ContratLigne|FactureFournisseurLigneRec|SupplierInvoiceLine|SupplierProposalLine $line';
|
||||
if ($line->desc == '(CREDIT_NOTE)') { // TODO Not sure this is used for source object
|
||||
$discount = new DiscountAbsolute($this->db);
|
||||
$discount->fetch($line->fk_remise_except);
|
||||
|
|
@ -5854,6 +5869,8 @@ abstract class CommonObject
|
|||
if ($obj instanceof ModelePDFMember) {
|
||||
$resultwritefile = $obj->write_file($this, $outputlangs, $srctemplatepath, 'member', 1, 'tmp_cards');
|
||||
} else {
|
||||
// TODO: Try to set type above again
|
||||
'@phan-var-force ModeleBarCode|ModeleDon|ModeleExports|ModeleImports|ModelePDFAsset|ModelePDFContract|ModelePDFDeliveryOrder|ModelePDFEvaluation|ModelePDFFactures|ModelePDFFicheinter|ModelePDFMo|ModelePDFMovement|ModelePDFProduct|ModelePDFProjects|ModelePDFPropales|ModelePDFRecruitmentJobPosition|ModelePDFStock|ModelePDFStockTransfer|ModelePDFSupplierProposal|ModelePDFSuppliersInvoices|ModelePDFSuppliersOrders|ModelePDFSuppliersPayments|ModelePDFTask|ModelePDFTicket|ModelePDFUser|ModelePDFUserGroup|ModelePdfExpedition|ModelePdfReception|ModeleThirdPartyDoc $obj';
|
||||
$resultwritefile = $obj->write_file($this, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref, $moreparams);
|
||||
}
|
||||
// After call of write_file $obj->result['fullpath'] is set with generated file. It will be used to update the ECM database index.
|
||||
|
|
@ -6357,8 +6374,8 @@ abstract class CommonObject
|
|||
if (empty($rowid)) {
|
||||
$rowid = $this->id;
|
||||
}
|
||||
if (empty($rowid) && isset($this->rowid)) {
|
||||
$rowid = $this->rowid; // deprecated
|
||||
if (empty($rowid) && isset($this->rowid)) { // @phan-suppress-current-line PhanUndeclaredProperty
|
||||
$rowid = $this->rowid; // deprecated @phan-suppress-current-line PhanUndeclaredProperty
|
||||
}
|
||||
|
||||
// To avoid SQL errors. Probably not the better solution though
|
||||
|
|
@ -6704,6 +6721,7 @@ abstract class CommonObject
|
|||
$new_array_options[$key] = '';
|
||||
} elseif ($value) {
|
||||
$object = new $InfoFieldList[0]($this->db);
|
||||
'@phan-var-force CommonObject $object';
|
||||
if (is_numeric($value)) {
|
||||
$res = $object->fetch($value); // Common case
|
||||
} else {
|
||||
|
|
@ -6884,7 +6902,7 @@ abstract class CommonObject
|
|||
if (is_array($value) || (!is_numeric($value) && $value != '')) {
|
||||
$this->errors[] = $langs->trans("ExtraLanguageHasWrongValue", $attributeLabel);
|
||||
return -1;
|
||||
} elseif ($value == '') {
|
||||
} elseif ($value == '') { // @phan-suppress-current-line PhanTypeComparisonFromArray
|
||||
$new_array_languages[$key] = null;
|
||||
}
|
||||
break;
|
||||
|
|
@ -8060,7 +8078,7 @@ abstract class CommonObject
|
|||
$isDependList = 1;
|
||||
}
|
||||
|
||||
$data[$obj->rowid] = $labeltoshow;
|
||||
$data[(int) $obj->rowid] = $labeltoshow;
|
||||
}
|
||||
|
||||
$i++;
|
||||
|
|
@ -8073,7 +8091,7 @@ abstract class CommonObject
|
|||
}
|
||||
} else {
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
$data = $form->select_all_categories(Categorie::$MAP_ID_TO_CODE[$InfoFieldList[5]], '', 'parent', 64, $InfoFieldList[6], 1, 1);
|
||||
$data = $form->select_all_categories(Categorie::$MAP_ID_TO_CODE[(int) $InfoFieldList[5]], '', 'parent', 64, $InfoFieldList[6], 1, 1);
|
||||
$out = $form->multiselectarray($keyprefix . $key . $keysuffix, $data, $value_arr, 0, 0, $morecss, 0, '100%');
|
||||
}
|
||||
}
|
||||
|
|
@ -8590,13 +8608,16 @@ abstract class CommonObject
|
|||
|
||||
if ($classname && class_exists($classname)) {
|
||||
$object = new $classname($this->db);
|
||||
'@phan-var-force CommonObject $object';
|
||||
if ($object->element === 'product') { // Special case for product because default valut of fetch are wrong
|
||||
'@phan-var-force Product $object';
|
||||
$result = $object->fetch($value, '', '', '', 0, 1, 1);
|
||||
} else {
|
||||
$result = $object->fetch($value);
|
||||
}
|
||||
if ($result > 0) {
|
||||
if ($object->element === 'product') {
|
||||
'@phan-var-force Product $object';
|
||||
$get_name_url_param_arr = array($getnomurlparam, $getnomurlparam2, 0, -1, 0, '', 0);
|
||||
if (isset($val['get_name_url_params'])) {
|
||||
$get_name_url_params = explode(':', $val['get_name_url_params']);
|
||||
|
|
@ -10266,7 +10287,7 @@ abstract class CommonObject
|
|||
* Load object in memory from the database. This does not load line. This is done by parent fetch() that call fetchCommon
|
||||
*
|
||||
* @param int $id Id object
|
||||
* @param string $ref Ref
|
||||
* @param ?string $ref Ref
|
||||
* @param string $morewhere More SQL filters (' AND ...')
|
||||
* @param int<0,1> $noextrafields 0=Default to load extrafields, 1=No extrafields
|
||||
* @return int<-4,1> Return integer <0 if KO, 0 if not found, >0 if OK
|
||||
|
|
|
|||
|
|
@ -930,6 +930,7 @@ function dolCopyDir($srcfile, $destfile, $newmask, $overwriteifexists, $arrayrep
|
|||
// Recursive function to copy all subdirectories and contents:
|
||||
if (is_dir($ossrcfile)) {
|
||||
$dir_handle = opendir($ossrcfile);
|
||||
$tmpresult = 0; // Initialised before loop to keep old behavior, may be needed inside loop
|
||||
while ($file = readdir($dir_handle)) {
|
||||
if ($file != "." && $file != ".." && !is_link($ossrcfile."/".$file)) {
|
||||
if (is_dir($ossrcfile."/".$file)) {
|
||||
|
|
@ -998,13 +999,13 @@ function dolCopyDir($srcfile, $destfile, $newmask, $overwriteifexists, $arrayrep
|
|||
* - Database indexes for files are updated.
|
||||
* - Test on virus is done only if param testvirus is provided and an antivirus was set.
|
||||
*
|
||||
* @param string $srcfile Source file (can't be a directory. use native php @rename() to move a directory)
|
||||
* @param string $destfile Destination file (can't be a directory. use native php @rename() to move a directory)
|
||||
* @param string $newmask Mask in octal string for new file ('0' by default means $conf->global->MAIN_UMASK)
|
||||
* @param int $overwriteifexists Overwrite file if exists (1 by default)
|
||||
* @param int $testvirus Do an antivirus test. Move is canceled if a virus is found.
|
||||
* @param int $indexdatabase Index new file into database.
|
||||
* @param array $moreinfo Array with more information to set in index table
|
||||
* @param string $srcfile Source file (can't be a directory. use native php @rename() to move a directory)
|
||||
* @param string $destfile Destination file (can't be a directory. use native php @rename() to move a directory)
|
||||
* @param string $newmask Mask in octal string for new file ('0' by default means $conf->global->MAIN_UMASK)
|
||||
* @param int<0,1> $overwriteifexists Overwrite file if exists (1 by default)
|
||||
* @param int<0,1> $testvirus Do an antivirus test. Move is canceled if a virus is found.
|
||||
* @param int<0,1> $indexdatabase Index new file into database.
|
||||
* @param array<string,mixed> $moreinfo Array with more information to set in index table
|
||||
* @return boolean True if OK, false if KO
|
||||
* @see dol_move_uploaded_file()
|
||||
*/
|
||||
|
|
@ -1795,9 +1796,12 @@ function dol_meta_create($object)
|
|||
dol_mkdir($dir);
|
||||
}
|
||||
|
||||
$meta = '';
|
||||
if (is_dir($dir)) {
|
||||
if (is_countable($object->lines) && count($object->lines) > 0) {
|
||||
$nblines = count($object->lines);
|
||||
} else {
|
||||
$nblines = 0;
|
||||
}
|
||||
$client = $object->thirdparty->name." ".$object->thirdparty->address." ".$object->thirdparty->zip." ".$object->thirdparty->town;
|
||||
$meta = "REFERENCE=\"".$object->ref."\"
|
||||
|
|
@ -1867,15 +1871,15 @@ function dol_init_file_process($pathtoscan = '', $trackid = '')
|
|||
* All information used are in db, conf, langs, user and _FILES.
|
||||
* Note: This function can be used only into a HTML page context.
|
||||
*
|
||||
* @param string $upload_dir Directory where to store uploaded file (note: used to forge $destpath = $upload_dir + filename)
|
||||
* @param int $allowoverwrite 1=Allow overwrite existing file
|
||||
* @param int $updatesessionordb 1=Do no edit _SESSION variable but update database index. 0=Update _SESSION and not database index. -1=Do not update SESSION neither db.
|
||||
* @param string $varfiles _FILES var name
|
||||
* @param string $savingdocmask Mask to use to define output filename. For example 'XXXXX-__YYYYMMDD__-__file__'
|
||||
* @param string $link Link to add (to add a link instead of a file)
|
||||
* @param string $trackid Track id (used to prefix name of session vars to avoid conflict)
|
||||
* @param int $generatethumbs 1=Generate also thumbs for uploaded image files
|
||||
* @param Object $object Object used to set 'src_object_*' fields
|
||||
* @param string $upload_dir Directory where to store uploaded file (note: used to forge $destpath = $upload_dir + filename)
|
||||
* @param int<0,1> $allowoverwrite 1=Allow overwrite existing file
|
||||
* @param int<-1,1> $updatesessionordb 1=Do no edit _SESSION variable but update database index. 0=Update _SESSION and not database index. -1=Do not update SESSION neither db.
|
||||
* @param string $varfiles _FILES var name
|
||||
* @param string $savingdocmask Mask to use to define output filename. For example 'XXXXX-__YYYYMMDD__-__file__'
|
||||
* @param ?string $link Link to add (to add a link instead of a file)
|
||||
* @param string $trackid Track id (used to prefix name of session vars to avoid conflict)
|
||||
* @param int<0,1> $generatethumbs 1=Generate also thumbs for uploaded image files
|
||||
* @param ?Object $object Object used to set 'src_object_*' fields
|
||||
* @return int Return integer <=0 if KO, >0 if OK
|
||||
* @see dol_remove_file_process()
|
||||
*/
|
||||
|
|
@ -2351,6 +2355,7 @@ function dol_compress_file($inputfile, $outputfile, $mode = "gz", &$errorstring
|
|||
dol_syslog("dol_compress_file mode=".$mode." inputfile=".$inputfile." outputfile=".$outputfile);
|
||||
|
||||
$data = implode("", file(dol_osencode($inputfile)));
|
||||
$compressdata = null;
|
||||
if ($mode == 'gz' && function_exists('gzencode')) {
|
||||
$foundhandler = 1;
|
||||
$compressdata = gzencode($data, 9);
|
||||
|
|
@ -2385,6 +2390,7 @@ function dol_compress_file($inputfile, $outputfile, $mode = "gz", &$errorstring
|
|||
new RecursiveDirectoryIterator($rootPath, FilesystemIterator::UNIX_PATHS),
|
||||
RecursiveIteratorIterator::LEAVES_ONLY
|
||||
);
|
||||
'@phan-var-force SplFileInfo[] $files';
|
||||
|
||||
foreach ($files as $name => $file) {
|
||||
// Skip directories (they would be added automatically)
|
||||
|
|
@ -2437,7 +2443,7 @@ function dol_compress_file($inputfile, $outputfile, $mode = "gz", &$errorstring
|
|||
}
|
||||
}
|
||||
|
||||
if ($foundhandler) {
|
||||
if ($foundhandler && is_string($compressdata)) {
|
||||
$fp = fopen($outputfile, "w");
|
||||
fwrite($fp, $compressdata);
|
||||
fclose($fp);
|
||||
|
|
@ -2466,7 +2472,7 @@ function dol_compress_file($inputfile, $outputfile, $mode = "gz", &$errorstring
|
|||
*
|
||||
* @param string $inputfile File to uncompress
|
||||
* @param string $outputdir Target dir name
|
||||
* @return array array('error'=>'Error code') or array() if no error
|
||||
* @return array{error?:string} array('error'=>'Error code') or array() if no error
|
||||
* @see dol_compress_file(), dol_compress_dir()
|
||||
*/
|
||||
function dol_uncompress($inputfile, $outputdir)
|
||||
|
|
@ -2657,6 +2663,7 @@ function dol_compress_dir($inputdir, $outputfile, $mode = "zip", $excludefiles =
|
|||
new RecursiveDirectoryIterator($inputdir, FilesystemIterator::UNIX_PATHS),
|
||||
RecursiveIteratorIterator::LEAVES_ONLY
|
||||
);
|
||||
'@phan-var-force SplFileInfo[] $files';
|
||||
|
||||
//var_dump($inputdir);
|
||||
foreach ($files as $name => $file) {
|
||||
|
|
@ -2909,19 +2916,19 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
|||
$accessallowed = 1;
|
||||
}
|
||||
$original_file = $conf->contract->multidir_output[$entity].'/'.$original_file;
|
||||
} elseif (($modulepart == 'apercusupplier_proposal' || $modulepart == 'apercusupplier_proposal') && !empty($conf->supplier_proposal->dir_output)) {
|
||||
} elseif (($modulepart == 'apercusupplier_proposal') && !empty($conf->supplier_proposal->dir_output)) {
|
||||
// Wrapping pour les apercu supplier proposal
|
||||
if ($fuser->hasRight('supplier_proposal', $lire)) {
|
||||
$accessallowed = 1;
|
||||
}
|
||||
$original_file = $conf->supplier_proposal->dir_output.'/'.$original_file;
|
||||
} elseif (($modulepart == 'apercusupplier_order' || $modulepart == 'apercusupplier_order') && !empty($conf->fournisseur->commande->dir_output)) {
|
||||
} elseif (($modulepart == 'apercusupplier_order') && !empty($conf->fournisseur->commande->dir_output)) {
|
||||
// Wrapping pour les apercu supplier order
|
||||
if ($fuser->hasRight('fournisseur', 'commande', $lire)) {
|
||||
$accessallowed = 1;
|
||||
}
|
||||
$original_file = $conf->fournisseur->commande->dir_output.'/'.$original_file;
|
||||
} elseif (($modulepart == 'apercusupplier_invoice' || $modulepart == 'apercusupplier_invoice') && !empty($conf->fournisseur->facture->dir_output)) {
|
||||
} elseif (($modulepart == 'apercusupplier_invoice') && !empty($conf->fournisseur->facture->dir_output)) {
|
||||
// Wrapping pour les apercu supplier invoice
|
||||
if ($fuser->hasRight('fournisseur', $lire)) {
|
||||
$accessallowed = 1;
|
||||
|
|
@ -3246,7 +3253,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
|||
$original_file = $conf->fournisseur->payment->dir_output.'/'.$original_file;
|
||||
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."paiementfournisseur WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity;
|
||||
} elseif ($modulepart == 'payment') {
|
||||
// Wrapping pour les rapport de paiements
|
||||
// Wrapping pour les rapport de paiements
|
||||
if ($fuser->rights->facture->{$lire} || preg_match('/^specimen/i', $original_file)) {
|
||||
$accessallowed = 1;
|
||||
}
|
||||
|
|
@ -3584,12 +3591,12 @@ function dirbasename($pathfile)
|
|||
* Function to get list of updated or modified files.
|
||||
* $file_list is used as global variable
|
||||
*
|
||||
* @param array $file_list Array for response
|
||||
* @param array{insignature:string[],missing?:array<array{filename:string,expectedmd5:string,expectedsize:string}>,updated:array<array{filename:string,expectedmd5:string,expectedsize:string,md5:string}>} $file_list Array for response
|
||||
* @param SimpleXMLElement $dir SimpleXMLElement of files to test
|
||||
* @param string $path Path of files relative to $pathref. We start with ''. Used by recursive calls.
|
||||
* @param string $pathref Path ref (DOL_DOCUMENT_ROOT)
|
||||
* @param array $checksumconcat Array of checksum
|
||||
* @return array Array of filenames
|
||||
* @param string $path Path of files relative to $pathref. We start with ''. Used by recursive calls.
|
||||
* @param string $pathref Path ref (DOL_DOCUMENT_ROOT)
|
||||
* @param string[] $checksumconcat Array of checksum
|
||||
* @return array{insignature:string[],missing?:array<array{filename:string,expectedmd5:string,expectedsize:string}>,updated:array<array{filename:string,expectedmd5:string,expectedsize:string,md5:string}>} $file_list Array of filenames
|
||||
*/
|
||||
function getFilesUpdated(&$file_list, SimpleXMLElement $dir, $path = '', $pathref = '', &$checksumconcat = array())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
* Copyright (C) 2023 Maxime Nicolas <maxime@oarces.com>
|
||||
* Copyright (C) 2023 Benjamin GREMBI <benjamin@oarces.com>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -317,7 +318,7 @@ if ($action == 'presend') {
|
|||
$element = $subelement = 'contrat';
|
||||
}
|
||||
if ($element == 'inter') {
|
||||
$element = $subelement = 'ficheinter';
|
||||
$element = $subelement = 'fichinter';
|
||||
}
|
||||
if ($element == 'shipping') {
|
||||
$element = $subelement = 'expedition';
|
||||
|
|
|
|||
|
|
@ -868,6 +868,8 @@ if (empty($reshook)) {
|
|||
|
||||
$form = new Form($db);
|
||||
$formfile = new FormFile($db);
|
||||
$formcontract = null;
|
||||
$formproject = null;
|
||||
if (isModEnabled('contract')) {
|
||||
$formcontract = new FormContract($db);
|
||||
}
|
||||
|
|
@ -1015,7 +1017,7 @@ if ($action == 'create') {
|
|||
}
|
||||
|
||||
// Contract
|
||||
if (isModEnabled('contract')) {
|
||||
if (isModEnabled('contract') && is_object($formcontract)) {
|
||||
$langs->load("contracts");
|
||||
print '<tr><td>'.$langs->trans("Contract").'</td><td>';
|
||||
$numcontrat = $formcontract->select_contract($soc->id, GETPOSTINT('contratid'), 'contratid', 0, 1, 1);
|
||||
|
|
|
|||
|
|
@ -1436,7 +1436,7 @@ class ProductAttribute extends CommonObject
|
|||
* @param Societe $seller Object of seller third party
|
||||
* @param Societe $buyer Object of buyer third party
|
||||
* @param int $selected Object line selected
|
||||
* @param Extrafields $extrafields Object of extrafields
|
||||
* @param ?Extrafields $extrafields Object of extrafields
|
||||
* @param string $defaulttpldir Directory where to find the template (deprecated)
|
||||
* @return void
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in a new issue