} if (!$error) { $result = $customer->fetch($object->fk_soc); if ($result <= 0) { $errmsg = $customer->error; $errmsgs = $acct->errors; $error++; } } if (!$error) { // Create draft invoice $invoice->type = Facture::TYPE_STANDARD; $invoice->cond_reglement_id = $customer->cond_reglement_id; if (empty($invoice->cond_reglement_id)) { $paymenttermstatic = new PaymentTerm($db); $invoice->cond_reglement_id = $paymenttermstatic->getDefaultId(); if (empty($invoice->cond_reglement_id)) { $error++; $errmsg = 'ErrorNoPaymentTermRECEPFound'; } } $invoice->socid = $object->fk_soc; $invoice->date = $datecotisation; $result = $invoice->create($user); if ($result <= 0) { $errmsg = $invoice->error; $errmsgs = $invoice->errors; $error++; } } if (!$error) {