I suggest you ...

Create a new invoice by copying another one.

325 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    anonymousanonymous shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    5 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...
      • DiegoDiego commented  ·   ·  Flag as inappropriate

        Con muy poco codigo se puede clonar un invoice, un recurring invoice.

        Por ej. para RecurringInvoice

        public function cloneInvoice()
        {
        $i = new RecurringInvoice();

        $iKeys = array_flip(array_keys($i->getTable()->getColumns()));
        $data = $this->toArray(false);
        unset($data['id'], $data['must_occurrences'], $data['created_at'],
        $data['last_execution_date'], $data['occurrences'], $data['customer_id'],
        $data['customer_name'], $data['customer_identification'], $data['customer_email'],
        $data['invoicing_address'], $data['shipping_address'], $data['contact_person']);

        $data = array_intersect_key($data, $iKeys);

        $i->fromArray($data);

        // Copy Items and taxes
        foreach ($this->Items as $item)
        {
        if ($item->getProduct()->getFixed() !== FALSE) {
        $iTmp = $item->copy(false);
        foreach ($item->Taxes as $tax)
        {
        $iTmp->Taxes[] = $tax;
        }
        $i->Items[] = $iTmp;
        }
        }
        // copy tags
        foreach ($this->getTags() as $tag)
        {
        $i->addTag($tag);
        }

        if($i->trySave())
        {
        $i->refresh(true)->setAmounts()->save();
        }

        return $i;
        }

      • steelersteeler commented  ·   ·  Flag as inappropriate

        Feature name: duplicate invoice. It would be great if the user can modify the invoice before save it.

      • GeorgGeorg commented  ·   ·  Flag as inappropriate

        Yes, I think this is a good idea. Please see my comment on invoice templates in the feature request for client data storage.

      Feedback and Knowledge Base