@@ -194,7 +194,16 @@ protected function loadDataDefault($model): void
194194 ];
195195 if ($ notificationModel ->loadWhere ($ where )) {
196196 $ shortCodes = ['{code} ' , '{name} ' , '{date} ' , '{total} ' , '{number2} ' ];
197- $ shortValues = [$ model ->codigo , $ model ->nombrecliente , $ model ->fecha , $ model ->total , $ model ->numero2 ];
197+ $ shortValues = [$ model ->codigo , '' , $ model ->fecha , $ model ->total , '' ];
198+
199+ $ shortValues [1 ] = $ model ->hasColumn ('nombrecliente ' )
200+ ? $ model ->nombrecliente
201+ : $ model ->nombre ;
202+
203+ $ shortValues [4 ] = $ model ->hasColumn ('numero2 ' )
204+ ? $ model ->numero2
205+ : $ model ->numproveedor ;
206+
198207 $ this ->newMail ->title = str_replace ($ shortCodes , $ shortValues , $ notificationModel ->subject );
199208 $ this ->newMail ->text = str_replace ($ shortCodes , $ shortValues , $ notificationModel ->body );
200209 return ;
@@ -203,21 +212,25 @@ protected function loadDataDefault($model): void
203212 // si no hay notificación, usamos los datos de las traducciones
204213 switch ($ model ->modelClassName ()) {
205214 case 'AlbaranCliente ' :
215+ case 'AlbaranProveedor ' :
206216 $ this ->newMail ->title = Tools::trans ('delivery-note-email-subject ' , ['%code% ' => $ model ->codigo ]);
207217 $ this ->newMail ->text = Tools::trans ('delivery-note-email-text ' , ['%code% ' => $ model ->codigo ]);
208218 break ;
209219
210220 case 'FacturaCliente ' :
221+ case 'FacturaProveedor ' :
211222 $ this ->newMail ->title = Tools::trans ('invoice-email-subject ' , ['%code% ' => $ model ->codigo ]);
212223 $ this ->newMail ->text = Tools::trans ('invoice-email-text ' , ['%code% ' => $ model ->codigo ]);
213224 break ;
214225
215226 case 'PedidoCliente ' :
227+ case 'PedidoProveedor ' :
216228 $ this ->newMail ->title = Tools::trans ('order-email-subject ' , ['%code% ' => $ model ->codigo ]);
217229 $ this ->newMail ->text = Tools::trans ('order-email-text ' , ['%code% ' => $ model ->codigo ]);
218230 break ;
219231
220232 case 'PresupuestoCliente ' :
233+ case 'PresupuestoProveedor ' :
221234 $ this ->newMail ->title = Tools::trans ('estimation-email-subject ' , ['%code% ' => $ model ->codigo ]);
222235 $ this ->newMail ->text = Tools::trans ('estimation-email-text ' , ['%code% ' => $ model ->codigo ]);
223236 break ;
0 commit comments