feat(crm): add invoices CLI and opportunity update
Expose CRM invoice list/get/create/delete and catalog items via oo, plus contact address/about helpers and opportunity bid/stage update. Needed for Medex VM billing and other draft invoices.
This commit is contained in:
@@ -19,6 +19,7 @@ func init() {
|
||||
opportunitiesCmd.AddCommand(oppListCmd())
|
||||
opportunitiesCmd.AddCommand(oppGetCmd())
|
||||
opportunitiesCmd.AddCommand(oppCreateCmd())
|
||||
opportunitiesCmd.AddCommand(oppUpdateCmd())
|
||||
opportunitiesCmd.AddCommand(oppDeleteCmd())
|
||||
opportunitiesCmd.AddCommand(oppStagesCmd())
|
||||
opportunitiesCmd.AddCommand(oppMemberAddCmd())
|
||||
@@ -118,6 +119,40 @@ func oppCreateCmd() *cobra.Command {
|
||||
return cmd
|
||||
}
|
||||
|
||||
func oppUpdateCmd() *cobra.Command {
|
||||
var title, desc string
|
||||
var stage int64
|
||||
var bid float64
|
||||
cmd := &cobra.Command{
|
||||
Use: "update OPPORTUNITY_ID",
|
||||
Short: "Update opportunity title, description, stage, or bid",
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
c, err := newOO(cmd)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
out, err := c.UpdateOpportunity(cmd.Context(), args[0], onlyoffice.UpdateOpportunityParams{
|
||||
Title: title,
|
||||
Description: desc,
|
||||
StageID: stage,
|
||||
BidValue: bid,
|
||||
BidValueSet: cmd.Flags().Changed("bid"),
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(out)
|
||||
return nil
|
||||
},
|
||||
}
|
||||
cmd.Flags().StringVar(&title, "title", "", "new title")
|
||||
cmd.Flags().StringVar(&desc, "description", "", "new description")
|
||||
cmd.Flags().Int64Var(&stage, "stage", 0, "pipeline stage id")
|
||||
cmd.Flags().Float64Var(&bid, "bid", 0, "bid value")
|
||||
return cmd
|
||||
}
|
||||
|
||||
func oppDeleteCmd() *cobra.Command {
|
||||
return &cobra.Command{
|
||||
Use: "delete OPPORTUNITY_ID [OPPORTUNITY_ID...]",
|
||||
|
||||
Reference in New Issue
Block a user