@@ -109,7 +109,7 @@ protected function writeRecord($item) {
109109 $ from_ba = \CRM_Contract_BankingLogic::getOrCreateBankAccount (
110110 $ membership ['contact_id ' ],
111111 $ item ['iban ' ],
112- $ item ['bic ' ] ? : 'NOTPROVIDED '
112+ isset ( $ item ['bic ' ]) && '' !== $ item [ ' bic ' ] ? $ item [ ' bic ' ] : 'NOTPROVIDED '
113113 );
114114 $ pi = $ types ['RCUR ' ] ?? \CRM_Contract_Configuration::getPaymentInstrumentIdByName ('RCUR ' );
115115 if ($ pi ) {
@@ -120,7 +120,8 @@ protected function writeRecord($item) {
120120 $ params ['contract_updates.ch_cycle_day ' ] = $ item ['cycle_day ' ];
121121 $ params ['contract_updates.ch_from_ba ' ] = $ from_ba ;
122122 $ params ['contract_updates.ch_from_name ' ] = $ item ['account_holder ' ];
123- $ params ['contract_updates.ch_defer_payment_start ' ] = empty ($ item ['defer_payment_start ' ]) ? '0 ' : '1 ' ;
123+ $ params ['contract_updates.ch_defer_payment_start ' ]
124+ = isset ($ item ['defer_payment_start ' ]) && '' !== $ item ['defer_payment_start ' ] ? '1 ' : '0 ' ;
124125 break ;
125126
126127 default :
@@ -145,7 +146,8 @@ protected function writeRecord($item) {
145146 $ item ['bic ' ]
146147 );
147148 $ params ['membership_payment.from_name ' ] = $ item ['account_holder ' ];
148- $ params ['membership_payment.defer_payment_start ' ] = empty ($ item ['defer_payment_start ' ]) ? '0 ' : '1 ' ;
149+ $ params ['membership_payment.defer_payment_start ' ]
150+ = isset ($ item ['defer_payment_start ' ]) && '' !== $ item ['defer_payment_start ' ] ? '1 ' : '0 ' ;
149151 break ;
150152 }
151153
@@ -161,12 +163,14 @@ protected function writeRecord($item) {
161163 // If this is a pause
162164 }
163165 elseif ($ item ['action ' ] == 'pause ' ) {
164- $ params ['resume_date ' ] = \CRM_Utils_Date::processDate ($ item ['resume_date ' ], FALSE , FALSE , 'Y-m-d ' );
166+ $ params ['resume_date ' ] = \CRM_Utils_Date::processDate ($ item ['resume_date ' ], NULL , FALSE , 'Y-m-d ' );
165167 }
166168
167169 \CRM_Contract_CustomData::resolveCustomFields ($ params );
168- civicrm_api3 ('Contract ' , 'modify ' , $ params );
170+ /** @phpstan-var array<string, mixed> $result */
171+ $ result = civicrm_api3 ('Contract ' , 'modify ' , $ params );
169172 civicrm_api3 ('Contract ' , 'process_scheduled_modifications ' , ['id ' => $ params ['id ' ]]);
173+ return $ result ;
170174 }
171175
172176}
0 commit comments